diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-15 09:48:20 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-15 09:48:20 -0800 |
commit | b1a953ee8b3ec6d488802e29665b533bbe03759b (patch) | |
tree | a404a64f52e18c029c85452757661f95a52a8205 /src/parseTools.js | |
parent | 581ef0e9afeace84c7ffb7605249973d1de0750e (diff) |
ensure explicit floats in function call arguments and all coercions
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 268d0e24..e0c99c52 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1019,14 +1019,18 @@ function asmCoercion(value, type, signedness) { if (type == 'void') { return value; } else if (type in Runtime.FLOAT_TYPES) { - if (signedness) { - if (signedness == 'u') { - value = '(' + value + ')>>>0'; - } else { - value = '(' + value + ')|0'; + if (isNumber(value)) { + return asmEnsureFloat(value, type); + } else { + if (signedness) { + if (signedness == 'u') { + value = '(' + value + ')>>>0'; + } else { + value = '(' + value + ')|0'; + } } + return '(+(' + value + '))'; } - return '(+(' + value + '))'; } else { return '((' + value + ')|0)'; } |