Compare commits

...

12 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
Sebastian McKenzie
725906a7dc v5.6.1 2015-06-21 00:05:13 +01:00
Sebastian McKenzie
13d5c94b8b update transformation tests 2015-06-21 00:03:29 +01:00
Sebastian McKenzie
85308a1e8c fix super spread in loose mode 2015-06-21 00:01:19 +01:00
Sebastian McKenzie
83bcaba1a5 downgrade to babel 5.5.7 2015-06-21 00:01:11 +01:00
Sebastian McKenzie
185648cb2c 5.6.0 2015-06-20 23:44:46 +01:00
Sebastian McKenzie
be355fc1c6 fix build-runtime script 2015-06-20 23:37:46 +01:00
22 changed files with 103 additions and 29 deletions

View File

@@ -13,6 +13,36 @@ _Note: Gaps between patch versions are faulty/broken releases._
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
## 5.6.0
* **Bug Fix**
* Fix istanbul interop for register hook when registering for non-existence extension.
* Fix super class constructor call differing for no constructor in derived classes.
* Disable module import receiver when in loose mode.
* Fix duplicate filenames when using `babel` CLI when passing multiple matching patterns.
* Register labels as bindings to fix undeclared variable checks.
* **Polish**
* Remove unnecessary string binary expressions when transforming template literals.
* Support module live bindings in arbitary positions not in Program statement position.
* Throw error when attemping to replace a `Program` root node with another node not of type `Program`.
* Optimise rest parameters in spread element position and allocate rest array at the earliest common ancestor of all references.
* Generate original number representation when value was not changed.
* Check for invalid binding identifiers when generating inferred method names.
* Don't terminate CLI when watching files fail compilation on init.
* **New Feature**
* Add new plugin API.
* **Internal**
* Split react displayName addition into a plugin.
* Add check for `JSXMemberExpression` to `t.isReferenced`.
* Move `validation.undeclaredVariableCheck` transformer up.
* Start great core-to-plugin exodus.
* Add `BindingIdentifier` virtual type.
* Hidden class optimisations.
* Array allocation optimisations.
* Update `regenerator`.
* Update `js-tokens`.
* Sync with upstream Acorn.
## 5.5.8
* **Internal**

View File

@@ -1,7 +1,7 @@
{
"name": "babel-core",
"description": "A compiler for writing next generation JavaScript",
"version": "5.6.0",
"version": "5.6.2",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",
@@ -77,7 +77,7 @@
"trim-right": "^1.0.0"
},
"devDependencies": {
"babel": "5.5.8",
"babel": "5.5.7",
"browserify": "^9.0.8",
"chai": "^2.2.0",
"eslint": "^0.21.2",

View File

@@ -1,14 +1,14 @@
{
"name": "babel",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "5.5.8",
"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.5.8",
"babel-core": "^5.6.1",
"chokidar": "^1.0.0",
"commander": "^2.6.0",
"convert-source-map": "^1.1.0",
@@ -26,4 +26,4 @@
"babel-external-helpers": "./bin/babel-external-helpers",
"babel-plugin": "./bin/babel-plugin/index.js"
}
}
}

View File

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

View File

@@ -75,7 +75,7 @@ writeFile("regenerator/runtime.js", selfContainify(readFile("regenerator/runtime
//
var coreDefinitions = require("../lib/babel/transformation/transformers/other/runtime/definitions");
var coreDefinitions = require("babel-plugin-runtime/lib/definitions");
var paths = ["is-iterable", "get-iterator"];

View File

@@ -169,7 +169,13 @@ export default class ReplaceSupers {
if (methodName.name === "constructor") {
// constructor() { super(); }
return t.memberExpression(superRef, t.identifier("call"));
if (parent.arguments.length === 2 && t.isSpreadElement(parent.arguments[1]) && t.isIdentifier(parent.arguments[1].argument, { name: "arguments" })) {
// special case single arguments spread
parent.arguments[1] = parent.arguments[1].argument;
return t.memberExpression(superRef, t.identifier("apply"));
} else {
return t.memberExpression(superRef, t.identifier("call"));
}
} else {
id = superRef;

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

@@ -1,7 +1,7 @@
import * as t from "../../../types";
function getSpreadLiteral(spread, scope) {
if (scope.hub.file.isLoose("es6.spread")) {
if (scope.hub.file.isLoose("es6.spread") && !t.isIdentifier(spread.argument, { name: "arguments" })) {
return spread.argument;
} else {
return scope.toArray(spread.argument, true);

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

@@ -10,7 +10,7 @@ var Test = (function (_Foo) {
_Foo.call(this);
_Foo.prototype.test.call(this);
_Foo.call.apply(_Foo, [this].concat(babelHelpers.slice.call(arguments)));
_Foo.apply(this, arguments);
_Foo.call.apply(_Foo, [this, "test"].concat(babelHelpers.slice.call(arguments)));
(_Foo$prototype$test = _Foo.prototype.test).call.apply(_Foo$prototype$test, [this].concat(babelHelpers.slice.call(arguments)));
@@ -36,4 +36,4 @@ var Test = (function (_Foo) {
};
return Test;
})(Foo);
})(Foo);

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

@@ -4,7 +4,7 @@ var BaseController = (function (_Chaplin$Controller) {
function BaseController() {
babelHelpers.classCallCheck(this, BaseController);
_Chaplin$Controller.call.apply(_Chaplin$Controller, [this].concat(babelHelpers.slice.call(arguments)));
_Chaplin$Controller.apply(this, arguments);
}
babelHelpers.inherits(BaseController, _Chaplin$Controller);
@@ -15,9 +15,9 @@ var BaseController2 = (function (_Chaplin$Controller$Another) {
function BaseController2() {
babelHelpers.classCallCheck(this, BaseController2);
_Chaplin$Controller$Another.call.apply(_Chaplin$Controller$Another, [this].concat(babelHelpers.slice.call(arguments)));
_Chaplin$Controller$Another.apply(this, arguments);
}
babelHelpers.inherits(BaseController2, _Chaplin$Controller$Another);
return BaseController2;
})(Chaplin.Controller.Another);
})(Chaplin.Controller.Another);

View File

@@ -4,9 +4,9 @@ var Test = (function (_Foo) {
function Test() {
babelHelpers.classCallCheck(this, Test);
_Foo.call.apply(_Foo, [this].concat(babelHelpers.slice.call(arguments)));
_Foo.apply(this, arguments);
}
babelHelpers.inherits(Test, _Foo);
return Test;
})(Foo);
})(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);
}