Skip to content

Commit 743c16e

Browse files
JohnLuck77copybara-github
authored andcommitted
Record bigint feature use from parser
PiperOrigin-RevId: 326120519
1 parent b2e8d2d commit 743c16e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/com/google/javascript/jscomp/parsing/parser/Parser.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,6 +2395,10 @@ private LiteralExpressionTree parseLiteralExpression() {
23952395
recordFeatureUsed(Feature.NUMERIC_SEPARATOR);
23962396
}
23972397

2398+
if (literal.type == TokenType.BIGINT) {
2399+
recordFeatureUsed(Feature.BIGINT);
2400+
}
2401+
23982402
return new LiteralExpressionTree(getTreeLocation(start), literal);
23992403
}
24002404

test/com/google/javascript/jscomp/parsing/ParserTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,6 +3993,12 @@ public void testBigIntLiteralWarning() {
39933993
"This language feature is only supported for ECMASCRIPT_2020 mode or better: bigint");
39943994
}
39953995

3996+
@Test
3997+
public void testBigIntFeatureRecorded() {
3998+
parse("1n;");
3999+
expectFeatures(Feature.BIGINT);
4000+
}
4001+
39964002
@Test
39974003
public void testBigIntLiteralInCall() {
39984004
parse("alert(1n)");

0 commit comments

Comments
 (0)