svn revision: 212968 Test case: --- checkModuleSyntax("function f(){} export async function f() {}"); --- Fails with: --- ASSERTION FAILED: We should only declare a function as a lexically scoped variable in scopes where var declarations aren't allowed. I.e, in strict mode and not at the top-level scope of a function or program. --- Stacktrace: --- #0 0x00007ffff6d97a4e in WTFCrash () at ../../Source/WTF/wtf/Assertions.cpp:323 #1 0x00007ffff698fad8 in JSC::Scope::declareFunction (this=0x7fffffffa100, ident=0x7fffef5d9200, declareAsVar=false, isSloppyModeHoistingCandidate=false) at ../../Source/JavaScriptCore/parser/Parser.h:397 #2 0x00007ffff699d3e1 in JSC::Parser<JSC::Lexer<unsigned char> >::declareFunction (this=0x7fffffffa0f0, ident=0x7fffef5d9200) at ../../Source/JavaScriptCore/parser/Parser.h:1228 #3 0x00007ffff69cf8ef in JSC::Parser<JSC::Lexer<unsigned char> >::parseAsyncFunctionDeclaration<JSC::ASTBuilder> (this=0x7fffffffa0f0, context=..., exportType=JSC::Parser<JSC::Lexer<unsigned char> >::ExportType::Exported, declarationDefaultContext=JSC::DeclarationDefaultContext::Standard) at ../../Source/JavaScriptCore/parser/Parser.cpp:2474 #4 0x00007ffff69bc262 in JSC::Parser<JSC::Lexer<unsigned char> >::parseExportDeclaration<JSC::ASTBuilder> (this=0x7fffffffa0f0, context=...) at ../../Source/JavaScriptCore/parser/Parser.cpp:3301 #5 0x00007ffff69ad691 in JSC::Parser<JSC::Lexer<unsigned char> >::parseModuleSourceElements<JSC::ASTBuilder> (this=0x7fffffffa0f0, context=..., parseMode=JSC::SourceParseMode::ModuleAnalyzeMode) at ../../Source/JavaScriptCore/parser/Parser.cpp:380 #6 0x00007ffff699dbf1 in JSC::Parser<JSC::Lexer<unsigned char> >::parseInner (this=0x7fffffffa0f0, calleeName=..., parseMode=JSC::SourceParseMode::ModuleAnalyzeMode) at ../../Source/JavaScriptCore/parser/Parser.cpp:207 #7 0x00007ffff62f27a1 in JSC::Parser<JSC::Lexer<unsigned char> >::parse<JSC::ModuleProgramNode> (this=0x7fffffffa0f0, error=..., calleeName=..., parseMode=JSC::SourceParseMode::ModuleAnalyzeMode) at ../../Source/JavaScriptCore/parser/Parser.h:1811 #8 0x00007ffff62f2167 in JSC::parse<JSC::ModuleProgramNode> (vm=0x7fffaf000000, source=..., name=..., builtinMode=JSC::JSParserBuiltinMode::NotBuiltin, strictMode=JSC::JSParserStrictMode::Strict, scriptMode=JSC::JSParserScriptMode::Module, parseMode=JSC::SourceParseMode::ModuleAnalyzeMode, superBinding=JSC::SuperBinding::NotNeeded, error=..., positionBeforeLastNewline=0x0, defaultConstructorKind=JSC::ConstructorKind::None, derivedContextType=JSC::DerivedContextType::None, evalContextType=JSC::EvalContextType::None, debuggerParseData=0x0) at ../../Source/JavaScriptCore/parser/Parser.h:1900 #9 0x00007ffff6aea605 in JSC::checkModuleSyntax (exec=0x7fffffffc740, source=..., error=...) at ../../Source/JavaScriptCore/runtime/Completion.cpp:79 #10 0x0000000000466689 in functionCheckModuleSyntax (exec=0x7fffffffc740) at ../../Source/JavaScriptCore/jsc.cpp:2939 ... ---
<rdar://problem/30724820>
Working on it right now.
Created attachment 311811 [details] Patch
Comment on attachment 311811 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=311811&action=review > JSTests/modules/async-function-export.js:1 > +function f() What are the semantics for this? If I tried to call “f” below, which one would I call?
Comment on attachment 311811 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=311811&action=review Thanks. >> JSTests/modules/async-function-export.js:1 >> +function f() > > What are the semantics for this? If I tried to call “f” below, which one would I call? Latter one. Same as function f() { } function f() { } case.
Committed r217755: <http://trac.webkit.org/changeset/217755>