aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/target/jvm/method.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/target/jvm/method.lux')
-rw-r--r--stdlib/source/lux/target/jvm/method.lux103
1 files changed, 0 insertions, 103 deletions
diff --git a/stdlib/source/lux/target/jvm/method.lux b/stdlib/source/lux/target/jvm/method.lux
deleted file mode 100644
index 6219a1c1d..000000000
--- a/stdlib/source/lux/target/jvm/method.lux
+++ /dev/null
@@ -1,103 +0,0 @@
-(.module:
- [lux (#- Type static)
- [abstract
- [equivalence (#+ Equivalence)]
- ["." monad (#+ do)]]
- [control
- ["." try]]
- [data
- ["." product]
- ["." format #_
- ["#" binary (#+ Writer) ("#\." monoid)]]
- [collection
- ["." row (#+ Row)]]]]
- ["." // #_
- ["#." modifier (#+ Modifier modifiers:)]
- ["#." index (#+ Index)]
- ["#." attribute (#+ Attribute)
- ["#/." code]]
- ["#." constant (#+ UTF8)
- ["#/." pool (#+ Pool Resource)]]
- ["#." bytecode (#+ Bytecode)
- ["#/." environment (#+ Environment)]
- ["#/." instruction]]
- ["#." type (#+ Type)
- ["#/." category]
- ["#." descriptor (#+ Descriptor)]]])
-
-(type: #export #rec Method
- {#modifier (Modifier Method)
- #name (Index UTF8)
- #descriptor (Index (Descriptor //type/category.Method))
- #attributes (Row Attribute)})
-
-(modifiers: Method
- ["0001" public]
- ["0002" private]
- ["0004" protected]
- ["0008" static]
- ["0010" final]
- ["0020" synchronized]
- ["0040" bridge]
- ["0080" var_args]
- ["0100" native]
- ["0400" abstract]
- ["0800" strict]
- ["1000" synthetic]
- )
-
-(def: #export (method modifier name type attributes code)
- (-> (Modifier Method) UTF8 (Type //type/category.Method) (List (Resource Attribute)) (Maybe (Bytecode Any))
- (Resource Method))
- (do {! //constant/pool.monad}
- [@name (//constant/pool.utf8 name)
- @descriptor (//constant/pool.descriptor (//type.descriptor type))
- attributes (|> attributes
- (monad.seq !)
- (\ ! map row.from_list))
- attributes (case code
- (#.Some code)
- (do !
- [environment (case (if (//modifier.has? static modifier)
- (//bytecode/environment.static type)
- (//bytecode/environment.virtual type))
- (#try.Success environment)
- (wrap environment)
-
- (#try.Failure error)
- (function (_ _) (#try.Failure error)))
- [environment exceptions instruction output] (//bytecode.resolve environment code)
- #let [bytecode (|> instruction //bytecode/instruction.run format.instance)]
- @code (//attribute.code {#//attribute/code.limit (get@ #//bytecode/environment.limit environment)
- #//attribute/code.code bytecode
- #//attribute/code.exception_table exceptions
- #//attribute/code.attributes (row.row)})]
- (wrap (row.add @code attributes)))
-
- #.None
- (wrap attributes))]
- (wrap {#modifier modifier
- #name @name
- #descriptor @descriptor
- #attributes attributes})))
-
-(def: #export equivalence
- (Equivalence Method)
- ($_ product.equivalence
- //modifier.equivalence
- //index.equivalence
- //index.equivalence
- (row.equivalence //attribute.equivalence)
- ))
-
-(def: #export (writer field)
- (Writer Method)
- (`` ($_ format\compose
- (~~ (template [<writer> <slot>]
- [(<writer> (get@ <slot> field))]
-
- [//modifier.writer #modifier]
- [//index.writer #name]
- [//index.writer #descriptor]
- [(format.row/16 //attribute.writer) #attributes]))
- )))