compiler/lookups

    Dark Mode
Search:
Group by:
  Source   Edit

Types

TLookupFlag = enum
  checkAmbiguity, checkUndeclared, checkModule, checkPureEnumFields
  Source   Edit
TOverloadIter = object
  it*: TIdentIter
  mit*: ModuleIter
  m*: PSym
  mode*: TOverloadIterMode
  symChoiceIndex*: int
  currentScope: PScope
  importIdx: int
  marked: IntSet
  Source   Edit
TOverloadIterMode = enum
  oimDone, oimNoQualifier, oimSelfModule, oimOtherModule, oimSymChoice,
  oimSymChoiceLocalLookup
  Source   Edit

Procs

proc addDecl(c: PContext; sym: PSym) {.inline, ...raises: [KeyError, Exception,
    ValueError, OSError, IOError, ERecoverableError], tags: [RootEffect,
    ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc addDecl(c: PContext; sym: PSym; info: TLineInfo) {.inline, ...raises: [
    KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc addDeclAt(c: PContext; scope: PScope; sym: PSym) {.inline, ...raises: [
    KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc addDeclAt(c: PContext; scope: PScope; sym: PSym; info: TLineInfo) {....raises: [
    KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc addInterfaceDecl(c: PContext; sym: PSym) {.inline, ...raises: [KeyError,
    Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
adds a decl and the interface if appropriate   Source   Edit
proc addInterfaceDeclAt(c: PContext; scope: PScope; sym: PSym) {....raises: [
    KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
adds a symbol on the scope and the interface if appropriate   Source   Edit
proc addInterfaceOverloadableSymAt(c: PContext; scope: PScope; sym: PSym) {....raises: [
    Exception, ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
adds an overloadable symbol on the scope and the interface if appropriate   Source   Edit
proc addOverloadableSymAt(c: PContext; scope: PScope; fn: PSym) {....raises: [
    Exception, ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
adds an symbol to the given scope, will check for and raise errors if it's a redefinition as opposed to an overload.   Source   Edit
proc addPrelimDecl(c: PContext; sym: PSym) {....raises: [], tags: [].}
  Source   Edit
proc addUniqueSym(scope: PScope; s: PSym): PSym {....raises: [], tags: [].}
  Source   Edit
proc closeScope(c: PContext) {....raises: [Exception], tags: [RootEffect].}
  Source   Edit
proc closeShadowScope(c: PContext) {....raises: [], tags: [].}
closes the shadow scope, but doesn't merge any of the symbols Does not check for unused symbols or missing forward decls since a macro or template consumes this AST   Source   Edit
proc considerQuotedIdent(c: PContext; n: PNode; origin: PNode = nil): PIdent {....raises: [
    Exception, KeyError, ValueError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
Retrieve a PIdent from a PNode, taking into account accent nodes. origin can be nil. If it is not nil, it is used for a better error message.   Source   Edit
proc debugScopes(c: PContext; limit = 0; max = int.high) {....deprecated,
    raises: [], tags: [].}
Deprecated
  Source   Edit
proc errorSym(c: PContext; n: PNode): PSym {....raises: [Exception, KeyError,
    ValueError, OSError, IOError, ERecoverableError], tags: [RootEffect,
    ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
creates an error symbol to avoid cascading errors (for IDE support)   Source   Edit
proc errorUndeclaredIdentifier(c: PContext; info: TLineInfo; name: string;
                               extra = "") {....raises: [Exception, ValueError,
    KeyError, OSError, IOError, ERecoverableError], tags: [RootEffect,
    ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc errorUndeclaredIdentifierHint(c: PContext; n: PNode; ident: PIdent): PSym {....raises: [
    KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc errorUseQualifier(c: PContext; info: TLineInfo; choices: PNode) {....raises: [
    ValueError, Exception, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc errorUseQualifier(c: PContext; info: TLineInfo; s: PSym) {....raises: [
    KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc getSymRepr(conf: ConfigRef; s: PSym; getDeclarationPath = true): string {.
    ...raises: [Exception, KeyError, ValueError, OSError],
    tags: [RootEffect, ReadDirEffect].}
  Source   Edit
proc initOverloadIter(o: var TOverloadIter; c: PContext; n: PNode): PSym {....raises: [
    Exception, KeyError, ValueError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc isShadowScope(s: PScope): bool {.inline, ...raises: [], tags: [].}
  Source   Edit
proc lastOverloadScope(o: TOverloadIter): int {....raises: [], tags: [].}
  Source   Edit
proc localSearchInScope(c: PContext; s: PIdent): PSym {....raises: [], tags: [].}
  Source   Edit
proc lookUp(c: PContext; n: PNode): PSym {....raises: [Exception, ValueError,
    KeyError, OSError, IOError, ERecoverableError], tags: [ReadIOEffect,
    RootEffect, ReadDirEffect, WriteIOEffect, ReadEnvEffect].}
  Source   Edit
proc mergeShadowScope(c: PContext) {....raises: [Exception, ValueError, KeyError,
    OSError, IOError, ERecoverableError], tags: [RootEffect, ReadDirEffect,
    WriteIOEffect, ReadIOEffect, ReadEnvEffect].}

close the existing scope and merge in all defined symbols, this will also trigger any export related code if this is into a non-shadow scope.

Merges: shadow -> shadow: add symbols to the parent but check for redefinitions etc shadow -> non-shadow: the above, but also handle exports and all that

  Source   Edit
proc nextOverloadIter(o: var TOverloadIter; c: PContext; n: PNode): PSym {....raises: [
    Exception, ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    ReadIOEffect, RootEffect, ReadDirEffect, WriteIOEffect, ReadEnvEffect].}
  Source   Edit
proc openScope(c: PContext): PScope {.discardable, ...raises: [], tags: [].}
  Source   Edit
proc openShadowScope(c: PContext) {....raises: [], tags: [].}
opens a shadow scope, just like any other scope except the depth is the same as the parent -- see isShadowScope.   Source   Edit
proc pickSym(c: PContext; n: PNode; kinds: set[TSymKind]; flags: TSymFlags = {}): PSym {....raises: [
    Exception, KeyError, ValueError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc qualifiedLookUp(c: PContext; n: PNode; flags: set[TLookupFlag]): PSym {....raises: [
    Exception, KeyError, ValueError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc rawCloseScope(c: PContext) {....raises: [], tags: [].}
  Source   Edit
proc searchInScopes(c: PContext; s: PIdent; ambiguous: var bool): PSym {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc searchInScopesFilterBy(c: PContext; s: PIdent; filter: TSymKinds): seq[PSym] {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc skipAlias(s: PSym; n: PNode; conf: ConfigRef): PSym {....raises: [Exception,
    ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    ReadIOEffect, RootEffect, ReadDirEffect, WriteIOEffect, ReadEnvEffect].}
  Source   Edit
proc someSymFromImportTable(c: PContext; name: PIdent; ambiguous: var bool): PSym {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc wrongRedefinition(c: PContext; info: TLineInfo; s: string;
                       conflictsWith: TLineInfo; note = errGenerated) {....raises: [
    Exception, ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
Emit a redefinition error if in non-interactive mode   Source   Edit

Iterators

iterator allScopes(scope: PScope): PScope {....raises: [], tags: [].}
  Source   Edit
iterator allSyms(c: PContext): (PSym, int, bool) {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
iterator importedItems(c: PContext; name: PIdent): PSym {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
iterator localScopesFrom(c: PContext; scope: PScope): PScope {....raises: [],
    tags: [].}
  Source   Edit

Templates

template addSym(scope: PScope; s: PSym)
  Source   Edit