aboutsummaryrefslogtreecommitdiff
path: root/luxc/src/lux/compiler/js/proc/common.clj
diff options
context:
space:
mode:
authorEduardo Julian2017-02-26 20:17:23 -0400
committerEduardo Julian2017-02-26 20:17:23 -0400
commit2f77d20394274e89da509716b4cf78fba9724e46 (patch)
tree323f1da5f3c7702c2498a35319c2cd99796b6669 /luxc/src/lux/compiler/js/proc/common.clj
parent79c10caf4c7e370dc53c4c60c57cc16ccec48773 (diff)
- Added try-catch procedure to JS backend.
Diffstat (limited to '')
-rw-r--r--luxc/src/lux/compiler/js/proc/common.clj8
1 files changed, 7 insertions, 1 deletions
diff --git a/luxc/src/lux/compiler/js/proc/common.clj b/luxc/src/lux/compiler/js/proc/common.clj
index a1b26a45b..08bf94b04 100644
--- a/luxc/src/lux/compiler/js/proc/common.clj
+++ b/luxc/src/lux/compiler/js/proc/common.clj
@@ -49,6 +49,11 @@
=right (compile ?right)]
(return (str "(" =left " === " =right ")"))))
+(defn ^:private compile-lux-try [compile ?values special-args]
+ (|do [:let [(&/$Cons ?op (&/$Nil)) ?values]
+ =op (compile ?op)]
+ (return (str "LuxRT.runTry(" =op ")"))))
+
(defn ^:private compile-array-new [compile ?values special-args]
(|do [:let [(&/$Cons ?length (&/$Nil)) ?values]
=length (compile ?length)]
@@ -496,7 +501,8 @@
(case category
"lux"
(case proc
- "is" (compile-lux-is compile ?values special-args))
+ "is" (compile-lux-is compile ?values special-args)
+ "try" (compile-lux-try compile ?values special-args))
"io"
(case proc