aboutsummaryrefslogtreecommitdiff
path: root/lux-js/source
diff options
context:
space:
mode:
authorEduardo Julian2021-07-10 03:10:43 -0400
committerEduardo Julian2021-07-10 03:10:43 -0400
commit4610968193df10af12c91f699fec39aeb3ef703a (patch)
tree27d1578548ad49f5aefe76fb696a7af10361c9cf /lux-js/source
parentf3e869d0246e956399ec31a074c6c6299ff73602 (diff)
Made the "try" macro into a common one, instead of a host-specific one.
Diffstat (limited to 'lux-js/source')
-rw-r--r--lux-js/source/program.lux14
1 files changed, 7 insertions, 7 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux
index 52e923892..43ced94d8 100644
--- a/lux-js/source/program.lux
+++ b/lux-js/source/program.lux
@@ -498,19 +498,19 @@
@.js
(as_is (def: (eval code)
- (-> Text (Maybe Any))
+ (-> Text (Try (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))))
+ (try (let [return ("js apply" (function.identity ("js constant" "eval")) code)]
+ (if ("js object null?" return)
+ #.None
+ (#.Some return)))))
(def: (evaluate! alias input)
(-> Context _.Expression (Try Any))
(do try.monad
- [?output (ffi.try (..eval (_.code input)))]
+ [?output (..eval (_.code input))]
(case ?output
(#.Some output)
(wrap output)
@@ -521,7 +521,7 @@
(def: (execute! input)
(-> _.Statement (Try Any))
(do try.monad
- [?output (ffi.try (..eval (_.code input)))]
+ [?output (..eval (_.code input))]
(wrap [])))
(def: (define! context input)