Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigInt type for Flow #10091

Merged
merged 4 commits into from Jul 3, 2019
Merged
Changes from 3 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -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,16 +1355,25 @@ 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"`);

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Jun 27, 2019

Member
Suggested change
this.unexpected(null, `Unexpected token, expected "number"`);
this.unexpected(null, `Unexpected token, expected "number" or "bigint"`);
}

this.unexpected();
@@ -1371,6 +1383,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");
@@ -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
@@ -27,22 +26,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,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.