Changeset 282968 in webkit
- Timestamp:
- Sep 23, 2021 10:24:52 AM (10 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/private-in.js (modified) (2 diffs)
-
JSTests/test262/expectations.yaml (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/parser/Parser.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r282925 r282968 1 2021-09-23 Ross Kirsling <ross.kirsling@sony.com> 2 3 [JSC] Handle syntactic production for `#x in expr` correctly 4 https://bugs.webkit.org/show_bug.cgi?id=230668 5 6 Reviewed by Yusuke Suzuki. 7 8 * stress/private-in.js: Add tests. 9 * test262/expectations.yaml: Mark two test cases as passing. 10 1 11 2021-09-22 Yusuke Suzuki <ysuzuki@apple.com> 2 12 -
trunk/JSTests/stress/private-in.js
r281429 r282968 1 1 function assert(b) { 2 2 if (!b) throw new Error; 3 } 4 5 function shouldNotThrow(script) { 6 eval(script); 7 } 8 9 function shouldThrowSyntaxError(script) { 10 let error; 11 try { 12 eval(script); 13 } catch (e) { 14 error = e; 15 } 16 17 if (!(error instanceof SyntaxError)) 18 throw new Error('Expected SyntaxError!'); 3 19 } 4 20 … … 60 76 for (let i = 0; i < 10000; i++) 61 77 test(); 78 79 shouldNotThrow(() => { class C { #x; f() { 0 == #x in {}; } } }); 80 shouldNotThrow(() => { class C { #x; f() { 0 != #x in {}; } } }); 81 shouldNotThrow(() => { class C { #x; f() { 0 === #x in {}; } } }); 82 shouldNotThrow(() => { class C { #x; f() { 0 !== #x in {}; } } }); 83 shouldThrowSyntaxError('class C { #x; f() { 0 < #x in {}; } }'); 84 shouldThrowSyntaxError('class C { #x; f() { 0 > #x in {}; } }'); 85 shouldThrowSyntaxError('class C { #x; f() { 0 <= #x in {}; } }'); 86 shouldThrowSyntaxError('class C { #x; f() { 0 >= #x in {}; } }'); 87 shouldThrowSyntaxError('class C { #x; f() { 0 instanceof #x in {}; } }'); 88 shouldThrowSyntaxError('class C { #x; f() { 0 in #x in {}; } }'); -
trunk/JSTests/test262/expectations.yaml
r282925 r282968 1596 1596 test/language/expressions/generators/scope-param-rest-elem-var-open.js: 1597 1597 default: 'Test262Error: Expected SameValue(«outside», «inside») to be true' 1598 test/language/expressions/in/private-field-in-nested.js:1599 default: 'Test262: This statement should not be evaluated.'1600 strict mode: 'Test262: This statement should not be evaluated.'1601 1598 test/language/expressions/instanceof/prototype-getter-with-primitive.js: 1602 1599 default: "Test262Error: getter for 'prototype' called" -
trunk/Source/JavaScriptCore/ChangeLog
r282950 r282968 1 2021-09-23 Ross Kirsling <ross.kirsling@sony.com> 2 3 [JSC] Handle syntactic production for `#x in expr` correctly 4 https://bugs.webkit.org/show_bug.cgi?id=230668 5 6 Reviewed by Yusuke Suzuki. 7 8 The production for `#x in expr` is easy to get wrong. 9 10 RelationalExpression[In, Yield, Await] : 11 ShiftExpression[?Yield, ?Await] 12 RelationalExpression[?In, ?Yield, ?Await] < ShiftExpression[?Yield, ?Await] 13 RelationalExpression[?In, ?Yield, ?Await] > ShiftExpression[?Yield, ?Await] 14 RelationalExpression[?In, ?Yield, ?Await] <= ShiftExpression[?Yield, ?Await] 15 RelationalExpression[?In, ?Yield, ?Await] >= ShiftExpression[?Yield, ?Await] 16 RelationalExpression[?In, ?Yield, ?Await] instanceof ShiftExpression[?Yield, ?Await] 17 [+In] RelationalExpression[+In, ?Yield, ?Await] in ShiftExpression[?Yield, ?Await] 18 [+In] PrivateIdentifier in ShiftExpression[?Yield, ?Await] 19 20 We were ensuring that a standalone private name `#x` is always followed by operator `in`; 21 this patch further ensures that that particular `in` can't have its LHS misparsed as a RelationalExpression. 22 23 * parser/Parser.cpp: 24 (JSC::Parser<LexerType>::parseBinaryExpression): 25 Verify the precedence of the topmost operator on the stack (if any) when parsing standalone `#x`. 26 1 27 2021-09-22 Mikhail R. Gadelha <mikhail@igalia.com> 2 28 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r281429 r282968 4239 4239 bool hasCoalesceOperator = false; 4240 4240 4241 int previousOperator = 0; 4241 4242 while (true) { 4242 4243 JSTextPosition exprStart = tokenStartPosition(); … … 4251 4252 m_seenPrivateNameUseInNonReparsingFunctionMode = true; 4252 4253 next(); 4253 semanticFailIfTrue(m_token.m_type != INTOKEN , "Bare private name can only be used as the left-hand side of an `in` expression");4254 semanticFailIfTrue(m_token.m_type != INTOKEN || previousOperator >= INTOKEN, "Bare private name can only be used as the left-hand side of an `in` expression"); 4254 4255 current = context.createPrivateIdentifierNode(location, *ident); 4255 4256 } else … … 4308 4309 } 4309 4310 context.operatorStackAppend(operatorStackDepth, operatorToken, precedence); 4311 previousOperator = operatorToken; 4310 4312 } 4311 4313 while (operatorStackDepth) {
Note: See TracChangeset
for help on using the changeset viewer.