diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/target/jvm/program.lux | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/stdlib/source/lux/target/jvm/program.lux b/stdlib/source/lux/target/jvm/program.lux index aeb3e0b0a..abfe6f5bb 100644 --- a/stdlib/source/lux/target/jvm/program.lux +++ b/stdlib/source/lux/target/jvm/program.lux @@ -23,7 +23,7 @@ ["#." instruction (#+ Primitive-Array-Type Instruction) ("#@." monoid)] ["/#" // #_ ["#." index] - ["#." descriptor (#+ Descriptor Value Return)] + ["#." descriptor (#+ Descriptor Value Return Field)] [encoding ["#." name (#+ External)] ["#." unsigned (#+ U1 U2)] @@ -496,3 +496,26 @@ [#0 invokespecial /instruction.invokespecial] [#0 invokeinterface /instruction.invokeinterface] ) + +(template [<name> <1> <2>] + [(def: #export (<name> class field type) + (-> External Text (Descriptor Field) (Program Any)) + (do ..monad + [index (<| ..lift + (//constant/pool.field class) + {#//constant/pool.name field + #//constant/pool.descriptor type})] + (..nullary (cond (is? //descriptor.long type) + (<2> index) + + (is? //descriptor.double type) + (<2> index) + + ## else + (<1> index)))))] + + [getstatic /instruction.getstatic/1 /instruction.getstatic/2] + [putstatic /instruction.putstatic/1 /instruction.putstatic/2] + [getfield /instruction.getfield/1 /instruction.getfield/2] + [putfield /instruction.putfield/1 /instruction.putfield/2] + ) |