Kindsys: Replace "Declaration" with "Definition" (#62515)

* s/Declaration/Definition/g

* s/DeclForGen/DefForGen/g

* Rename some local vars
This commit is contained in:
sam boyer
2023-01-31 04:50:08 -05:00
committed by GitHub
parent d48a8fd227
commit dbe2f0c8f6
34 changed files with 262 additions and 261 deletions

View File

@ -126,17 +126,17 @@ func (d prefixmod) applyfunc(c *dstutil.Cursor) bool {
// field value specifications that reference those types.
d.handleExpr(x.Type)
case *dst.File:
for _, decl := range x.Decls {
comments := decl.Decorations().Start.All()
decl.Decorations().Start.Clear()
for _, def := range x.Decls {
comments := def.Decorations().Start.All()
def.Decorations().Start.Clear()
// For any reason, sometimes it retrieves the comment duplicated 🤷
commentMap := make(map[string]bool)
for _, c := range comments {
if _, ok := commentMap[c]; !ok {
commentMap[c] = true
decl.Decorations().Start.Append(d.rxpsuff.ReplaceAllString(c, "$1"))
def.Decorations().Start.Append(d.rxpsuff.ReplaceAllString(c, "$1"))
if d.replace != "" {
decl.Decorations().Start.Append(d.rxp.ReplaceAllString(c, d.replace+"$1"))
def.Decorations().Start.Append(d.rxp.ReplaceAllString(c, d.replace+"$1"))
}
}
}