/
genIntReprInt.go
108 lines (98 loc) · 4.43 KB
/
genIntReprInt.go
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package gengo
import (
"io"
"github.com/ipld/go-ipld-prime/schema"
"github.com/ipld/go-ipld-prime/schema/gen/go/mixins"
)
var _ TypeGenerator = &intReprIntGenerator{}
func NewIntReprIntGenerator(pkgName string, typ *schema.TypeInt, adjCfg *AdjunctCfg) TypeGenerator {
return intReprIntGenerator{
intGenerator{
adjCfg,
mixins.IntTraits{
PkgName: pkgName,
TypeName: string(typ.Name()),
TypeSymbol: adjCfg.TypeSymbol(typ),
},
pkgName,
typ,
},
}
}
type intReprIntGenerator struct {
intGenerator
}
func (g intReprIntGenerator) GetRepresentationNodeGen() NodeGenerator {
return intReprIntReprGenerator{
g.AdjCfg,
g.Type,
}
}
type intReprIntReprGenerator struct {
AdjCfg *AdjunctCfg
Type *schema.TypeInt
}
func (g intReprIntReprGenerator) EmitNodeType(w io.Writer) {
// Since this is a "natural" representation... there's just a type alias here.
// No new functions are necessary.
doTemplate(`
type _{{ .Type | TypeSymbol }}__Repr = _{{ .Type | TypeSymbol }}
`, w, g.AdjCfg, g)
}
func (g intReprIntReprGenerator) EmitNodeTypeAssertions(w io.Writer) {
doTemplate(`
var _ datamodel.Node = &_{{ .Type | TypeSymbol }}__Repr{}
`, w, g.AdjCfg, g)
}
func (intReprIntReprGenerator) EmitNodeMethodKind(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodLookupByString(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodLookupByNode(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodLookupByIndex(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodLookupBySegment(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodMapIterator(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodListIterator(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodLength(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodIsAbsent(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodIsNull(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodAsBool(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodAsInt(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodAsFloat(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodAsString(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodAsBytes(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodAsLink(io.Writer) {}
func (intReprIntReprGenerator) EmitNodeMethodPrototype(io.Writer) {}
func (g intReprIntReprGenerator) EmitNodePrototypeType(w io.Writer) {
// Since this is a "natural" representation... there's just a type alias here.
// No new functions are necessary.
doTemplate(`
type _{{ .Type | TypeSymbol }}__ReprPrototype = _{{ .Type | TypeSymbol }}__Prototype
`, w, g.AdjCfg, g)
}
func (g intReprIntReprGenerator) GetNodeBuilderGenerator() NodeBuilderGenerator {
return intReprIntReprBuilderGenerator(g)
}
type intReprIntReprBuilderGenerator struct {
AdjCfg *AdjunctCfg
Type *schema.TypeInt
}
func (intReprIntReprBuilderGenerator) EmitNodeBuilderType(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeBuilderMethods(io.Writer) {}
func (g intReprIntReprBuilderGenerator) EmitNodeAssemblerType(w io.Writer) {
// Since this is a "natural" representation... there's just a type alias here.
// No new functions are necessary.
doTemplate(`
type _{{ .Type | TypeSymbol }}__ReprAssembler = _{{ .Type | TypeSymbol }}__Assembler
`, w, g.AdjCfg, g)
}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodBeginMap(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodBeginList(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignNull(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignBool(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignInt(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignFloat(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignString(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignBytes(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignLink(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerMethodPrototype(io.Writer) {}
func (intReprIntReprBuilderGenerator) EmitNodeAssemblerOtherBits(io.Writer) {}