[dynamic-import] Implementing import() syntax (#163)

This commit is contained in:
Jordan Gensler
2016-10-14 14:54:21 -04:00
committed by Henry Zhu
parent 4c445fd5f8
commit c63c1bc728
27 changed files with 1475 additions and 1 deletions

View File

@@ -98,6 +98,8 @@ pp.parseStatement = function (declaration, topLevel) {
case tt.semi: return this.parseEmptyStatement(node);
case tt._export:
case tt._import:
if (this.hasPlugin("dynamicImport") && this.lookahead().type === tt.parenL) break;
if (!this.options.allowImportExportEverywhere) {
if (!topLevel) {
this.raise(this.state.start, "'import' and 'export' may only appear at the top level");