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

String identifiers can't be used with method shorthand #21

Closed
nzakas opened this issue Dec 23, 2014 · 3 comments
Closed

String identifiers can't be used with method shorthand #21

nzakas opened this issue Dec 23, 2014 · 3 comments
Labels

Comments

@nzakas
Copy link
Member

nzakas commented Dec 23, 2014

The following should be legal but throws an error when objectLiteralShorthandMethods is enabled:

var x = {
    "foo"() {
        return bar;
    }
};
@nzakas nzakas added the bug label Dec 23, 2014
@nzakas
Copy link
Member Author

nzakas commented Dec 23, 2014

Working on this.

@nzakas
Copy link
Member Author

nzakas commented Dec 24, 2014

In the course of working on this issue, I found several addition problems:

First, this is legal but is throwing an error:

var x = {
    get(){}
};

var x = {
    set(){}
};

Also, this is parsing fine but should throw an error:

var x = {
    method() 43
};

@nzakas
Copy link
Member Author

nzakas commented Dec 24, 2014

I'm adding a lot more tests for properties as part of this.

@nzakas nzakas closed this as completed in 5f6242c Dec 24, 2014
nzakas added a commit that referenced this issue Dec 24, 2014
Fix: Parsing issues with property methods (fixes #21)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant