From b77574ea1c25e2630dcde000ae0fa32b01f8311e Mon Sep 17 00:00:00 2001 From: Mihai Bazon Date: Fri, 7 Sep 2012 11:22:01 +0300 Subject: [PATCH] fixed tests (need to drop the toplevel block in "expected" if it's a single statement) --- lib/ast.js | 3 --- lib/compress.js | 2 +- test/run-tests.js | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/ast.js b/lib/ast.js index 7b2a3271..4e0c08b1 100644 --- a/lib/ast.js +++ b/lib/ast.js @@ -232,9 +232,6 @@ var AST_Scope = DEFNODE("Scope", "variables functions uses_with uses_eval parent }, AST_Block); var AST_Toplevel = DEFNODE("Toplevel", null, { - initialize: function() { - this.required = true; - }, $documentation: "The toplevel scope" }, AST_Scope); diff --git a/lib/compress.js b/lib/compress.js index d8def866..a7563b98 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -473,7 +473,7 @@ function Compressor(options, false_by_default) { SQUEEZE(AST_BlockStatement, function(self, compressor){ self = self.clone(); self.body = tighten_body(self.body, compressor); - if (self.body.length == 1 && !self.required) + if (self.body.length == 1) return self.body[0]; return self; }); diff --git a/test/run-tests.js b/test/run-tests.js index 1f554e11..b70e2291 100755 --- a/test/run-tests.js +++ b/test/run-tests.js @@ -119,8 +119,8 @@ function parse_test(file) { }) ); var stat = node.body; - if (stat instanceof U.AST_BlockStatement) - stat.required = 1; + if (stat instanceof U.AST_BlockStatement && stat.body.length == 1) + stat = stat.body[0]; test[node.label.name] = stat; return true; } -- 2.34.1