blob: b6dc1b9462097f3e31c96facea98efb2ce653472 (
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
|
(.module:
[lux (#- static)
[abstract
[monoid (#+)]
["." equivalence (#+ Equivalence)]
["." monad (#+ do)]]
[control
["." state (#+ State)]]
[data
[number (#+)
[i64 (#+)]]
[format
[".F" binary (#+ Writer) ("#@." monoid)]]
[collection
["." row (#+ Row)]]]
[type
[abstract (#+)]]]
["." // #_
["." modifier (#+ Modifier modifiers:)]
["#." constant (#+ UTF8)
["#/." pool (#+ Pool)]]
["#." index (#+ Index)]
["#." attribute (#+ Attribute)]
["#." descriptor (#+ Descriptor Value)]])
(type: #export #rec Field
{#modifier (Modifier Field)
#name (Index UTF8)
#descriptor (Index (Descriptor Value))
#attributes (Row Attribute)})
(modifiers: Field
["0001" public]
["0002" private]
["0004" protected]
["0008" static]
["0010" final]
["0040" volatile]
["0080" transient]
["1000" synthetic]
["4000" enum]
)
(def: #export equivalence
(Equivalence Field)
($_ equivalence.product
modifier.equivalence
//index.equivalence
//index.equivalence
(row.equivalence //attribute.equivalence)))
(def: #export (writer field)
(Writer Field)
(`` ($_ binaryF@compose
(~~ (template [<writer> <slot>]
[(<writer> (get@ <slot> field))]
[modifier.writer #modifier]
[//index.writer #name]
[//index.writer #descriptor]
[(binaryF.row/16 //attribute.writer) #attributes]))
)))
(def: #export (field modifier name descriptor attributes)
(-> (Modifier Field) UTF8 (Descriptor Value) (Row Attribute)
(State Pool Field))
(do state.monad
[@name (//constant/pool.utf8 name)
@descriptor (//constant/pool.descriptor descriptor)]
(wrap {#modifier modifier
#name @name
#descriptor @descriptor
#attributes attributes})))
|