google / closure-linter

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

when use "default" as key occurs AttributeError #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
test.js
{{{
var a = new Scheme({default: 0})
}}}
gjslint test.js

Output:

{{{
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/closure_linter/checkerbase.py", line 201, in CheckLines
    self.__metadata_pass.Process(token)
  File "/usr/lib/python2.7/site-packages/closure_linter/ecmametadatapass.py", line 415, in Process
    self._ProcessToken()
  File "/usr/lib/python2.7/site-packages/closure_linter/ecmametadatapass.py", line 432, in _ProcessToken
    context = (self._ProcessContext() or self._context)
  File "/usr/lib/python2.7/site-packages/closure_linter/ecmametadatapass.py", line 369, in _ProcessContext
    while self._context.parent.type != EcmaContext.SWITCH:
AttributeError: 'NoneType' object has no attribute 'type'
}}}

What version of the product are you using? On what operating system?
gjslint 2.2.7

Original issue reported on code.google.com by guil...@gmail.com on 9 Mar 2011 at 8:37

GoogleCodeExporter commented 9 years ago
Weird, but I can reproduce.

Original comment by a...@google.com on 8 Apr 2011 at 8:49

GoogleCodeExporter commented 9 years ago
We have some special logic for handling the 'default' case of switch statements 
that was getting run anytime default was seen as an identifier rather than only 
when used within a switch.

Original comment by a...@google.com on 8 Apr 2011 at 10:05

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago

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