Changeset 291577 in webkit
- Timestamp:
- Mar 21, 2022 12:57:19 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/class-field-initializer-should-have-variable-scope.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/parser/Parser.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/parser/Parser.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r290981 r291577 1 2022-03-21 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] ReferenceError when using extra parens in class fields 4 https://bugs.webkit.org/show_bug.cgi?id=236843 5 6 Reviewed by Saam Barati. 7 8 * stress/class-field-initializer-should-have-variable-scope.js: Added. 9 (shouldBe): 10 (test1.const.a.x.B): 11 (test1): 12 (test2.const.a.x.B): 13 (test2): 14 (test3.B.prototype.b): 15 (test3.B): 16 (test3): 17 1 18 2022-03-08 Mark Lam <mark.lam@apple.com> 2 19 -
trunk/Source/JavaScriptCore/ChangeLog
r291559 r291577 1 2022-03-21 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] ReferenceError when using extra parens in class fields 4 https://bugs.webkit.org/show_bug.cgi?id=236843 5 6 Reviewed by Saam Barati. 7 8 class field initializer should create its own used-variables set 9 to capture used variables separately from the other variables since 10 it becomes independent CodeBlock internally later. The current code 11 was wrong since, 12 13 1. Incorrectly using the current set of class-scope. 14 2. Incorrectly marking only the last set while parseAssignmentExpression can create a new set inside it. 15 16 * parser/Parser.cpp: 17 (JSC::Parser<LexerType>::parseClass): 18 * parser/Parser.h: 19 (JSC::Scope::markLastUsedVariablesSetAsCaptured): 20 1 21 2022-03-21 Jonathan Bedard <jbedard@apple.com> 2 22 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r290575 r291577 3111 3111 TreeExpression initializer = 0; 3112 3112 if (consume(EQUAL)) { 3113 size_t usedVariablesSize = currentScope()->currentUsedVariablesSize(); 3114 currentScope()->pushUsedVariableSet(); 3113 3115 SetForScope overrideParsingClassFieldInitializer(m_parserState.isParsingClassFieldInitializer, true); 3114 3116 classScope->setExpectedSuperBinding(SuperBinding::Needed); … … 3116 3118 classScope->setExpectedSuperBinding(SuperBinding::NotNeeded); 3117 3119 failIfFalse(initializer, "Cannot parse initializer for class field"); 3118 classScope->markLastUsedVariablesSetAsCaptured( );3120 classScope->markLastUsedVariablesSetAsCaptured(usedVariablesSize); 3119 3121 } 3120 3122 failIfFalse(autoSemiColon(), "Expected a ';' following a class field"); -
trunk/Source/JavaScriptCore/parser/Parser.h
r288473 r291577 664 664 } 665 665 666 void markLastUsedVariablesSetAsCaptured() 667 { 668 for (UniquedStringImpl* impl : m_usedVariables.last()) 669 m_closedVariableCandidates.add(impl); 666 void markLastUsedVariablesSetAsCaptured(unsigned from) 667 { 668 for (unsigned index = from; index < m_usedVariables.size(); ++index) { 669 for (UniquedStringImpl* impl : m_usedVariables[index]) 670 m_closedVariableCandidates.add(impl); 671 } 670 672 } 671 673
Note: See TracChangeset
for help on using the changeset viewer.