implements --hint[globalvar]:on switch for quickly finding global variables
This commit is contained in:
parent
9849808720
commit
dd8a6ef3a2
2 changed files with 7 additions and 3 deletions
|
|
@ -44,6 +44,7 @@ type
|
||||||
hintConditionAlwaysTrue, hintName, hintPattern,
|
hintConditionAlwaysTrue, hintName, hintPattern,
|
||||||
hintExecuting, hintLinking, hintDependency,
|
hintExecuting, hintLinking, hintDependency,
|
||||||
hintSource, hintPerformance, hintStackTrace, hintGCStats,
|
hintSource, hintPerformance, hintStackTrace, hintGCStats,
|
||||||
|
hintGlobalVar,
|
||||||
hintUser, hintUserRaw
|
hintUser, hintUserRaw
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
@ -113,6 +114,7 @@ const
|
||||||
hintPerformance: "$1",
|
hintPerformance: "$1",
|
||||||
hintStackTrace: "$1",
|
hintStackTrace: "$1",
|
||||||
hintGCStats: "$1",
|
hintGCStats: "$1",
|
||||||
|
hintGlobalVar: "global variable declared here",
|
||||||
hintUser: "$1",
|
hintUser: "$1",
|
||||||
hintUserRaw: "$1"]
|
hintUserRaw: "$1"]
|
||||||
|
|
||||||
|
|
@ -134,7 +136,7 @@ const
|
||||||
"XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded",
|
"XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded",
|
||||||
"ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf",
|
"ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf",
|
||||||
"Path", "CondTrue", "Name", "Pattern", "Exec", "Link", "Dependency",
|
"Path", "CondTrue", "Name", "Pattern", "Exec", "Link", "Dependency",
|
||||||
"Source", "Performance", "StackTrace", "GCStats",
|
"Source", "Performance", "StackTrace", "GCStats", "GlobalVar",
|
||||||
"User", "UserRaw"]
|
"User", "UserRaw"]
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
@ -166,7 +168,7 @@ const
|
||||||
hintExecuting, hintLinking,
|
hintExecuting, hintLinking,
|
||||||
hintCodeBegin, hintCodeEnd,
|
hintCodeBegin, hintCodeEnd,
|
||||||
hintSource, hintStackTrace,
|
hintSource, hintStackTrace,
|
||||||
hintGCStats},
|
hintGlobalVar, hintGCStats},
|
||||||
{low(TNoteKind)..high(TNoteKind)} - {warnShadowIdent, warnUninit,
|
{low(TNoteKind)..high(TNoteKind)} - {warnShadowIdent, warnUninit,
|
||||||
warnProveField, warnProveIndex,
|
warnProveField, warnProveIndex,
|
||||||
warnGcUnsafe,
|
warnGcUnsafe,
|
||||||
|
|
@ -174,7 +176,7 @@ const
|
||||||
hintDependency,
|
hintDependency,
|
||||||
hintCodeBegin, hintCodeEnd,
|
hintCodeBegin, hintCodeEnd,
|
||||||
hintSource, hintStackTrace,
|
hintSource, hintStackTrace,
|
||||||
hintGCStats},
|
hintGlobalVar, hintGCStats},
|
||||||
{low(TNoteKind)..high(TNoteKind)} - {hintStackTrace, warnUninit},
|
{low(TNoteKind)..high(TNoteKind)} - {hintStackTrace, warnUninit},
|
||||||
{low(TNoteKind)..high(TNoteKind)}]
|
{low(TNoteKind)..high(TNoteKind)}]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -569,6 +569,8 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
|
||||||
b.sons[j] = newSymNode(v)
|
b.sons[j] = newSymNode(v)
|
||||||
checkNilable(c, v)
|
checkNilable(c, v)
|
||||||
if sfCompileTime in v.flags: hasCompileTime = true
|
if sfCompileTime in v.flags: hasCompileTime = true
|
||||||
|
if v.flags * {sfGlobal, sfThread} == {sfGlobal}:
|
||||||
|
message(c.config, v.info, hintGlobalVar)
|
||||||
if hasCompileTime:
|
if hasCompileTime:
|
||||||
vm.setupCompileTimeVar(c.module, c.cache, c.graph, result)
|
vm.setupCompileTimeVar(c.module, c.cache, c.graph, result)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue