aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-03 16:43:46 -0700
committeralon@honor <none@none>2010-10-03 16:43:46 -0700
commitc0ffc853665a8deef0c7b12f3450c1a81fc1640d (patch)
tree1b2d84c87dc73351680971f06b5ebfc85fac148e /src
parent54b864dba82d95b85a9e5615b3cb652e560249a8 (diff)
proper indentation of generated code
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 0892f1db..a76db445 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -270,9 +270,13 @@ function JSify(data) {
}
// for special labels we care about (for phi), mark that we visited them
if (func.remarkableLabels.indexOf(label.ident) >= 0) {
- ret += ' __lastLabel__ = ' + getLabelId(label.ident) + ';\n';
+ ret += indent + '__lastLabel__ = ' + getLabelId(label.ident) + ';\n';
}
- return ret + label.lines.map(function(line) { return indent + line.JS + (line.comment ? ' // ' + line.comment : '') }).join('\n');
+ return ret + label.lines.map(function(line) { return line.JS + (line.comment ? ' // ' + line.comment : '') })
+ .join('\n')
+ .split('\n') // some lines include line breaks
+ .map(function(line) { return indent + line })
+ .join('\n');
}
var ret = '';
if (block.type == 'emulated') {