Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout committed Oct 22, 2024
1 parent 934943d commit 27131d4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions compiler/injectdestructors.nim
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,19 @@ proc checkForErrorPragma(c: Con; t: PType; ri: PNode; opname: string; inferredFr
#m.add renderTree(c.body, {renderIds})
localError(c.graph.config, ri.info, errGenerated, m)

proc makePtrType(c: var Con, baseType: PType): PType =
result = newType(tyPtr, c.idgen, c.owner)
addSonSkipIntLit(result, baseType, c.idgen)
proc genAddr(c: var Con; x: PNode): PNode =
if x.kind == nkHiddenDeref:
result = x[0]
else:
result = newNodeIT(nkHiddenAddr, x.info, makeVarType(x.typ.owner, x.typ, c.idgen))
result.add x

proc genOp(c: var Con; op: PSym; dest: PNode): PNode =
var addrExp: PNode
if op.typ != nil and op.typ.signatureLen > 1 and op.typ.firstParamType.kind != tyVar:
addrExp = dest
else:
addrExp = newNodeIT(nkHiddenAddr, dest.info, makePtrType(c, dest.typ))
addrExp.add(dest)
addrExp = genAddr(c, dest)
result = newTree(nkCall, newSymNode(op), addrExp)

proc genOp(c: var Con; t: PType; kind: TTypeAttachedOp; dest, ri: PNode): PNode =
Expand Down

0 comments on commit 27131d4

Please sign in to comment.