/
type.go
46 lines (34 loc) · 1.08 KB
/
type.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
// Copyright (c) 2023, Cogent Core. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gtigen
import (
"go/ast"
"cogentcore.org/core/gti"
)
// Type represents a parsed type.
type Type struct {
gti.Type
// LocalName is the name of the type in its package
LocalName string
// The standard AST type value
AST *ast.TypeSpec
// The name of the package the type is in
Pkg string
// The fields of the struct type; nil if not a struct
Fields Fields
// The embeds of the struct type; nil if not a struct
Embeds Fields
// The fields contained within the embeds of the struct type;
// nil if not a struct, and used for generating setters only
EmbeddedFields Fields
// Configuration information set in the comment directive for the type;
// is initialized to generator config info first
Config *Config
}
// Fields extends []gti.Field to provide the local type names and struct tags for each field.
type Fields struct {
Fields []gti.Field
LocalTypes map[string]string
Tags map[string]string
}