fix #12094 Use of _ (as var placeholder) inside a template causes XDe… (#20635)

fix #12094 Use of _ (as var placeholder) inside a template causes XDeclaredButNotUsed
This commit is contained in:
Bung 2022-10-25 14:43:14 +08:00 • committed by GitHub
commit 4728c52c78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -370,7 +370,8 @@ proc addToVarSection(c: PContext; result: var PNode; orig, identDefs: PNode) =
result.add identDefs result.add identDefs
proc isDiscardUnderscore(v: PSym): bool = proc isDiscardUnderscore(v: PSym): bool =
if v.name.s == "_": # template generated underscore symbol name starts with _`gensym
if v.name.s == "_" or v.name.s.startsWith("_`"):
v.flags.incl(sfGenSym) v.flags.incl(sfGenSym)
result = true result = true