aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux')
-rw-r--r--stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux34
1 files changed, 15 insertions, 19 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux
index 241ec2676..ac1347c2d 100644
--- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux
+++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux
@@ -2,8 +2,6 @@
[lux (#- Type type)
[abstract
["." monad (#+ do)]]
- [control
- [state (#+ State)]]
[data
[number
["n" nat]]
@@ -14,11 +12,9 @@
["." modifier (#+ Modifier) ("#@." monoid)]
["." field (#+ Field)]
["." method (#+ Method)]
- ["_" instruction (#+ Instruction)]
+ ["_" bytecode (#+ Bytecode)]
["." constant
- [pool (#+ Pool)]]
- [encoding
- ["." unsigned]]
+ [pool (#+ Resource)]]
[type (#+ Type)
["." category (#+ Class Value Return)]]]]]
["." //
@@ -41,7 +37,7 @@
["." phase]]]]])
(def: #export (instance' foreign-setup class environment arity)
- (-> (List (Instruction Any)) (Type Class) Environment Arity (Instruction Any))
+ (-> (List (Bytecode Any)) (Type Class) Environment Arity (Bytecode Any))
($_ _.compose
(_.new class)
_.dup
@@ -50,13 +46,13 @@
(_.invokespecial class //init.name (//init.type environment arity))))
(def: #export (instance class environment arity)
- (-> (Type Class) Environment Arity (Operation (Instruction Any)))
+ (-> (Type Class) Environment Arity (Operation (Bytecode Any)))
(do phase.monad
[foreign* (monad.map @ ////reference.variable environment)]
(wrap (instance' foreign* class environment arity))))
(def: #export (method class environment arity)
- (-> (Type Class) Environment Arity (State Pool Method))
+ (-> (Type Class) Environment Arity (Resource Method))
(let [after-this (: (-> Nat Nat)
(n.+ 1))
environment-size (list.size environment)
@@ -67,13 +63,13 @@
(method.method //.modifier //init.name
(//init.type environment arity)
(list)
- ($_ _.compose
- ////reference.this
- (//init.super environment-size arity)
- (monad.map _.monad (function (_ register)
- (///foreign.put class register (_.aload (unsigned.u1 (after-this register)))))
- (list.indices environment-size))
- (monad.map _.monad (function (_ register)
- (///partial.put class register (_.aload (unsigned.u1 (after-arity register)))))
- (list.indices (n.- ///arity.minimum arity)))
- _.areturn))))
+ (#.Some ($_ _.compose
+ ////reference.this
+ (//init.super environment-size arity)
+ (monad.map _.monad (function (_ register)
+ (///foreign.put class register (_.aload (after-this register))))
+ (list.indices environment-size))
+ (monad.map _.monad (function (_ register)
+ (///partial.put class register (_.aload (after-arity register))))
+ (list.indices (n.- ///arity.minimum arity)))
+ _.areturn)))))