Announcement / closure-linter

Automatically exported from code.google.com/p/closure-linter
Apache License 2.0
0 stars 0 forks source link

AttributeError: 'NoneType' object has no attribute 'IsType' #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Traceback (most recent call last):
  File "/home/aktive/Work/Development/nGUI/env/bin/gjslint", line 8, in <module>
    load_entry_point('closure-linter==2.3.6.1', 'console_scripts', 'gjslint')()
  File "build/bdist.linux-x86_64/egg/closure_linter/gjslint.py", line 256, in main
  File "build/bdist.linux-x86_64/egg/closure_linter/gjslint.py", line 206, in _PrintErrorRecords
  File "build/bdist.linux-x86_64/egg/closure_linter/gjslint.py", line 128, in _CheckPaths
  File "build/bdist.linux-x86_64/egg/closure_linter/gjslint.py", line 144, in _CheckPath
  File "build/bdist.linux-x86_64/egg/closure_linter/runner.py", line 141, in Run
  File "build/bdist.linux-x86_64/egg/closure_linter/runner.py", line 191, in _RunChecker
  File "build/bdist.linux-x86_64/egg/closure_linter/checker.py", line 82, in Check
  File "build/bdist.linux-x86_64/egg/closure_linter/checkerbase.py", line 182, in _ExecutePass
  File "build/bdist.linux-x86_64/egg/closure_linter/javascriptstatetracker.py", line 148, in HandleToken
  File "build/bdist.linux-x86_64/egg/closure_linter/statetracker.py", line 1068, in HandleToken
AttributeError: 'NoneType' object has no attribute 'IsType'

Original issue reported on code.google.com by jo...@nimbic.com on 6 Aug 2012 at 4:47

GoogleCodeExporter commented 9 years ago
I think this problem occurs for any file which has an identifier as the last 
token. For example, `echo foo >> test.js` will produce a file which causes the 
crash.

Line 1068 is:

  `if next_token.IsType(Type.SEMICOLON):`

which fails when next_token is None. I believe the fix is just to change this 
line to:

  `if next_token is None or next_token.IsType(Type.SEMICOLON):`

Original comment by sidnai...@gmail.com on 21 Sep 2012 at 7:28

GoogleCodeExporter commented 9 years ago

Original comment by vagra...@google.com on 29 Jul 2013 at 7:23

GoogleCodeExporter commented 9 years ago

Original comment by vagra...@google.com on 29 Jul 2013 at 8:17