-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Object literal shorthand generator methods have incorrect range #36
Comments
Interesting point. The conundrum here is that this behavior matches Esprima's, so even if it's the wrong thing, there's a large compatibly issue to consider. This definitely seems weird, it's just a matter of figuring out of its a bug to fix or not. |
Agreed; I wouldn't advocate breaking compatibility unnecessarily. However, I might be able to make the case that this would be a bug in Esprima: Now that I edited the test script above to output |
I think a good case can be made that this is a bug. Would you mind filing an issue with Esprima to start the discussion? |
Upon further investigation, this applies to non-generator shorthand methods as well. Esprima issue: https://code.google.com/p/esprima/issues/detail?id=625 |
The Esprima issue has been moved to jquery/esprima#1029. |
Fix: Extend property method range and loc to include params (fixes #36)
Perhaps this is intentional, but the range given to object literal shorthand generator methods includes only the method body
{}
. Since they key is part of the parent property and overlapping, non-ancestral ranges might get confusing, I'm not sure that theFunctionExpression
's range should include all of*foo(arg1) {}
, but it seems like the range should expand to at least(arg1) {}
.Related: eslint/eslint#1677
Edit: Add
arg1
to output.The text was updated successfully, but these errors were encountered: