Skip to content

Commit

Permalink
Syntax error if broken Unicode escape
Browse files Browse the repository at this point in the history
  • Loading branch information
tuchida committed Aug 24, 2023
1 parent 97c51f5 commit 495a74e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
4 changes: 4 additions & 0 deletions src/org/mozilla/javascript/TokenStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,10 @@ final int getToken() throws IOException {
c = getChar();
escapeVal = Kit.xDigitToInt(c, escapeVal);
if (escapeVal < 0) {
if (parser.compilerEnv.getLanguageVersion()
>= Context.VERSION_ES6) {
parser.reportError("msg.invalid.escape");
}
continue strLoop;
}
addToString(c);
Expand Down
13 changes: 1 addition & 12 deletions testsrc/test262.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5348,7 +5348,7 @@ language/line-terminators 4/41 (9.76%)
S7.3_A6_T3.js
S7.3_A6_T4.js

language/literals 107/434 (24.65%)
language/literals 96/434 (22.12%)
bigint/numeric-separators/numeric-separator-literal-nonoctal-08-err.js non-strict
bigint/numeric-separators/numeric-separator-literal-nonoctal-09-err.js non-strict
bigint/legacy-octal-like-invalid-00n.js non-strict
Expand Down Expand Up @@ -5390,17 +5390,6 @@ language/literals 107/434 (24.65%)
string/mongolian-vowel-separator-eval.js {unsupported: [u180e]}
string/S7.8.4_A4.3_T1.js strict
string/S7.8.4_A4.3_T2.js strict
string/S7.8.4_A7.1_T4.js
string/S7.8.4_A7.2_T1.js
string/S7.8.4_A7.2_T2.js
string/S7.8.4_A7.2_T3.js
string/S7.8.4_A7.2_T4.js
string/S7.8.4_A7.2_T5.js
string/S7.8.4_A7.2_T6.js
string/unicode-escape-nls-err-double.js
string/unicode-escape-nls-err-single.js
string/unicode-escape-no-hex-err-double.js
string/unicode-escape-no-hex-err-single.js

~language/module-code

Expand Down

0 comments on commit 495a74e

Please sign in to comment.