From 5771c8b4b256018666278e1084e876aaef5efde7 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 22 Nov 2012 09:48:01 +0100
Subject: [PATCH] Add missing semicolon() calls to debugger and throw statement
parsers
Issue #5
---
acorn.js | 2 ++
index.html | 2 ++
test/tests.js | 26 --------------------------
3 files changed, 4 insertions(+), 26 deletions(-)
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
|