blob: 5db3ac6b0f5176f1c3b93f2c1a1fbf6b03284531 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
(.using
[library
[lux {"-" Type static public private}
[abstract
[equivalence {"+" Equivalence}]
["[0]" monad {"+" do}]]
[data
["[0]" product]
[format
["[0]F" binary {"+" Writer} ("[1]#[0]" monoid)]]
[collection
["[0]" sequence {"+" Sequence}]]]]]
["[0]" // "_"
["[0]" modifier {"+" Modifier modifiers:}]
["[1][0]" constant {"+" UTF8}
["[1]/[0]" pool {"+" Pool Resource}]]
["[1][0]" index {"+" Index}]
["[1][0]" attribute {"+" Attribute}]
["[1][0]" type {"+" Type}
[category {"+" Value}]
[descriptor {"+" Descriptor}]]])
(type: .public Field
(Rec Field
(Record
[#modifier (Modifier Field)
#name (Index UTF8)
#descriptor (Index (Descriptor Value))
#attributes (Sequence Attribute)])))
(modifiers: Field
["0001" public]
["0002" private]
["0004" protected]
["0008" static]
["0010" final]
["0040" volatile]
["0080" transient]
["1000" synthetic]
["4000" enum]
)
(def: .public equivalence
(Equivalence Field)
($_ product.equivalence
modifier.equivalence
//index.equivalence
//index.equivalence
(sequence.equivalence //attribute.equivalence)))
(def: .public (writer field)
(Writer Field)
(`` ($_ binaryF#composite
(~~ (template [<writer> <slot>]
[(<writer> (the <slot> field))]
[modifier.writer #modifier]
[//index.writer #name]
[//index.writer #descriptor]
[(binaryF.sequence_16 //attribute.writer) #attributes]))
)))
(def: .public (field modifier name with_signature? type attributes)
(-> (Modifier Field) UTF8 Bit (Type Value) (Sequence Attribute)
(Resource Field))
(do [! //constant/pool.monad]
[@name (//constant/pool.utf8 name)
@descriptor (//constant/pool.descriptor (//type.descriptor type))
@signature (if with_signature?
(# ! each (|>> {.#Some}) (//attribute.signature (//type.signature type)))
(in {.#None}))]
(in [#modifier modifier
#name @name
#descriptor @descriptor
#attributes (case @signature
{.#Some @signature}
(sequence.suffix @signature attributes)
{.#None}
attributes)])))
|