checkpoint
This commit is contained in:
12
lib/scope.js
12
lib/scope.js
@@ -165,6 +165,7 @@ AST_Toplevel.DEFMETHOD("scope_warnings", function(options){
|
||||
unreferenced : true,
|
||||
assign_to_global : true,
|
||||
func_arguments : true,
|
||||
nested_defuns : true,
|
||||
eval : true
|
||||
});
|
||||
var tw = new TreeWalker(function(node){
|
||||
@@ -225,6 +226,17 @@ AST_Toplevel.DEFMETHOD("scope_warnings", function(options){
|
||||
col: node.start.col
|
||||
});
|
||||
}
|
||||
if (options.nested_defuns
|
||||
&& node instanceof AST_Defun
|
||||
&& !(tw.parent() instanceof AST_Scope
|
||||
|| (tw.parent() instanceof AST_BlockStatement
|
||||
&& tw.parent(1) instanceof AST_Scope))) {
|
||||
AST_Node.warn("Function {name} declared in nested statement [{line},{col}]", {
|
||||
name: node.name.name,
|
||||
line: node.start.line,
|
||||
col: node.start.col
|
||||
});
|
||||
}
|
||||
});
|
||||
this.walk(tw);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user