diff --git a/acorn.js b/acorn.js index 9160e58542..7785748cab 100644 --- a/acorn.js +++ b/acorn.js @@ -1067,6 +1067,7 @@ case _debugger: next(); + semicolon(); return finishNode(node, "DebuggerStatement"); case _do: @@ -1166,6 +1167,7 @@ if (newline.test(input.slice(lastEnd, tokStart))) raise(lastEnd, "Illegal newline after throw"); node.argument = parseExpression(); + semicolon(); return finishNode(node, "ThrowStatement"); case _try: diff --git a/index.html b/index.html index 8a4419bc47..625d5a6ccb 100644 --- a/index.html +++ b/index.html @@ -750,6 +750,7 @@ continue to.

< case _debugger: next(); + semicolon(); return finishNode(node, "DebuggerStatement"); case _do: @@ -839,6 +840,7 @@ adding statements to.

if (newline.test(input.slice(lastEnd, tokStart))) raise(lastEnd, "Illegal newline after throw"); node.argument = parseExpression(); + semicolon(); return finishNode(node, "ThrowStatement"); case _try: diff --git a/test/tests.js b/test/tests.js index 50852d51c7..e571d49670 100644 --- a/test/tests.js +++ b/test/tests.js @@ -21634,19 +21634,6 @@ test("throw x;", { line: 1, column: 0 }, - end: { - line: 1, - column: 7 - } - } - }, - { - type: "EmptyStatement", - loc: { - start: { - line: 1, - column: 7 - }, end: { line: 1, column: 8 @@ -22790,19 +22777,6 @@ test("debugger;", { line: 1, column: 0 }, - end: { - line: 1, - column: 8 - } - } - }, - { - type: "EmptyStatement", - loc: { - start: { - line: 1, - column: 8 - }, end: { line: 1, column: 9