replace deprecated safeAdd with add (#9416)

This commit is contained in:
Miran
2018-10-18 12:29:32 +02:00
committed by Andreas Rumpf
parent 7d8e281239
commit 675c629fee
7 changed files with 12 additions and 12 deletions

View File

@@ -616,7 +616,7 @@ proc loadType(g; id: int; info: TLineInfo): PType =
doAssert b.s[b.pos] == '\20'
inc(b.pos)
let y = loadSym(g, decodeVInt(b.s, b.pos), info)
result.methods.safeAdd((x, y))
result.methods.add((x, y))
decodeLoc(g, b, result.loc, info)
while b.s[b.pos] == '^':
inc(b.pos)
@@ -656,7 +656,7 @@ proc decodeInstantiations(g; b; info: TLineInfo;
if b.s[b.pos] == '\20':
inc(b.pos)
ii.compilesId = decodeVInt(b.s, b.pos)
s.safeAdd ii
s.add ii
proc loadSymFromBlob(g; b; info: TLineInfo): PSym =
if b.s[b.pos] == '{':
@@ -717,7 +717,7 @@ proc loadSymFromBlob(g; b; info: TLineInfo): PSym =
of skType, skGenericParam:
while b.s[b.pos] == '\14':
inc(b.pos)
result.typeInstCache.safeAdd loadType(g, decodeVInt(b.s, b.pos), result.info)
result.typeInstCache.add loadType(g, decodeVInt(b.s, b.pos), result.info)
of routineKinds:
decodeInstantiations(g, b, result.info, result.procInstCache)
if b.s[b.pos] == '\16':

View File

@@ -105,7 +105,7 @@ proc pickBestCandidate(c: PContext, headSymbol: PNode,
if cmp < 0: best = z # x is better than the best so far
elif cmp == 0: alt = z # x is as good as the best so far
elif errorsEnabled or z.diagnosticsEnabled:
errors.safeAdd(CandidateError(
errors.add(CandidateError(
sym: sym,
unmatchedVarParam: int z.mutabilityProblem,
firstMismatch: z.firstMismatch,

View File

@@ -377,7 +377,7 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
#if c.compilesContextId == 0:
rawHandleSelf(c, result)
entry.compilesId = c.compilesContextId
fn.procInstCache.safeAdd(entry)
fn.procInstCache.add(entry)
c.generics.add(makeInstPair(fn, entry))
if n.sons[pragmasPos].kind != nkEmpty:
pragma(c, result, n.sons[pragmasPos], allRoutinePragmas)

View File

@@ -1517,7 +1517,7 @@ proc semMethodPrototype(c: PContext; s: PSym; n: PNode) =
tyAlias, tySink})
if x.kind == tyObject and t.len-1 == n.sons[genericParamsPos].len:
foundObj = true
x.methods.safeAdd((col,s))
x.methods.add((col,s))
if not foundObj:
message(c.config, n.info, warnDeprecated, "generic method not attachable to object type")
else:

View File

@@ -69,7 +69,7 @@ proc cacheTypeInst*(inst: PType) =
let t = if gt.kind == tyGenericBody: gt.lastSon else: gt
if t.kind in {tyStatic, tyGenericParam} + tyTypeClasses:
return
gt.sym.typeInstCache.safeAdd(inst)
gt.sym.typeInstCache.add(inst)
type

View File

@@ -728,7 +728,7 @@ proc matchUserTypeClass*(m: var TCandidate; ff, a: PType): PType =
else:
makeTypeDesc(c, typ)
typeParams.safeAdd((param, typ))
typeParams.add((param, typ))
addDecl(c, param)
@@ -757,7 +757,7 @@ proc matchUserTypeClass*(m: var TCandidate; ff, a: PType): PType =
if collectDiagnostics:
m.c.config.writelnHook = oldWriteHook
for msg in diagnostics:
m.diagnostics.safeAdd msg
m.diagnostics.add msg
m.diagnosticsEnabled = true
if checkedBody == nil: return nil
@@ -1027,7 +1027,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType,
result = typeRel(c, aOrig.base, candidate)
if result != isNone:
c.inferredTypes.safeAdd aOrig
c.inferredTypes.add aOrig
aOrig.sons.add candidate
result = isEqual
return
@@ -1727,7 +1727,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType,
else:
result = typeRel(c, f.base, a)
if result != isNone:
c.inferredTypes.safeAdd f
c.inferredTypes.add f
f.sons.add a
of tyTypeDesc:

View File

@@ -406,7 +406,7 @@ const
const preferToResolveSymbols = {preferName, preferTypeName, preferModuleInfo, preferGenericArg}
template bindConcreteTypeToUserTypeClass*(tc, concrete: PType) =
tc.sons.safeAdd concrete
tc.sons.add concrete
tc.flags.incl tfResolved
# TODO: It would be a good idea to kill the special state of a resolved