[javascriptlint-commit] SF.net SVN: javascriptlint:[244] trunk/pyjsl/lint.py
Status: Beta
Brought to you by:
matthiasmiller
|
From: <mat...@us...> - 2009-05-26 02:26:27
|
Revision: 244
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=244&view=rev
Author: matthiasmiller
Date: 2009-05-26 02:26:18 +0000 (Tue, 26 May 2009)
Log Message:
-----------
var_hides_arg should also check parent scopes
Modified Paths:
--------------
trunk/pyjsl/lint.py
Modified: trunk/pyjsl/lint.py
===================================================================
--- trunk/pyjsl/lint.py 2009-05-20 07:37:57 UTC (rev 243)
+++ trunk/pyjsl/lint.py 2009-05-26 02:26:18 UTC (rev 244)
@@ -435,12 +435,13 @@
return onpush
def _warn_or_declare(scope, name, node, report):
- other = scope.get_identifier(name)
+ parent_scope, other = scope.resolve_identifier(name) or (None, None)
if other and other.kind == tok.FUNCTION and name in other.fn_args:
report(node, 'var_hides_arg', name=name)
- elif other:
+ elif other and parent_scope == scope:
report(node, 'redeclared_var', name=name)
else:
+ # TODO: Warn when hiding a variable in a parent scope.
scope.add_declaration(name, node)
def _get_scope_checks(scope, report):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|