1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

LibJS: Disallow NumericLiteral immediately followed by Identifier

From the spec: https://tc39.es/ecma262/#sec-literals-numeric-literals

The SourceCharacter immediately following a NumericLiteral must not be
an IdentifierStart or DecimalDigit.

For example: 3in is an error and not the two input elements 3 and in.
This commit is contained in:
Linus Groh 2020-10-22 22:18:31 +01:00 committed by Andreas Kling
parent 80bb22788f
commit f8ae6fa713
2 changed files with 4 additions and 0 deletions

View file

@ -46,4 +46,6 @@ test("invalid numeric literals", () => {
expect("0b").not.toEval();
expect("0o").not.toEval();
expect("'use strict'; 0755").not.toEval();
expect("1in[]").not.toEval();
expect("2instanceof foo").not.toEval();
});