diff --git a/js/ast_test.go b/js/ast_test.go index 1df53c2..0fa02eb 100644 --- a/js/ast_test.go +++ b/js/ast_test.go @@ -120,6 +120,7 @@ func TestJS(t *testing.T) { {"- - --3", "- - --3;"}, {"([,,])=>P", "([,,]) => { return P; };"}, {"(t)=>{//!\n}", "(t) => { //! };"}, + {"import();", "import();"}, } re := regexp.MustCompile("\n *") diff --git a/js/parse.go b/js/parse.go index c4bac6d..5c609e2 100644 --- a/js/parse.go +++ b/js/parse.go @@ -190,6 +190,9 @@ func (p *Parser) parseModule() (module BlockStmt) { suffix := p.parseExpressionSuffix(left, OpExpr, OpCall) p.exprLevel-- module.List = append(module.List, &ExprStmt{suffix}) + if !p.prevLT && p.tt == SemicolonToken { + p.next() + } } else { importStmt := p.parseImportStmt() module.List = append(module.List, &importStmt)