aboutsummaryrefslogtreecommitdiff
path: root/lux-js/source
diff options
context:
space:
mode:
Diffstat (limited to 'lux-js/source')
-rw-r--r--lux-js/source/program.lux52
1 files changed, 26 insertions, 26 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux
index 9be0834a6..0156887b7 100644
--- a/lux-js/source/program.lux
+++ b/lux-js/source/program.lux
@@ -166,32 +166,32 @@
(def: (js_int value)
(-> Int org/openjdk/nashorn/api/scripting/JSObject)
- (<| (ffi.as org/openjdk/nashorn/api/scripting/JSObject)
+ (<| (ffi.is org/openjdk/nashorn/api/scripting/JSObject)
(ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject [IntValue]
[]
... Methods
(IntValue
[] (getValue self []) java/lang/Object
- (ffi.as java/lang/Object (ffi.as_long value)))
+ (ffi.is java/lang/Object (ffi.as_long value)))
(org/openjdk/nashorn/api/scripting/AbstractJSObject
[] (getMember self [member java/lang/String]) java/lang/Object
(case (ffi.of_string member)
(pattern (static runtime.i64_high_field))
(|> value .nat runtime.high jvm_int
- (ffi.as java/lang/Object))
+ (ffi.is java/lang/Object))
(pattern (static runtime.i64_low_field))
(|> value .nat runtime.low jvm_int
- (ffi.as java/lang/Object))
+ (ffi.is java/lang/Object))
_
(panic! (exception.error ..unknown_member [(ffi.of_string member)
- (ffi.as java/lang/Object (ffi.as_long value))]))))
+ (ffi.is java/lang/Object (ffi.as_long value))]))))
)))
(def: (::toString js_object)
(-> Any org/openjdk/nashorn/api/scripting/JSObject)
- (<| (ffi.as org/openjdk/nashorn/api/scripting/JSObject)
+ (<| (ffi.is org/openjdk/nashorn/api/scripting/JSObject)
(ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject []
[]
(org/openjdk/nashorn/api/scripting/AbstractJSObject
@@ -204,12 +204,12 @@
(|> js_object
debug.inspection
ffi.as_string
- (ffi.as java/lang/Object)))
+ (ffi.is java/lang/Object)))
)))
(def: (::slice js_object value)
(-> (-> java/lang/Object org/openjdk/nashorn/api/scripting/JSObject) (Array java/lang/Object) org/openjdk/nashorn/api/scripting/JSObject)
- (<| (ffi.as org/openjdk/nashorn/api/scripting/JSObject)
+ (<| (ffi.is org/openjdk/nashorn/api/scripting/JSObject)
(ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject []
[]
(org/openjdk/nashorn/api/scripting/AbstractJSObject
@@ -228,32 +228,32 @@
(ffi.as_int (.int (array.size value))))
(as java/lang/Object)
js_object
- (ffi.as java/lang/Object)))
+ (ffi.is java/lang/Object)))
)))
(def: (js_structure value)
(-> (Array java/lang/Object) org/openjdk/nashorn/api/scripting/JSObject)
(let [js_object (is (-> java/lang/Object org/openjdk/nashorn/api/scripting/JSObject)
(function (_ sub_value)
- (<| (case (ffi.check [java/lang/Object] sub_value)
+ (<| (case (ffi.is [java/lang/Object] sub_value)
{.#Some sub_value}
(|> sub_value (as (Array java/lang/Object)) js_structure)
{.#None})
- (case (ffi.check java/lang/Long sub_value)
+ (case (ffi.is java/lang/Long sub_value)
{.#Some sub_value}
(|> sub_value ffi.of_long js_int)
{.#None})
... else
(as org/openjdk/nashorn/api/scripting/JSObject sub_value))))]
- (<| (ffi.as org/openjdk/nashorn/api/scripting/JSObject)
+ (<| (ffi.is org/openjdk/nashorn/api/scripting/JSObject)
(ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject [StructureValue]
[]
... Methods
(StructureValue
[] (getValue self []) java/lang/Object
- (ffi.as java/lang/Object value))
+ (ffi.is java/lang/Object value))
(org/openjdk/nashorn/api/scripting/AbstractJSObject
[] (isArray self []) boolean
(ffi.as_boolean #1))
@@ -263,17 +263,17 @@
(case (ffi.of_string member)
(^.or "toJSON" "toString")
(|> (::toString value)
- (ffi.as java/lang/Object))
+ (ffi.is java/lang/Object))
"length"
(|> value
array.size
jvm_int
- (ffi.as java/lang/Object))
+ (ffi.is java/lang/Object))
"slice"
(|> (::slice js_object value)
- (ffi.as java/lang/Object))
+ (ffi.is java/lang/Object))
(pattern (static runtime.variant_tag_field))
(|> value
@@ -293,7 +293,7 @@
(array.read! 2)
maybe.trusted
js_object
- (ffi.as java/lang/Object))
+ (ffi.is java/lang/Object))
_
(panic! (exception.error ..unknown_member [(as Text member) (as java/lang/Object value)])))
@@ -313,7 +313,7 @@
(exception.report
"Class" (ffi.of_string (java/lang/Object::toString (java/lang/Object::getClass object)))
"Object" (ffi.of_string (java/lang/Object::toString object))
- "Keys" (case (ffi.check org/openjdk/nashorn/api/scripting/ScriptObjectMirror object)
+ "Keys" (case (ffi.is org/openjdk/nashorn/api/scripting/ScriptObjectMirror object)
{.#Some object}
(|> object
(org/openjdk/nashorn/api/scripting/ScriptObjectMirror::getOwnKeys true)
@@ -327,7 +327,7 @@
(-> Text org/openjdk/nashorn/api/scripting/ScriptObjectMirror (Maybe Int))
(|> i64
(org/openjdk/nashorn/api/scripting/JSObject::getMember [(ffi.as_string half)])
- (maybe#each (|>> (ffi.check java/lang/Number)))
+ (maybe#each (|>> (ffi.is java/lang/Number)))
maybe#conjoint
(maybe#each (|>> java/lang/Number::longValue ffi.of_long))))
@@ -353,7 +353,7 @@
(org/openjdk/nashorn/api/scripting/JSObject::getMember [(ffi.as_string runtime.variant_flag_field)] js_object)
(org/openjdk/nashorn/api/scripting/JSObject::getMember [(ffi.as_string runtime.variant_value_field)] js_object)]
(^.multi [{.#Some tag} ?flag {.#Some value}]
- [[(ffi.check java/lang/Number tag) (lux_object value)]
+ [[(ffi.is java/lang/Number tag) (lux_object value)]
[{.#Some tag} {try.#Success value}]])
{.#Some [(java/lang/Number::intValue (as java/lang/Number tag))
(maybe.else (ffi.null) ?flag)
@@ -374,7 +374,7 @@
(if (n.< num_keys idx)
(case (org/openjdk/nashorn/api/scripting/JSObject::getMember (ffi.as_string (%.nat idx)) js_object)
{.#Some member}
- (case (ffi.check org/openjdk/nashorn/internal/runtime/Undefined member)
+ (case (ffi.is org/openjdk/nashorn/internal/runtime/Undefined member)
{.#Some _}
(again (++ idx) output)
@@ -395,13 +395,13 @@
(-> java/lang/Object (Try Any))
(`` (<| (if (ffi.null? js_object)
(exception.except ..null_has_no_lux_representation [{.#None}]))
- (case (ffi.check org/openjdk/nashorn/internal/runtime/Undefined js_object)
+ (case (ffi.is org/openjdk/nashorn/internal/runtime/Undefined js_object)
{.#Some _}
(exception.except ..undefined_has_no_lux_representation [])
{.#None})
(~~ (template [<class>]
- [(case (ffi.check <class> js_object)
+ [(case (ffi.is <class> js_object)
{.#Some js_object}
{try.#Success js_object}
@@ -409,7 +409,7 @@
[java/lang/Boolean] [java/lang/String]))
(~~ (template [<class> <method>]
- [(case (ffi.check <class> js_object)
+ [(case (ffi.is <class> js_object)
{.#Some js_object}
{try.#Success (<method> js_object)}
@@ -418,7 +418,7 @@
[java/lang/Number java/lang/Number::doubleValue]
[StructureValue StructureValue::getValue]
[IntValue IntValue::getValue]))
- (case (ffi.check org/openjdk/nashorn/api/scripting/ScriptObjectMirror js_object)
+ (case (ffi.is org/openjdk/nashorn/api/scripting/ScriptObjectMirror js_object)
{.#Some js_object}
(case (check_int js_object)
{.#Some value}
@@ -451,7 +451,7 @@
(do maybe.monad
[function (|> function
(as java/lang/Object)
- (ffi.check org/openjdk/nashorn/api/scripting/JSObject))]
+ (ffi.is org/openjdk/nashorn/api/scripting/JSObject))]
(if (ffi.of_boolean (org/openjdk/nashorn/api/scripting/JSObject::isFunction function))
{.#Some function}
{.#None})))