aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-16 16:04:30 -0700
committeralon@honor <none@none>2010-10-16 16:04:30 -0700
commit81eafc4df3de74e5366891476506bf3f6b0db61d (patch)
tree84dd8b53fe30be7ce7d603b271431300b92c4dea
parent373e75c2151229ae4b6caaae77eb9d49da72e2c2 (diff)
tweak loop optimizer
-rw-r--r--src/analyzer.js3
-rw-r--r--src/jsifier.js2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 30512b45..c4773b95 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -733,7 +733,8 @@ function analyzer(data) {
if (!block) return;
function singular(block) {
- if (!block || block.type === 'multiple') return null;
+ if (!block) return endOfTheWorld;
+ if (block.type === 'multiple') return null;
if (block.entries.length == 1) {
return block.entries[0];
} else {
diff --git a/src/jsifier.js b/src/jsifier.js
index 15e66669..0395b5f9 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -349,7 +349,7 @@ function JSify(data) {
multipleIdent = ' ';
}
block.entryLabels.forEach(function(entryLabel) {
- ret += indent + (first ? '' : 'else ') + multipleIdent + 'if (__label__ == ' + getLabelId(entryLabel.ident) + ') {\n';
+ ret += indent + multipleIdent + (first ? '' : 'else ') + 'if (__label__ == ' + getLabelId(entryLabel.ident) + ') {\n';
ret += walkBlock(entryLabel.block, indent + ' ' + multipleIdent);
ret += indent + multipleIdent + '}\n';
first = false;