fixes #2823
This commit is contained in:
parent
cd42d38887
commit
d82d430cbe
2 changed files with 11 additions and 2 deletions
|
|
@ -323,7 +323,8 @@ proc paramStorageLoc(param: PSym): TStorageLoc =
|
||||||
result = OnUnknown
|
result = OnUnknown
|
||||||
|
|
||||||
proc genProcParams(m: BModule, t: PType, rettype, params: var Rope,
|
proc genProcParams(m: BModule, t: PType, rettype, params: var Rope,
|
||||||
check: var IntSet, declareEnvironment=true) =
|
check: var IntSet, declareEnvironment=true;
|
||||||
|
weakDep=false) =
|
||||||
params = nil
|
params = nil
|
||||||
if (t.sons[0] == nil) or isInvalidReturnType(t.sons[0]):
|
if (t.sons[0] == nil) or isInvalidReturnType(t.sons[0]):
|
||||||
rettype = ~"void"
|
rettype = ~"void"
|
||||||
|
|
@ -341,6 +342,8 @@ proc genProcParams(m: BModule, t: PType, rettype, params: var Rope,
|
||||||
add(params, ~"*")
|
add(params, ~"*")
|
||||||
incl(param.loc.flags, lfIndirect)
|
incl(param.loc.flags, lfIndirect)
|
||||||
param.loc.s = OnUnknown
|
param.loc.s = OnUnknown
|
||||||
|
elif weakDep:
|
||||||
|
add(params, getTypeDescWeak(m, param.typ, check))
|
||||||
else:
|
else:
|
||||||
add(params, getTypeDescAux(m, param.typ, check))
|
add(params, getTypeDescAux(m, param.typ, check))
|
||||||
add(params, ~" ")
|
add(params, ~" ")
|
||||||
|
|
@ -577,7 +580,7 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var IntSet): Rope =
|
||||||
result = getTypeName(t)
|
result = getTypeName(t)
|
||||||
idTablePut(m.typeCache, t, result)
|
idTablePut(m.typeCache, t, result)
|
||||||
var rettype, desc: Rope
|
var rettype, desc: Rope
|
||||||
genProcParams(m, t, rettype, desc, check)
|
genProcParams(m, t, rettype, desc, check, true, true)
|
||||||
if not isImportedType(t):
|
if not isImportedType(t):
|
||||||
if t.callConv != ccClosure: # procedure vars may need a closure!
|
if t.callConv != ccClosure: # procedure vars may need a closure!
|
||||||
addf(m.s[cfsTypes], "typedef $1_PTR($2, $3) $4;$n",
|
addf(m.s[cfsTypes], "typedef $1_PTR($2, $3) $4;$n",
|
||||||
|
|
|
||||||
|
|
@ -6,3 +6,9 @@ proc f(x: proc: MalType) =
|
||||||
discard x()
|
discard x()
|
||||||
|
|
||||||
f(nil)
|
f(nil)
|
||||||
|
|
||||||
|
# bug #2823
|
||||||
|
|
||||||
|
type A = object #of RootObj <-- Uncomment this to get no errors
|
||||||
|
test: proc(i: A): bool
|
||||||
|
var a: proc(i: A): bool # Or comment this line to get no errors
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue