Don't parse class properties without initializers when classProperties is disabled and Flow is enabled (#300)
This commit is contained in:
committed by
Daniel Tschinder
parent
56a92ccec1
commit
aec4beff0c
@@ -751,8 +751,13 @@ pp.parseClassBody = function (node) {
|
||||
};
|
||||
|
||||
pp.parseClassProperty = function (node) {
|
||||
const noPluginMsg = "You can only use Class Properties when the 'classProperties' plugin is enabled.";
|
||||
if (!node.typeAnnotation && !this.hasPlugin("classProperties")) {
|
||||
this.raise(node.start, noPluginMsg);
|
||||
}
|
||||
|
||||
if (this.match(tt.eq)) {
|
||||
if (!this.hasPlugin("classProperties")) this.unexpected();
|
||||
if (!this.hasPlugin("classProperties")) this.raise(this.state.start, noPluginMsg);
|
||||
this.next();
|
||||
node.value = this.parseMaybeAssign();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user