aboutsummaryrefslogtreecommitdiff
path: root/lux-js
diff options
context:
space:
mode:
Diffstat (limited to 'lux-js')
-rw-r--r--lux-js/source/program.lux49
1 files changed, 2 insertions, 47 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux
index a55c29aa6..1a2bfc8d8 100644
--- a/lux-js/source/program.lux
+++ b/lux-js/source/program.lux
@@ -20,6 +20,7 @@
["." template]]
[world
["." file]]
+ ["." debug]
["." host (#+ import: interface: do-to object)
["_" js]]
[tool
@@ -123,52 +124,6 @@
(error! (exception.construct unknown-member [member (:coerce java/lang/Object value)]))))
))
-(def: (inspect object)
- (-> java/lang/Object Text)
- (<| (case (host.check java/lang/Boolean object)
- (#.Some value)
- (%b value)
- #.None)
- (case (host.check java/lang/String object)
- (#.Some value)
- (%t value)
- #.None)
- (case (host.check java/lang/Long object)
- (#.Some value)
- (%i (.int value))
- #.None)
- (case (host.check java/lang/Number object)
- (#.Some value)
- (%f (java/lang/Number::doubleValue value))
- #.None)
- (case (host.check (Array java/lang/Object) object)
- (#.Some value)
- (let [value (:coerce (Array java/lang/Object) value)]
- (case (array.read 0 value)
- (^multi (#.Some tag)
- [(host.check java/lang/Integer tag)
- (#.Some tag)]
- [[(array.read 1 value)
- (array.read 2 value)]
- [last?
- (#.Some choice)]])
- (let [last? (case last?
- (#.Some _) #1
- #.None #0)]
- (|> (format (%n (.nat (java/lang/Integer::longValue tag)))
- " " (%b last?)
- " " (inspect choice))
- (text.enclose ["(" ")"])))
-
- _
- (|> value
- array.to-list
- (list/map inspect)
- (text.join-with " ")
- (text.enclose ["[" "]"]))))
- #.None)
- (java/lang/Object::toString object)))
-
(def: (::toString js-object)
(-> Any jdk/nashorn/api/scripting/JSObject)
(object [] jdk/nashorn/api/scripting/AbstractJSObject []
@@ -178,7 +133,7 @@
#1)
(jdk/nashorn/api/scripting/AbstractJSObject
(call {this java/lang/Object} {args (Array java/lang/Object)}) java/lang/Object
- (inspect (:coerce java/lang/Object js-object)))
+ (debug.inspect js-object))
))
(def: (::slice js-object value)