aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-09-03 12:39:02 +0300
committerMihai Bazon <mihai@bazon.net>2012-09-03 12:39:02 +0300
commitf70226461732321780a04f5c5dd02ed753ede0cf (patch)
tree0cc61c439607df7655a0a3e0695dafa02e29f098
parent6d0db4ce14fd67681bdda1d1861517763eff4c6e (diff)
downloadtracifyjs-f70226461732321780a04f5c5dd02ed753ede0cf.tar.gz
tracifyjs-f70226461732321780a04f5c5dd02ed753ede0cf.zip
jumps, try and definitions are statements too
-rw-r--r--lib/ast.js6
-rw-r--r--lib/output.js2
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/ast.js b/lib/ast.js
index 9dd92cb2..48904ec9 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -248,7 +248,7 @@ var AST_Defun = DEFNODE("Defun", null, {
var AST_Jump = DEFNODE("Jump", null, {
$documentation: "Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)"
-});
+}, AST_Statement);
var AST_Exit = DEFNODE("Exit", "value", {
$documentation: "Base class for “exits” (`return` and `throw`)",
@@ -353,7 +353,7 @@ var AST_Try = DEFNODE("Try", "btry bcatch bfinally", {
if (this.bfinally) this.bfinally._walk(visitor);
});
}
-});
+}, AST_Statement);
// XXX: this is wrong according to ECMA-262 (12.4). the catch block
// should introduce another scope, as the argname should be visible
@@ -391,7 +391,7 @@ var AST_Definitions = DEFNODE("Definitions", "definitions", {
});
});
}
-});
+}, AST_Statement);
var AST_Var = DEFNODE("Var", null, {
$documentation: "A `var` statement"
diff --git a/lib/output.js b/lib/output.js
index c321d46d..98bc983c 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -921,7 +921,7 @@ function OutputStream(options) {
function first_in_statement(output) {
var a = output.stack(), i = a.length, node = a[--i], p = a[--i];
while (i > 0) {
- if (p instanceof AST_Statement)
+ if (p instanceof AST_Statement && p.body === node)
return true;
if ((p instanceof AST_Seq && p.first === node ) ||
(p instanceof AST_Call && p.expression === node ) ||