* TSymFlag has 47 flags already

* fixes #18320
This commit is contained in:
Andreas Rumpf 2021-06-24 18:37:04 +02:00 • committed by GitHub
commit 16038d44f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -229,7 +229,7 @@ type
TNodeKinds* = set[TNodeKind] TNodeKinds* = set[TNodeKind]
type type
TSymFlag* = enum # 46 flags! TSymFlag* = enum # 47 flags!
sfUsed, # read access of sym (for warnings) or simply used sfUsed, # read access of sym (for warnings) or simply used
sfExported, # symbol is exported from module sfExported, # symbol is exported from module
sfFromGeneric, # symbol is instantiation of a generic; this is needed sfFromGeneric, # symbol is instantiation of a generic; this is needed

View file

@ -51,6 +51,7 @@ type
SubgraphFlag = enum SubgraphFlag = enum
isMutated, # graph might be mutated isMutated, # graph might be mutated
isMutatedDirectly, # graph is mutated directly by a non-var parameter. isMutatedDirectly, # graph is mutated directly by a non-var parameter.
isMutatedByVarParam, # graph is mutated by a var parameter.
connectsConstParam # graph is connected to a non-var parameter. connectsConstParam # graph is connected to a non-var parameter.
VarFlag = enum VarFlag = enum
@ -184,7 +185,7 @@ proc potentialMutation(v: var Partitions; s: PSym; level: int; info: TLineInfo)
{isMutated, isMutatedDirectly} {isMutated, isMutatedDirectly}
elif s.typ.kind == tyVar and level <= 1: elif s.typ.kind == tyVar and level <= 1:
# varParam[i] = v is different from varParam[i][] = v # varParam[i] = v is different from varParam[i][] = v
{} {isMutatedByVarParam}
else: else:
{isMutated} {isMutated}
else: else:
@ -878,7 +879,7 @@ proc computeGraphPartitions*(s: PSym; n: PNode; g: ModuleGraph; goals: set[Goal]
proc dangerousMutation(g: MutationInfo; v: VarIndex): bool = proc dangerousMutation(g: MutationInfo; v: VarIndex): bool =
#echo "range ", v.aliveStart, " .. ", v.aliveEnd, " ", v.sym #echo "range ", v.aliveStart, " .. ", v.aliveEnd, " ", v.sym
if isMutated in g.flags: if {isMutated, isMutatedByVarParam} * g.flags != {}:
for m in g.mutations: for m in g.mutations:
#echo "mutation ", m #echo "mutation ", m
if m in v.aliveStart..v.aliveEnd: if m in v.aliveStart..v.aliveEnd:
@ -941,4 +942,5 @@ proc computeCursors*(s: PSym; n: PNode; g: ModuleGraph) =
discard "cannot cursor into a graph that is mutated" discard "cannot cursor into a graph that is mutated"
else: else:
v.sym.flags.incl sfCursor v.sym.flags.incl sfCursor
#echo "this is now a cursor ", v.sym, " ", par.s[rid].flags, " ", g.config $ v.sym.info when false:
echo "this is now a cursor ", v.sym, " ", par.s[rid].flags, " ", g.config $ v.sym.info