Ignore:
Timestamp:
Aug 6, 2017, 6:04:32 AM (8 years ago)
Author:
[email protected]
Message:

[Next] Async iteration - Implement Async Generator - parser
https://bugs.webkit.org/show_bug.cgi?id=175210

Reviewed by Yusuke Suzuki.

JSTests:

  • stress/async-await-syntax.js:

(testTopLevelAsyncAwaitSyntaxSloppyMode.testSyntax):

  • stress/async-iteration-syntax.js: Added.

(assert):
(checkSyntax):
(checkSyntaxError):
(checkSimpleAsyncGeneratorSloppyMode):
(checkSimpleAsyncGeneratorStrictMode):
(checkNestedAsyncGenerators):
(checkSimpleAsyncGeneratorSyntaxErrorInStrictMode):

  • stress/generator-class-methods-syntax.js:

Source/JavaScriptCore:

Current implementation is draft version of Async Iteration.
Link to spec https://tc39.github.io/proposal-async-iteration/

Current patch implement only parser part of the Async generator
Runtime part will be in next ptches

  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createFunctionMetadata):

  • parser/Parser.cpp:

(JSC::getAsynFunctionBodyParseMode):
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::parseAsyncFunctionSourceElements):
(JSC::Parser<LexerType>::parseAsyncGeneratorFunctionSourceElements):
(JSC::stringArticleForFunctionMode):
(JSC::stringForFunctionMode):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseAsyncFunctionDeclaration):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parsePropertyMethod):
(JSC::Parser<LexerType>::parseAsyncFunctionExpression):

  • parser/Parser.h:

(JSC::Scope::setSourceParseMode):

  • parser/ParserModes.h:

(JSC::isFunctionParseMode):
(JSC::isAsyncFunctionParseMode):
(JSC::isAsyncArrowFunctionParseMode):
(JSC::isAsyncGeneratorFunctionParseMode):
(JSC::isAsyncFunctionOrAsyncGeneratorWrapperParseMode):
(JSC::isAsyncFunctionWrapperParseMode):
(JSC::isAsyncFunctionBodyParseMode):
(JSC::isGeneratorMethodParseMode):
(JSC::isAsyncMethodParseMode):
(JSC::isAsyncGeneratorMethodParseMode):
(JSC::isMethodParseMode):
(JSC::isGeneratorOrAsyncFunctionBodyParseMode):
(JSC::isGeneratorOrAsyncFunctionWrapperParseMode):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/ASTBuilder.h

    r219702 r220323  
    438438        SourceParseMode mode, bool isArrowFunctionBodyExpression)
    439439    {
     440        SourceParseMode bodySourceParseMode = mode;
     441        if (mode == SourceParseMode::AsyncGeneratorBodyMode) {
     442            ASSERT(Options::useAsyncIterator());
     443            bodySourceParseMode = SourceParseMode::AsyncFunctionBodyMode;
     444        } else if (mode == SourceParseMode::AsyncGeneratorWrapperFunctionMode) {
     445            ASSERT(Options::useAsyncIterator());
     446            bodySourceParseMode = SourceParseMode::ArrowFunctionMode;
     447        } else if (mode == SourceParseMode::AsyncGeneratorWrapperMethodMode) {
     448            ASSERT(Options::useAsyncIterator());
     449            bodySourceParseMode = SourceParseMode::AsyncMethodMode;
     450        }
     451
    440452        return new (m_parserArena) FunctionMetadataNode(
    441453            m_parserArena, startLocation, endLocation, startColumn, endColumn,
    442454            functionKeywordStart, functionNameStart, parametersStart,
    443455            inStrictContext, constructorKind, superBinding,
    444             parameterCount, mode, isArrowFunctionBodyExpression);
     456            parameterCount, bodySourceParseMode, isArrowFunctionBodyExpression);
    445457    }
    446458
Note: See TracChangeset for help on using the changeset viewer.