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

Parser fails on generator methods #85

Closed
steadicat opened this issue Mar 9, 2015 · 2 comments
Closed

Parser fails on generator methods #85

steadicat opened this issue Mar 9, 2015 · 2 comments

Comments

@steadicat
Copy link

Espree parser fails on the following with Unexpected token *:

class Foo {
  *bar() {
  }
}

Test case:

var espree = require("espree");

espree.parse('class Foo {*bar() {}}', {
  "ecmaFeatures": {
    "classes": true,
    "generators": true,
    "objectLiteralShorthandMethods": true,
  },
});

Stack:

node_modules/espree/espree.js:5373
        throw e;
              ^
Error: Line 1: Unexpected token *
    at throwError (node_modules/espree/espree.js:2078:17)
    at throwUnexpected (node_modules/espree/espree.js:2141:5)
    at parseObjectPropertyKey (node_modules/espree/espree.js:2364:5)
    at parseClassBody (node_modules/espree/espree.js:4934:15)
    at parseClassDeclaration (node_modules/espree/espree.js:5023:17)
    at parseSourceElement (node_modules/espree/espree.js:5053:28)
    at parseSourceElements (node_modules/espree/espree.js:5101:25)
    at parseProgram (node_modules/espree/espree.js:5120:12)
    at Object.parse (node_modules/espree/espree.js:5361:19)
    at Object.<anonymous> (esp.js:3:8)

See eslint/eslint#1990.

@xjamundx
Copy link
Contributor

If no one else does I can look at this tomorrow. Swore we tested for this...oh inside of a class yeah probably not. I can fix that!

@xjamundx
Copy link
Contributor

Made some progress tonight. should have fix in the morning.

xjamundx pushed a commit to xjamundx/espree that referenced this issue Mar 10, 2015
xjamundx pushed a commit to xjamundx/espree that referenced this issue Mar 10, 2015
xjamundx pushed a commit to xjamundx/espree that referenced this issue Mar 10, 2015
xjamundx pushed a commit to xjamundx/espree that referenced this issue Mar 10, 2015
@nzakas nzakas closed this as completed in 9eac2ef Mar 10, 2015
nzakas added a commit that referenced this issue Mar 10, 2015
Fix: generator methods in classes (fixes #85)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants