Merge branch 'master' into harmony

This commit is contained in:
Richard van Velzen
2016-10-23 22:03:20 +02:00
17 changed files with 529 additions and 66 deletions

View File

@@ -256,12 +256,16 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
}
if (node instanceof AST_SymbolRef) {
var name = node.name;
if (name == "eval" && tw.parent() instanceof AST_Call) {
var parent = tw.parent();
if (name == "eval" && parent instanceof AST_Call) {
for (var s = node.scope; s && !s.uses_eval; s = s.parent_scope) {
s.uses_eval = true;
}
}
var sym = node.scope.find_variable(name);
if (node.scope instanceof AST_Lambda && name == "arguments") {
node.scope.uses_arguments = true;
}
if (!sym) {
var g;
if (globals.has(name)) {
@@ -272,12 +276,12 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
g.global = true;
globals.set(name, g);
}
node.thedef = g;
if (func && name == "arguments") {
func.uses_arguments = true;
}
} else {
node.thedef = sym;
sym = g;
}
node.thedef = sym;
if (parent instanceof AST_Unary && (parent.operator === '++' || parent.operator === '--')
|| parent instanceof AST_Assign && parent.left === node) {
sym.modified = true;
}
node.reference();
return true;