From 268c21aa6867263b890f5dd2b3038a675bc915f7 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 24 Jul 2020 23:37:00 -0400 Subject: Can get the JS(JS) compiler to compile. --- lux-js/source/program.lux | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lux-js/source') diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index 14e3b812e..3232e6c82 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -8,6 +8,7 @@ ["." try (#+ Try)] ["." exception (#+ exception:)] ["." io (#+ IO io)] + ["." function] [parser [cli (#+ program:)]] [concurrency @@ -481,8 +482,16 @@ ) @.js - (as-is (import: (eval [Text] #? Any)) - + (as-is (def: (eval code) + (-> Text (Maybe Any)) + ## Note: I have to call "eval" this way + ## in order to avoid a quirk of calling eval in Node + ## when the code is running under "use strict";. + (let [return ("js apply" (function.identity ("js constant" "eval")) code)] + (if ("js object null?" return) + #.None + (#.Some return)))) + (def: (evaluate! alias input) (-> Text _.Expression (Try Any)) (do try.monad -- cgit v1.2.3