Merge 360628de96 into 5c7705fcad
This commit is contained in:
commit
1aa187ed4b
14
lib/scope.js
14
lib/scope.js
|
|
@ -189,6 +189,16 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
|
||||||
func = node;
|
func = node;
|
||||||
descend();
|
descend();
|
||||||
func = prev_func;
|
func = prev_func;
|
||||||
|
|
||||||
|
if (node instanceof AST_Function && node.name && node.argnames.length) {
|
||||||
|
var ref = new AST_SymbolRef({
|
||||||
|
scope: node.argnames[0].scope,
|
||||||
|
name: node.name.name,
|
||||||
|
thedef: node.name.thedef
|
||||||
|
});
|
||||||
|
ref.reference(true);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (node instanceof AST_LoopControl && node.label) {
|
if (node instanceof AST_LoopControl && node.label) {
|
||||||
|
|
@ -255,9 +265,9 @@ AST_Lambda.DEFMETHOD("init_scope_vars", function(){
|
||||||
this.variables.set(symbol.name, def);
|
this.variables.set(symbol.name, def);
|
||||||
});
|
});
|
||||||
|
|
||||||
AST_SymbolRef.DEFMETHOD("reference", function() {
|
AST_SymbolRef.DEFMETHOD("reference", function(virtual) {
|
||||||
var def = this.definition();
|
var def = this.definition();
|
||||||
def.references.push(this);
|
if (!virtual) def.references.push(this);
|
||||||
var s = this.scope;
|
var s = this.scope;
|
||||||
while (s) {
|
while (s) {
|
||||||
push_uniq(s.enclosed, def);
|
push_uniq(s.enclosed, def);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user