traceur upstream sync

This commit is contained in:
Sebastian McKenzie
2015-04-02 02:21:12 +11:00
parent 3c343adf33
commit f88a4147a6
4 changed files with 30 additions and 21 deletions

View File

@@ -5,6 +5,8 @@ export var metadata = {
};
export function TemplateLiteral(node, parent, scope, file) {
if (t.isTaggedTemplateExpression(parent)) return;
for (var i = 0; i < node.expressions.length; i++) {
node.expressions[i] = t.callExpression(t.identifier("String"), [node.expressions[i]]);
}

View File

@@ -1,12 +1,8 @@
import * as t from "../../../types";
export function BlockStatement(node, parent, scope, file) {
if ((t.isFunction(parent) && parent.body === node) || t.isExportDeclaration(parent)) {
return;
}
for (var i = 0; i < node.body.length; i++) {
var func = node.body[i];
function statementList(key, node, file) {
for (var i = 0; i < node[key].length; i++) {
var func = node[key][i];
if (!t.isFunctionDeclaration(func)) continue;
var declar = t.variableDeclaration("let", [
@@ -19,8 +15,20 @@ export function BlockStatement(node, parent, scope, file) {
// todo: name this
func.id = null;
node.body[i] = declar;
node[key][i] = declar;
file.checkNode(declar);
}
}
export function BlockStatement(node, parent, scope, file) {
if ((t.isFunction(parent) && parent.body === node) || t.isExportDeclaration(parent)) {
return;
}
statementList("body", node, file);
}
export function SwitchCase(node, parent, scope, file) {
statementList("consequent", node, file);
}

View File

@@ -41,16 +41,15 @@ require("./_transformation-helper")({
// TODO
"Syntax/StrictKeywordsInPattern",
// broken test, see google/traceur-compiler#1797
"Classes/NestedClassSuperAnimal",
// babel has no way to check these :( TODO: add to caveats
"TemplateLiterals/TemplateObjectCaching.module",
// TODO: #426
// babel does function/class name inference which these tests don't take into consideration
"Classes/ClassNameBinding",
"PropertyMethodAssignment/PropertyMethodAssignment",
// TODO: investigate
"Classes/SuperSet",
"Classes/PrototypeDescriptor",
"Classes/ExtendStrange",
"Classes/ClassNameBinding",
// these are the responsibility of core-js
"Symbol/GetOwnPropertySymbols",
@@ -62,20 +61,20 @@ require("./_transformation-helper")({
"Destructuring/Rest",
"Destructuring/Empty",
// babel doesn't like non-closing comments :)
"Syntax/NoNewLineHereEndOfFile",
// traceur uses an old version of regexpu
"RegularExpression/Simple",
// class methods are still enumerable in traceur
// class methods are still enumerable in traceur...
"Classes/PrototypeDescriptor",
"NumericLiteral/Simple",
"Classes/Method",
// Object.mixin didn't make it into ES6
"ObjectMixin",
// traceur doesn't name methods and has an incorrect test asserting that
// they have no names
"PropertyMethodAssignment/PropertyMethodAssignment",
// Babel assumes that all code transformed is a module so this isn't necessary
"Strict",
"Syntax/UseStrictEscapeSequence",
@@ -91,7 +90,7 @@ require("./_transformation-helper")({
"Syntax/StrictKeywords"
]
}, {
optional: ["es6.spec.symbols"],
optional: ["es6.spec.symbols", "es6.spec.templateLiterals"],
stage: 0
}, function (opts, task) {
if (!_.contains(task.exec.loc, "module.js")) {

2
vendor/traceur vendored