From 87321b0adcfa8108a3445d13997d3942df0def9a Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 18 Sep 2018 14:17:10 +0100 Subject: [PATCH] Bug 1492074 - Syntax parse of dynamic module import syntax should fail since this is not yet implemented r=jandem on a CLOSED TREE --- js/src/frontend/Parser.cpp | 4 ++++ js/src/jit-test/tests/modules/dynamic-import-lazy.js | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 js/src/jit-test/tests/modules/dynamic-import-lazy.js diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index aa835c93ae86..67855ef8cc81 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -10597,6 +10597,10 @@ Parser::importExpr(YieldHandling yieldHandling) MUST_MATCH_TOKEN_MOD(TokenKind::RightParen, TokenStream::Operand, JSMSG_PAREN_AFTER_ARGS); + if (!abortIfSyntaxParser()) { + return null(); + } + return handler.newCallImport(importHolder, arg); } else { error(JSMSG_UNEXPECTED_TOKEN_NO_EXPECT, TokenKindToDesc(next)); diff --git a/js/src/jit-test/tests/modules/dynamic-import-lazy.js b/js/src/jit-test/tests/modules/dynamic-import-lazy.js new file mode 100644 index 000000000000..f1b31b3608da --- /dev/null +++ b/js/src/jit-test/tests/modules/dynamic-import-lazy.js @@ -0,0 +1,6 @@ +// |jit-test| error: SyntaxError + +function lazyilyParsedFunction() +{ + return import("/module1.js"); +}