add support for boolean flow literals - fixes #2127

This commit is contained in:
Sebastian McKenzie 2015-07-30 23:44:36 +01:00
parent c91c2eb748
commit 1d81dd995c
17 changed files with 7 additions and 0 deletions

View File

@ -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);

View File

@ -0,0 +1 @@
var foo: true

View File

@ -0,0 +1 @@
var foo: false