aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/statement
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/statement')
-rw-r--r--new-luxc/source/luxc/lang/statement/jvm.lux45
1 files changed, 24 insertions, 21 deletions
diff --git a/new-luxc/source/luxc/lang/statement/jvm.lux b/new-luxc/source/luxc/lang/statement/jvm.lux
index 9ded2083b..4ca0744db 100644
--- a/new-luxc/source/luxc/lang/statement/jvm.lux
+++ b/new-luxc/source/luxc/lang/statement/jvm.lux
@@ -16,6 +16,7 @@
["." check (#+ Check)]]
[target
[jvm
+ ["." descriptor (#+ Descriptor)]
["." type (#+ Var Parameter Class Argument Typed Return)
[".T" lux]]]]
[tool
@@ -35,7 +36,6 @@
[lang
[host
["$" jvm (#+ Anchor Inst Definition Operation Phase)
- ["_" inst]
["_." def]]]]])
(type: Declaration
@@ -75,8 +75,14 @@
(Parser Annotation)
<c>.any)
+(def: field-descriptor
+ (Parser (Descriptor descriptor.Field))
+ (:: <>.monad map
+ (|>> (:coerce (Descriptor descriptor.Field)))
+ <c>.text))
+
(type: Constant
- [Text (List Annotation) type.Type Code])
+ [Text (List Annotation) (Descriptor descriptor.Field) Code])
(def: constant
(Parser Constant)
@@ -85,12 +91,12 @@
($_ <>.and
<c>.text
(<c>.tuple (<>.some ..annotation))
- jvm.type
+ ..field-descriptor
<c>.any
)))
(type: Variable
- [Text jvm.Visibility State (List Annotation) type.Type])
+ [Text jvm.Visibility State (List Annotation) (Descriptor descriptor.Field)])
(def: variable
(Parser Variable)
@@ -101,7 +107,7 @@
jvm.visibility
..state
(<c>.tuple (<>.some ..annotation))
- jvm.type
+ ..field-descriptor
)))
(type: Field
@@ -134,8 +140,6 @@
(-> Text Parameter)
[name [type.object-class (list)] (list)])
-(def: string-descriptor (type.descriptor (type.class "java.lang.String" (list))))
-
(def: jvm::class
(Handler Anchor Inst Definition)
(/.custom
@@ -169,21 +173,20 @@
(case field
## TODO: Handle annotations.
(#Constant [name annotations type value])
- (case [(type.descriptor type) value]
- (^template [<descriptor> <tag> <field>]
- (^ [(static <descriptor>) [_ (<tag> value)]])
+ (case value
+ (^template [<tag> <field>]
+ [_ (<tag> value)]
(<field> #$.Public ($.++F $.staticF $.finalF) name value))
- ([type.boolean-descriptor #.Bit _def.boolean-field]
- [type.byte-descriptor #.Int _def.byte-field]
- [type.short-descriptor #.Int _def.short-field]
- [type.int-descriptor #.Int _def.int-field]
- [type.long-descriptor #.Int _def.long-field]
- [type.float-descriptor #.Frac _def.float-field]
- [type.double-descriptor #.Frac _def.double-field]
- [type.char-descriptor #.Nat _def.char-field]
- [string-descriptor #.Text _def.string-field])
-
- ## TODO: Handle constants better.
+ ([#.Bit _def.boolean-field]
+ [#.Int _def.byte-field]
+ [#.Int _def.short-field]
+ [#.Int _def.int-field]
+ [#.Int _def.long-field]
+ [#.Frac _def.float-field]
+ [#.Frac _def.double-field]
+ [#.Nat _def.char-field]
+ [#.Text _def.string-field])
+
_
(undefined))