bugfix: endless recursion in 'semAfterMacroCall'
This commit is contained in:
parent
c682a1da2b
commit
69997af8e9
2 changed files with 5 additions and 1 deletions
|
|
@ -99,6 +99,10 @@ proc semAndEvalConstExpr(c: PContext, n: PNode): PNode =
|
||||||
include seminst, semcall
|
include seminst, semcall
|
||||||
|
|
||||||
proc semAfterMacroCall(c: PContext, n: PNode, s: PSym): PNode =
|
proc semAfterMacroCall(c: PContext, n: PNode, s: PSym): PNode =
|
||||||
|
inc(evalTemplateCounter)
|
||||||
|
if evalTemplateCounter > 100:
|
||||||
|
GlobalError(s.info, errTemplateInstantiationTooNested)
|
||||||
|
|
||||||
result = n
|
result = n
|
||||||
case s.typ.sons[0].kind
|
case s.typ.sons[0].kind
|
||||||
of tyExpr:
|
of tyExpr:
|
||||||
|
|
@ -115,6 +119,7 @@ proc semAfterMacroCall(c: PContext, n: PNode, s: PSym): PNode =
|
||||||
result = semExpr(c, result)
|
result = semExpr(c, result)
|
||||||
result = fitNode(c, s.typ.sons[0], result)
|
result = fitNode(c, s.typ.sons[0], result)
|
||||||
#GlobalError(s.info, errInvalidParamKindX, typeToString(s.typ.sons[0]))
|
#GlobalError(s.info, errInvalidParamKindX, typeToString(s.typ.sons[0]))
|
||||||
|
dec(evalTemplateCounter)
|
||||||
|
|
||||||
proc semMacroExpr(c: PContext, n: PNode, sym: PSym,
|
proc semMacroExpr(c: PContext, n: PNode, sym: PSym,
|
||||||
semCheck: bool = true): PNode =
|
semCheck: bool = true): PNode =
|
||||||
|
|
|
||||||
|
|
@ -562,7 +562,6 @@ proc rawAlloc0(a: var TMemRegion, requestedSize: int): pointer =
|
||||||
|
|
||||||
proc rawDealloc(a: var TMemRegion, p: pointer) =
|
proc rawDealloc(a: var TMemRegion, p: pointer) =
|
||||||
sysAssert(allocInv(a), "rawDealloc: begin")
|
sysAssert(allocInv(a), "rawDealloc: begin")
|
||||||
sysAssert(isAllocatedPtr(a, p), "rawDealloc: no allocated pointer!")
|
|
||||||
var c = pageAddr(p)
|
var c = pageAddr(p)
|
||||||
if isSmallChunk(c):
|
if isSmallChunk(c):
|
||||||
# `p` is within a small chunk:
|
# `p` is within a small chunk:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue