aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-28 17:32:01 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-02 17:31:35 -0700
commit8a6713905050aeb491a83720714942aa7b14c32e (patch)
treebb7e6797bf7c8b886b1cba9a4a12bb79e83c0f80 /src
parent08c73e4a03c12cb88748364d870f66c79d638f2d (diff)
remove whitespace in switch
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index b20aec31..f8fa5b47 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1112,7 +1112,7 @@ function JSify(data, functionsOnly, givenFunctions) {
item.groupedLabels = [];
}
if (!useIfs) {
- ret += 'switch(' + signedIdent + ') {\n';
+ ret += 'switch(' + signedIdent + '){\n';
}
// process target labels, sorting them so output is consistently ordered
keys(targetLabels).sort().forEach(function(targetLabel) {
@@ -1125,17 +1125,17 @@ function JSify(data, functionsOnly, givenFunctions) {
if (useIfs) {
value = targetLabels[targetLabel].map(function(value) {
return makeComparison(signedIdent, '==', makeSignOp(value, item.type, 're'), item.type)
- }).join(' | ');
- ret += 'if (' + value + ') {\n';
+ }).join('|');
+ ret += 'if(' + value + '){\n';
} else {
value = targetLabels[targetLabel].map(function(value) {
return 'case ' + makeSignOp(value, item.type, 're') + ':';
- }).join(' ');
+ }).join('');
ret += value + '{\n';
}
var phiSet = getPhiSetsForLabel(phiSets, targetLabel);
ret += INDENTATION + '' + phiSet + makeBranch(targetLabel, item.currLabelId || null) + '\n';
- ret += '}\n';
+ ret += '}';
if (RELOOP) {
item.groupedLabels.push({
label: targetLabel,
@@ -1146,15 +1146,15 @@ function JSify(data, functionsOnly, givenFunctions) {
});
var phiSet = item.defaultLabelJS = getPhiSetsForLabel(phiSets, item.defaultLabel);
if (useIfs) {
- if (item.switchLabels.length > 0) ret += 'else {\n';
+ if (item.switchLabels.length > 0) ret += 'else{\n';
ret += phiSet + makeBranch(item.defaultLabel, item.currLabelId) + '\n';
if (item.switchLabels.length > 0) ret += '}\n';
} else {
- ret += 'default: {\n';
+ ret += 'default:{\n';
ret += phiSet + makeBranch(item.defaultLabel, item.currLabelId) + '\n';
ret += '}\n';
- ret += '} break; \n'; // finish switch and break, to move control flow properly (breaks from makeBranch just broke out of the switch)
+ ret += '}break;\n'; // finish switch and break, to move control flow properly (breaks from makeBranch just broke out of the switch)
}
if (item.value) {
ret += ' ' + toNiceIdent(item.value);