Changeset 259536 in webkit
- Timestamp:
- Apr 4, 2020, 12:36:31 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/mozilla/ecma/Array/15.4.5.1-1.js (modified) (2 diffs)
-
JSTests/mozilla/ecma/LexicalConventions/7.7.4.js (modified) (1 diff)
-
JSTests/test262/expectations.yaml (modified) (1 diff)
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/js/script-tests/unicode-escape-sequences.js (modified) (2 diffs)
-
LayoutTests/js/unicode-escape-sequences-expected.txt (modified) (2 diffs)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/parser/Lexer.cpp (modified) (4 diffs)
-
Source/JavaScriptCore/parser/Lexer.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r259535 r259536 1 2020-04-04 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 '\u' should throw an early SyntaxError exception, but instead evaluates to 'u' 4 https://bugs.webkit.org/show_bug.cgi?id=198790 5 6 Reviewed by Yusuke Suzuki. 7 8 * mozilla/ecma/Array/15.4.5.1-1.js: 9 * mozilla/ecma/LexicalConventions/7.7.4.js: 10 * test262/expectations.yaml: Mark 4 test cases as passing. 11 1 12 2020-04-04 Yusuke Suzuki <ysuzuki@apple.com> 2 13 -
trunk/JSTests/mozilla/ecma/Array/15.4.5.1-1.js
r108841 r259536 105 105 106 106 for ( var i = 0X0020, TEST_STRING = "var A = new Array( " ; i < 0x00ff; i++ ) { 107 if ( i === 0x58 || i === 0x78 ) // x or X - skip testing invalid hexescapes.107 if ( i === 0x58 || i === 0x78 || i === 0x75 ) // skip testing invalid hex (x & X) and Unicode (u) escapes. 108 108 continue; 109 109 TEST_STRING += "\'\\"+ String.fromCharCode( i ) +"\'"; … … 115 115 } 116 116 117 var LENGTH = 0x00ff - 0x0020 - 2; // x & X117 var LENGTH = 0x00ff - 0x0020 - 3; // x & X & u 118 118 119 119 array[item++] = new TestCase( SECTION, -
trunk/JSTests/mozilla/ecma/LexicalConventions/7.7.4.js
r108841 r259536 191 191 array[item++] = new TestCase( SECTION, "\\q", "q", "\q" ); 192 192 array[item++] = new TestCase( SECTION, "\\s", "s", "\s" ); 193 array[item++] = new TestCase( SECTION, "\\u", "u", "\u" ); 193 // Invalid Unicode escapes are syntax error; these are covered in the test262 suite. 194 // array[item++] = new TestCase( SECTION, "\\u", "u", "\u" ); 194 195 195 196 array[item++] = new TestCase( SECTION, "\\w", "w", "\w" ); -
trunk/JSTests/test262/expectations.yaml
r259529 r259536 3226 3226 default: 'Test262Error: Expected SameValue(«�», «null») to be true' 3227 3227 strict mode: 'Test262Error: Expected SameValue(«�», «null») to be true' 3228 test/language/literals/string/unicode-escape-no-hex-err-double.js:3229 default: 'Test262: This statement should not be evaluated.'3230 strict mode: 'Test262: This statement should not be evaluated.'3231 test/language/literals/string/unicode-escape-no-hex-err-single.js:3232 default: 'Test262: This statement should not be evaluated.'3233 strict mode: 'Test262: This statement should not be evaluated.'3234 3228 test/language/module-code/eval-rqstd-once.js: 3235 3229 module: "SyntaxError: Unexpected identifier 'as'. Expected 'from' before exported module name." -
trunk/LayoutTests/ChangeLog
r259532 r259536 1 2020-04-04 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 '\u' should throw an early SyntaxError exception, but instead evaluates to 'u' 4 https://bugs.webkit.org/show_bug.cgi?id=198790 5 6 Reviewed by Yusuke Suzuki. 7 8 * js/script-tests/unicode-escape-sequences.js: 9 * js/unicode-escape-sequences-expected.txt: 10 1 11 2020-04-04 Antti Koivisto <antti@apple.com> 2 12 -
trunk/LayoutTests/js/script-tests/unicode-escape-sequences.js
r258531 r259536 41 41 } 42 42 43 testStringUnicodeEscapeSequence("", "0075");44 43 testStringUnicodeEscapeSequence("{0}", "0000"); 45 44 testStringUnicodeEscapeSequence("{41}", "0041"); … … 63 62 testStringUnicodeEscapeSequence("{00000000000000000000000010ffff}", "DBFF,DFFF"); 64 63 64 testInvalidStringUnicodeEscapeSequence(""); 65 65 testInvalidStringUnicodeEscapeSequence("x"); 66 66 testInvalidStringUnicodeEscapeSequence("{"); -
trunk/LayoutTests/js/unicode-escape-sequences-expected.txt
r258531 r259536 4 4 5 5 6 PASS codeUnits("\u") is "0075"7 6 PASS codeUnits("\u{0}") is "0000" 8 7 PASS codeUnits("\u{41}") is "0041" … … 25 24 PASS codeUnits("\u{00000000000000000000000010FFFF}") is "DBFF,DFFF" 26 25 PASS codeUnits("\u{00000000000000000000000010ffff}") is "DBFF,DFFF" 26 PASS codeUnits("\u") threw exception SyntaxError: \u can only be followed by a Unicode character sequence. 27 27 PASS codeUnits("\ux") threw exception SyntaxError: \u can only be followed by a Unicode character sequence. 28 28 PASS codeUnits("\u{") threw exception SyntaxError: \u can only be followed by a Unicode character sequence. -
trunk/Source/JavaScriptCore/ChangeLog
r259481 r259536 1 2020-04-04 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 '\u' should throw an early SyntaxError exception, but instead evaluates to 'u' 4 https://bugs.webkit.org/show_bug.cgi?id=198790 5 6 Reviewed by Yusuke Suzuki. 7 8 This change removes special-case for '\u', invoking parseUnicodeEscape() right away, 9 aligning string literals with ES6 template literals. parseComplexEscape() method 10 signature is greatly simplified, JSC is aligned with V8 and SpiderMonkey. 11 12 Grammar: https://tc39.es/ecma262/#prod-UnicodeEscapeSequence 13 (Hex4Digits or '{' is required, otherwise parsing fails) 14 15 * parser/Lexer.cpp: 16 (JSC::Lexer<T>::parseComplexEscape): 17 (JSC::Lexer<T>::parseStringSlowCase): 18 (JSC::Lexer<T>::parseTemplateLiteral): 19 * parser/Lexer.h: 20 1 21 2020-04-03 Yusuke Suzuki <ysuzuki@apple.com> 2 22 -
trunk/Source/JavaScriptCore/parser/Lexer.cpp
r259096 r259536 1234 1234 1235 1235 template <typename T> 1236 template <bool shouldBuildStrings , LexerEscapeParseMode escapeParseMode> ALWAYS_INLINE auto Lexer<T>::parseComplexEscape(bool strictMode, T stringQuoteCharacter) -> StringParseResult1236 template <bool shouldBuildStrings> ALWAYS_INLINE auto Lexer<T>::parseComplexEscape(bool strictMode) -> StringParseResult 1237 1237 { 1238 1238 if (m_current == 'x') { … … 1263 1263 if (m_current == 'u') { 1264 1264 shift(); 1265 1266 if (escapeParseMode == LexerEscapeParseMode::String && m_current == stringQuoteCharacter) {1267 if (shouldBuildStrings)1268 record16('u');1269 return StringParsedSuccessfully;1270 }1271 1265 1272 1266 auto character = parseUnicodeEscape(); … … 1362 1356 shiftLineTerminator(); 1363 1357 else { 1364 StringParseResult result = parseComplexEscape<shouldBuildStrings , LexerEscapeParseMode::String>(strictMode, stringQuoteCharacter);1358 StringParseResult result = parseComplexEscape<shouldBuildStrings>(strictMode); 1365 1359 if (result != StringParsedSuccessfully) 1366 1360 return result; … … 1430 1424 } else { 1431 1425 bool strictMode = true; 1432 StringParseResult result = parseComplexEscape<true , LexerEscapeParseMode::Template>(strictMode, '`');1426 StringParseResult result = parseComplexEscape<true>(strictMode); 1433 1427 if (result != StringParsedSuccessfully) { 1434 1428 if (rawStringsBuildMode == RawStringsBuildMode::BuildRawStrings && result == StringCannotBeParsed) -
trunk/Source/JavaScriptCore/parser/Lexer.h
r258531 r259536 39 39 }; 40 40 41 enum class LexerEscapeParseMode { Template, String };42 43 41 struct ParsedUnicodeEscapeValue; 44 42 … … 177 175 178 176 179 template <bool shouldBuildStrings , LexerEscapeParseMode escapeParseMode> ALWAYS_INLINE StringParseResult parseComplexEscape(bool strictMode, T stringQuoteCharacter);177 template <bool shouldBuildStrings> ALWAYS_INLINE StringParseResult parseComplexEscape(bool strictMode); 180 178 ALWAYS_INLINE StringParseResult parseTemplateLiteral(JSTokenData*, RawStringsBuildMode); 181 179
Note:
See TracChangeset
for help on using the changeset viewer.