add support for boolean flow literals - fixes #2127
This commit is contained in:
parent
c91c2eb748
commit
1d81dd995c
@ -493,6 +493,11 @@ pp.flowParsePrimaryType = function () {
|
||||
this.next();
|
||||
return this.finishNode(node, "StringLiteralTypeAnnotation");
|
||||
|
||||
case tt._true: case tt._false:
|
||||
node.value = this.match(tt._true)
|
||||
this.next();
|
||||
return this.finishNode(node, "BooleanLiteralTypeAnnotation");
|
||||
|
||||
case tt.num:
|
||||
node.rawValue = node.value = this.state.value;
|
||||
node.raw = this.input.slice(this.state.start, this.state.end);
|
||||
|
||||
1
test/fixtures/flow/literal-types/boolean-false/actual.js
vendored
Normal file
1
test/fixtures/flow/literal-types/boolean-false/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var foo: true
|
||||
1
test/fixtures/flow/literal-types/boolean-true/actual.js
vendored
Normal file
1
test/fixtures/flow/literal-types/boolean-true/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var foo: false
|
||||
Loading…
x
Reference in New Issue
Block a user