[javascriptlint-commit] SF.net SVN: javascriptlint:[296] trunk
Status: Beta
Brought to you by:
matthiasmiller
From: <mat...@us...> - 2010-04-23 20:06:04
|
Revision: 296 http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=296&view=rev Author: matthiasmiller Date: 2010-04-23 20:05:58 +0000 (Fri, 23 Apr 2010) Log Message: ----------- Fix exception when passing arguments to a "new function() {};" statement. Modified Paths: -------------- trunk/javascriptlint/warnings.py trunk/tests/warnings/want_assign_or_call.js Modified: trunk/javascriptlint/warnings.py =================================================================== --- trunk/javascriptlint/warnings.py 2010-04-19 15:19:43 UTC (rev 295) +++ trunk/javascriptlint/warnings.py 2010-04-23 20:05:58 UTC (rev 296) @@ -516,7 +516,8 @@ return # Allow new function() { } as statements. if child.kind == tok.NEW: - grandchild, = child.kids + # The first kid is the constructor, followed by its arguments. + grandchild = child.kids[0] if grandchild.kind == tok.FUNCTION: return raise LintWarning, child Modified: trunk/tests/warnings/want_assign_or_call.js =================================================================== --- trunk/tests/warnings/want_assign_or_call.js 2010-04-19 15:19:43 UTC (rev 295) +++ trunk/tests/warnings/want_assign_or_call.js 2010-04-23 20:05:58 UTC (rev 296) @@ -21,5 +21,10 @@ delete a; a.b(); + + /* Test with arguments to the constructor. */ + new function(x) { + this.x = x; + }(42); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |