Kindsys: Replace "Declaration" with "Definition" (#62515)
* s/Declaration/Definition/g * s/DeclForGen/DefForGen/g * Rename some local vars
This commit is contained in:
1 parent
d48a8fd227
commit
dbe2f0c8f6
34 files changed
+262
-261
No files matched your search
@@ -20,8 +20,8 @@ func CoreKindJenny(gokindsdir string, cfg *CoreKindJennyConfig) OneToOne {
|
||||
cfg = new(CoreKindJennyConfig)
|
||||
}
|
||||
if cfg.GenDirName == nil {
|
||||
cfg.GenDirName = func(decl *DeclForGen) string {
|
||||
return decl.Properties.Common().MachineName
|
||||
cfg.GenDirName = func(def *DefForGen) string {
|
||||
return def.Properties.Common().MachineName
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ func CoreKindJenny(gokindsdir string, cfg *CoreKindJennyConfig) OneToOne {
|
||||
// CoreKindJennyConfig holds configuration options for [CoreKindJenny].
|
||||
type CoreKindJennyConfig struct {
|
||||
// GenDirName returns the name of the directory in which the file should be
|
||||
// generated. Defaults to DeclForGen.Lineage().Name() if nil.
|
||||
GenDirName func(*DeclForGen) string
|
||||
// generated. Defaults to DefForGen.Lineage().Name() if nil.
|
||||
GenDirName func(*DefForGen) string
|
||||
}
|
||||
|
||||
type coreKindJenny struct {
|
||||
@@ -49,14 +49,14 @@ func (gen *coreKindJenny) JennyName() string {
|
||||
return "CoreKindJenny"
|
||||
}
|
||||
|
||||
func (gen *coreKindJenny) Generate(decl *DeclForGen) (*codejen.File, error) {
|
||||
if !decl.IsCore() {
|
||||
func (gen *coreKindJenny) Generate(def *DefForGen) (*codejen.File, error) {
|
||||
if !def.IsCore() {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
path := filepath.Join(gen.gokindsdir, gen.cfg.GenDirName(decl), decl.Properties.Common().MachineName+"_kind_gen.go")
|
||||
path := filepath.Join(gen.gokindsdir, gen.cfg.GenDirName(def), def.Properties.Common().MachineName+"_kind_gen.go")
|
||||
buf := new(bytes.Buffer)
|
||||
if err := tmpls.Lookup("kind_core.tmpl").Execute(buf, decl); err != nil {
|
||||
if err := tmpls.Lookup("kind_core.tmpl").Execute(buf, def); err != nil {
|
||||
return nil, fmt.Errorf("failed executing kind_core template for %s: %w", path, err)
|
||||
}
|
||||
b, err := postprocessGoFile(genGoFile{
|
||||
|
||||
Reference in new issue
Block a user