Ignore:
Timestamp:
Mar 14, 2018, 1:00:21 PM (7 years ago)
Author:
[email protected]
Message:

[JSC] fix order of evaluation for ClassDefinitionEvaluation
https://bugs.webkit.org/show_bug.cgi?id=183523

Reviewed by Keith Miller.

Computed property names need to be evaluated in source order during class
definition evaluation, as it's observable (and specified to work this way).

This change improves compatibility with Chromium.

JSTests:

  • stress/class_elements.js: Added.

(test):
(test.C.prototype.effect):
(test.C.effect):
(test.C.prototype.get effect):
(test.C.prototype.set effect):
(test.C):

Source/JavaScriptCore:

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::emitDefineClassElements):

  • bytecompiler/NodesCodegen.cpp:

(JSC::PropertyListNode::emitBytecode):
(JSC::ClassExprNode::emitBytecode):

  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createClassExpr):
(JSC::ASTBuilder::createGetterOrSetterProperty):
(JSC::ASTBuilder::createProperty):

  • parser/NodeConstructors.h:

(JSC::PropertyNode::PropertyNode):
(JSC::ClassExprNode::ClassExprNode):

  • parser/Nodes.cpp:

(JSC::PropertyListNode::hasStaticallyNamedProperty):

  • parser/Nodes.h:

(JSC::PropertyNode::isClassProperty const):
(JSC::PropertyNode::isStaticClassProperty const):
(JSC::PropertyNode::isInstanceClassProperty const):

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parseGetterSetter):

  • parser/Parser.h:
  • parser/SyntaxChecker.h:

(JSC::SyntaxChecker::createClassExpr):
(JSC::SyntaxChecker::createProperty):
(JSC::SyntaxChecker::createGetterOrSetterProperty):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Nodes.cpp

    r221622 r229608  
    249249    PropertyListNode* list = this;
    250250    while (list) {
    251         const Identifier* currentNodeName = list->m_node->name();
    252         if (currentNodeName && *currentNodeName == propName)
    253             return true;
     251        if (list->m_node->isStaticClassProperty()) {
     252            const Identifier* currentNodeName = list->m_node->name();
     253            if (currentNodeName && *currentNodeName == propName)
     254                return true;
     255        }
    254256        list = list->m_next;
    255257    }
Note: See TracChangeset for help on using the changeset viewer.