Ignore:
Timestamp:
Feb 10, 2015, 11:01:41 AM (10 years ago)
Author:
[email protected]
Message:

Parser::parseVarDeclarationList gets the wrong JSToken for the last identifier
https://bugs.webkit.org/show_bug.cgi?id=141272

Reviewed by Oliver Hunt.

This patch fixes a bug where the wrong text location would be
assigned to a variable declaration inside a ForIn/ForOf loop.
It also fixes a bug in the type profiler where the type profiler
emits the wrong text offset for a ForIn loop's variable declarator
when it's not a pattern node.

  • bytecompiler/NodesCodegen.cpp:

(JSC::ForInNode::emitLoopHeader):

  • parser/Parser.cpp:

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

  • tests/typeProfiler/loop.js:

(testForIn):
(testForOf):

File:
1 edited

Legend:

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

    r179682 r179873  
    453453    TreeExpression tail = 0;
    454454    const Identifier* lastIdent;
     455    JSToken lastIdentToken;
    455456    do {
    456457        lastIdent = 0;
     
    467468            const Identifier* name = m_token.m_data.ident;
    468469            lastIdent = name;
     470            lastIdentToken = m_token;
    469471            next();
    470472            hasInitializer = match(EQUAL);
     
    507509    } while (match(COMMA));
    508510    if (lastIdent)
    509         lastPattern = createBindingPattern(context, DeconstructToVariables, *lastIdent, 0, m_token);
     511        lastPattern = createBindingPattern(context, DeconstructToVariables, *lastIdent, 0, lastIdentToken);
    510512    return head;
    511513}
Note: See TracChangeset for help on using the changeset viewer.