Small scope refactoring (#18263)

* Small scope refactoring

* Add test for #10251

* Add inline where appropriate
This commit is contained in:
Clyybber 2021-06-14 19:19:58 +02:00 • committed by GitHub
commit 8c42f5be02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 24 deletions

View file

@ -138,15 +138,13 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
identToReplace[] = symNode
if e.position == 0: hasNull = true
if result.sym != nil and sfExported in result.sym.flags:
incl(e.flags, {sfUsed, sfExported})
if result.sym != nil and not isPure:
addInterfaceDeclAux(c, e, forceExport = sfExported in result.sym.flags)
e.flags.incl {sfUsed, sfExported}
result.n.add symNode
styleCheckDef(c.config, e)
onDef(e.info, e)
if sfGenSym notin e.flags:
if not isPure: addDecl(c, e)
if not isPure: addInterfaceDecl(c, e)
else: declarePureEnumField(c, e)
if isPure and (let conflict = strTableInclReportConflict(symbols, e); conflict != nil):
wrongRedefinition(c, e.info, e.name.s, conflict.info)