Changeset 242193 in webkit


Ignore:
Timestamp:
Feb 27, 2019 10:44:15 PM (5 years ago)
Author:
mark.lam@apple.com
Message:

The parser is failing to record the token location of new in new.target.
https://bugs.webkit.org/show_bug.cgi?id=195127
<rdar://problem/39645578>

Reviewed by Yusuke Suzuki.

JSTests:

  • stress/parser-should-record-token-location-of-new-dot-target.js: Added.

Source/JavaScriptCore:

Also adjust the token location for the following to be as shown:

new.target

super

import.meta

  • parser/Parser.cpp:

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

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r242192 r242193  
     12019-02-27  Mark Lam  <mark.lam@apple.com>
     2
     3        The parser is failing to record the token location of new in new.target.
     4        https://bugs.webkit.org/show_bug.cgi?id=195127
     5        <rdar://problem/39645578>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        * stress/parser-should-record-token-location-of-new-dot-target.js: Added.
     10
    1112019-02-27  Yusuke Suzuki  <ysuzuki@apple.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r242192 r242193  
     12019-02-27  Mark Lam  <mark.lam@apple.com>
     2
     3        The parser is failing to record the token location of new in new.target.
     4        https://bugs.webkit.org/show_bug.cgi?id=195127
     5        <rdar://problem/39645578>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        Also adjust the token location for the following to be as shown:
     10
     11            new.target
     12            ^
     13            super
     14            ^
     15            import.meta
     16            ^
     17
     18        * parser/Parser.cpp:
     19        (JSC::Parser<LexerType>::parseMemberExpression):
     20
    1212019-02-27  Yusuke Suzuki  <ysuzuki@apple.com>
    222
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r241201 r242193  
    22 *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2003, 2006-2010, 2013, 2016 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2003-2019 Apple Inc. All rights reserved.
    55 *
    66 *  This library is free software; you can redistribute it and/or
     
    46754675    int newCount = 0;
    46764676    JSTokenLocation startLocation = tokenLocation();
    4677     JSTokenLocation location;
     4677    JSTokenLocation lastNewTokenLocation;
    46784678    while (match(NEW)) {
     4679        lastNewTokenLocation = tokenLocation();
    46794680        next();
    46804681        newCount++;
    46814682    }
     4683    JSTokenLocation location = tokenLocation();
    46824684
    46834685    bool baseIsSuper = match(SUPER);
     
    46974699                currentScope()->setInnerArrowFunctionUsesNewTarget();
    46984700            }
    4699             base = context.createNewTargetExpr(location);
     4701            ASSERT(lastNewTokenLocation.line);
     4702            base = context.createNewTargetExpr(lastNewTokenLocation);
    47004703            newCount--;
    47014704            next();
     
    47314734            if (matchContextualKeyword(m_vm->propertyNames->builtinNames().metaPublicName())) {
    47324735                semanticFailIfFalse(m_scriptMode == JSParserScriptMode::Module, "import.meta is only valid inside modules");
    4733 
    4734                 JSTokenLocation location(tokenLocation());
    47354736                base = context.createImportMetaExpr(location, createResolveAndUseVariable(context, &m_vm->propertyNames->metaPrivateName, false, expressionStart, location));
    47364737                next();
Note: See TracChangeset for help on using the changeset viewer.