aboutsummaryrefslogtreecommitdiff
path: root/lux-js/source
diff options
context:
space:
mode:
authorEduardo Julian2021-07-17 22:48:54 -0400
committerEduardo Julian2021-07-17 22:48:54 -0400
commit442d1557b879a8a4bd76f441f72a17bfb71cf05f (patch)
tree7726138a487b3d64081c2cfdf99a564cf2b6ed7b /lux-js/source
parent2c99b4515447315d76a8dc203a2dbcafc09506ea (diff)
Now allowing compilers to generate custom-named outputs.
Diffstat (limited to 'lux-js/source')
-rw-r--r--lux-js/source/program.lux22
1 files changed, 12 insertions, 10 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux
index 6163c2dfa..295aba2ce 100644
--- a/lux-js/source/program.lux
+++ b/lux-js/source/program.lux
@@ -465,9 +465,10 @@
[?output (javax/script/ScriptEngine::eval (_.code input) interpreter)]
(wrap [])))
- (def: (define! interpreter context input)
- (-> javax/script/ScriptEngine Context _.Expression (Try [Text Any _.Statement]))
- (let [global (reference.artifact context)
+ (def: (define! interpreter context custom input)
+ (-> javax/script/ScriptEngine Context (Maybe Text) _.Expression (Try [Text Any _.Statement]))
+ (let [global (maybe.default (reference.artifact context)
+ custom)
@global (_.var global)]
(do try.monad
[#let [definition (_.define @global input)]
@@ -488,10 +489,10 @@
(def: (ingest context content)
(|> content (\ utf8.codec decode) try.assume (:as _.Statement)))
- (def: (re_learn context content)
+ (def: (re_learn context custom content)
(..execute! interpreter content))
- (def: (re_load context content)
+ (def: (re_load context custom content)
(do try.monad
[_ (..execute! interpreter content)]
(..evaluate! interpreter context (_.var (reference.artifact context))))))))))
@@ -525,9 +526,10 @@
[?output (..eval (_.code input))]
(wrap [])))
- (def: (define! context input)
- (-> Context _.Expression (Try [Text Any _.Statement]))
- (let [global (reference.artifact context)
+ (def: (define! context custom input)
+ (-> Context (Maybe Text) _.Expression (Try [Text Any _.Statement]))
+ (let [global (maybe.default (reference.artifact context)
+ custom)
@global (_.var global)]
(do try.monad
[#let [definition (_.define @global input)]
@@ -546,10 +548,10 @@
(def: (ingest context content)
(|> content (\ utf8.codec decode) try.assume (:as _.Statement)))
- (def: (re_learn context content)
+ (def: (re_learn context custom content)
(..execute! content))
- (def: (re_load context content)
+ (def: (re_load context custom content)
(do try.monad
[_ (..execute! content)]
(..evaluate! context (_.var (reference.artifact context)))))))))