diff options
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux index bce63ce9c..348e5bcf9 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux @@ -11,6 +11,16 @@ (lang (host [ruby #+ Ruby Expression Statement]))) [//]) +(do-template [<name>] + [(exception: #export (<name> {message Text}) + message)] + + [Not-A-Variant] + [Unknown-Kind-Of-Host-Object] + [Null-Has-No-Lux-Representation] + [Cannot-Evaluate] + ) + (host.import java/lang/Object (toString [] String) (getClass [] (Class Object))) @@ -44,8 +54,6 @@ (recur (n/inc idx) (array.write idx lux-value output)))) (#e.Success output))))) -(exception: #export Not-A-Variant) - (def: (variant lux-object host-object) (-> (-> Object (Error Top)) RubyHash (Error Top)) (case [(RubyHash::get [(:! Object //.variant-tag-field)] host-object) @@ -61,9 +69,6 @@ _ (ex.throw Not-A-Variant ""))) -(exception: #export Unknown-Kind-Of-Host-Object) -(exception: #export Null-Has-No-Lux-Representation) - (def: (lux-object host-object) (-> Object (Error Top)) (`` (cond (host.null? host-object) @@ -94,11 +99,9 @@ (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation))) ))) -(exception: #export Cannot-Evaluate) - (def: #export (eval code) (-> Expression (Meta Top)) - (function [compiler] + (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) @@ -111,7 +114,7 @@ (case (lux-object (:! Object output)) (#e.Success parsed-output) (exec ## (log! (format "eval #e.Success\n" - ## "<< " code)) + ## "<< " code)) (#e.Success [compiler parsed-output])) (#e.Error error) |