From de8af6044d590354563f4ea8849d98e8637c034a Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 16 Feb 2022 04:41:41 -0400 Subject: FIXED loop binding initialization in several back-ends. --- lux-js/source/program.lux | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'lux-js') 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! [])) -- cgit v1.2.3