Don't set inType flag when parsing property names (#266)
* Don't set inType flag when parsing property names * Add inPropertyName type definition * Move inPropertyName check before this.curContext()
This commit is contained in:
committed by
Daniel Tschinder
parent
dd4c4ead2d
commit
3267e5f365
@@ -949,17 +949,6 @@ export default function (instance) {
|
||||
};
|
||||
});
|
||||
|
||||
// ensure that inside property names, < isn't interpreted as JSX, but as a type parameter
|
||||
instance.extend("parsePropertyName", function (inner) {
|
||||
return function (prop) {
|
||||
const oldInType = this.state.inType;
|
||||
this.state.inType = true;
|
||||
const out = inner.call(this, prop);
|
||||
this.state.inType = oldInType;
|
||||
return out;
|
||||
};
|
||||
});
|
||||
|
||||
// ensure that inside flow types, we bypass the jsx parser plugin
|
||||
instance.extend("readToken", function (inner) {
|
||||
return function (code) {
|
||||
|
||||
@@ -416,7 +416,9 @@ export default function(instance) {
|
||||
|
||||
instance.extend("readToken", function(inner) {
|
||||
return function(code) {
|
||||
let context = this.curContext();
|
||||
if (this.state.inPropertyName) return inner.call(this, code);
|
||||
|
||||
const context = this.curContext();
|
||||
|
||||
if (context === tc.j_expr) {
|
||||
return this.jsxReadToken();
|
||||
|
||||
Reference in New Issue
Block a user