compiler/sem/lowerings

    Dark Mode
Search:
  Source   Edit

This module implements common simple lowerings.

Consts

genPrefix = ":tmp"
prefix for generated names   Source   Edit

Procs

proc addField(obj: PType; s: PSym; cache: IdentCache; idgen: IdGenerator) {.
    ...raises: [], tags: [].}
Similar to addUnmappedField, but makes sure that the field can later be looked up via the ItemId of s.   Source   Edit
proc addUniqueField(obj: PType; s: PSym; cache: IdentCache; idgen: IdGenerator): PSym {.
    discardable, ...raises: [], tags: [].}
  Source   Edit
proc addUnmappedField(obj: PType; s: PSym; cache: IdentCache; idgen: IdGenerator): PSym {.
    ...raises: [], tags: [].}
Adds a new field to obj and returns the new field's symbol. The field's type and whether it's a cursor are provided by s; it's name is based on that of s, but guaranteed to be unique.   Source   Edit
proc callCodegenProc(g: ModuleGraph; name: string;
                     info: TLineInfo = unknownLineInfo;
                     arg1, arg2, arg3, optionalArgs: PNode = nil): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc createObj(g: ModuleGraph; idgen: IdGenerator; owner: PSym; info: TLineInfo;
               final = true): PType {....raises: [KeyError, Exception],
                                      tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc evalOnce(g: ModuleGraph; value: PNode; idgen: IdGenerator; owner: PSym): PNode {.
    ...raises: [], tags: [].}
Turns (value) into (let tmp = value; tmp) so that 'value' can be re-used freely, multiple times. This is frequently required and such a builtin would also be handy to have in macros.nim. The value that can be reused is 'result.lastSon'!   Source   Edit
proc genAddrOf(n: PNode; idgen: IdGenerator; typeKind = tyPtr): PNode {.
    ...raises: [], tags: [].}
  Source   Edit
proc genDeref(n: PNode; k = nkHiddenDeref): PNode {....raises: [], tags: [].}
  Source   Edit
proc genHigh(g: ModuleGraph; n: PNode): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc genLen(g: ModuleGraph; n: PNode): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc getFieldFromObj(t: PType; v: PSym): PSym {....raises: [], tags: [].}
  Source   Edit
proc indirectAccess(a, b: PSym; info: TLineInfo): PNode {....raises: [], tags: [].}
  Source   Edit
proc indirectAccess(a: PNode; b: ItemId; info: TLineInfo): PNode {....raises: [],
    tags: [].}
  Source   Edit
proc indirectAccess(a: PNode; b: PSym; info: TLineInfo): PNode {....raises: [],
    tags: [].}
  Source   Edit
proc indirectAccess(a: PNode; b: string; info: TLineInfo; cache: IdentCache): PNode {.
    ...raises: [], tags: [].}
  Source   Edit
proc lowerTupleUnpacking(g: ModuleGraph; n: PNode; idgen: IdGenerator;
                         owner: PSym): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc lowerTupleUnpackingForAsgn(g: ModuleGraph; n: PNode; idgen: IdGenerator;
                                owner: PSym): PNode {....raises: [KeyError],
    tags: [].}
  Source   Edit
proc newAsgnStmt(le, ri: PNode): PNode {....raises: [], tags: [].}
  Source   Edit
proc newBreakStmt(info: TLineInfo; label: PSym): PNode {....raises: [], tags: [].}
Generates the AST for labeled break and marks label as used.   Source   Edit
proc newDeref(n: PNode): PNode {.inline, ...raises: [], tags: [].}
  Source   Edit
proc newDotExpr(obj, b: PSym): PNode {....raises: [], tags: [].}
  Source   Edit
proc newFastAsgnStmt(le, ri: PNode): PNode {....raises: [], tags: [].}
  Source   Edit
proc newFastMoveStmt(g: ModuleGraph; le, ri: PNode): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc newIdentDefs(v, value: PNode): PNode {....raises: [], tags: [].}
  Source   Edit
proc newIdentDefs(v: PNode): PNode {....raises: [], tags: [].}
  Source   Edit
proc newIntLit(g: ModuleGraph; info: TLineInfo; value: BiggestInt): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc newTryFinally(body, final: PNode): PNode {....raises: [], tags: [].}
  Source   Edit
proc newTupleAccess(g: ModuleGraph; tup: PNode; i: int): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc newTupleAccessRaw(tup: PNode; i: int): PNode {....raises: [KeyError], tags: [].}
  Source   Edit
proc rawAddField(obj: PType; field: PSym) {....raises: [], tags: [].}
  Source   Edit
proc rawDirectAccess(obj, field: PSym): PNode {....raises: [], tags: [].}
  Source   Edit
proc rawIndirectAccess(a: PNode; field: PSym; info: TLineInfo): PNode {.
    ...raises: [], tags: [].}
  Source   Edit