allow keyword in object/class property names with Flow type parameters (#145)

This commit is contained in:
Dan Harper
2016-10-14 20:13:00 +01:00
committed by Daniel Tschinder
parent c63c1bc728
commit f7c1af1c1f
12 changed files with 1603 additions and 0 deletions

View File

@@ -888,6 +888,17 @@ 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) {