floatGenMixin.go 4.68 KB
Newer Older
Eric Myhre's avatar
Eric Myhre committed
1 2 3 4 5
package mixins

import (
	"io"

6
	ld "gitlab.dms3.io/ld/go-ld-prime"
Eric Myhre's avatar
Eric Myhre committed
7 8 9 10 11 12 13 14
)

type FloatTraits struct {
	PkgName    string
	TypeName   string // see doc in kindTraitsGenerator
	TypeSymbol string // see doc in kindTraitsGenerator
}

15 16
func (FloatTraits) Kind() ld.Kind {
	return ld.Kind_Float
Eric Myhre's avatar
Eric Myhre committed
17
}
18
func (g FloatTraits) EmitNodeMethodKind(w io.Writer) {
Eric Myhre's avatar
Eric Myhre committed
19
	doTemplate(`
20 21
		func ({{ .TypeSymbol }}) Kind() ld.Kind {
			return ld.Kind_Float
Eric Myhre's avatar
Eric Myhre committed
22 23 24
		}
	`, w, g)
}
25
func (g FloatTraits) EmitNodeMethodLookupByString(w io.Writer) {
26
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodLookupByString(w)
Eric Myhre's avatar
Eric Myhre committed
27
}
28
func (g FloatTraits) EmitNodeMethodLookupByNode(w io.Writer) {
29
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodLookupByNode(w)
Eric Myhre's avatar
Eric Myhre committed
30
}
31
func (g FloatTraits) EmitNodeMethodLookupByIndex(w io.Writer) {
32
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodLookupByIndex(w)
Eric Myhre's avatar
Eric Myhre committed
33
}
34
func (g FloatTraits) EmitNodeMethodLookupBySegment(w io.Writer) {
35
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodLookupBySegment(w)
Eric Myhre's avatar
Eric Myhre committed
36 37
}
func (g FloatTraits) EmitNodeMethodMapIterator(w io.Writer) {
38
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodMapIterator(w)
Eric Myhre's avatar
Eric Myhre committed
39 40
}
func (g FloatTraits) EmitNodeMethodListIterator(w io.Writer) {
41
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodListIterator(w)
Eric Myhre's avatar
Eric Myhre committed
42 43
}
func (g FloatTraits) EmitNodeMethodLength(w io.Writer) {
44
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodLength(w)
Eric Myhre's avatar
Eric Myhre committed
45
}
46
func (g FloatTraits) EmitNodeMethodIsAbsent(w io.Writer) {
47
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodIsAbsent(w)
Eric Myhre's avatar
Eric Myhre committed
48 49
}
func (g FloatTraits) EmitNodeMethodIsNull(w io.Writer) {
50
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodIsNull(w)
Eric Myhre's avatar
Eric Myhre committed
51 52
}
func (g FloatTraits) EmitNodeMethodAsBool(w io.Writer) {
53
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodAsBool(w)
Eric Myhre's avatar
Eric Myhre committed
54 55
}
func (g FloatTraits) EmitNodeMethodAsInt(w io.Writer) {
56
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodAsInt(w)
Eric Myhre's avatar
Eric Myhre committed
57 58
}
func (g FloatTraits) EmitNodeMethodAsString(w io.Writer) {
59
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodAsString(w)
Eric Myhre's avatar
Eric Myhre committed
60 61
}
func (g FloatTraits) EmitNodeMethodAsBytes(w io.Writer) {
62
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodAsBytes(w)
Eric Myhre's avatar
Eric Myhre committed
63 64
}
func (g FloatTraits) EmitNodeMethodAsLink(w io.Writer) {
65
	kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodAsLink(w)
Eric Myhre's avatar
Eric Myhre committed
66 67 68 69 70 71 72 73
}

type FloatAssemblerTraits struct {
	PkgName       string
	TypeName      string // see doc in kindAssemblerTraitsGenerator
	AppliedPrefix string // see doc in kindAssemblerTraitsGenerator
}

74 75
func (FloatAssemblerTraits) Kind() ld.Kind {
	return ld.Kind_Float
Eric Myhre's avatar
Eric Myhre committed
76 77
}
func (g FloatAssemblerTraits) EmitNodeAssemblerMethodBeginMap(w io.Writer) {
78
	kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodBeginMap(w)
Eric Myhre's avatar
Eric Myhre committed
79 80
}
func (g FloatAssemblerTraits) EmitNodeAssemblerMethodBeginList(w io.Writer) {
81
	kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodBeginList(w)
Eric Myhre's avatar
Eric Myhre committed
82 83
}
func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignNull(w io.Writer) {
84
	kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignNull(w)
Eric Myhre's avatar
Eric Myhre committed
85 86
}
func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignBool(w io.Writer) {
87
	kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignBool(w)
Eric Myhre's avatar
Eric Myhre committed
88 89
}
func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignInt(w io.Writer) {
90
	kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignInt(w)
Eric Myhre's avatar
Eric Myhre committed
91 92
}
func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignString(w io.Writer) {
93
	kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignString(w)
Eric Myhre's avatar
Eric Myhre committed
94 95
}
func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignBytes(w io.Writer) {
96
	kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignBytes(w)
Eric Myhre's avatar
Eric Myhre committed
97 98
}
func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignLink(w io.Writer) {
99
	kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignLink(w)
Eric Myhre's avatar
Eric Myhre committed
100
}
101
func (g FloatAssemblerTraits) EmitNodeAssemblerMethodPrototype(w io.Writer) {
102
	kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodPrototype(w)
Eric Myhre's avatar
Eric Myhre committed
103
}