aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-06-20 02:14:05 +0800
committerGitHub <noreply@github.com>2017-06-20 02:14:05 +0800
commit343ea326c217b9c1dbaf098a2def96df2b0b818c (patch)
treee524415b3426b32356d40cc8bbe72daf897d9c83 /lib/scope.js
parent1c150c632f200bb58044a3ff9592d884f1010e67 (diff)
downloadtracifyjs-343ea326c217b9c1dbaf098a2def96df2b0b818c.tar.gz
tracifyjs-343ea326c217b9c1dbaf098a2def96df2b0b818c.zip
ensure mangling works if catch reuses a scope variable (#2123)
fixes #2120
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/scope.js b/lib/scope.js
index 82a935a2..c147ce00 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -79,7 +79,7 @@ SymbolDef.prototype = {
if (options.ie8 && sym instanceof AST_SymbolLambda)
s = s.parent_scope;
var def;
- if (this.defun && (def = this.defun.variables.get(this.name))) {
+ if (def = this.redefined()) {
this.mangled_name = def.mangled_name || def.name;
} else
this.mangled_name = s.next_mangled(options, this);
@@ -87,6 +87,9 @@ SymbolDef.prototype = {
cache.set(this.name, this.mangled_name);
}
}
+ },
+ redefined: function() {
+ return this.defun && this.defun.variables.get(this.name);
}
};
@@ -206,6 +209,16 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
node.reference(options);
return true;
}
+ // ensure mangling works if catch reuses a scope variable
+ var def;
+ if (node instanceof AST_SymbolCatch && (def = node.definition().redefined())) {
+ var s = node.scope;
+ while (s) {
+ push_uniq(s.enclosed, def);
+ if (s === def.scope) break;
+ s = s.parent_scope;
+ }
+ }
});
self.walk(tw);
7bfbc0e9fbfb99bbb2daed4f'>machine: Rename 'system' field....* gnu/machine.scm (machine-system): Delete variable. (machine-operating-system): New variable. All callers changed. * doc/guix.texi (Invoking guix deploy): Use the 'machine-operating-system' accessor rather than 'machine-system'. Jakob L. Kreuze 2019-07-26guix system: Add 'reconfigure' module....* guix/scripts/system/reconfigure.scm: New file. * Makefile.am (MODULES): Add it. * guix/scripts/system.scm (bootloader-installer-script): Export variable. * gnu/machine/ssh.scm (switch-to-system, upgrade-shepherd-services) (install-bootloader): Delete variable. * gnu/machine/ssh.scm (deploy-managed-host): Rewrite procedure. * gnu/services/herd.scm (live-service): Export variable. * gnu/services/herd.scm (live-service-canonical-name): New variable. * tests/services.scm (live-service): Delete variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Jakob L. Kreuze 2019-07-18machine: Fix typo....* gnu/machine/ssh.scm (managed-host-environment-type)[description]: Fix typo. Tobias Geerinckx-Rice 2019-07-06gnu: Add machine type for deployment specifications....* gnu/machine.scm: New file. * gnu/machine/ssh.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. Jakob L. Kreuze