generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 5
/
typeparameter.go
35 lines (28 loc) 路 988 Bytes
/
typeparameter.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
package schema
import (
"google.golang.org/protobuf/reflect/protoreflect"
schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema"
)
type TypeParameter struct {
Pos Position `parser:"" protobuf:"1,optional"`
Name string `parser:"@Ident" protobuf:"2"`
}
var _ Symbol = (*TypeParameter)(nil)
func (t *TypeParameter) Position() Position { return t.Pos }
func (t *TypeParameter) String() string { return t.Name }
func (t *TypeParameter) ToProto() protoreflect.ProtoMessage {
return &schemapb.TypeParameter{Pos: posToProto(t.Pos), Name: t.Name}
}
func (t *TypeParameter) schemaChildren() []Node { return nil }
func (t *TypeParameter) schemaSymbol() {}
func (t *TypeParameter) GetName() string { return t.Name }
func typeParametersToSchema(s []*schemapb.TypeParameter) []*TypeParameter {
var out []*TypeParameter
for _, n := range s {
out = append(out, &TypeParameter{
Pos: posFromProto(n.Pos),
Name: n.Name,
})
}
return out
}