diff options
author | alon@honor <none@none> | 2010-10-03 16:43:46 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-10-03 16:43:46 -0700 |
commit | c0ffc853665a8deef0c7b12f3450c1a81fc1640d (patch) | |
tree | 1b2d84c87dc73351680971f06b5ebfc85fac148e | |
parent | 54b864dba82d95b85a9e5615b3cb652e560249a8 (diff) |
proper indentation of generated code
-rw-r--r-- | src/jsifier.js | 8 |
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') { |