Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce3c6289a2 | ||
|
|
0364519869 | ||
|
|
58cda35831 | ||
|
|
ebaa06f4a2 | ||
|
|
4b0f624fb3 | ||
|
|
aa0f3ac5d0 |
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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>",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -22,3 +22,11 @@ export function toComputedKey(): Object {
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
*/
|
||||
|
||||
export function ensureBlock() {
|
||||
return t.ensureBlock(this.node);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
"bar"() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
Foo.prototype["bar"] = function bar() {};
|
||||
|
||||
return Foo;
|
||||
})();
|
||||
@@ -13,3 +13,8 @@ function foo(a, ...b) {
|
||||
function foo(...b) {
|
||||
foo(1, ...b);
|
||||
}
|
||||
|
||||
function foo(...args){
|
||||
args.pop()
|
||||
foo(...args);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user