RESOLVED FIXED 168844
ASSERTION FAILED: "We should only declare a function as a lexically scoped variable in scopes where var declarations aren't allowed. ..." for function redeclaration with async function module export
https://bugs.webkit.org/show_bug.cgi?id=168844
Summary ASSERTION FAILED: "We should only declare a function as a lexically scoped va...
André Bargull
Reported 2017-02-24 14:18:36 PST
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 ... ---
Attachments
Patch (4.48 KB, patch)
2017-06-02 02:55 PDT, Yusuke Suzuki
saam: review+
Radar WebKit Bug Importer
Comment 1 2017-02-26 13:38:52 PST
Yusuke Suzuki
Comment 2 2017-06-02 02:48:16 PDT
Working on it right now.
Yusuke Suzuki
Comment 3 2017-06-02 02:55:15 PDT
Saam Barati
Comment 4 2017-06-02 08:56:09 PDT
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?
Yusuke Suzuki
Comment 5 2017-06-03 04:20:37 PDT
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.
Yusuke Suzuki
Comment 6 2017-06-03 04:25:22 PDT
Note You need to log in before you can comment on or make changes to this bug.