BigInt type for Flow (#10091)
* flow BigIntLiteralTypeAnnotation * numericSeparator for flow test plugins * fix flow tuple * fix code review
This commit is contained in:
committed by
Nicolò Ribaudo
parent
cbb482e2f9
commit
f588e4ec47
@@ -1263,7 +1263,10 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
});
|
||||
|
||||
case tt.bracketL:
|
||||
return this.flowParseTupleType();
|
||||
this.state.noAnonFunctionType = false;
|
||||
type = this.flowParseTupleType();
|
||||
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
||||
return type;
|
||||
|
||||
case tt.relational:
|
||||
if (this.state.value === "<") {
|
||||
@@ -1352,15 +1355,27 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
case tt.plusMin:
|
||||
if (this.state.value === "-") {
|
||||
this.next();
|
||||
if (!this.match(tt.num)) {
|
||||
this.unexpected(null, `Unexpected token, expected "number"`);
|
||||
if (this.match(tt.num)) {
|
||||
return this.parseLiteral(
|
||||
-this.state.value,
|
||||
"NumberLiteralTypeAnnotation",
|
||||
node.start,
|
||||
node.loc.start,
|
||||
);
|
||||
}
|
||||
|
||||
return this.parseLiteral(
|
||||
-this.state.value,
|
||||
"NumberLiteralTypeAnnotation",
|
||||
node.start,
|
||||
node.loc.start,
|
||||
if (this.match(tt.bigint)) {
|
||||
return this.parseLiteral(
|
||||
-this.state.value,
|
||||
"BigIntLiteralTypeAnnotation",
|
||||
node.start,
|
||||
node.loc.start,
|
||||
);
|
||||
}
|
||||
|
||||
this.unexpected(
|
||||
null,
|
||||
`Unexpected token, expected "number" or "bigint"`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1371,6 +1386,12 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
"NumberLiteralTypeAnnotation",
|
||||
);
|
||||
|
||||
case tt.bigint:
|
||||
return this.parseLiteral(
|
||||
this.state.value,
|
||||
"BigIntLiteralTypeAnnotation",
|
||||
);
|
||||
|
||||
case tt._void:
|
||||
this.next();
|
||||
return this.finishNode(node, "VoidTypeAnnotation");
|
||||
|
||||
Reference in New Issue
Block a user