Merge branch 'master' into code-generator

This commit is contained in:
Sebastian McKenzie
2014-10-31 21:39:47 +11:00
3 changed files with 19 additions and 2 deletions

View File

@@ -147,5 +147,22 @@ exports.VariableDeclaration = function (node, parent, file) {
}
});
if (parent.type !== "Program" && parent.type !== "BlockStatement") {
var declar;
_.each(nodes, function (node) {
declar = declar || b.variableDeclaration(node.kind, []);
if (node.type !== "VariableDeclaration" && declar.kind !== node.kind) {
throw util.errorWithNode(node, "Cannot use this node within the current parent");
}
declar.declarations = declar.declarations.concat(node.declarations);
});
return declar;
}
return nodes;
};