compiler/sem/semfold

  Source   Edit

this module folds constants; used by semantic checking phase and evaluation phase

Procs

proc errorType(g: ModuleGraph): PType {....raises: [], tags: [].}
creates a type representing an error state   Source   Edit
proc evalOp(m: TMagic; n, a, b, c: PNode; idgen: IdGenerator; g: ModuleGraph): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc foldInAst(m: PSym; n: PNode; idgen: IdGenerator; g: ModuleGraph): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [RootEffect, ReadDirEffect, ReadEnvEffect, TimeEffect].}
Performs constant folding on all expressions appearing in the statement or expression n. If nothing changed, n is returned, a new AST otherwise.   Source   Edit
proc getConstExpr(m: PSym; n: PNode; idgen: IdGenerator; g: ModuleGraph): PNode {....raises: [
    KeyError, Exception, ERecoverableError, Exception, Exception, KeyError,
    Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect, ReadEnvEffect, TimeEffect].}
  Source   Edit
proc getConstExprError(m: PSym; n: PNode; idgen: IdGenerator; g: ModuleGraph): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect, ReadEnvEffect, TimeEffect].}
If n is an error, returns the error. Otherwise returns the folded value, or nil, if n isn't constant.   Source   Edit
proc leValueConv(a, b: PNode): bool {....raises: [ERecoverableError], tags: [].}
  Source   Edit
proc newFloatNodeT(floatVal: BiggestFloat; n: PNode; g: ModuleGraph): PNode {.
    ...raises: [], tags: [].}
  Source   Edit
proc newIntNodeT(intVal: Int128; n: PNode; idgen: IdGenerator; g: ModuleGraph): PNode {.
    ...raises: [KeyError, Exception, ERecoverableError],
    tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc newStrNodeT(strVal: string; n: PNode; g: ModuleGraph): PNode {....raises: [],
    tags: [].}
  Source   Edit
proc newSymNodeTypeDesc(s: PSym; idgen: IdGenerator; info: TLineInfo): PNode {.
    ...raises: [], tags: [].}
  Source   Edit