Changeset 223175 in webkit
- Timestamp:
- Oct 11, 2017 5:59:36 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r223125 r223175 1 2017-10-11 Caio Lima <ticaiolima@gmail.com> 2 3 Object properties are undefined in super.call() but not in this.call() 4 https://bugs.webkit.org/show_bug.cgi?id=177230 5 6 Reviewed by Saam Barati. 7 8 * stress/super-call-function-subclass.js: Added. 9 (assert): 10 (A.prototype.t): 11 (A): 12 * stress/super-dot-call-and-apply.js: Added. 13 (assert): 14 (A): 15 (A.prototype.call): 16 (A.prototype.apply): 17 (B.prototype.testSuper): 18 (B): 19 (const.obj.new.B.string_appeared_here.obj.testSuper.C): 20 (D.prototype.testSuper): 21 (D): 22 1 23 2017-10-10 Saam Barati <sbarati@apple.com> 2 24 -
trunk/Source/JavaScriptCore/ChangeLog
r223173 r223175 1 2017-10-11 Caio Lima <ticaiolima@gmail.com> 2 3 Object properties are undefined in super.call() but not in this.call() 4 https://bugs.webkit.org/show_bug.cgi?id=177230 5 6 Reviewed by Saam Barati. 7 8 Bytecode generation for "super.call(...)" or "super.apply(...)" 9 shouldn't be considered as CallFunctionCallDotNode or 10 ApplyFunctionCallDotNode because they should be considered as common 11 super property access as any other function. According to spec[1], 12 "super" is not refering to parent constructor. 13 14 [1] - https://tc39.github.io/ecma262/#sec-super-keyword-runtime-semantics-evaluation 15 16 * parser/ASTBuilder.h: 17 (JSC::ASTBuilder::makeFunctionCallNode): 18 * parser/Parser.cpp: 19 (JSC::Parser<LexerType>::parseMemberExpression): 20 * parser/SyntaxChecker.h: 21 (JSC::SyntaxChecker::makeFunctionCallNode): 22 1 23 2017-10-11 Yusuke Suzuki <utatane.tea@gmail.com> 2 24 -
trunk/Source/JavaScriptCore/parser/ASTBuilder.h
r221358 r223175 130 130 131 131 ExpressionNode* makeBinaryNode(const JSTokenLocation&, int token, std::pair<ExpressionNode*, BinaryOpInfo>, std::pair<ExpressionNode*, BinaryOpInfo>); 132 ExpressionNode* makeFunctionCallNode(const JSTokenLocation&, ExpressionNode* func, ArgumentsNode* args, const JSTextPosition& divotStart, const JSTextPosition& divot, const JSTextPosition& divotEnd, size_t callOrApplyChildDepth);132 ExpressionNode* makeFunctionCallNode(const JSTokenLocation&, ExpressionNode* func, bool previousBaseWasSuper, ArgumentsNode* args, const JSTextPosition& divotStart, const JSTextPosition& divot, const JSTextPosition& divotEnd, size_t callOrApplyChildDepth); 133 133 134 134 JSC::SourceElements* createSourceElements() { return new (m_parserArena) JSC::SourceElements(); } … … 1318 1318 } 1319 1319 1320 ExpressionNode* ASTBuilder::makeFunctionCallNode(const JSTokenLocation& location, ExpressionNode* func, ArgumentsNode* args, const JSTextPosition& divotStart, const JSTextPosition& divot, const JSTextPosition& divotEnd, size_t callOrApplyChildDepth)1320 ExpressionNode* ASTBuilder::makeFunctionCallNode(const JSTokenLocation& location, ExpressionNode* func, bool previousBaseWasSuper, ArgumentsNode* args, const JSTextPosition& divotStart, const JSTextPosition& divot, const JSTextPosition& divotEnd, size_t callOrApplyChildDepth) 1321 1321 { 1322 1322 ASSERT(divot.offset >= divot.lineStartOffset); … … 1349 1349 DotAccessorNode* dot = static_cast<DotAccessorNode*>(func); 1350 1350 FunctionCallDotNode* node; 1351 if ( dot->identifier() == m_vm->propertyNames->builtinNames().callPublicName() || dot->identifier() == m_vm->propertyNames->builtinNames().callPrivateName())1351 if (!previousBaseWasSuper && (dot->identifier() == m_vm->propertyNames->builtinNames().callPublicName() || dot->identifier() == m_vm->propertyNames->builtinNames().callPrivateName())) 1352 1352 node = new (m_parserArena) CallFunctionCallDotNode(location, dot->base(), dot->identifier(), args, divot, divotStart, divotEnd, callOrApplyChildDepth); 1353 else if ( dot->identifier() == m_vm->propertyNames->builtinNames().applyPublicName() || dot->identifier() == m_vm->propertyNames->builtinNames().applyPrivateName())1353 else if (!previousBaseWasSuper && (dot->identifier() == m_vm->propertyNames->builtinNames().applyPublicName() || dot->identifier() == m_vm->propertyNames->builtinNames().applyPrivateName())) 1354 1354 node = new (m_parserArena) ApplyFunctionCallDotNode(location, dot->base(), dot->identifier(), args, divot, divotStart, divotEnd, callOrApplyChildDepth); 1355 1355 else -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r223124 r223175 4648 4648 4649 4649 bool baseIsSuper = match(SUPER); 4650 bool previousBaseWasSuper = false; 4650 4651 bool baseIsImport = match(IMPORT); 4651 4652 semanticFailIfTrue((baseIsSuper || baseIsImport) && newCount, "Cannot use new with ", getToken()); … … 4789 4790 functionScope->setInnerArrowFunctionUsesSuperCall(); 4790 4791 } 4791 base = context.makeFunctionCallNode(startLocation, base, arguments, expressionStart,4792 base = context.makeFunctionCallNode(startLocation, base, previousBaseWasSuper, arguments, expressionStart, 4792 4793 expressionEnd, lastTokenEndPosition(), callOrApplyDepthScope ? callOrApplyDepthScope->distanceToInnermostChild() : 0); 4793 4794 } … … 4819 4820 goto endMemberExpression; 4820 4821 } 4822 previousBaseWasSuper = baseIsSuper; 4821 4823 baseIsSuper = false; 4822 4824 } -
trunk/Source/JavaScriptCore/parser/SyntaxChecker.h
r221358 r223175 144 144 145 145 int createSourceElements() { return SourceElementsResult; } 146 ExpressionType makeFunctionCallNode(const JSTokenLocation&, int, int, int, int, int, size_t) { return CallExpr; }146 ExpressionType makeFunctionCallNode(const JSTokenLocation&, int, bool, int, int, int, int, size_t) { return CallExpr; } 147 147 ExpressionType createCommaExpr(const JSTokenLocation&, ExpressionType expr) { return expr; } 148 148 ExpressionType appendToCommaExpr(const JSTokenLocation&, ExpressionType& head, ExpressionType, ExpressionType next) { head = next; return next; }
Note: See TracChangeset
for help on using the changeset viewer.