aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux16
1 files changed, 10 insertions, 6 deletions
diff --git a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux
index c42ba0668..8be5667e9 100644
--- a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux
@@ -11,6 +11,15 @@
(lang (host [lua #+ Lua Expression Statement])))
[//])
+(do-template [<name>]
+ [(exception: #export (<name> {message Text})
+ message)]
+
+ [Unknown-Kind-Of-Host-Object]
+ [Null-Has-No-Lux-Representation]
+ [Cannot-Evaluate]
+ )
+
(host.import java/lang/Object
(toString [] String)
(getClass [] (Class Object)))
@@ -64,9 +73,6 @@
(recur num-keys (n/inc idx) output))
(#.Some output)))))
-(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)
@@ -99,11 +105,9 @@
(ex.throw Unknown-Kind-Of-Host-Object (format "FIRST " (Object::toString [] (:! Object host-object))))
)))
-(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 (format "return " code ";"))
(#e.Error error)