aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
diff options
context:
space:
mode:
authorEduardo Julian2018-02-21 22:31:08 -0400
committerEduardo Julian2018-02-21 22:31:08 -0400
commit4369bd0ee320d85590efa9c71db591200fb54cd2 (patch)
treed483775a6f4d356f74a87fd736374513791a2589 /new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
parentd01f75d220539efd7d58ee9534d3ef3a7bbc3cdc (diff)
- Fixed the failing simple tests.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux38
1 files changed, 24 insertions, 14 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
index 849ff67d0..ce79bda35 100644
--- a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
@@ -152,6 +152,14 @@
[bit//and runtimeT.bit//and]
[bit//or runtimeT.bit//or]
[bit//xor runtimeT.bit//xor]
+ )
+
+(do-template [<name> <op>]
+ [(def: (<name> [subjectJS paramJS])
+ Binary
+ (let [simple-param (format runtimeT.int//to-number "(" paramJS ")")]
+ (format <op> "(" subjectJS "," simple-param ")")))]
+
[bit//shift-left runtimeT.bit//shift-left]
[bit//shift-right runtimeT.bit//signed-shift-right]
[bit//unsigned-shift-right runtimeT.bit//shift-right]
@@ -199,21 +207,21 @@
Nullary
(<encode> <const>))]
- [nat//min 0 runtimeT.int-constant]
- [nat//max -1 runtimeT.int-constant]
+ [nat//min 0 runtimeT.int]
+ [nat//max -1 runtimeT.int]
- [int//min Long::MIN_VALUE runtimeT.int-constant]
- [int//max Long::MAX_VALUE runtimeT.int-constant]
+ [int//min Long::MIN_VALUE runtimeT.int]
+ [int//max Long::MAX_VALUE runtimeT.int]
- [frac//smallest Double::MIN_VALUE runtimeT.frac-constant]
- [frac//min (f/* -1.0 Double::MAX_VALUE) runtimeT.frac-constant]
- [frac//max Double::MAX_VALUE runtimeT.frac-constant]
- [frac//not-a-number Double::NaN runtimeT.frac-constant]
- [frac//positive-infinity Double::POSITIVE_INFINITY runtimeT.frac-constant]
- [frac//negative-infinity Double::NEGATIVE_INFINITY runtimeT.frac-constant]
-
- [deg//min 0 runtimeT.int-constant]
- [deg//max -1 runtimeT.int-constant]
+ [frac//smallest Double::MIN_VALUE runtimeT.frac]
+ [frac//min (f/* -1.0 Double::MAX_VALUE) runtimeT.frac]
+ [frac//max Double::MAX_VALUE runtimeT.frac]
+ [frac//not-a-number Double::NaN runtimeT.frac]
+ [frac//positive-infinity Double::POSITIVE_INFINITY runtimeT.frac]
+ [frac//negative-infinity Double::NEGATIVE_INFINITY runtimeT.frac]
+
+ [deg//min 0 runtimeT.int]
+ [deg//max -1 runtimeT.int]
)
(do-template [<name> <op>]
@@ -287,7 +295,9 @@
(def: (frac//decode inputJS)
Unary
- (format "parseFloat(" inputJS ")"))
+ (let [decoding (format "parseFloat(" inputJS ")")
+ thunk (format "(function () {" decoding "}")]
+ (lux//try decoding)))
(do-template [<name> <transform>]
[(def: (<name> inputJS)