Changeset 248826 in webkit

Timestamp:
Aug 17, 2019, 7:20:07 PM (6 years ago)
Author:
Ross Kirsling
Message:

[ESNext] Support hashbang.
https://bugs.webkit.org/show_bug.cgi?id=200865

Reviewed by Mark Lam.

JSTests:

  • stress/hashbang.js: Added.
  • test262/expectations.yaml: Mark 6 cases as passing.

Source/JavaScriptCore:

Hashbang (a.k.a. shebang) support is at Stage 3 in TC39:
https://github.com/tc39/proposal-hashbang

This allows #! to be treated like //, but only at the very start of the source text.

  • parser/Lexer.cpp:

(JSC::Lexer<T>::Lexer):
(JSC::Lexer<T>::lexWithoutClearingLineTerminator):

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r248825 r248826  
     1
     2
     3
     4
     5
     6
     7
     8
     9
     10
    1112019-08-17  Yusuke Suzuki  <ysuzuki@apple.com>
    212
  • trunk/JSTests/test262/expectations.yaml

    r248787 r248826  
    22672267test/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-generator.js:
    22682268  default: 'Test262: This statement should not be evaluated.'
    2269 test/language/comments/hashbang/eval-indirect.js:
    2270   default: "SyntaxError: Invalid character: '#'"
    2271   strict mode: "SyntaxError: Invalid character: '#'"
    2272 test/language/comments/hashbang/eval.js:
    2273   default: "SyntaxError: Invalid character: '#'"
    2274   strict mode: "SyntaxError: Invalid character: '#'"
    2275 test/language/comments/hashbang/no-line-separator.js:
    2276   default: "SyntaxError: Invalid character: '#'"
    2277   strict mode: "SyntaxError: Invalid character: '#'"
    22782269test/language/computed-property-names/class/static/method-number.js:
    22792270  default: "Test262Error: `compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'name', 'a', 'c'])` returns `true`"
  • trunk/Source/JavaScriptCore/ChangeLog

    r248825 r248826  
     1
     2
     3
     4
     5
     6
     7
     8
     9
     10
     11
     12
     13
     14
     15
     16
    1172019-08-17  Yusuke Suzuki  <ysuzuki@apple.com>
    218
  • trunk/Source/JavaScriptCore/parser/Lexer.cpp

    r247845 r248826  
    9696    // Other types (only one so far)
    9797    CharacterWhiteSpace,
     98
    9899    CharacterPrivateIdentifierStart
    99100};
     
    136137/*  33 - !                  */ CharacterExclamationMark,
    137138/*  34 - "                  */ CharacterQuote,
    138 /*  35 - #                  */ CharacterInvalid,
     139/*  35 - #                  */ Character,
    139140/*  36 - $                  */ CharacterIdentifierStart,
    140141/*  37 - %                  */ CharacterModulo,
     
    24232424        m_lineStart = m_code;
    24242425        goto start;
     2426
     2427
     2428
     2429
     2430
     2431
     2432
     2433
    24252434    case CharacterPrivateIdentifierStart:
    24262435        if (m_parsingBuiltinFunction)
    24272436            goto parseIdent;
    2428 
    2429         FALLTHROUGH;
     2437        goto invalidCharacter;
    24302438    case CharacterOtherIdentifierPart:
    24312439    case CharacterInvalid:
    2432         m_lexErrorMessage = invalidCharacterMessage();
    2433         token = ERRORTOK;
    2434         goto returnError;
     2440        goto invalidCharacter;
    24352441    default:
    24362442        RELEASE_ASSERT_NOT_REACHED();
     
    24822488    fillTokenInfo(tokenRecord, token, m_lineNumber, currentOffset(), currentLineStartOffset(), currentPosition());
    24832489    return token;
     2490
     2491
     2492
     2493
     2494
    24842495
    24852496returnError:
Note: See TracChangeset for help on using the changeset viewer.