[javascriptlint-commit] SF.net SVN: javascriptlint:[220] trunk
Status: Beta
Brought to you by:
matthiasmiller
|
From: <mat...@us...> - 2008-08-26 13:54:33
|
Revision: 220
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=220&view=rev
Author: matthiasmiller
Date: 2008-08-26 13:54:31 +0000 (Tue, 26 Aug 2008)
Log Message:
-----------
fix traceback with syntax errors
Modified Paths:
--------------
trunk/pyjsl/lint.py
Added Paths:
-----------
trunk/tests/errors/syntax_error.js
Modified: trunk/pyjsl/lint.py
===================================================================
--- trunk/pyjsl/lint.py 2008-08-26 03:50:14 UTC (rev 219)
+++ trunk/pyjsl/lint.py 2008-08-26 13:54:31 UTC (rev 220)
@@ -245,17 +245,26 @@
return lint_error(pos.line, pos.col, errname)
parse_errors = []
- root = jsparse.parse(script, parse_error)
- if root:
- comments = jsparse.parsecomments(script, root)
- else:
- comments = []
ignores = []
- start_ignore = None
declares = []
import_paths = []
fallthrus = []
passes = []
+
+ root = jsparse.parse(script, parse_error)
+ if not root:
+ # Cache empty results for this script.
+ assert not script_cache
+ script_cache['imports'] = set()
+ script_cache['scope'] = Scope(None)
+
+ # Report errors and quit.
+ for pos, msg in parse_errors:
+ _report(pos, msg, False)
+ return
+
+ comments = jsparse.parsecomments(script, root)
+ start_ignore = None
for comment in comments:
cc = _parse_control_comment(comment)
if cc:
@@ -316,8 +325,7 @@
visitation.make_visitors(visitors, [_get_scope_checks(scope, report)])
# kickoff!
- if root:
- _lint_node(root, visitors)
+ _lint_node(root, visitors)
for fallthru in fallthrus:
report(fallthru, 'invalid_fallthru')
Added: trunk/tests/errors/syntax_error.js
===================================================================
--- trunk/tests/errors/syntax_error.js (rev 0)
+++ trunk/tests/errors/syntax_error.js 2008-08-26 13:54:31 UTC (rev 220)
@@ -0,0 +1,4 @@
+function syntax_error() {
+ &; /*warning:syntax_error*/
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|