From abe24425ced15fd784ef6c62d6f186af72b491db Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 11 Jul 2021 01:51:04 -0400 Subject: Re-named ":coerce" to ":as" since it technically doesn't do coercions. --- lux-jvm/source/luxc/lang/directive/jvm.lux | 12 ++++++------ lux-jvm/source/luxc/lang/translation/jvm/primitive.lux | 10 ++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'lux-jvm/source/luxc/lang') diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index 7b3235c06..bcd40a1f8 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -526,9 +526,9 @@ (def: (true_handler extender pseudo) (-> jvm.Extender Any jvm.Handler) (function (_ extension_name phase archive inputs) - (do phase.monad - [bytecode ((extender pseudo) extension_name phase archive inputs)] - (wrap (..bytecode (:coerce (/.Bytecode Inst /.Label) bytecode)))))) + (\ phase.monad map + (|>> (:as (/.Bytecode Inst /.Label)) ..bytecode) + ((extender pseudo) extension_name phase archive inputs)))) (def: (def::generation extender) (-> jvm.Extender @@ -538,13 +538,13 @@ (^ (list nameC valueC)) (do phase.monad [[_ _ name] (lux/.evaluate! archive Text nameC) - [_ handlerV] (lux/.generator archive (:coerce Text name) ..Handler valueC) + [_ handlerV] (lux/.generator archive (:as Text name) ..Handler valueC) _ (|> handlerV (..true_handler extender) - (extension.install extender (:coerce Text name)) + (extension.install extender (:as Text name)) directive.lift_generation) _ (directive.lift_generation - (generation.log! (format "Generation " (%.text (:coerce Text name)))))] + (generation.log! (format "Generation " (%.text (:as Text name)))))] (wrap directive.no_requirements)) _ diff --git a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux index 3383e3856..5f3a98b0f 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux @@ -98,12 +98,14 @@ [+5.0 _.ICONST_5]) _ - (let [constantI (if (i.= ..d0-bits - (java/lang/Double::doubleToRawLongBits (:coerce java/lang/Double value))) + (let [constantI (if (|> value + (:as java/lang/Double) + java/lang/Double::doubleToRawLongBits + (i.= ..d0-bits)) _.DCONST_0 (_.double value))] (operation@wrap (|>> constantI (_.wrap type.double)))))) -(def: #export (text value) +(def: #export text (-> Text (Operation Inst)) - (operation@wrap (_.string value))) + (|>> _.string operation@wrap)) -- cgit v1.2.3