aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-22 11:50:14 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-22 11:50:14 -0800
commit9c4dcaa0c4648148b8bb96c91108c7e51b9573fa (patch)
treef310e899895d7f2048178bf047a4fbb219c1293b /tools
parentd85a66e494512af061f359a575c6be46b68e7e9d (diff)
fix hoister bug with ['block']
Diffstat (limited to 'tools')
-rw-r--r--tools/js-optimizer.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index c4de51e3..0660b20f 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -437,7 +437,7 @@ function hoistMultiples(ast) {
var type = node[0];
if (type == 'defun' && isGenerated(node[1])) {
traverse(node, function(node, type) {
- if (type == 'if' && node[2][0] == 'block' && node[2][1].length == 0) {
+ if (type == 'if' && node[2][0] == 'block' && (!node[2][1] || node[2][1].length == 0)) {
more = true;
if (node[2][2]) { // if there is an else, return that
return node[2][2];