aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/host/jvm/attribute.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/host/jvm/attribute.lux')
-rw-r--r--stdlib/source/lux/host/jvm/attribute.lux82
1 files changed, 72 insertions, 10 deletions
diff --git a/stdlib/source/lux/host/jvm/attribute.lux b/stdlib/source/lux/host/jvm/attribute.lux
index 3f0dd9b61..87891f35c 100644
--- a/stdlib/source/lux/host/jvm/attribute.lux
+++ b/stdlib/source/lux/host/jvm/attribute.lux
@@ -1,22 +1,84 @@
(.module:
- [lux #*
+ [lux (#- Info Code' Code)
+ [control
+ [monad (#+ do)]
+ ["." state (#+ State)]]
[data
[format
- ["." binary (#+ Format)]]]]
+ ["." binary (#+ Format)]]
+ [collection
+ ["." row (#+ Row)]]]
+ [world
+ [binary (#+ Binary)]]]
[//
["//." encoding (#+ U2 U4)]
- ["//." index (#+ Index)]])
+ ["//." index (#+ Index)]
+ ["//." constant (#+ UTF8 Class Value)
+ ["//." pool (#+ Pool)]]])
-(type: #export Constant-Value
- {#name Index
+(type: #export (Info about)
+ {#name (Index UTF8)
#length U4
- #index Index})
+ #info about})
-(def: #export constant-value
+(def: (info-format about)
+ (All [about]
+ (-> (Format about)
+ (Format (Info about))))
($_ binary.and
//index.format
//encoding.u4-format
- //index.format))
+ about))
-(type: #export Attribute
- Any)
+(type: #export Constant
+ (Info (Index (Value Any))))
+
+(def: constant-format
+ (Format Constant)
+ (..info-format //index.format))
+
+(type: #export Label U2)
+
+(type: #export Exception
+ {#start-pc Label
+ #end-pc Label
+ #handler-pc Label
+ #catch-type (Index Class)})
+
+(type: #export (Code' Attribute)
+ {#max-stack U2
+ #max-locals U2
+ #code Binary
+ #exception-table (Row Exception)
+ #attributes (Row Attribute)})
+
+(with-expansions [<Code> (as-is (Info (Code' Attribute)))]
+ (type: #export #rec Attribute
+ (#Constant Constant)
+ ## (#Code <Code>)
+ )
+
+ ## (type: #export Code
+ ## <Code>)
+ )
+
+(def: #export (constant index)
+ (-> (Index (Value Any))
+ (State Pool Attribute))
+ (do state.Monad<State>
+ [@name (//pool.utf8 "ConstantValue")]
+ (wrap (#Constant {#name @name
+ #length (//encoding.to-u4 //encoding.u2-bytes)
+ #info index}))))
+
+## (def: #export (code specification)
+## (-> Code' (State Pool Attribute))
+## (do state.Monad<State>
+## [@name (//pool.utf8 "Code")]
+## (wrap (#Code {#name @name
+## #length (undefined)
+## #info specification}))))
+
+(def: #export format
+ (Format Attribute)
+ ..constant-format)