aboutsummaryrefslogtreecommitdiff
path: root/lux-js
diff options
context:
space:
mode:
authorEduardo Julian2022-02-16 04:41:41 -0400
committerEduardo Julian2022-02-16 04:41:41 -0400
commitde8af6044d590354563f4ea8849d98e8637c034a (patch)
tree7ac4dc03830fc4f8154ec7e31a3971e5b7a5a923 /lux-js
parentb68f2b6aead6224c14902c80fc00c27705eece6c (diff)
FIXED loop binding initialization in several back-ends.
Diffstat (limited to 'lux-js')
-rw-r--r--lux-js/source/program.lux24
1 files changed, 14 insertions, 10 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux
index 824113da5..36e2fd023 100644
--- a/lux-js/source/program.lux
+++ b/lux-js/source/program.lux
@@ -42,7 +42,7 @@
[language
[lux
[program {"+" Program}]
- [generation {"+" Context Host}]
+ [generation {"+" Host}]
[analysis
[macro {"+" Expander}]]
[phase
@@ -60,7 +60,8 @@
["[0]" platform {"+" Platform}]]
[meta
["[0]" cli]
- [archive {"+" Archive}]
+ [archive {"+" Archive}
+ ["[0]" unit]]
["[0]" packager "_"
["[1]" script]]]]]]]
[program
@@ -472,7 +473,7 @@
(for [@.old
(as_is (def: (evaluate! interpreter alias input)
- (-> javax/script/ScriptEngine Context _.Expression (Try Any))
+ (-> javax/script/ScriptEngine unit.ID _.Expression (Try Any))
(do try.monad
[?output (javax/script/ScriptEngine::eval (_.code input) interpreter)]
(case ?output
@@ -489,7 +490,7 @@
(in [])))
(def: (define! interpreter context custom input)
- (-> javax/script/ScriptEngine Context (Maybe Text) _.Expression (Try [Text Any _.Statement]))
+ (-> javax/script/ScriptEngine unit.ID (Maybe Text) _.Expression (Try [Text Any _.Statement]))
(let [global (maybe.else (reference.artifact context)
custom)
@global (_.var global)]
@@ -533,7 +534,7 @@
{.#Some return}))))
(def: (evaluate! alias input)
- (-> Context _.Expression (Try Any))
+ (-> unit.ID _.Expression (Try Any))
(do try.monad
[?output (..eval (_.code input))]
(case ?output
@@ -550,7 +551,7 @@
(in [])))
(def: (define! context custom input)
- (-> Context (Maybe Text) _.Expression (Try [Text Any _.Statement]))
+ (-> unit.ID (Maybe Text) _.Expression (Try [Text Any _.Statement]))
(let [global (maybe.else (reference.artifact context)
custom)
@global (_.var global)]
@@ -599,7 +600,9 @@
[host ..host]
(in [platform.#&file_system (for [@.old (file.async file.default)
@.jvm (file.async file.default)
- @.js file.default])
+ ... TODO: Handle this in a safer manner.
+ ... This would crash if the compiler was run on a browser.
+ @.js (maybe.trusted file.default)])
platform.#host host
platform.#phase js.generate
platform.#runtime runtime.generate
@@ -670,13 +673,14 @@
(program: [service cli.service]
(let [extension ".js"]
(exec (do async.monad
- [_ (/.compiler [/static.#host @.js
+ [platform (async.future ..platform)
+ _ (/.compiler [/static.#host @.js
/static.#host_module_extension extension
/static.#target (cli.target service)
/static.#artifact_extension extension]
..expander
analysis.bundle
- ..platform
+ (io.io platform)
generation.bundle
(function.constant extension/bundle.empty)
..program
@@ -685,7 +689,7 @@
service
[(packager.package _.use_strict _.code _.then ..scope)
(format (cli.target service)
- (# file.default separator)
+ (# (value@ platform.#&file_system platform) separator)
"program"
extension)])]
(..declare_success! []))