Changeset 266318 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Aug 28, 2020, 7:26:40 PM (5 years ago)
Author:
[email protected]
Message:

[JSC] new import.meta() is acceptable
https://bugs.webkit.org/show_bug.cgi?id=215915

Reviewed by Ross Kirsling.

JSTests:

  • stress/modules-syntax-error.js:
  • stress/modules-syntax.js:
  • test262/expectations.yaml:

Source/JavaScriptCore:

new import.meta() is valid in terms of syntax while it throws runtime error.
We should accept this code, while new import() is not correct syntax.

  • parser/Parser.cpp:

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

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r266264 r266318  
     12020-08-28  Yusuke Suzuki  <[email protected]>
     2
     3        [JSC] `new import.meta()` is acceptable
     4        https://bugs.webkit.org/show_bug.cgi?id=215915
     5
     6        Reviewed by Ross Kirsling.
     7
     8        `new import.meta()` is valid in terms of syntax while it throws runtime error.
     9        We should accept this code, while `new import()` is not correct syntax.
     10
     11        * parser/Parser.cpp:
     12        (JSC::Parser<LexerType>::parseMemberExpression):
     13
    1142020-08-27  Alexey Shvayka  <[email protected]>
    215
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r266264 r266318  
    48444844    bool previousBaseWasSuper = false;
    48454845    bool baseIsImport = match(IMPORT);
    4846     semanticFailIfTrue((baseIsSuper || baseIsImport) && newCount, "Cannot use new with ", getToken());
     4846    semanticFailIfTrue(baseIsSuper && newCount, "Cannot use new with ", getToken());
    48474847
    48484848    bool baseIsNewTarget = false;
     
    49044904            }
    49054905        } else {
     4906            semanticFailIfTrue(newCount, "Cannot use new with import");
    49064907            consumeOrFail(OPENPAREN, "import call expects exactly one argument");
    49074908            TreeExpression expr = parseAssignmentExpression(context);
Note: See TracChangeset for help on using the changeset viewer.