Ignore:
Timestamp:
Mar 6, 2015, 1:31:27 PM (10 years ago)
Author:
Joseph Pecoraro
Message:

proto shorthand property should not modify prototype in Object Literal construction
https://bugs.webkit.org/show_bug.cgi?id=142382

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

When parsing shorthand property syntax we know we will do a
put direct, even if the property name is proto. Pass that
information through to bytecode generation.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitDirectPutById):

  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/NodesCodegen.cpp:

(JSC::PropertyListNode::emitPutConstantProperty):

  • parser/ASTBuilder.h:

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

  • parser/NodeConstructors.h:

(JSC::PropertyNode::PropertyNode):

  • parser/Nodes.h:

(JSC::PropertyNode::putType):

  • parser/Parser.cpp:

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

  • parser/SyntaxChecker.h:

(JSC::SyntaxChecker::createProperty):

LayoutTests:

  • js/object-literal-shorthand-construction-expected.txt:
  • js/script-tests/object-literal-shorthand-construction.js:

Update test to cover the proto shorthand case which is
different from longhand case.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/SyntaxChecker.h

    r180813 r181179  
    176176    int createArgumentsList(const JSTokenLocation&, int) { return ArgumentsListResult; }
    177177    int createArgumentsList(const JSTokenLocation&, int, int) { return ArgumentsListResult; }
    178     Property createProperty(const Identifier* name, int, PropertyNode::Type type, bool complete)
     178    Property createProperty(const Identifier* name, int, PropertyNode::Type type, PropertyNode::PutType, bool complete)
    179179    {
    180180        if (!complete)
     
    183183        return Property(name, type);
    184184    }
    185     Property createProperty(VM* vm, ParserArena& parserArena, double name, int, PropertyNode::Type type, bool complete)
     185    Property createProperty(VM* vm, ParserArena& parserArena, double name, int, PropertyNode::Type type, PropertyNode::PutType, bool complete)
    186186    {
    187187        if (!complete)
     
    189189        return Property(&parserArena.identifierArena().makeNumericIdentifier(vm, name), type);
    190190    }
    191     Property createProperty(int, int, PropertyNode::Type type, bool)
     191    Property createProperty(int, int, PropertyNode::Type type, PropertyNode::PutType, bool)
    192192    {
    193193        return Property(type);
Note: See TracChangeset for help on using the changeset viewer.