-
-
Notifications
You must be signed in to change notification settings - Fork 257
Don't set inType flag when parsing property names #266
Conversation
@@ -0,0 +1,3 @@ | |||
const map = { | |||
[age <= 17] : 'Too young' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the original use case? It's not important in the expected AST.
I would suggest something like that:
[1 <= 0]: null
@@ -16,6 +16,7 @@ export default class State { | |||
this.inFunction = | |||
this.inGenerator = | |||
this.inAsync = | |||
this.inPropertyName = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also add the flow type, like the other fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it in 1d5932c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested, but I think that this won't work anymore now:
var x = {
[<div></div>]: 0
}
This is not really useful, but should be still valid.
Although just noticed it is not working in 6.13 either.
@@ -416,6 +416,10 @@ export default function(instance) { | |||
return function(code) { | |||
let context = this.curContext(); | |||
|
|||
if (this.state.inPropertyName) { | |||
return inner.call(this, code); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could move this before the curContext()
call.
Previously
inType
flag was set when parsing property names. Among other things it was used to prevent jsx tokenization. This patch adds specializedinPropertyName
flag and prevent jsx tokenization in jsx plugin.