Changeset 181121 in webkit


Ignore:
Timestamp:
Mar 5, 2015 5:16:25 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Source/JavaScriptCore:
ES6: Object Literal Extensions - Shorthand Properties (Identifiers)
https://bugs.webkit.org/show_bug.cgi?id=142353

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2015-03-05
Reviewed by Geoffrey Garen.

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseProperty):
Parsing an identifier property followed by a comma or end brace treat
as a shorthand property and create a property that has the same
property name as the identifier name and value of a variable with that
identifier. Otherwise, fall through to getter/setter parsing.

LayoutTests:
Web Inspector: Follow-up fixes to ObjectTreeBaseTreeElement
https://bugs.webkit.org/show_bug.cgi?id=142367

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2015-03-05
Reviewed by Geoffrey Garen.

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

(equivalent):
(testShorthandConstructionEquivalent):
(testShorthandConstructionNotEquivalent):
Tests specifically for new literal construction with shorthands.

  • sputnik/Conformance/12_Statement/12.1_Block/S12.1_A4_T1-expected.txt:
  • sputnik/Conformance/12_Statement/12.1_Block/S12.1_A4_T2-expected.txt:
  • sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A15-expected.txt:

These tests use object literal shorthand construction syntax and expected
failures. The tests now fail differently, so just rebase their results.

Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r181118 r181121  
     12015-03-05  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Follow-up fixes to ObjectTreeBaseTreeElement
     4        https://bugs.webkit.org/show_bug.cgi?id=142367
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * js/object-literal-shorthand-construction-expected.txt: Added.
     9        * js/object-literal-shorthand-construction.html: Added.
     10        * js/script-tests/object-literal-shorthand-construction.js: Added.
     11        (equivalent):
     12        (testShorthandConstructionEquivalent):
     13        (testShorthandConstructionNotEquivalent):
     14        Tests specifically for new literal construction with shorthands.
     15
     16        * sputnik/Conformance/12_Statement/12.1_Block/S12.1_A4_T1-expected.txt:
     17        * sputnik/Conformance/12_Statement/12.1_Block/S12.1_A4_T2-expected.txt:
     18        * sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A15-expected.txt:
     19        These tests use object literal shorthand construction syntax and expected
     20        failures. The tests now fail differently, so just rebase their results.
     21
    1222015-03-05  Timothy Horton  <timothy_horton@apple.com>
    223
  • trunk/LayoutTests/sputnik/Conformance/12_Statement/12.1_Block/S12.1_A4_T1-expected.txt

    r158014 r181121  
    1 CONSOLE MESSAGE: line 80: SyntaxError: Unexpected token '}'. Expected a ':' following the property name '__func'.
    21S12.1_A4_T1
    32
    4 PASS Expected parsing failure
     3PASS TypeError: Object is not a function (evaluating '{__func}()')
    54
    65TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/12_Statement/12.1_Block/S12.1_A4_T2-expected.txt

    r158014 r181121  
    1 CONSOLE MESSAGE: line 80: SyntaxError: Unexpected token '}'. Expected a ':' following the property name 'x'.
    21S12.1_A4_T2
    32
    4 PASS Expected parsing failure
     3FAIL No error detected
    54
    65TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/12_Statement/12.6_Iteration_Statements/12.6.4_The_for_in_Statement/S12.6.4_A15-expected.txt

    r158014 r181121  
    1 CONSOLE MESSAGE: line 79: SyntaxError: Unexpected token '}'. Expected a ':' following the property name '__arr'.
    21S12.6.4_A15
    32
    4 PASS Expected parsing failure
     3FAIL No error detected
    54
    65TEST COMPLETE
  • trunk/Source/JavaScriptCore/ChangeLog

    r181106 r181121  
     12015-03-05  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        ES6: Object Literal Extensions - Shorthand Properties (Identifiers)
     4        https://bugs.webkit.org/show_bug.cgi?id=142353
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * parser/Parser.cpp:
     9        (JSC::Parser<LexerType>::parseProperty):
     10        Parsing an identifier property followed by a comma or end brace treat
     11        as a shorthand property and create a property that has the same
     12        property name as the identifier name and value of a variable with that
     13        identifier. Otherwise, fall through to getter/setter parsing.
     14
    1152015-03-05  Brent Fulgham  <bfulgham@apple.com>
    216
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r180813 r181121  
    18701870template <class TreeBuilder> TreeExpression Parser<LexerType>::parseBinaryExpression(TreeBuilder& context)
    18711871{
    1872    
    18731872    int operandStackDepth = 0;
    18741873    int operatorStackDepth = 0;
     
    19291928        else
    19301929            nextExpectIdentifier(LexerFlagsIgnoreReservedWords | TreeBuilder::DontBuildKeywords);
    1931        
     1930
    19321931        if (match(COLON)) {
    19331932            next();
     
    19371936            return context.createProperty(ident, node, PropertyNode::Constant, complete);
    19381937        }
     1938
    19391939        failIfFalse(wasIdent, "Expected an identifier as property name");
     1940
     1941        if (match(COMMA) || match(CLOSEBRACE)) {
     1942            JSTextPosition start = tokenStartPosition();
     1943            JSTokenLocation location(tokenLocation());
     1944            currentScope()->useVariable(ident, m_vm->propertyNames->eval == *ident);
     1945            TreeExpression node = context.createResolve(location, ident, start);
     1946            return context.createProperty(ident, node, PropertyNode::Constant, complete);
     1947        }
     1948
    19401949        PropertyNode::Type type;
    19411950        if (*ident == m_vm->propertyNames->get)
Note: See TracChangeset for help on using the changeset viewer.