aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/host/js.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/host/js.lux26
1 files changed, 21 insertions, 5 deletions
diff --git a/stdlib/source/lux/host/js.lux b/stdlib/source/lux/host/js.lux
index b297be69a..e61ce7985 100644
--- a/stdlib/source/lux/host/js.lux
+++ b/stdlib/source/lux/host/js.lux
@@ -29,16 +29,16 @@
(`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+)))))]
[Expression Expression' [Code]]
- [Location Location' [Expression' Code]]
+ [Computation Computation' [Expression' Code]]
+ [Location Location' [Computation' Expression' Code]]
)
(do-template [<type> <brand> <super>+]
[(abstract: #export <brand> {} Any)
(`` (type: #export <type> (|> <brand> (~~ (template.splice <super>+)))))]
- [Var Var' [Location' Expression' Code]]
- [Access Access' [Location' Expression' Code]]
- [Computation Computation' [Expression' Code]]
+ [Var Var' [Location' Computation' Expression' Code]]
+ [Access Access' [Location' Computation' Expression' Code]]
[Statement Statement' [Code]]
)
@@ -109,7 +109,7 @@
(:abstraction (format (:representation object) "." field)))
(def: #export (do method inputs object)
- (-> Text (List Expression) Expression Access)
+ (-> Text (List Expression) Expression Computation)
(|> (format (:representation (..the method object))
(|> inputs
(list/map ..code)
@@ -131,6 +131,12 @@
(-> Text Var)
(|>> :abstraction))
+ (def: #export (, pre post)
+ (-> Expression Expression Computation)
+ (|> (format (:representation pre) ", " (:representation post))
+ ..argument
+ :abstraction))
+
(def: #export (then pre post)
(-> Statement Statement Statement)
(:abstraction (format (text.suffix ..statement-suffix
@@ -260,6 +266,16 @@
..argument
:abstraction))
+ (def: #export (new constructor inputs)
+ (-> Expression (List Expression) Computation)
+ (|> (format "new " (:representation constructor)
+ (|> inputs
+ (list/map ..code)
+ (text.join-with ..argument-separator)
+ ..argument))
+ ..argument
+ :abstraction))
+
(def: #export statement
(-> Expression Statement)
(|>> :transmutation))