diff options
| author | Eduardo Julian | 2018-07-03 18:40:16 -0400 | 
|---|---|---|
| committer | Eduardo Julian | 2018-07-03 18:40:16 -0400 | 
| commit | d3f5e1f4baa667bc2eb72edd542cf5d8cd3924ce (patch) | |
| tree | 2aa771401cce0d08276abc072b9d31e00a651f29 /new-luxc/source/luxc/lang/translation/r/eval.jvm.lux | |
| parent | bfd2d6c203042dfddb0ce29db3696365fe213314 (diff) | |
- Re-named ":!" to ":coerce".
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/r/eval.jvm.lux')
| -rw-r--r-- | new-luxc/source/luxc/lang/translation/r/eval.jvm.lux | 44 | 
1 files changed, 22 insertions, 22 deletions
diff --git a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux index e3a255e41..eb20d73c5 100644 --- a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux @@ -51,21 +51,21 @@  (def: (parse-tuple lux-object host-object)    (-> (-> Object (Error Any)) ListVector (Error Any)) -  (let [size (:! Nat (ListVector::length [] host-object))] +  (let [size (:coerce Nat (ListVector::length [] host-object))]      (loop [idx +0 -           output (:! (Array Any) (array.new size))] +           output (:coerce (Array Any) (array.new size))]        (if (n/< size idx) -        (case (ListVector::getElementAsSEXP [(:! Int idx)] host-object) +        (case (ListVector::getElementAsSEXP [(:coerce Int idx)] host-object)            (#e.Error error)            (#e.Error error)            (#e.Success value) -          (case (lux-object (:! Object value)) +          (case (lux-object (:coerce Object value))              (#e.Error error)              (#e.Error error)              (#e.Success lux-value) -            (recur (inc idx) (array.write idx (:! Any lux-value) output)))) +            (recur (inc idx) (array.write idx (:coerce Any lux-value) output))))          (#e.Success output)))))  (def: (parse-variant lux-object host-object) @@ -74,9 +74,9 @@      [tag (ListVector::get-field-sexp [//.variant-tag-field] host-object)       flag (ListVector::get-field-sexp [//.variant-flag-field] host-object)       value (ListVector::get-field-sexp [//.variant-value-field] host-object) -     value (lux-object (:! Object value))] +     value (lux-object (:coerce Object value))]      (wrap [(|> tag -               (:! IntArrayVector) +               (:coerce IntArrayVector)                 (IntArrayVector::getElementAsInt [0])                 (Long::intValue []))             (: Any @@ -90,35 +90,35 @@    (do e.Monad<Error>      [high (ListVector::get-field-sexp [//.int-high-field] host-object)       low (ListVector::get-field-sexp [//.int-low-field] host-object) -     #let [get-int-32 (|>> (IntArrayVector::getElementAsInt [0]) (:! Nat)) -           high (get-int-32 (:! IntArrayVector high)) -           low (get-int-32 (:! IntArrayVector low))]] -    (wrap (:! Int +     #let [get-int-32 (|>> (IntArrayVector::getElementAsInt [0]) (:coerce Nat)) +           high (get-int-32 (:coerce IntArrayVector high)) +           low (get-int-32 (:coerce IntArrayVector low))]] +    (wrap (:coerce Int                (n/+ (|> high (bit.left-shift +32)) -                   (if (i/< 0 (:! Int low)) +                   (if (i/< 0 (:coerce Int low))                       (|> low (bit.left-shift +32) (bit.logical-right-shift +32))                       low))))))  (def: (lux-object host-object)    (-> Object (Error Any))    (cond (host.instance? StringArrayVector host-object) -        (#e.Success (StringArrayVector::getElementAsString [0] (:! StringArrayVector host-object))) +        (#e.Success (StringArrayVector::getElementAsString [0] (:coerce StringArrayVector host-object)))          (host.instance? LogicalArrayVector host-object) -        (#e.Success (i/= 1 (LogicalArrayVector::getElementAsRawLogical [0] (:! LogicalArrayVector host-object)))) +        (#e.Success (i/= 1 (LogicalArrayVector::getElementAsRawLogical [0] (:coerce LogicalArrayVector host-object))))          (host.instance? IntArrayVector host-object) -        (#e.Success (IntArrayVector::getElementAsInt [0] (:! IntArrayVector host-object))) +        (#e.Success (IntArrayVector::getElementAsInt [0] (:coerce IntArrayVector host-object)))          (host.instance? DoubleArrayVector host-object) -        (#e.Success (DoubleArrayVector::getElementAsDouble [0] (:! DoubleArrayVector host-object))) +        (#e.Success (DoubleArrayVector::getElementAsDouble [0] (:coerce DoubleArrayVector host-object)))          (host.instance? ListVector host-object) -        (case (parse-int (:! ListVector host-object)) +        (case (parse-int (:coerce ListVector host-object))            (#e.Error error) -          (case (parse-variant lux-object (:! ListVector host-object)) +          (case (parse-variant lux-object (:coerce ListVector host-object))              (#e.Error error) -            (parse-tuple lux-object (:! ListVector host-object)) +            (parse-tuple lux-object (:coerce ListVector host-object))              output              output) @@ -127,14 +127,14 @@            output)          ## else -        (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) -              text-representation (:! Text (Object::toString [] (:! Object host-object)))] +        (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) +              text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))]            (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation)))))  (def: #export (eval code)    (-> Expression (Meta Any))    (function (_ compiler) -    (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] +    (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))]        (case (interpreter code)          (#e.Error error)          (exec (log! (format "eval #e.Error\n"  | 
