Compare commits

...

9 Commits

Author SHA1 Message Date
Sebastian McKenzie
1b046a6ecb v4.6.5 2015-03-02 22:54:35 +11:00
Sebastian McKenzie
3b8ed0d401 add 4.6.5 changelog 2015-03-02 22:51:21 +11:00
Sebastian McKenzie
d4c98d7738 add transformer aliases 2015-03-02 22:47:00 +11:00
Sebastian McKenzie
4e44af819f fix rogue strict reference 2015-03-02 22:45:21 +11:00
Sebastian McKenzie
a65acd73ca fix rogue useStrict transformer references 2015-03-02 22:41:55 +11:00
Sebastian McKenzie
b7cb2bcb7b rename useStrict transformer to strict 2015-03-02 22:37:51 +11:00
Sebastian McKenzie
5ac4dc0541 don't evaluate ArrayExpressions 2015-03-02 17:16:10 +11:00
Sebastian McKenzie
99ddd02b0a change Function export to avoid messing with istanbul 2015-03-02 15:38:43 +11:00
Sebastian McKenzie
19cfee14fd 4.6.4 2015-03-02 15:38:31 +11:00
33 changed files with 46 additions and 34 deletions

View File

@@ -13,6 +13,19 @@ _Note: Gaps between patch versions are faulty/broken releases._
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
## 4.6.5
* **Internal**
* `useStrict` transformer has been renamed to `strict`.
## 4.6.4
* **Bug Fix**
* Fix `ForOfStatement` not proplery inheriting labels.
* When in closure mode in block scoping transformer, properly check for variable shadowing.
* **New Feature**
* New `utility.inlineEnvironmentVariables` and `utility.inlineExpression` transformers.
## 4.6.3
* **Bug Fix**

View File

@@ -1,7 +1,7 @@
{
"name": "babel",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "4.6.4",
"version": "4.6.5",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"repository": "babel/babel",

View File

@@ -1,7 +1,7 @@
{
"name": "babel-runtime",
"description": "babel selfContained runtime",
"version": "4.6.3",
"version": "4.6.4",
"repository": "babel/babel",
"author": "Sebastian McKenzie <sebmck@gmail.com>"
}

View File

@@ -388,7 +388,7 @@ export default class File {
var opts = this.opts;
opts.allowImportExportEverywhere = this.isLoose("es6.modules");
opts.strictMode = this.transformers.useStrict.canRun();
opts.strictMode = this.transformers.strict.canRun();
return parse(opts, code, (tree) => {
this.transform(tree);

View File

@@ -25,7 +25,10 @@ transform._ensureTransformerNames = function (type, rawKeys) {
var key = rawKeys[i];
var deprecatedKey = transform.deprecatedTransformerMap[key];
if (deprecatedKey) {
var aliasKey = transform.aliasTransformerMap[key];
if (aliasKey) {
keys.push(aliasKey);
} else if (deprecatedKey) {
// deprecated key, remap it to the new one
console.error("The transformer " + key + " has been renamed to " + deprecatedKey);
rawKeys.push(deprecatedKey);
@@ -49,6 +52,7 @@ transform.transformers = object();
transform.namespaces = object();
transform.deprecatedTransformerMap = require("./transformers/deprecated");
transform.aliasTransformerMap = require("./transformers/aliases");
transform.moduleFormatters = require("./modules");
import rawTransformers from "./transformers";

View File

@@ -0,0 +1,3 @@
{
"useStrict": "strict"
}

View File

@@ -1,5 +1,5 @@
export default {
useStrict: require("./other/use-strict"),
strict: require("./other/strict"),
"validation.undeclaredVariableCheck": require("./validation/undeclared-variable-check"),
"validation.noForInOfAssignment": require("./validation/no-for-in-of-assignment"),
@@ -97,7 +97,7 @@ export default {
"spec.typeofSymbol": require("./spec/typeof-symbol"),
"spec.undefinedToVoid": require("./spec/undefined-to-void"),
_useStrict: require("./internal/use-strict"),
_strict: require("./internal/strict"),
_moduleFormatter: require("./internal/module-formatter"),
"es3.propertyLiterals": require("./es3/property-literals"),

View File

@@ -1,4 +1,4 @@
import * as useStrict from "../../helpers/use-strict";
import * as strict from "../../helpers/strict";
import t from "../../../types";
export var secondPass = true;
@@ -6,7 +6,7 @@ export var secondPass = true;
export function BlockStatement(node, parent, scope, file) {
if (!node._declarations) return;
useStrict.wrap(node, function () {
strict.wrap(node, function () {
var kinds = {};
var kind;

View File

@@ -1,9 +1,9 @@
import * as useStrict from "../../helpers/use-strict";
import * as strict from "../../helpers/strict";
export function Program(program, parent, scope, file) {
if (!file.transformers["es6.modules"].canRun()) return;
useStrict.wrap(program, function () {
strict.wrap(program, function () {
program.body = file.dynamicImports.concat(program.body);
});

View File

@@ -1,7 +1,7 @@
import t from "../../../types";
export function Program(program, parent, scope, file) {
if (file.transformers.useStrict.canRun()) {
if (file.transformers.strict.canRun()) {
program.body.unshift(t.expressionStatement(t.literal("use strict")));
}
}

View File

@@ -13,12 +13,12 @@ export function Class(node) {
node.implements = null;
}
export function Function(node) {
exports.Function = function (node) {
for (var i = 0; i < node.params.length; i++) {
var param = node.params[i];
param.optional = false;
}
}
};
export function TypeCastExpression(node) {
return node.expression;

View File

@@ -887,25 +887,17 @@ t.evaluate = function (node) {
}
if (t.isUnaryExpression(node, { prefix: true })) {
var arg = evaluate(node.argument);
switch (node.operator) {
case "void": return undefined;
case "!": return !evaluate(node.argument);
case "+": return +evaluate(node.argument);
case "-": return -evaluate(node.argument);
case "!": return !arg;
case "+": return +arg;
case "-": return -arg;
}
}
if (t.isArrayExpression(node)) {
// possible perf issues - could deopt on X elements
var values = [];
for (var i = 0; i < node.elements.length; i++) {
values.push(evaluate(node.elements[i]));
}
return values;
}
if (t.isObjectExpression(node)) {
// todo: deopt on mutable computed property keys etc
if (t.isArrayExpression(node) || t.isObjectExpression(node)) {
// we could evaluate these but it's probably impractical and not very useful
}
if (t.isLogicalExpression(node)) {

View File

@@ -1,4 +1,4 @@
{
"blacklist": "useStrict",
"blacklist": "strict",
"optional": "reactCompat"
}

View File

@@ -1,3 +1,3 @@
{
"blacklist": ["useStrict", "es6.tailCall"]
"blacklist": ["strict", "es6.tailCall"]
}

View File

@@ -1,3 +1,3 @@
{
"blacklist": ["useStrict"]
"blacklist": ["strict"]
}

View File

@@ -47,7 +47,7 @@ suite("kangax/compat-table", function () {
test(key, function () {
code = transform(code, {
filename: key,
blacklist: ["useStrict"],
blacklist: ["strict"],
optional: ["spec.typeofSymbol", "es6.blockScopingTDZ"]
}).code;

View File

@@ -11,7 +11,7 @@ var regeneratorLoc = __dirname + "/../vendor/regenerator";
suite("regenerator", function () {
setup(function () {
require("../register")({
blacklist: ["useStrict"],
blacklist: ["strict"],
experimental: true
});
});

View File

@@ -29,7 +29,7 @@ var check = function (loc) {
transform(file, {
filename: loc,
blacklist: ["useStrict"],
blacklist: ["strict"],
_anal: true
});
} catch (err) {

View File

@@ -86,6 +86,6 @@ require("./_transformation-helper")({
experimental: true
}, function (opts, task) {
if (!_.contains(task.exec.loc, "module.js")) {
opts.blacklist = ["useStrict"];
opts.blacklist = ["strict"];
}
});