aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-21 11:56:05 -0700
committeralon@honor <none@none>2010-10-21 11:56:05 -0700
commit4d9d2829c206c2456155087a3150e17fd4c8130f (patch)
treefd75ebdd9aa2e890f67e9751ded10499fffdaccb /src/jsifier.js
parent9cbeceb19e293eff976e813fe3564f0b2507e22b (diff)
support phi with >2 params
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index d20409ea..f82a497c 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -620,7 +620,14 @@ function JSify(data) {
}
});
makeFuncLineZyme('phi', function(item) {
- return '__lastLabel__ == ' + getLabelId(item.label1) + ' ? ' + toNiceIdent(item.value1) + ' : ' + toNiceIdent(item.value2);
+ var params = item.params;
+ function makeOne(i) {
+ if (i === params.length-1) {
+ return params[i].value;
+ }
+ return '__lastLabel__ == ' + getLabelId(params[i].label) + ' ? ' + params[i].value + ' : (' + makeOne(i+1) + ')';
+ }
+ return makeOne(0);
});
function makeUnSign(value, type) {