This commit is contained in:
Araq
2015-07-22 19:47:20 +02:00
parent cd42d38887
commit d82d430cbe
2 changed files with 11 additions and 2 deletions

View File

@@ -323,7 +323,8 @@ proc paramStorageLoc(param: PSym): TStorageLoc =
result = OnUnknown
proc genProcParams(m: BModule, t: PType, rettype, params: var Rope,
check: var IntSet, declareEnvironment=true) =
check: var IntSet, declareEnvironment=true;
weakDep=false) =
params = nil
if (t.sons[0] == nil) or isInvalidReturnType(t.sons[0]):
rettype = ~"void"
@@ -341,6 +342,8 @@ proc genProcParams(m: BModule, t: PType, rettype, params: var Rope,
add(params, ~"*")
incl(param.loc.flags, lfIndirect)
param.loc.s = OnUnknown
elif weakDep:
add(params, getTypeDescWeak(m, param.typ, check))
else:
add(params, getTypeDescAux(m, param.typ, check))
add(params, ~" ")
@@ -577,7 +580,7 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var IntSet): Rope =
result = getTypeName(t)
idTablePut(m.typeCache, t, result)
var rettype, desc: Rope
genProcParams(m, t, rettype, desc, check)
genProcParams(m, t, rettype, desc, check, true, true)
if not isImportedType(t):
if t.callConv != ccClosure: # procedure vars may need a closure!
addf(m.s[cfsTypes], "typedef $1_PTR($2, $3) $4;$n",

View File

@@ -6,3 +6,9 @@ proc f(x: proc: MalType) =
discard x()
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