BigInt type for Flow (#10091)
* flow BigIntLiteralTypeAnnotation * numericSeparator for flow test plugins * fix flow tuple * fix code review
This commit is contained in:
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");
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \"number\" (1:8)"
|
||||
"throws": "Unexpected token, expected \"number\" or \"bigint\" (1:8)"
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
# Entries should be removed incrementally as the babel parser is improved.
|
||||
|
||||
JSX_invalid/migrated_0000.js
|
||||
arrow_function/tuple_return_type.js
|
||||
arrow_function_invalid/migrated_0002.js
|
||||
async_await/migrated_0007.js
|
||||
async_await/migrated_0020.js
|
||||
@ -26,22 +25,7 @@ private_class_properties/getter_duplicate.js
|
||||
private_class_properties/setter_and_field.js
|
||||
private_class_properties/setter_duplicate.js
|
||||
types/member/reserved_words.js
|
||||
types/bigint_literal/migrated_0000.js
|
||||
types/bigint_literal/migrated_0002.js
|
||||
types/bigint_literal/migrated_0003.js
|
||||
types/bigint_literal/migrated_0004.js
|
||||
types/bigint_literal/migrated_0005.js
|
||||
types/bigint_literal/migrated_0006.js
|
||||
types/bigint_literal/migrated_0007.js
|
||||
types/bigint_literal/migrated_0008.js
|
||||
types/bigint_literal/migrated_0009.js
|
||||
class_method_kinds/polymorphic_getter.js
|
||||
numbers/underscored_bin.js
|
||||
numbers/underscored_float.js
|
||||
numbers/underscored_float_whole.js
|
||||
numbers/underscored_hex.js
|
||||
numbers/underscored_number.js
|
||||
numbers/underscored_oct.js
|
||||
ES6/modules/migrated_0020.js
|
||||
export_import_reserved_words/migrated_0003.js
|
||||
export_statements/export_trailing_comma.js
|
||||
|
||||
@ -117,6 +117,7 @@ const options = {
|
||||
"classPrivateProperties",
|
||||
"classPrivateMethods",
|
||||
"bigInt",
|
||||
"numericSeparator",
|
||||
],
|
||||
sourceType: "module",
|
||||
ranges: true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user