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

Can't parse code with a generator method named "[Symbol.iterator]" #123

Closed
hegemonic opened this issue Apr 8, 2015 · 4 comments
Closed

Comments

@hegemonic
Copy link

According to Axel Rauschmayer's article on generators, it's legal to have a generator method whose name is [Symbol.iterator], like so:

class MyTree {
    *[Symbol.iterator]() {
        // ...
    }
}

However, Espree throws an error when it attempts to parse this code.

@nzakas
Copy link
Member

nzakas commented Apr 9, 2015

What language features are you using?

@hegemonic
Copy link
Author

All of them, I think (aside from JSX). Here's the options object that I'm using:

{
    comment: true,
    loc: true,
    range: true,
    tokens: true,
    ecmaFeatures: {
        arrowFunctions: true,
        binaryLiterals: true,
        blockBindings: true,
        classes: true,
        defaultParams: true,
        destructuring: true,
        forOf: true,
        generators: true,
        globalReturn: true,
        jsx: false,
        modules: true,
        objectLiteralComputedProperties: true,
        objectLiteralDuplicateProperties: true,
        objectLiteralShorthandMethods: true,
        objectLiteralShorthandProperties: true,
        octalLiterals: true,
        regexUFlag: true,
        regexYFlag: true,
        restParams: true,
        spread: true,
        superInFunctions: true,
        templateStrings: true,
        unicodeCodePointEscapes: true
    }
}

I should also have mentioned that I'm testing with Espree 2.0.0.

@nzakas
Copy link
Member

nzakas commented Apr 9, 2015

OK, looks like a bug.

julien-f added a commit to vatesfr/xo-collection that referenced this issue Apr 27, 2015
Currently broken du to due to eslint/espree#123
@nzakas
Copy link
Member

nzakas commented Apr 29, 2015

Working on this.

@nzakas nzakas closed this as completed in afca198 Apr 29, 2015
nzakas added a commit that referenced this issue Apr 29, 2015
Fix: Allow computed generators in classes (fixes #123)
julien-f added a commit to vatesfr/xen-orchestra-old that referenced this issue Jan 10, 2017
Currently broken du to due to eslint/espree#123
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

2 participants