☰

# lookups

Theme:

- Index

Search:
Group by:
Source Edit

# Imports

ast, astalgo, idents, semdata, types, msgs, options, renderer, lineinfos, modulegraphs, astmsgs, wordrecg, ic/ic

# Types

    TLookupFlag = enum
      checkAmbiguity, checkUndeclared, checkModule, checkPureEnumFields

  Source Edit

    TOverloadIter = object
      it*: TIdentIter
      mit*: ModuleIter
      m*: PSym
      mode*: TOverloadIterMode
      symChoiceIndex*: int

  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], forbids: [].}

  Source Edit

    proc addDecl(c: PContext; sym: PSym; info: TLineInfo) {.inline, ...raises: [
        KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Source Edit

    proc addDeclAt(c: PContext; scope: PScope; sym: PSym) {.inline, ...raises: [
        KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  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],
        forbids: [].}

  Source Edit

    proc addInterfaceDecl(c: PContext; sym: PSym) {.inline, ...raises: [KeyError,
        Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  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],
        forbids: [].}

  adds a symbol on the scope and the interface if appropriate Source Edit

    proc addInterfaceOverloadableSymAt(c: PContext; scope: PScope; sym: PSym) {....raises: [
        Exception, ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  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, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  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: [], forbids: [].}

  Source Edit

    proc addUniqueSym(scope: PScope; s: PSym): PSym {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc ambiguousIdentifierMsg(candidates: seq[PSym]; prefix = "use one of";
                                indent = 0): string {.
        ...raises: [ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}

  Source Edit

    proc ambiguousIdentifierMsg(choices: PNode; indent = 0): string {.
        ...raises: [ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}

  Source Edit

    proc closeScope(c: PContext) {....raises: [Exception], tags: [RootEffect],
                                   forbids: [].}

  Source Edit

    proc closeShadowScope(c: PContext) {....raises: [], tags: [], forbids: [].}

  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 cmpScopes(ctx: PContext; s: PSym): int {....raises: [], tags: [], forbids: [].}

  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],
        forbids: [].}

  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: [], forbids: [].}

  Deprecated
  Source Edit

    proc errorSym(c: PContext; ident: PIdent; info: TLineInfo): PSym {....raises: [],
        tags: [], forbids: [].}

  creates an error symbol to avoid cascading errors (for IDE support) Source Edit

    proc errorSym(c: PContext; n: PNode): PSym {....raises: [Exception, KeyError,
        ValueError, OSError, IOError, ERecoverableError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Source Edit

    proc errorUndeclaredIdentifier(c: PContext; info: TLineInfo; name: string;
                                   extra = "") {....raises: [Exception, ValueError,
        OSError, KeyError, IOError, ERecoverableError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Source Edit

    proc errorUndeclaredIdentifierHint(c: PContext; ident: PIdent; info: TLineInfo): PSym {....raises: [
        KeyError, ValueError, OSError, Exception, IOError, ERecoverableError], tags: [
        ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Source Edit

    proc errorUseQualifier(c: PContext; info: TLineInfo; candidates: seq[PSym]) {....raises: [
        Exception, ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Source Edit

    proc errorUseQualifier(c: PContext; info: TLineInfo; choices: PNode) {....raises: [
        Exception, ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Source Edit

    proc errorUseQualifier(c: PContext; info: TLineInfo; s: PSym) {....raises: [
        KeyError, ValueError, OSError, Exception, IOError, ERecoverableError], tags: [
        ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Source Edit

    proc getSymRepr(conf: ConfigRef; s: PSym; getDeclarationPath = true): string {.
        ...raises: [Exception, KeyError, ValueError, OSError],
        tags: [RootEffect, ReadDirEffect], forbids: [].}

  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],
        forbids: [].}

  Source Edit

    proc isAmbiguous(c: PContext; s: PIdent; filter: TSymKinds; sym: var PSym): bool {.
        ...raises: [KeyError, ValueError, OSError, Exception],
        tags: [ReadDirEffect, RootEffect], forbids: [].}

  Source Edit

    proc isShadowScope(s: PScope): bool {.inline, ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc lastOverloadScope(o: TOverloadIter): int {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc localSearchInScope(c: PContext; s: PIdent): PSym {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc lookUp(c: PContext; n: PNode): PSym {....raises: [KeyError, ValueError,
        OSError, Exception, IOError, ERecoverableError], tags: [ReadDirEffect,
        RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Source Edit

    proc lookUpCandidates(c: PContext; ident: PIdent; filter: set[TSymKind];
                          includePureEnum = false): seq[PSym] {.
        ...raises: [KeyError, ValueError, OSError, Exception],
        tags: [ReadDirEffect, RootEffect], forbids: [].}

  Source Edit

    proc mergeShadowScope(c: PContext) {....raises: [Exception, ValueError, OSError,
        KeyError, IOError, ERecoverableError], tags: [RootEffect, ReadDirEffect,
        WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  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: [KeyError, ValueError, OSError, Exception],
        tags: [ReadDirEffect, RootEffect], forbids: [].}

  Source Edit

    proc openScope(c: PContext): PScope {.discardable, ...raises: [], tags: [],
                                          forbids: [].}

  Source Edit

    proc openShadowScope(c: PContext) {....raises: [], tags: [], forbids: [].}

  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],
        forbids: [].}

  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],
        forbids: [].}

  Source Edit

    proc rawCloseScope(c: PContext) {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc searchImportsAll(c: PContext; s: PIdent; filter: TSymKinds;
                          holding: var seq[PSym]) {.
        ...raises: [KeyError, ValueError, OSError, Exception],
        tags: [ReadDirEffect, RootEffect], forbids: [].}

  Source Edit

    proc searchInScopes(c: PContext; s: PIdent; ambiguous: var bool): PSym {.
        ...raises: [KeyError, ValueError, OSError, Exception],
        tags: [ReadDirEffect, RootEffect], forbids: [].}

  Source Edit

    proc searchScopes(c: PContext; s: PIdent; filter: TSymKinds): seq[PSym] {.
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc searchScopesAll(c: PContext; s: PIdent; filter: TSymKinds): seq[PSym] {.
        ...raises: [KeyError, ValueError, OSError, Exception],
        tags: [ReadDirEffect, RootEffect], forbids: [].}

  Source Edit

    proc selectFromScopesElseAll(c: PContext; s: PIdent; filter: TSymKinds): seq[
        PSym] {....raises: [KeyError, ValueError, OSError, Exception],
                tags: [ReadDirEffect, RootEffect], forbids: [].}

  Source Edit

    proc someSymFromImportTable(c: PContext; name: PIdent; ambiguous: var bool): PSym {.
        ...raises: [KeyError, ValueError, OSError, Exception],
        tags: [ReadDirEffect, RootEffect], forbids: [].}

  Source Edit

    proc wrongRedefinition(c: PContext; info: TLineInfo; s: string;
                           conflictsWith: TLineInfo; note = errGenerated) {....raises: [
        Exception, ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Emit a redefinition error if in non-interactive mode Source Edit

# Iterators

    iterator allScopes(scope: PScope): PScope {....raises: [], tags: [], forbids: [].}

  Source Edit

    iterator allSyms(c: PContext): (PSym, int, bool) {.
        ...raises: [KeyError, ValueError, OSError, Exception],
        tags: [ReadDirEffect, RootEffect], forbids: [].}

  Source Edit

    iterator importedItems(c: PContext; name: PIdent): PSym {.
        ...raises: [KeyError, ValueError, OSError, Exception],
        tags: [ReadDirEffect, RootEffect], forbids: [].}

  Source Edit

    iterator localScopesFrom(c: PContext; scope: PScope): PScope {....raises: [],
        tags: [], forbids: [].}

  Source Edit

    iterator uniqueSyms(c: PContext): (PSym, int, bool) {.
        ...raises: [KeyError, ValueError, OSError, Exception],
        tags: [ReadDirEffect, RootEffect], forbids: [].}

  Like allSyms except only returns unique symbols (Uniqueness determined by line + name) Source Edit

# Templates

    template addSym(scope: PScope; s: PSym)

  Source Edit