diff options
author | Eduardo Julian | 2020-07-24 23:37:00 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-07-24 23:37:00 -0400 |
commit | 268c21aa6867263b890f5dd2b3038a675bc915f7 (patch) | |
tree | ec3f273bb5cac68142001f0f59d2b13490c6b148 /lux-js | |
parent | 80c727065593a4cadcb1d72c38c8ad5c3bf85acc (diff) |
Can get the JS(JS) compiler to compile.
Diffstat (limited to 'lux-js')
-rw-r--r-- | lux-js/source/program.lux | 13 |
1 files changed, 11 insertions, 2 deletions
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 |