Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: Support ES6 classes (refs #10) #67

Merged
merged 1 commit into from
Mar 1, 2015
Merged

New: Support ES6 classes (refs #10) #67

merged 1 commit into from
Mar 1, 2015

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Feb 28, 2015

Three of the original Esprima tests are failing due to a strict mode violation. For some reason, my changes introduced a problem where things like this aren't flagged:

function f() {"use strict"; x={ set s(eval){} }}

It should throw an error on eval, since that's now allowed in strict mode, but doesn't. The three test failures all have to do with this situation (same with getters and methods as well).

I've been staring at this for too long and can't figure out how to fix it. Any insights greatly appreciated. :)

if (allowClasses) {
return parseClassDeclaration();
}
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading through from the start trying to grok this. If classes are disabled, shouldn't this go to the default case as with block bindings below?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. The default case and breaking out of the switch both end up calling parseStatement(). Doesn't that make the default case redundant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably. I mostly just copy-pasted. :)

@btmills
Copy link
Member

btmills commented Mar 1, 2015

espree.js line 2613 in the set portion of parseObjectProperty() is param = [ parseVariableIdentifier() ];. Nowhere does it call validateParam(), which gets called by parseParam() in normal methods. Could that be the issue?

@nzakas
Copy link
Member Author

nzakas commented Mar 1, 2015

Ah could be! That method was completely refactored in Esprima, and I really didn't want to fight through that refactoring with this commit.

@nzakas
Copy link
Member Author

nzakas commented Mar 1, 2015

@btmills That was it! All tests are passing! We have classes!

nzakas added a commit that referenced this pull request Mar 1, 2015
New: Support ES6 classes (refs #10)
@nzakas nzakas merged commit d37f447 into master Mar 1, 2015
@nzakas nzakas deleted the classes branch March 1, 2015 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants