From 3f1dd44ed34ba6c08510955e4160c2bc94c4c17e Mon Sep 17 00:00:00 2001 From: zhangrengao Date: Tue, 2 Aug 2022 20:14:14 +0800 Subject: [PATCH] Fix async function parse await keyword issue: I5KAZ5 Signed-off-by: zhangrengao Change-Id: Ic3d10bb6e226c536431c991743a425f8075990ba --- es2panda/parser/statementParser.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/es2panda/parser/statementParser.cpp b/es2panda/parser/statementParser.cpp index c1e63e01d4..340f032b0f 100644 --- a/es2panda/parser/statementParser.cpp +++ b/es2panda/parser/statementParser.cpp @@ -768,6 +768,10 @@ ir::BlockStatement *ParserImpl::ParseBlockStatement(binder::Scope *scope) blockNode->SetRange({startLoc, lexer_->GetToken().End()}); scope->BindNode(blockNode); + // fix case: async function foo() { function test(){} await sleep(100);} + if (scope->IsFunctionScope()) { + context_.Status() = context_.Prev()->Status(); + } lexer_->NextToken(); return blockNode; } -- Gitee