Compare commits

...

6 Commits

Author SHA1 Message Date
Sebastian McKenzie
ce3c6289a2 v5.6.2 2015-06-22 00:08:52 +01:00
Sebastian McKenzie
0364519869 remove unused import 2015-06-22 00:06:43 +01:00
Sebastian McKenzie
58cda35831 log spread element rest parameter as a candidate instead of replacing it in place - fixes #1796 2015-06-22 00:06:03 +01:00
Sebastian McKenzie
ebaa06f4a2 add ensureBlock path method 2015-06-21 23:59:14 +01:00
Sebastian McKenzie
4b0f624fb3 turn method literal keys into assignments in loose mode - fixes #1797 2015-06-21 23:59:06 +01:00
Sebastian McKenzie
aa0f3ac5d0 5.6.1 2015-06-21 00:07:07 +01:00
15 changed files with 55 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "babel-core",
"description": "A compiler for writing next generation JavaScript",
"version": "5.6.1",
"version": "5.6.2",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",

View File

@@ -1,14 +1,14 @@
{
"name": "babel",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "5.6.0",
"version": "5.6.1",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",
"repository": "babel/babel",
"preferGlobal": true,
"dependencies": {
"babel-core": "^5.6.0",
"babel-core": "^5.6.1",
"chokidar": "^1.0.0",
"commander": "^2.6.0",
"convert-source-map": "^1.1.0",

View File

@@ -1,7 +1,7 @@
{
"name": "babel-runtime",
"description": "babel selfContained runtime",
"version": "5.6.0",
"version": "5.6.1",
"license": "MIT",
"repository": "babel/babel",
"author": "Sebastian McKenzie <sebmck@gmail.com>",

View File

@@ -1,9 +1,6 @@
import * as t from "../../../types";
export var visitor = {
ArrowFunctionExpression(node) {
t.ensureBlock(node);
this.ensureBlock();
node.expression = false;
node.type = "FunctionExpression";
node.shadow = true;

View File

@@ -477,7 +477,7 @@ class ClassTransformer {
var classRef = this.classRef;
if (!node.static) classRef = t.memberExpression(classRef, t.identifier("prototype"));
var methodName = t.memberExpression(classRef, node.key, node.computed);
var methodName = t.memberExpression(classRef, node.key, node.computed || t.isLiteral(node.key));
var expr = t.expressionStatement(t.assignmentExpression("=", methodName, node.value));
t.inheritsComments(expr, node);

View File

@@ -18,7 +18,7 @@ export var visitor = {
t.variableDeclarator(temp)
]);
t.ensureBlock(node);
this.ensureBlock();
node.body.body.unshift(t.variableDeclaration("var", [
t.variableDeclarator(left, temp)
@@ -48,7 +48,7 @@ export var visitor = {
destructuring.init(pattern, key);
t.ensureBlock(node);
this.ensureBlock();
var block = node.body;
block.body = nodes.concat(block.body);
@@ -84,7 +84,7 @@ export var visitor = {
destructuring.init(pattern, ref);
}
t.ensureBlock(node);
this.ensureBlock();
var block = node.body;
block.body = nodes.concat(block.body);

View File

@@ -17,7 +17,7 @@ export var visitor = {
var block = loop.body;
// ensure that it's a block so we can take all its statements
t.ensureBlock(node);
this.ensureBlock();
// add the value declaration to the new loop body
if (declar) {

View File

@@ -27,7 +27,7 @@ export var visitor = {
if (!hasDefaults(node)) return;
// ensure it's a block, useful for arrow functions
t.ensureBlock(node);
this.ensureBlock();
var state = {
iife: false,

View File

@@ -42,7 +42,8 @@ var memberExpressionOptimisationVisitor = {
if (this.parentPath.isSpreadElement() && state.offset === 0) {
var call = this.parentPath.parentPath;
if (call.isCallExpression() && call.node.arguments.length === 1) {
return state.argumentsNode;
state.candidates.push(this);
return;
}
}
}
@@ -124,7 +125,9 @@ export var visitor = {
if (state.candidates.length) {
for (var candidate of (state.candidates: Array)) {
candidate.replaceWith(argsId);
optimiseMemberExpression(candidate.parent, state.offset);
if (candidate.parentPath.isMemberExpression()) {
optimiseMemberExpression(candidate.parent, state.offset);
}
}
}
return;

View File

@@ -150,7 +150,7 @@ class TailCallTransformer {
//
var body = t.ensureBlock(node).body;
var body = this.path.ensureBlock().body;
for (var i = 0; i < body.length; i++) {
var bodyNode = body[i];

View File

@@ -22,3 +22,11 @@ export function toComputedKey(): Object {
return key;
}
/**
* Description
*/
export function ensureBlock() {
return t.ensureBlock(this.node);
}

View File

@@ -0,0 +1,5 @@
class Foo {
"bar"() {
}
}

View File

@@ -0,0 +1,11 @@
"use strict";
var Foo = (function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
}
Foo.prototype["bar"] = function bar() {};
return Foo;
})();

View File

@@ -13,3 +13,8 @@ function foo(a, ...b) {
function foo(...b) {
foo(1, ...b);
}
function foo(...args){
args.pop()
foo(...args);
}

View File

@@ -23,3 +23,12 @@ function foo() {
foo.apply(undefined, [1].concat(b));
}
function foo() {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
args.pop();
foo.apply(undefined, args);
}