From eff4c59794868b89d60fdc411f9b544a270b817e Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 2 Aug 2021 20:26:21 -0400 Subject: Fixed a bug in the new compiler which allowed the same module to be imported more than once. --- lux-jvm/source/luxc/lang/directive/jvm.lux | 204 ++++++++++++++--------------- 1 file changed, 102 insertions(+), 102 deletions(-) (limited to 'lux-jvm/source/luxc/lang/directive/jvm.lux') diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index fe3889c38..93a356c0e 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -446,7 +446,7 @@ (let [[mapping input] (..relabel [mapping input])] [mapping (list& input output)])) [mapping (list)] labels)] - [mapping (#/.TABLESWITCH min max default (list.reverse labels))]) + [mapping (#/.TABLESWITCH min max default (list.reversed labels))]) (#/.LOOKUPSWITCH default keys+labels) (let [[mapping default] (..relabel [mapping default]) @@ -454,7 +454,7 @@ (let [[mapping input] (..relabel [mapping input])] [mapping (list& [expected input] output)])) [mapping (list)] keys+labels)] - [mapping (#/.LOOKUPSWITCH default (list.reverse keys+labels))]) + [mapping (#/.LOOKUPSWITCH default (list.reversed keys+labels))]) )) (def: (relabel_exception [mapping instruction]) @@ -523,7 +523,7 @@ (def: fresh Mapping - (dictionary.new nat.hash)) + (dictionary.empty nat.hash)) (def: bytecode (-> (/.Bytecode Inst /.Label) jvm.Inst) @@ -575,10 +575,10 @@ directive.lift_generation) _ (directive.lift_generation (generation.log! (format "Generation " (%.text (:as Text name)))))] - (wrap directive.no_requirements)) + (in directive.no_requirements)) _ - (phase.throw extension.invalid_syntax [extension_name %.code inputsC+])))) + (phase.except extension.invalid_syntax [extension_name %.code inputsC+])))) (def: #export (custom [parser handler]) (All [i] @@ -591,7 +591,7 @@ (handler extension_name phase archive input') (#try.Failure error) - (phase.throw extension.invalid_syntax [extension_name %.code input])))) + (phase.except extension.invalid_syntax [extension_name %.code input])))) (type: Declaration [External (List (Type Var))]) @@ -678,7 +678,7 @@ state ..state _ (.tuple (<>.some ..annotation)) type ..value] - (wrap [name privacy state (list) type])))) + (in [name privacy state (list) type])))) (type: Argument [Text (Type Value)]) @@ -1021,7 +1021,7 @@ [typeL (//A.reflection_type mapping typeJ) termA (typeA.with_type typeL (analyse archive termC))] - (wrap [typeJ termA]))) + (in [typeJ termA]))) constructor_argumentsC) selfT (//A.reflection_type mapping (/type.class class_name class_tvars)) arguments' (monad.map ! @@ -1031,14 +1031,14 @@ arguments) returnT (//A.boxed_reflection_return mapping /type.void) [_scope bodyA] (|> arguments' - (#.Cons [self selfT]) - list.reverse + (#.Item [self selfT]) + list.reversed (list\fold scopeA.with_local (analyse archive bodyC)) (typeA.with_type returnT) analysis.with_scope)] - (wrap [privacy strict_floating_point? annotations method_tvars exceptions - self arguments constructor_argumentsA - bodyA]))))) + (in [privacy strict_floating_point? annotations method_tvars exceptions + self arguments constructor_argumentsA + bodyA]))))) (def: (override_method_analysis archive [class_name class_tvars] supers method) (-> Archive Declaration (List (Type Class)) (Override Code) (Operation (Override Analysis))) @@ -1061,14 +1061,14 @@ arguments) returnT (//A.boxed_reflection_return mapping returnJ) [_scope bodyA] (|> arguments' - (#.Cons [self selfT]) - list.reverse + (#.Item [self selfT]) + list.reversed (list\fold scopeA.with_local (analyse archive bodyC)) (typeA.with_type returnT) analysis.with_scope)] - (wrap [[super_name super_tvars] method_name strict_floating_point? annotations - method_tvars self arguments returnJ exceptionsJ - bodyA]))))) + (in [[super_name super_tvars] method_name strict_floating_point? annotations + method_tvars self arguments returnJ exceptionsJ + bodyA]))))) (def: (virtual_method_analysis archive [class_name class_tvars] method) (-> Archive Declaration (Virtual Code) (Operation (Virtual Analysis))) @@ -1089,14 +1089,14 @@ arguments) returnT (//A.boxed_reflection_return mapping returnJ) [_scope bodyA] (|> arguments' - (#.Cons [self selfT]) - list.reverse + (#.Item [self selfT]) + list.reversed (list\fold scopeA.with_local (analyse archive bodyC)) (typeA.with_type returnT) analysis.with_scope)] - (wrap [name privacy final? strict_floating_point? annotations method_tvars - self arguments returnJ exceptionsJ - bodyA]))))) + (in [name privacy final? strict_floating_point? annotations method_tvars + self arguments returnJ exceptionsJ + bodyA]))))) (def: (static_method_analysis archive method) (-> Archive (Static Code) (Operation (Static Analysis))) @@ -1115,13 +1115,13 @@ arguments) returnT (//A.boxed_reflection_return mapping returnJ) [_scope bodyA] (|> arguments' - list.reverse + list.reversed (list\fold scopeA.with_local (analyse archive bodyC)) (typeA.with_type returnT) analysis.with_scope)] - (wrap [name privacy strict_floating_point? annotations method_tvars - arguments returnJ exceptionsJ - bodyA]))))) + (in [name privacy strict_floating_point? annotations method_tvars + arguments returnJ exceptionsJ + bodyA]))))) (def: (method_analysis archive declaration supers method) (-> Archive Declaration (List (Type Class)) (Method Code) (Operation (Method Analysis))) @@ -1143,7 +1143,7 @@ (static_method_analysis archive method)) (#Abstract method) - (\ phase.monad wrap (#Abstract method)) + (\ phase.monad in (#Abstract method)) )) (template: (method_body ) @@ -1167,14 +1167,14 @@ (synthesise archive termA))) constructor_argumentsA) bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] - (wrap [privacy strict_floating_point? annotations method_tvars exceptions - self arguments constructor_argumentsS - (case bodyS - (^ (method_body bodyS)) - bodyS + (in [privacy strict_floating_point? annotations method_tvars exceptions + self arguments constructor_argumentsS + (case bodyS + (^ (method_body bodyS)) + bodyS - _ - bodyS)]))))) + _ + bodyS)]))))) (def: (override_method_synthesis archive method) (-> Archive (Override Analysis) (Operation (Override Synthesis))) @@ -1186,14 +1186,14 @@ (directive.lift_synthesis (do ! [bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] - (wrap [[super_name super_tvars] method_name strict_floating_point? annotations - method_tvars self arguments returnJ exceptionsJ - (case bodyS - (^ (method_body bodyS)) - bodyS + (in [[super_name super_tvars] method_name strict_floating_point? annotations + method_tvars self arguments returnJ exceptionsJ + (case bodyS + (^ (method_body bodyS)) + bodyS - _ - bodyS)]))))) + _ + bodyS)]))))) (def: (virtual_method_synthesis archive method) (-> Archive (Virtual Analysis) (Operation (Virtual Synthesis))) @@ -1205,14 +1205,14 @@ (directive.lift_synthesis (do ! [bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] - (wrap [name privacy final? strict_floating_point? annotations method_tvars - self arguments returnJ exceptionsJ - (case bodyS - (^ (method_body bodyS)) - bodyS + (in [name privacy final? strict_floating_point? annotations method_tvars + self arguments returnJ exceptionsJ + (case bodyS + (^ (method_body bodyS)) + bodyS - _ - bodyS)]))))) + _ + bodyS)]))))) (def: (static_method_synthesis archive method) (-> Archive (Static Analysis) (Operation (Static Synthesis))) @@ -1224,14 +1224,14 @@ (directive.lift_synthesis (do ! [bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] - (wrap [name privacy strict_floating_point? annotations method_tvars - arguments returnJ exceptionsJ - (case bodyS - (^ (method_body bodyS)) - bodyS + (in [name privacy strict_floating_point? annotations method_tvars + arguments returnJ exceptionsJ + (case bodyS + (^ (method_body bodyS)) + bodyS - _ - bodyS)]))))) + _ + bodyS)]))))) (def: (method_synthesis archive method) (-> Archive (Method Analysis) (Operation (Method Synthesis))) @@ -1253,7 +1253,7 @@ (static_method_synthesis archive method)) (#Abstract method) - (\ phase.monad wrap (#Abstract method)) + (\ phase.monad in (#Abstract method)) )) (def: (constructor_method_generation archive super_class method) @@ -1279,16 +1279,16 @@ (|>> (_.ALOAD 0) super_constructor_argument_values (_.INVOKESPECIAL super_class ..constructor_name super_constructorT)))]] - (wrap (def.method (..visibility privacy) - (if strict_floating_point? - jvm.strictM - jvm.noneM) - ..constructor_name - (/type.method [method_tvars argumentsT /type.void exceptions]) - (|>> initialize_object! - (//G.prepare_arguments 1 argumentsT) - bodyG - _.RETURN))))))) + (in (def.method (..visibility privacy) + (if strict_floating_point? + jvm.strictM + jvm.noneM) + ..constructor_name + (/type.method [method_tvars argumentsT /type.void exceptions]) + (|>> initialize_object! + (//G.prepare_arguments 1 argumentsT) + bodyG + _.RETURN))))))) (def: (override_method_generation archive method) (-> Archive (Override Synthesis) (Operation jvm.Def)) @@ -1301,15 +1301,15 @@ (do ! [bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS)) #let [argumentsT (list\map product.right arguments)]] - (wrap (def.method #jvm.Public - (if strict_floating_point? - jvm.strictM - jvm.noneM) - method_name - (/type.method [method_tvars argumentsT returnJ exceptionsJ]) - (|>> (//G.prepare_arguments 1 argumentsT) - bodyG - (//G.returnI returnJ)))))))) + (in (def.method #jvm.Public + (if strict_floating_point? + jvm.strictM + jvm.noneM) + method_name + (/type.method [method_tvars argumentsT returnJ exceptionsJ]) + (|>> (//G.prepare_arguments 1 argumentsT) + bodyG + (//G.returnI returnJ)))))))) (def: (virtual_method_generation archive method) (-> Archive (Virtual Synthesis) (Operation jvm.Def)) @@ -1322,19 +1322,19 @@ (do ! [bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS)) #let [argumentsT (list\map product.right arguments)]] - (wrap (def.method (..visibility privacy) - (|> jvm.noneM - (jvm.++M (if strict_floating_point? - jvm.strictM - jvm.noneM)) - (jvm.++M (if final? - jvm.finalM - jvm.noneM))) - method_name - (/type.method [method_tvars argumentsT returnJ exceptionsJ]) - (|>> (//G.prepare_arguments 1 argumentsT) - bodyG - (//G.returnI returnJ)))))))) + (in (def.method (..visibility privacy) + (|> jvm.noneM + (jvm.++M (if strict_floating_point? + jvm.strictM + jvm.noneM)) + (jvm.++M (if final? + jvm.finalM + jvm.noneM))) + method_name + (/type.method [method_tvars argumentsT returnJ exceptionsJ]) + (|>> (//G.prepare_arguments 1 argumentsT) + bodyG + (//G.returnI returnJ)))))))) (def: (static_method_generation archive method) (-> Archive (Static Synthesis) (Operation jvm.Def)) @@ -1347,16 +1347,16 @@ (do ! [bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS)) #let [argumentsT (list\map product.right arguments)]] - (wrap (def.method (..visibility privacy) - (|> jvm.staticM - (jvm.++M (if strict_floating_point? - jvm.strictM - jvm.noneM))) - method_name - (/type.method [method_tvars argumentsT returnJ exceptionsJ]) - (|>> (//G.prepare_arguments 0 argumentsT) - bodyG - (//G.returnI returnJ)))))))) + (in (def.method (..visibility privacy) + (|> jvm.staticM + (jvm.++M (if strict_floating_point? + jvm.strictM + jvm.noneM))) + method_name + (/type.method [method_tvars argumentsT returnJ exceptionsJ]) + (|>> (//G.prepare_arguments 0 argumentsT) + bodyG + (//G.returnI returnJ)))))))) (def: (method_generation archive super_class method) (-> Archive (Type Class) (Method Synthesis) (Operation jvm.Def)) @@ -1374,7 +1374,7 @@ (..static_method_generation archive method) (#Abstract method) - (\ phase.monad wrap (..abstract_method_generation method)) + (\ phase.monad in (..abstract_method_generation method)) )) (import: java/lang/ClassLoader) @@ -1445,7 +1445,7 @@ _ (generation.execute! directive) _ (generation.save! artifact_id (#.Some class_name) directive) _ (generation.log! (format "JVM Class " (%.text class_name)))] - (wrap directive.no_requirements)))))])) + (in directive.no_requirements)))))])) (def: jvm::class::interface ..Handler @@ -1472,7 +1472,7 @@ _ (generation.execute! directive) _ (generation.save! artifact_id (#.Some class_name) directive) _ (generation.log! (format "JVM Interface " (%.text class_name)))] - (wrap directive.no_requirements)))))])) + (in directive.no_requirements)))))])) (def: #export (bundle class_loader extender) (-> java/lang/ClassLoader jvm.Extender (directive.Bundle jvm.Anchor jvm.Inst jvm.Definition)) -- cgit v1.2.3