aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/reset.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/reset.lux58
1 files changed, 58 insertions, 0 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/reset.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/reset.lux
new file mode 100644
index 000000000..7aee9e428
--- /dev/null
+++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/reset.lux
@@ -0,0 +1,58 @@
+(.module:
+ [lux (#- type)
+ [abstract
+ ["." monad]]
+ [control
+ [state (#+ State)]]
+ [data
+ [collection
+ ["." list]]]
+ [target
+ [jvm
+ [modifier (#+ Modifier)]
+ ["." descriptor (#+ Descriptor)]
+ ["." method (#+ Method)]
+ ["_" instruction]
+ [constant
+ [pool (#+ Pool)]]
+ [encoding
+ [name (#+ External)]]]]]
+ ["." //
+ ["#." new]
+ ["/#" // #_
+ ["#." arity]
+ ["#." field
+ ["#/." partial]]
+ ["/#" // #_
+ ["#." value]
+ ["#." reference]
+ [////
+ [analysis (#+ Environment)]
+ [reference (#+ Register)]
+ ["." arity (#+ Arity)]]]]])
+
+(def: #export name "reset")
+
+(def: #export type
+ (-> External (Descriptor descriptor.Method))
+ (|>> descriptor.object [(list)] descriptor.method))
+
+(def: #export (method class environment arity)
+ (-> External Environment Arity (State Pool Method))
+ (method.method //.modifier ..name
+ (..type class)
+ (list)
+ ($_ _.compose
+ (if (arity.multiary? arity)
+ ($_ _.compose
+ (_.new class)
+ _.dup
+ (monad.map _.monad (function (_ source)
+ ($_ _.compose
+ ////reference.this
+ (_.getfield class (////reference.foreign-name source) ////value.type)))
+ (list.indices (list.size environment)))
+ (///field/partial.new arity)
+ (_.invokespecial class "<init>" (//new.type environment arity)))
+ ////reference.this)
+ _.areturn)))