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);
}