Ignore:
Timestamp:
Nov 24, 2015, 5:43:14 PM (10 years ago)
Author:
[email protected]
Message:

[JSC] support Computed Property Names in destructuring Patterns
https://bugs.webkit.org/show_bug.cgi?id=151494

Patch by Caitlin Potter <[email protected]> on 2015-11-24
Reviewed by Saam Barati.

Add support for computed property names in destructuring BindingPatterns
and AssignmentPatterns.

Productions BindingProperty(1) and AssignmentProperty(2) allow for any valid
PropertName(3), including ComputedPropertyName(4)

1: http://tc39.github.io/ecma262/#prod-BindingProperty
2: http://tc39.github.io/ecma262/#prod-AssignmentProperty
3: http://tc39.github.io/ecma262/#prod-PropertyName
4: http://tc39.github.io/ecma262/#prod-ComputedPropertyName

  • bytecompiler/NodesCodegen.cpp:

(JSC::ObjectPatternNode::bindValue):

  • parser/ASTBuilder.h:

(JSC::ASTBuilder::appendObjectPatternEntry):

  • parser/Nodes.h:

(JSC::ObjectPatternNode::appendEntry):

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseDestructuringPattern):

  • parser/SyntaxChecker.h:

(JSC::SyntaxChecker::operatorStackPop):

  • tests/es6.yaml:
  • tests/es6/destructuring_assignment_computed_properties.js: Added.

(test):
(test.computeName):
(test.loadValue):
(test.out.get a):
(test.out.set a):
(test.out.get b):
(test.out.set b):
(test.out.get c):
(test.out.set c):
(test.get var):

File:
1 edited

Legend:

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

    r192671 r192768  
    852852        node->appendEntry(location, identifier, wasString, pattern, defaultValue);
    853853    }
    854    
     854
     855    void appendObjectPatternEntry(ObjectPattern node, const JSTokenLocation& location, ExpressionNode* propertyExpression, DestructuringPattern pattern, ExpressionNode* defaultValue)
     856    {
     857        node->appendEntry(location, propertyExpression, pattern, defaultValue);
     858    }
     859
    855860    BindingPattern createBindingLocation(const JSTokenLocation&, const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end, AssignmentContext context)
    856861    {
Note: See TracChangeset for help on using the changeset viewer.