# # # The Nim Compiler # (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. # ## This module implements lifting for assignments. Later versions of this code ## will be able to also lift ``=deepCopy`` and ``=destroy``. # included from sem.nim type TLiftCtx = object c: PContext info: TLineInfo # for construction kind: TTypeAttachedOp fn: PSym asgnForType: PType recurse: bool proc liftBodyAux(c: var TLiftCtx; t: PType; body, x, y: PNode) proc liftBody(c: PContext; typ: PType; kind: TTypeAttachedOp; info: TLineInfo): PSym {.discardable.} proc at(a, i: PNode, elemType: PType): PNode = result = newNodeI(nkBracketExpr, a.info, 2) result.sons[0] = a result.sons[1] = i result.typ = elemType proc liftBodyTup(c: var TLiftCtx; t: PType; body, x, y: PNode) = for i in 0 ..