aboutsummaryrefslogtreecommitdiff
path: root/luxc/src
diff options
context:
space:
mode:
authorEduardo Julian2017-02-28 19:00:53 -0400
committerEduardo Julian2017-02-28 19:00:53 -0400
commit71ce7d944f40b0533c7774aaf75712f1c09afd0b (patch)
tree36cd3433729ebba1074c31d6650bb8e73a38f480 /luxc/src
parent19eb25c2f1263988f67ff72f632dea50b8e3f8dd (diff)
- Fixed some bugs when compiling pattern-matching.
Diffstat (limited to 'luxc/src')
-rw-r--r--luxc/src/lux/compiler/js/lux.clj16
1 files changed, 9 insertions, 7 deletions
diff --git a/luxc/src/lux/compiler/js/lux.clj b/luxc/src/lux/compiler/js/lux.clj
index 2de9eeec1..e0d5a4247 100644
--- a/luxc/src/lux/compiler/js/lux.clj
+++ b/luxc/src/lux/compiler/js/lux.clj
@@ -33,8 +33,8 @@
(do-template [<name>]
(defn <name> [value]
- (let [high (-> value (unsigned-bit-shift-right 32) (bit-and mask-4b))
- low (-> value (bit-and mask-4b))]
+ (let [high (-> value (bit-shift-right 32) int)
+ low (-> value (bit-and mask-4b) (bit-shift-left 32) (bit-shift-right 32) int)]
(return (str &&rt/LuxRT "." "makeI64" "(" high "," low ")"))))
compile-nat
@@ -179,24 +179,26 @@
(&o/$NatPM _value)
(|do [=value (compile-nat _value)]
- (return (str "if(" (str "LuxRT.eqI64(" cursor-peek "," _value ")") ") { " pm-fail " }")))
+ (return (str "if(!" (str "LuxRT.eqI64(" cursor-peek "," =value ")") ") { " pm-fail " }")))
(&o/$IntPM _value)
(|do [=value (compile-int _value)]
- (return (str "if(" (str "LuxRT.eqI64(" cursor-peek "," _value ")") ") { " pm-fail " }")))
+ (return (str "if(!" (str "LuxRT.eqI64(" cursor-peek "," =value ")") ") { " pm-fail " }")))
(&o/$DegPM _value)
(|do [=value (compile-deg _value)]
- (return (str "if(" (str "LuxRT.eqI64(" cursor-peek "," _value ")") ") { " pm-fail " }")))
+ (return (str "if(!" (str "LuxRT.eqI64(" cursor-peek "," =value ")") ") { " pm-fail " }")))
(&o/$RealPM _value)
(return (str "if(" cursor-peek " !== " _value ") { " pm-fail " }"))
(&o/$CharPM _value)
- (return (str "if(" (str "(" cursor-peek ").C") " !== " (pr-str (str _value)) ") { " pm-fail " }"))
+ (|do [=value (compile-char _value)]
+ (return (str "if(" (str "(" cursor-peek ").C") " !== " (str "(" =value ").C") ") { " pm-fail " }")))
(&o/$TextPM _value)
- (return (str "if(" cursor-peek " !== " (pr-str _value) ") { " pm-fail " }"))
+ (|do [=value (compile-text _value)]
+ (return (str "if(" cursor-peek " !== " =value ") { " pm-fail " }")))
(&o/$TuplePM _idx+)
(|let [[_idx is-tail?] (|case _idx+