diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgtypes.nim | 3 | ||||
-rw-r--r-- | compiler/liftdestructors.nim | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index b116a9aa6..46949831e 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -1297,7 +1297,8 @@ proc genHook(m: BModule; t: PType; info: TLineInfo; op: TTypeAttachedOp): Rope = if op == attachedTrace and m.config.selectedGC == gcOrc and containsGarbageCollectedRef(t): when false: - # re-enable this check + # unfortunately this check is wrong for an object type that only contains + # .cursor fields like 'Node' inside 'cycleleak'. internalError(m.config, info, "no attached trace proc found") result = rope("NIM_NIL") diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim index a64857765..61034ef03 100644 --- a/compiler/liftdestructors.nim +++ b/compiler/liftdestructors.nim @@ -91,7 +91,7 @@ proc genWhileLoop(c: var TLiftCtx; i, dest: PNode): PNode = proc genIf(c: var TLiftCtx; cond, action: PNode): PNode = result = newTree(nkIfStmt, newTree(nkElifBranch, cond, action)) -proc genContainerOf(c: TLiftCtx; objType: PType, field, x: PSym): PNode = +proc genContainerOf(c: TLiftCtx; objType: PType, field, x: PSym): PNode = # generate: cast[ptr ObjType](cast[int](addr(x)) - offsetOf(objType.field)) let intType = getSysType(c.g, unknownLineInfo, tyInt) @@ -104,7 +104,7 @@ proc genContainerOf(c: TLiftCtx; objType: PType, field, x: PSym): PNode = let dotExpr = newNodeIT(nkDotExpr, c.info, x.typ) dotExpr.add newNodeIT(nkType, c.info, objType) dotExpr.add newSymNode(field) - + let offsetOf = genBuiltin(c.g, mOffsetOf, "offsetof", dotExpr) offsetOf.typ = intType @@ -174,7 +174,7 @@ proc fillBodyObj(c: var TLiftCtx; n, body, x, y: PNode; enforceDefaultOp: bool) caseStmt.add(branch) if emptyBranches != n.len-1: body.add(caseStmt) - c.filterDiscriminator = oldfilterDiscriminator + c.filterDiscriminator = oldfilterDiscriminator of nkRecList: for t in items(n): fillBodyObj(c, t, body, x, y, enforceDefaultOp) else: |