diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-09-06 12:06:38 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-09-06 12:06:38 -0700 |
commit | d52f7f8a7b05c5b46fc99526cd8a6b2bf270bc85 (patch) | |
tree | 2a2a131dc6eb2446594f7c1db472bc0019a8da57 | |
parent | 328ee0ba86401b00fee0e9f00023cac300de4488 (diff) |
fix switch for the case with no labels given
-rw-r--r-- | src/jsifier.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index be9360af..b1f42567 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -684,9 +684,9 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) { ret += ' ' + makeBranch(switchLabel.label, item.currLabelId || null) + '\n'; ret += '}\n'; }); - ret += 'else {\n'; + if (item.switchLabels.length > 0) ret += 'else {\n'; ret += makeBranch(item.defaultLabel, item.currLabelId) + '\n'; - ret += '}\n'; + if (item.switchLabels.length > 0) ret += '}\n'; if (item.value) { ret += ' ' + toNiceIdent(item.value); } @@ -832,7 +832,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) { } makeFuncLineActor('getelementptr', function(item) { return finalizeLLVMFunctionCall(item) }); makeFuncLineActor('call', function(item) { - if (LibraryManager.isStubFunction(item.ident)) return ';'; + if (item.standalone && LibraryManager.isStubFunction(item.ident)) return ';'; return makeFunctionCall(item.ident, item.params, item.funcData) + (item.standalone ? ';' : ''); }); |