fixes #4295
This commit is contained in:
parent
dc33b7d7e9
commit
e8faa214eb
2 changed files with 12 additions and 6 deletions
|
|
@ -41,11 +41,15 @@ proc getSysSym*(name: string): PSym =
|
||||||
proc getSysMagic*(name: string, m: TMagic): PSym =
|
proc getSysMagic*(name: string, m: TMagic): PSym =
|
||||||
var ti: TIdentIter
|
var ti: TIdentIter
|
||||||
let id = getIdent(name)
|
let id = getIdent(name)
|
||||||
result = initIdentIter(ti, systemModule.tab, id)
|
var r = initIdentIter(ti, systemModule.tab, id)
|
||||||
while result != nil:
|
while r != nil:
|
||||||
if result.kind == skStub: loadStub(result)
|
if r.kind == skStub: loadStub(r)
|
||||||
if result.magic == m: return result
|
if r.magic == m:
|
||||||
result = nextIdentIter(ti, systemModule.tab)
|
# prefer the tyInt variant:
|
||||||
|
if r.typ.sons[0].kind == tyInt: return r
|
||||||
|
result = r
|
||||||
|
r = nextIdentIter(ti, systemModule.tab)
|
||||||
|
if result != nil: return result
|
||||||
rawMessage(errSystemNeeds, name)
|
rawMessage(errSystemNeeds, name)
|
||||||
result = newSym(skError, id, systemModule, systemModule.info)
|
result = newSym(skError, id, systemModule, systemModule.info)
|
||||||
result.typ = newType(tyError, systemModule)
|
result.typ = newType(tyError, systemModule)
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,9 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode,
|
||||||
result = n.sons[1]
|
result = n.sons[1]
|
||||||
else:
|
else:
|
||||||
result = newNodeIT(nkCall, n.info, getSysType(tyInt))
|
result = newNodeIT(nkCall, n.info, getSysType(tyInt))
|
||||||
result.add newSymNode(getSysMagic("-", mSubI), n.info)
|
let subi = getSysMagic("-", mSubI)
|
||||||
|
#echo "got ", typeToString(subi.typ)
|
||||||
|
result.add newSymNode(subi, n.info)
|
||||||
result.add lenExprB
|
result.add lenExprB
|
||||||
result.add n.sons[1]
|
result.add n.sons[1]
|
||||||
of mPlugin:
|
of mPlugin:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue