From 4610968193df10af12c91f699fec39aeb3ef703a Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 10 Jul 2021 03:10:43 -0400 Subject: Made the "try" macro into a common one, instead of a host-specific one. --- lux-js/source/program.lux | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lux-js/source') 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) -- cgit v1.2.3