bugfix: tvtable works again

This commit is contained in:
Araq 2013-03-05 07:39:52 +01:00
commit 16821e31be
2 changed files with 5 additions and 4 deletions

View file

@ -620,8 +620,9 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode =
let nOrig = n.copyTree let nOrig = n.copyTree
semOpAux(c, n) semOpAux(c, n)
var t: PType = nil var t: PType = nil
if (n.sons[0].typ != nil): t = skipTypes(n.sons[0].typ, abstractInst) if n.sons[0].typ != nil:
if (t != nil) and (t.kind == tyProc): t = skipTypes(n.sons[0].typ, abstractInst-{tyTypedesc})
if t != nil and t.kind == tyProc:
# This is a proc variable, apply normal overload resolution # This is a proc variable, apply normal overload resolution
var m: TCandidate var m: TCandidate
initCandidate(m, t) initCandidate(m, t)
@ -653,7 +654,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode =
# we assume that a procedure that calls something indirectly # we assume that a procedure that calls something indirectly
# has side-effects: # has side-effects:
if tfNoSideEffect notin t.flags: incl(c.p.owner.flags, sfSideEffect) if tfNoSideEffect notin t.flags: incl(c.p.owner.flags, sfSideEffect)
elif (t != nil) and t.kind == tyTypeDesc: elif t != nil and t.kind == tyTypeDesc:
let destType = t.skipTypes({tyTypeDesc, tyGenericInst}) let destType = t.skipTypes({tyTypeDesc, tyGenericInst})
result = semConv(c, n, symFromType(destType, n.info)) result = semConv(c, n, symFromType(destType, n.info))
return return

View file

@ -15,7 +15,7 @@ type
barProc[T] = proc (o: var T) barProc[T] = proc (o: var T)
# an untyped table to store the proc pointers # an untyped table to store the proc pointers
# it's also possible to use a strontly typed tuple here # it's also possible to use a strongly typed tuple here
VTable = array[0..1, pointer] VTable = array[0..1, pointer]
TBase = object {.inheritable.} TBase = object {.inheritable.}