This commit is contained in:
Araq
2015-01-31 11:31:59 +01:00
parent e9a197e704
commit ee4e95fefe
4 changed files with 30 additions and 6 deletions

View File

@@ -1120,7 +1120,7 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
var r = rdLoc(tmp)
if isRef:
rawGenNew(p, tmp, nil)
t = t.sons[0].skipTypes(abstractInst)
t = t.lastSon.skipTypes(abstractInst)
r = ropef("(*$1)", r)
gcUsage(e)
else:
@@ -1201,9 +1201,9 @@ proc genNewFinalize(p: BProc, e: PNode) =
appf(p.module.s[cfsTypeInit3], "$1->finalizer = (void*)$2;$n", [ti, rdLoc(f)])
b.r = ropecg(p.module, "($1) #newObj($2, sizeof($3))", [
getTypeDesc(p.module, refType),
ti, getTypeDesc(p.module, skipTypes(refType.sons[0], abstractRange))])
ti, getTypeDesc(p.module, skipTypes(refType.lastSon, abstractRange))])
genAssignment(p, a, b, {needToKeepAlive}) # set the object type:
bt = skipTypes(refType.sons[0], abstractRange)
bt = skipTypes(refType.lastSon, abstractRange)
genObjectInit(p, cpsStmts, bt, a, false)
gcUsage(e)

View File

@@ -956,9 +956,10 @@ proc makeDeref(n: PNode): PNode =
t = skipTypes(t.sons[0], {tyGenericInst})
while t.kind in {tyPtr, tyRef}:
var a = result
result = newNodeIT(nkHiddenDeref, n.info, t.sons[0])
let baseTyp = t.lastSon
result = newNodeIT(nkHiddenDeref, n.info, baseTyp)
addSon(result, a)
t = skipTypes(t.lastSon, {tyGenericInst})
t = skipTypes(baseTyp, {tyGenericInst})
const
tyTypeParamsHolders = {tyGenericInst, tyCompositeTypeClass}

View File

@@ -0,0 +1,23 @@
# bug #2039
type
RegionTy = object
ThingyPtr = RegionTy ptr Thingy
Thingy = object
next: ThingyPtr
name: string
proc iname(t: ThingyPtr) =
var x = t
while not x.isNil:
echo x.name
x = x.next
proc go() =
var athing : ThingyPtr
iname(athing)
go()

View File

@@ -7,6 +7,7 @@ version 0.10
prevent 'not 4 == 5' from compiling. -> requires 'mixin' annotation for procs!
- parameter lists without type end up in 'experimental'
- iterators always require a return type
- overloading of '='
- make nimble part of the distribution
- split docgen into separate tool
@@ -50,7 +51,6 @@ Bugs
version 0.9.x
=============
- overloading of '='
- allow simple read accesses to global variables --> difficult to ensure that
no data races happen
- pragmas need 'bindSym' support