diff options
author | Eduardo Julian | 2017-02-26 18:48:33 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-02-26 18:48:33 -0400 |
commit | 8fafa00056cbd4b0a3da77258e4d258a2f25767e (patch) | |
tree | 8c4d6e1f1acb199aced7608eb458f138c1a6d2f3 | |
parent | 78e43d0be6fac5b8513e9dc4081a10391632feaa (diff) |
- Implemented new IO procedures for JS.
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/compiler/js/proc/common.clj | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/luxc/src/lux/compiler/js/proc/common.clj b/luxc/src/lux/compiler/js/proc/common.clj index 942f24c79..a1b26a45b 100644 --- a/luxc/src/lux/compiler/js/proc/common.clj +++ b/luxc/src/lux/compiler/js/proc/common.clj @@ -392,6 +392,15 @@ =message (compile ?message)] (return (str "LuxRT.error(" =message ")")))) +(defn ^:private compile-io-exit [compile ?values special-args] + (|do [:let [(&/$Cons ?code (&/$Nil)) ?values] + =code (compile ?code)] + (return (str "(process && process.exit && process.exit(LuxRT.fromNumberI64(" =code ")))")))) + +(defn ^:private compile-io-current-time [compile ?values special-args] + (|do [:let [(&/$Nil) ?values]] + (return (str "LuxRT.toNumberI64(" "(new Date()).getTime()" ")")))) + (defn ^:private compile-atom-new [compile ?values special-args] (|do [:let [(&/$Cons ?init (&/$Nil)) ?values] =init (compile ?init)] @@ -492,7 +501,9 @@ "io" (case proc "log" (compile-io-log compile ?values special-args) - "error" (compile-io-error compile ?values special-args)) + "error" (compile-io-error compile ?values special-args) + "exit" (compile-io-exit compile ?values special-args) + "current-time" (compile-io-current-time compile ?values special-args)) "text" (case proc |