replace deprecated safeAdd with add (#9416)
This commit is contained in:
parent
7d8e281239
commit
675c629fee
7 changed files with 12 additions and 12 deletions
|
|
@ -616,7 +616,7 @@ proc loadType(g; id: int; info: TLineInfo): PType =
|
||||||
doAssert b.s[b.pos] == '\20'
|
doAssert b.s[b.pos] == '\20'
|
||||||
inc(b.pos)
|
inc(b.pos)
|
||||||
let y = loadSym(g, decodeVInt(b.s, b.pos), info)
|
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)
|
decodeLoc(g, b, result.loc, info)
|
||||||
while b.s[b.pos] == '^':
|
while b.s[b.pos] == '^':
|
||||||
inc(b.pos)
|
inc(b.pos)
|
||||||
|
|
@ -656,7 +656,7 @@ proc decodeInstantiations(g; b; info: TLineInfo;
|
||||||
if b.s[b.pos] == '\20':
|
if b.s[b.pos] == '\20':
|
||||||
inc(b.pos)
|
inc(b.pos)
|
||||||
ii.compilesId = decodeVInt(b.s, b.pos)
|
ii.compilesId = decodeVInt(b.s, b.pos)
|
||||||
s.safeAdd ii
|
s.add ii
|
||||||
|
|
||||||
proc loadSymFromBlob(g; b; info: TLineInfo): PSym =
|
proc loadSymFromBlob(g; b; info: TLineInfo): PSym =
|
||||||
if b.s[b.pos] == '{':
|
if b.s[b.pos] == '{':
|
||||||
|
|
@ -717,7 +717,7 @@ proc loadSymFromBlob(g; b; info: TLineInfo): PSym =
|
||||||
of skType, skGenericParam:
|
of skType, skGenericParam:
|
||||||
while b.s[b.pos] == '\14':
|
while b.s[b.pos] == '\14':
|
||||||
inc(b.pos)
|
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:
|
of routineKinds:
|
||||||
decodeInstantiations(g, b, result.info, result.procInstCache)
|
decodeInstantiations(g, b, result.info, result.procInstCache)
|
||||||
if b.s[b.pos] == '\16':
|
if b.s[b.pos] == '\16':
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ proc pickBestCandidate(c: PContext, headSymbol: PNode,
|
||||||
if cmp < 0: best = z # x is better than the best so far
|
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 cmp == 0: alt = z # x is as good as the best so far
|
||||||
elif errorsEnabled or z.diagnosticsEnabled:
|
elif errorsEnabled or z.diagnosticsEnabled:
|
||||||
errors.safeAdd(CandidateError(
|
errors.add(CandidateError(
|
||||||
sym: sym,
|
sym: sym,
|
||||||
unmatchedVarParam: int z.mutabilityProblem,
|
unmatchedVarParam: int z.mutabilityProblem,
|
||||||
firstMismatch: z.firstMismatch,
|
firstMismatch: z.firstMismatch,
|
||||||
|
|
|
||||||
|
|
@ -377,7 +377,7 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
|
||||||
#if c.compilesContextId == 0:
|
#if c.compilesContextId == 0:
|
||||||
rawHandleSelf(c, result)
|
rawHandleSelf(c, result)
|
||||||
entry.compilesId = c.compilesContextId
|
entry.compilesId = c.compilesContextId
|
||||||
fn.procInstCache.safeAdd(entry)
|
fn.procInstCache.add(entry)
|
||||||
c.generics.add(makeInstPair(fn, entry))
|
c.generics.add(makeInstPair(fn, entry))
|
||||||
if n.sons[pragmasPos].kind != nkEmpty:
|
if n.sons[pragmasPos].kind != nkEmpty:
|
||||||
pragma(c, result, n.sons[pragmasPos], allRoutinePragmas)
|
pragma(c, result, n.sons[pragmasPos], allRoutinePragmas)
|
||||||
|
|
|
||||||
|
|
@ -1517,7 +1517,7 @@ proc semMethodPrototype(c: PContext; s: PSym; n: PNode) =
|
||||||
tyAlias, tySink})
|
tyAlias, tySink})
|
||||||
if x.kind == tyObject and t.len-1 == n.sons[genericParamsPos].len:
|
if x.kind == tyObject and t.len-1 == n.sons[genericParamsPos].len:
|
||||||
foundObj = true
|
foundObj = true
|
||||||
x.methods.safeAdd((col,s))
|
x.methods.add((col,s))
|
||||||
if not foundObj:
|
if not foundObj:
|
||||||
message(c.config, n.info, warnDeprecated, "generic method not attachable to object type")
|
message(c.config, n.info, warnDeprecated, "generic method not attachable to object type")
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ proc cacheTypeInst*(inst: PType) =
|
||||||
let t = if gt.kind == tyGenericBody: gt.lastSon else: gt
|
let t = if gt.kind == tyGenericBody: gt.lastSon else: gt
|
||||||
if t.kind in {tyStatic, tyGenericParam} + tyTypeClasses:
|
if t.kind in {tyStatic, tyGenericParam} + tyTypeClasses:
|
||||||
return
|
return
|
||||||
gt.sym.typeInstCache.safeAdd(inst)
|
gt.sym.typeInstCache.add(inst)
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -728,7 +728,7 @@ proc matchUserTypeClass*(m: var TCandidate; ff, a: PType): PType =
|
||||||
else:
|
else:
|
||||||
makeTypeDesc(c, typ)
|
makeTypeDesc(c, typ)
|
||||||
|
|
||||||
typeParams.safeAdd((param, typ))
|
typeParams.add((param, typ))
|
||||||
|
|
||||||
addDecl(c, param)
|
addDecl(c, param)
|
||||||
|
|
||||||
|
|
@ -757,7 +757,7 @@ proc matchUserTypeClass*(m: var TCandidate; ff, a: PType): PType =
|
||||||
if collectDiagnostics:
|
if collectDiagnostics:
|
||||||
m.c.config.writelnHook = oldWriteHook
|
m.c.config.writelnHook = oldWriteHook
|
||||||
for msg in diagnostics:
|
for msg in diagnostics:
|
||||||
m.diagnostics.safeAdd msg
|
m.diagnostics.add msg
|
||||||
m.diagnosticsEnabled = true
|
m.diagnosticsEnabled = true
|
||||||
|
|
||||||
if checkedBody == nil: return nil
|
if checkedBody == nil: return nil
|
||||||
|
|
@ -1027,7 +1027,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType,
|
||||||
|
|
||||||
result = typeRel(c, aOrig.base, candidate)
|
result = typeRel(c, aOrig.base, candidate)
|
||||||
if result != isNone:
|
if result != isNone:
|
||||||
c.inferredTypes.safeAdd aOrig
|
c.inferredTypes.add aOrig
|
||||||
aOrig.sons.add candidate
|
aOrig.sons.add candidate
|
||||||
result = isEqual
|
result = isEqual
|
||||||
return
|
return
|
||||||
|
|
@ -1727,7 +1727,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType,
|
||||||
else:
|
else:
|
||||||
result = typeRel(c, f.base, a)
|
result = typeRel(c, f.base, a)
|
||||||
if result != isNone:
|
if result != isNone:
|
||||||
c.inferredTypes.safeAdd f
|
c.inferredTypes.add f
|
||||||
f.sons.add a
|
f.sons.add a
|
||||||
|
|
||||||
of tyTypeDesc:
|
of tyTypeDesc:
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ const
|
||||||
const preferToResolveSymbols = {preferName, preferTypeName, preferModuleInfo, preferGenericArg}
|
const preferToResolveSymbols = {preferName, preferTypeName, preferModuleInfo, preferGenericArg}
|
||||||
|
|
||||||
template bindConcreteTypeToUserTypeClass*(tc, concrete: PType) =
|
template bindConcreteTypeToUserTypeClass*(tc, concrete: PType) =
|
||||||
tc.sons.safeAdd concrete
|
tc.sons.add concrete
|
||||||
tc.flags.incl tfResolved
|
tc.flags.incl tfResolved
|
||||||
|
|
||||||
# TODO: It would be a good idea to kill the special state of a resolved
|
# TODO: It would be a good idea to kill the special state of a resolved
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue