diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/host/jvm.lux | 41 | ||||
-rw-r--r-- | stdlib/source/lux/host/jvm/method.lux | 52 | ||||
-rw-r--r-- | stdlib/source/lux/host/jvm/modifier/method.lux | 30 |
3 files changed, 73 insertions, 50 deletions
diff --git a/stdlib/source/lux/host/jvm.lux b/stdlib/source/lux/host/jvm.lux index b0030c84f..379be7c9a 100644 --- a/stdlib/source/lux/host/jvm.lux +++ b/stdlib/source/lux/host/jvm.lux @@ -15,17 +15,12 @@ ["/." index (#+ Index)] ["/." attribute (#+ Attribute)] ["/." field (#+ Field)] + ["/." method (#+ Method)] [modifier ["/.M" class]] ["/." constant (#+ Constant) ["/." pool (#+ Pool)]]]) -(type: #export Interface - (Index /constant.Class)) - -(type: #export Method - Any) - (type: #export Class {#magic Magic #minor-version Minor @@ -34,7 +29,7 @@ #access-flags /classM.Modifier #this (Index /constant.Class) #super (Index /constant.Class) - #interfaces (Row Interface) + #interfaces (Row (Index /constant.Class)) #fields (Row Field) #methods (Row Method) #attributes (Row Attribute)}) @@ -43,20 +38,26 @@ (def: (install-classes this super interfaces) (-> Internal Internal (List Internal) - (State Pool [(Index /constant.Class) (Index /constant.Class) (Row Interface)])) + (State Pool [(Index /constant.Class) (Index /constant.Class) (Row (Index /constant.Class))])) (do state.Monad<State> [@this (/pool.class (/name.read this)) @super (/pool.class (/name.read super)) - @interfaces (monad.fold @ (function (_ interface @interfaces) - (do @ - [@interface (/pool.class (/name.read interface))] - (wrap (row.add @interface @interfaces)))) - (: (Row Interface) row.empty) - interfaces)] + @interfaces (: (State Pool (Row (Index /constant.Class))) + (monad.fold @ (function (_ interface @interfaces) + (do @ + [@interface (/pool.class (/name.read interface))] + (wrap (row.add @interface @interfaces)))) + row.empty + interfaces))] (wrap [@this @super @interfaces]))) -(def: #export (class version access super this interfaces fields) - (-> Major /classM.Modifier Internal Internal (List Internal) (Row Field) Class) +(def: #export (class version access + super this interfaces + fields methods attributes) + (-> Major /classM.Modifier + Internal Internal (List Internal) + (Row Field) (Row Method) (Row Attribute) + Class) (let [[pool [@this @super @interfaces]] (state.run (: Pool row.empty) (install-classes this super interfaces))] {#magic /magic.code @@ -68,10 +69,10 @@ #super @super #interfaces @interfaces #fields fields - #methods row.empty - #attributes row.empty})) + #methods methods + #attributes attributes})) -(def: #export classF +(def: #export format (Format Class) ($_ binary.and /magic.format @@ -83,5 +84,5 @@ /index.format (binary.row/16 /index.format) (binary.row/16 /field.format) - (binary.row/16 (binary.ignore [])) + (binary.row/16 /method.format) (binary.row/16 /attribute.format))) diff --git a/stdlib/source/lux/host/jvm/method.lux b/stdlib/source/lux/host/jvm/method.lux new file mode 100644 index 000000000..d7e8354e8 --- /dev/null +++ b/stdlib/source/lux/host/jvm/method.lux @@ -0,0 +1,52 @@ +(.module: + [lux (#- static) + [control + [monoid (#+)] + [parser (#+)] + ["." monad (#+ do)] + ["." state (#+ State)]] + [data + [number (#+) + [i64 (#+)]] + [format + ["." binary (#+ Format)]] + [collection + ["." row (#+ Row)]]] + [type + [abstract (#+)]]] + [// + [encoding (#+)] + [modifier (#+ modifiers:)] + ["//." constant (#+ UTF8)] + ["//." index (#+ Index)] + ["//." attribute (#+ Attribute)] + ["//." descriptor (#+ Descriptor)]]) + +(modifiers: + ["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] + ) + +(type: #export Method + {#modifier Modifier + #name (Index UTF8) + #descriptor (Index (Descriptor //descriptor.Method)) + #attributes (Row Attribute)}) + +(def: #export format + (Format Method) + ($_ binary.and + ..modifier-format + //index.format + //index.format + (binary.row/16 //attribute.format))) diff --git a/stdlib/source/lux/host/jvm/modifier/method.lux b/stdlib/source/lux/host/jvm/modifier/method.lux deleted file mode 100644 index e15a971ae..000000000 --- a/stdlib/source/lux/host/jvm/modifier/method.lux +++ /dev/null @@ -1,30 +0,0 @@ -(.module: - [lux (#- static) - [control - [monoid (#+)] - [parser (#+)]] - [data - [number (#+) - [i64 (#+)]] - [format - [binary (#+)]]] - [type - [abstract (#+)]]] - [// (#+ modifiers:) - [// - [encoding (#+)]]]) - -(modifiers: - ["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] - ) |