diff options
author | Araq <rumpf_a@web.de> | 2018-10-30 15:03:19 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-10-30 15:03:28 +0100 |
commit | e844e536bf29d3b18333d7ed4c53bb54b75a2d75 (patch) | |
tree | d06c43b70dc7de82355051579443a1b0d10d16c9 /compiler/semstmts.nim | |
parent | 5c25b9389818925ec3697750c6cbcad3bf5c757b (diff) | |
download | Nim-e844e536bf29d3b18333d7ed4c53bb54b75a2d75.tar.gz |
Nim style checker: document the switch; fixes #9564
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r-- | compiler/semstmts.nim | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index b97a56178..5c7f866ce 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -318,7 +318,6 @@ proc semIdentDef(c: PContext, n: PNode, kind: TSymKind): PSym = if result.owner.kind == skModule: incl(result.flags, sfGlobal) suggestSym(c.config, n.info, result, c.graph.usageSym) - styleCheckDef(c.config, result) proc checkNilable(c: PContext; v: PSym) = if {sfGlobal, sfImportC} * v.flags == {sfGlobal} and @@ -359,6 +358,7 @@ proc semUsing(c: PContext; n: PNode): PNode = let typ = semTypeNode(c, a.sons[length-2], nil) for j in countup(0, length-3): let v = semIdentDef(c, a.sons[j], skParam) + styleCheckDef(c.config, v) v.typ = typ strTableIncl(c.signatures, v) else: @@ -489,6 +489,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = addToVarSection(c, result, n, a) continue var v = semIdentDef(c, a.sons[j], symkind) + styleCheckDef(c.config, v) if sfGenSym notin v.flags and not isDiscardUnderscore(v): addInterfaceDecl(c, v) when oKeepVariableNames: @@ -542,6 +543,7 @@ proc semConst(c: PContext, n: PNode): PNode = if a.kind != nkConstDef: illFormedAst(a, c.config) checkSonsLen(a, 3, c.config) var v = semIdentDef(c, a.sons[0], skConst) + styleCheckDef(c.config, v) var typ: PType = nil if a.sons[1].kind != nkEmpty: typ = semTypeNode(c, a.sons[1], nil) @@ -873,6 +875,7 @@ proc typeSectionLeftSidePass(c: PContext, n: PNode) = let typsym = pkg.tab.strTableGet(typName) if typsym.isNil: s = semIdentDef(c, name[1], skType) + styleCheckDef(c.config, s) s.typ = newTypeS(tyObject, c) s.typ.sym = s s.flags.incl sfForward @@ -886,6 +889,7 @@ proc typeSectionLeftSidePass(c: PContext, n: PNode) = s = typsym else: s = semIdentDef(c, name, skType) + styleCheckDef(c.config, s) s.typ = newTypeS(tyForward, c) s.typ.sym = s # process pragmas: if name.kind == nkPragmaExpr: @@ -1616,6 +1620,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, pragma(c, s, n.sons[pragmasPos], validPragmas) else: implicitPragmas(c, s, n, validPragmas) + styleCheckDef(c.config, s) else: if n.sons[pragmasPos].kind != nkEmpty: pragma(c, s, n.sons[pragmasPos], validPragmas) @@ -1628,6 +1633,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, if proto.typ.callConv != s.typ.callConv or proto.typ.flags < s.typ.flags: localError(c.config, n.sons[pragmasPos].info, errPragmaOnlyInHeaderOfProcX % ("'" & proto.name.s & "' from " & c.config$proto.info)) + styleCheckDef(c.config, s) if sfForward notin proto.flags and proto.magic == mNone: wrongRedefinition(c, n.info, proto.name.s, proto.info) excl(proto.flags, sfForward) |