diff options
Diffstat (limited to 'stdlib/source/lux/debug.lux')
-rw-r--r-- | stdlib/source/lux/debug.lux | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/stdlib/source/lux/debug.lux b/stdlib/source/lux/debug.lux index 47e104842..135e33251 100644 --- a/stdlib/source/lux/debug.lux +++ b/stdlib/source/lux/debug.lux @@ -28,31 +28,31 @@ [macro ["." template]]]) -(with-expansions [<for-jvm> (as-is (import: #long java/lang/String) +(with-expansions [<jvm> (as-is (import: #long java/lang/String) - (import: #long (java/lang/Class a) - (getCanonicalName [] java/lang/String)) + (import: #long (java/lang/Class a) + (getCanonicalName [] java/lang/String)) - (import: #long java/lang/Object - (new []) - (toString [] java/lang/String) - (getClass [] (java/lang/Class java/lang/Object))) + (import: #long java/lang/Object + (new []) + (toString [] java/lang/String) + (getClass [] (java/lang/Class java/lang/Object))) - (import: #long java/lang/Integer - (longValue [] long)) + (import: #long java/lang/Integer + (longValue [] long)) - (import: #long java/lang/Long - (intValue [] int)) + (import: #long java/lang/Long + (intValue [] int)) - (import: #long java/lang/Number - (intValue [] int) - (longValue [] long) - (doubleValue [] double)))] + (import: #long java/lang/Number + (intValue [] int) + (longValue [] long) + (doubleValue [] double)))] (for {@.old - (as-is <for-jvm>) + (as-is <jvm>) @.jvm - (as-is <for-jvm>) + (as-is <jvm>) @.js (as-is (import: JSON @@ -72,46 +72,46 @@ (def: #export (inspect value) Inspector - (with-expansions [<for-jvm> (let [object (:coerce java/lang/Object value)] - (`` (<| (~~ (template [<class> <processing>] - [(case (host.check <class> object) - (#.Some value) - (`` (|> value (~~ (template.splice <processing>)))) - #.None)] - - [java/lang/Boolean [(:coerce .Bit) %.bit]] - [java/lang/String [(:coerce .Text) %.text]] - [java/lang/Long [(:coerce .Int) %.int]] - [java/lang/Number [java/lang/Number::doubleValue %.frac]] - )) - (case (host.check [java/lang/Object] object) - (#.Some value) - (let [value (:coerce (array.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 (%.nat (.nat (java/lang/Integer::longValue tag))) - " " (%.bit last?) - " " (inspect choice)) - (text.enclose ["(" ")"]))) - - _ - (inspect-tuple inspect value))) - #.None) - (java/lang/Object::toString object))))] + (with-expansions [<jvm> (let [object (:coerce java/lang/Object value)] + (`` (<| (~~ (template [<class> <processing>] + [(case (host.check <class> object) + (#.Some value) + (`` (|> value (~~ (template.splice <processing>)))) + #.None)] + + [java/lang/Boolean [(:coerce .Bit) %.bit]] + [java/lang/String [(:coerce .Text) %.text]] + [java/lang/Long [(:coerce .Int) %.int]] + [java/lang/Number [java/lang/Number::doubleValue %.frac]] + )) + (case (host.check [java/lang/Object] object) + (#.Some value) + (let [value (:coerce (array.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 (%.nat (.nat (java/lang/Integer::longValue tag))) + " " (%.bit last?) + " " (inspect choice)) + (text.enclose ["(" ")"]))) + + _ + (inspect-tuple inspect value))) + #.None) + (java/lang/Object::toString object))))] (for {@.old - <for-jvm> + <jvm> @.jvm - <for-jvm> + <jvm> @.js (case (host.type-of value) |