diff options
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux index 2e39860fc..a9df2710c 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux @@ -671,6 +671,16 @@ _ (phase@map (|>> #.Some) (generate-type description)))) +(def: (prepare-argI [type argI]) + (-> [$.Type Inst] Inst) + (case (_t.class-name type) + (#.Some class-name) + (|>> argI + (_.CHECKCAST class-name)) + + #.None + argI)) + (def: (invoke::static proc generate inputs) Handler (case inputs @@ -681,7 +691,7 @@ (do phase.monad [argsTI (monad.map @ (generate-arg generate) argsS) returnT (method-return-type unboxed)] - (wrap (|>> (_.fuse (list@map product.right argsTI)) + (wrap (|>> (_.fuse (list@map ..prepare-argI argsTI)) (_.INVOKESTATIC class method (_t.method (list@map product.left argsTI) returnT (list)) false)))) @@ -704,7 +714,7 @@ returnT (method-return-type unboxed)] (wrap (|>> objectI (_.CHECKCAST class) - (_.fuse (list@map product.right argsTI)) + (_.fuse (list@map ..prepare-argI argsTI)) (<invoke> class method (_t.method (list@map product.left argsTI) returnT (list)) <interface?>)))) @@ -725,7 +735,7 @@ [argsTI (monad.map @ (generate-arg generate) argsS)] (wrap (|>> (_.NEW class) _.DUP - (_.fuse (list@map product.right argsTI)) + (_.fuse (list@map ..prepare-argI argsTI)) (_.INVOKESPECIAL class "<init>" (_t.method (list@map product.left argsTI) #.None (list)) false)))) |