aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jsifier.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 01546b05..96cb8d9a 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1114,7 +1114,8 @@ function JSify(data, functionsOnly, givenFunctions) {
if (!useIfs) {
ret += 'switch(' + signedIdent + ') {\n';
}
- for (var targetLabel in targetLabels) {
+ // process target labels, sorting them so output is consistently ordered
+ keys(targetLabels).sort().forEach(function(targetLabel) {
if (!first && useIfs) {
ret += 'else ';
} else {
@@ -1142,7 +1143,7 @@ function JSify(data, functionsOnly, givenFunctions) {
labelJS: phiSet
});
}
- }
+ });
var phiSet = item.defaultLabelJS = getPhiSetsForLabel(phiSets, item.defaultLabel);
if (useIfs) {
if (item.switchLabels.length > 0) ret += 'else {\n';