aboutsummaryrefslogtreecommitdiff
path: root/lux-php/source
diff options
context:
space:
mode:
authorEduardo Julian2021-07-11 01:51:04 -0400
committerEduardo Julian2021-07-11 01:51:04 -0400
commitabe24425ced15fd784ef6c62d6f186af72b491db (patch)
tree42b6e3cbd179c83fae8941fa4b128b13afc766f5 /lux-php/source
parent4610968193df10af12c91f699fec39aeb3ef703a (diff)
Re-named ":coerce" to ":as" since it technically doesn't do coercions.
Diffstat (limited to 'lux-php/source')
-rw-r--r--lux-php/source/program.lux54
1 files changed, 27 insertions, 27 deletions
diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux
index b97adb407..ebcc8be25 100644
--- a/lux-php/source/program.lux
+++ b/lux-php/source/program.lux
@@ -186,7 +186,7 @@
(php/runtime/memory/NullMemory::INSTANCE))
(case (ffi.check java/lang/Boolean value)
(#.Some value)
- (if (:coerce Bit value)
+ (if (:as Bit value)
(php/runtime/memory/TrueMemory::INSTANCE)
(php/runtime/memory/FalseMemory::INSTANCE))
@@ -208,7 +208,7 @@
#.None)
(case (ffi.check [java/lang/Object] value)
(#.Some value)
- (lux_structure (:coerce (Array java/lang/Object) value))
+ (lux_structure (:as (Array java/lang/Object) value))
#.None)
(case (ffi.check php/runtime/memory/ObjectMemory value)
@@ -276,12 +276,12 @@
{trace php/runtime/env/TraceInfo}
{index java/lang/String})
php/runtime/Memory
- (case (:coerce Text index)
+ (case (:as Text index)
(^ (static runtime.variant_tag_field))
(|> value
(array.read 0)
maybe.assume
- (:coerce java/lang/Integer)
+ (:as java/lang/Integer)
php/runtime/memory/LongMemory::valueOf)
(^ (static runtime.variant_flag_field))
@@ -309,15 +309,15 @@
(-> Reader php/runtime/memory/ArrayMemory (Try Any))
(let [size (|> host_object
php/runtime/memory/ArrayMemory::size
- (:coerce Nat)
+ (:as Nat)
dec)]
(loop [idx 0
- output (:coerce (Array Any) (array.new size))]
+ output (:as (Array Any) (array.new size))]
(if (n.< size idx)
(let [value (|> host_object
(php/runtime/memory/ArrayMemory::get (php/runtime/memory/LongMemory::new (.int idx)))
maybe.assume
- (:coerce php/runtime/memory/ReferenceMemory)
+ (:as php/runtime/memory/ReferenceMemory)
php/runtime/memory/ReferenceMemory::getValue)]
(case (ffi.check php/runtime/memory/NullMemory value)
(#.Some _)
@@ -352,12 +352,12 @@
maybe.assume
read)]
[(#try.Success tag) (#try.Success value)]
- (#try.Success [(java/lang/Long::intValue (:coerce java/lang/Long tag))
+ (#try.Success [(java/lang/Long::intValue (:as java/lang/Long tag))
(: Any
(case (|> host_object
(php/runtime/memory/ArrayMemory::get ..variant_flag_field)
maybe.assume
- (:coerce php/runtime/memory/ReferenceMemory)
+ (:as php/runtime/memory/ReferenceMemory)
php/runtime/memory/ReferenceMemory::getValue
(ffi.check php/runtime/memory/NullMemory))
(#.Some _)
@@ -429,7 +429,7 @@
(def: (ensure_macro macro)
(-> Macro (Maybe php/runtime/memory/ObjectMemory))
(|> macro
- (:coerce java/lang/Object)
+ (:as java/lang/Object)
(ffi.check php/runtime/memory/ObjectMemory)))
(def: interpreter
@@ -442,7 +442,7 @@
(java/lang/Class::getDeclaredField "environment")
(exec> [(java/lang/reflect/AccessibleObject::setAccessible true)])
(java/lang/reflect/Field::get ..interpreter)
- (:coerce php/runtime/env/Environment)))
+ (:as php/runtime/env/Environment)))
(def: (call_macro inputs lux macro)
(-> (List Code) Lux php/runtime/memory/ObjectMemory (Try (Try [Lux (List Code)])))
@@ -451,11 +451,11 @@
[output (php/runtime/lang/Closure::call ..default_environment
(|> (ffi.array php/runtime/Memory 3)
(ffi.array_write 0 macro)
- (ffi.array_write 1 (lux_structure (:coerce (Array java/lang/Object) inputs)))
- (ffi.array_write 2 (lux_structure (:coerce (Array java/lang/Object) lux))))
- (:coerce php/runtime/lang/Closure
- (php/runtime/memory/ObjectMemory::value macro)))]
- (..read (:coerce java/lang/Object output)))))
+ (ffi.array_write 1 (lux_structure (:as (Array java/lang/Object) inputs)))
+ (ffi.array_write 2 (lux_structure (:as (Array java/lang/Object) lux))))
+ (:as php/runtime/lang/Closure
+ (php/runtime/memory/ObjectMemory::value macro)))]
+ (..read (:as java/lang/Object output)))))
(def: (expander macro inputs lux)
Expander
@@ -464,7 +464,7 @@
(call_macro inputs lux macro)
#.None
- (exception.throw ..cannot_apply_a_non_function (:coerce java/lang/Object macro))))
+ (exception.throw ..cannot_apply_a_non_function (:as java/lang/Object macro))))
(def: host
(IO (Host _.Expression _.Statement))
@@ -490,7 +490,7 @@
(wrap [global value definition]))))
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.assume (:coerce _.Statement)))
+ (|> content (\ utf8.codec decode) try.assume (:as _.Statement)))
(def: (re_learn context content)
(run! content))
@@ -520,21 +520,21 @@
(def: extender
Extender
## TODO: Stop relying on coercions ASAP.
- (<| (:coerce Extender)
+ (<| (:as Extender)
(function (@self handler))
- (:coerce Handler)
+ (:as Handler)
(function (@self name phase))
- (:coerce Phase)
+ (:as Phase)
(function (@self archive parameters))
- (:coerce Operation)
+ (:as Operation)
(function (@self state))
- (:coerce Try)
+ (:as Try)
try.assume
- (:coerce Try)
+ (:as Try)
(do try.monad
[handler (try.from_maybe (..ensure_macro handler))
#let [to_php (: (-> Any php/runtime/Memory)
- (|>> (:coerce (Array java/lang/Object)) lux_structure (:coerce php/runtime/Memory)))]
+ (|>> (:as (Array java/lang/Object)) lux_structure (:as php/runtime/Memory)))]
output (php/runtime/lang/Closure::call ..default_environment
(|> (ffi.array php/runtime/Memory 6)
(ffi.array_write 0 handler)
@@ -543,8 +543,8 @@
(ffi.array_write 3 (to_php archive))
(ffi.array_write 4 (to_php parameters))
(ffi.array_write 5 (to_php state)))
- (:coerce php/runtime/lang/Closure
- (php/runtime/memory/ObjectMemory::value handler)))]
+ (:as php/runtime/lang/Closure
+ (php/runtime/memory/ObjectMemory::value handler)))]
(..read output))))
@.php