Module aya.base

Interface ModuleContext

All Superinterfaces:
Context
All Known Implementing Classes:
NoExportContext, PhysicalModuleContext

public sealed interface ModuleContext extends Context permits NoExportContext, PhysicalModuleContext
  • Method Details

    • parent

      @NotNull @NotNull Context parent()
      Specified by:
      parent in interface Context
    • reporter

      @NotNull default @NotNull org.aya.util.reporter.Reporter reporter()
      Specified by:
      reporter in interface Context
    • underlyingFile

      @NotNull default @NotNull Path underlyingFile()
      Specified by:
      underlyingFile in interface Context
    • symbols

      @NotNull @NotNull ModuleSymbol<AnyVar> symbols()
      All available symbols in this context
    • modules

      @NotNull @NotNull kala.collection.mutable.MutableMap<ModuleName.Qualified,ModuleExport> modules()
      All imported modules in this context.
      Qualified Module -> Module Export
      API Note:
      empty list => this module
      Implementation Note:
      This module should be automatically imported.
    • exports

      @NotNull @NotNull ModuleExport exports()
      Things (symbol or module) that are exported by this module.
    • getModuleLocalMaybe

      @Nullable default @Nullable ModuleExport getModuleLocalMaybe(@NotNull ModuleName.Qualified modName)
      Description copied from interface: Context
      Trying to get a ModuleExport by a module in this context.
      Specified by:
      getModuleLocalMaybe in interface Context
      Parameters:
      modName - qualified module name
      Returns:
      a ModuleExport of that module; null if no such module.
    • getUnqualifiedLocalMaybe

      @Nullable default @Nullable AnyVar getUnqualifiedLocalMaybe(@NotNull @NotNull String name, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos)
      Description copied from interface: Context
      Trying to get a symbol by unqualified name in this context.
      Specified by:
      getUnqualifiedLocalMaybe in interface Context
    • getQualifiedLocalMaybe

      @Nullable default @Nullable AnyVar getQualifiedLocalMaybe(@NotNull ModuleName.Qualified modName, @NotNull @NotNull String name, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos)
      Description copied from interface: Context
      Trying to get a symbol by qualified id {modName}::{name} in this context
      Specified by:
      getQualifiedLocalMaybe in interface Context
      Returns:
      a symbol in component , even it is ModuleName.This; null if not found
    • importModule

      default void importModule(@NotNull ModuleName.Qualified modName, @NotNull @NotNull ModuleContext module, @NotNull Stmt.Accessibility accessibility, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos)
      Import the whole module (including itself and its re-exports)
      See Also:
    • importModule

      default void importModule(@NotNull ModuleName.Qualified modName, @NotNull @NotNull ModuleExport moduleExport, @NotNull Stmt.Accessibility accessibility, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos)
      Importing one module export.
      Parameters:
      modName - the name of the module
      moduleExport - the module
      accessibility - of importing, re-export if public
    • openModule

      default void openModule(@NotNull ModuleName.Qualified modName, @NotNull Stmt.Accessibility accessibility, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos, @NotNull @NotNull UseHide useHide)
    • openModule

      default void openModule(@NotNull ModuleName.Qualified modName, @NotNull Stmt.Accessibility accessibility, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<QualifiedID> filter, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.error.WithPos<UseHide.Rename>> rename, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos, UseHide.Strategy strategy)
      Open an imported module
      Parameters:
      modName - the name of the module
      filter - use or hide which definitions
      rename - renaming
    • importSymbol

      default void importSymbol(boolean imported, @NotNull @NotNull AnyVar ref, @NotNull @NotNull ModuleName modName, @NotNull @NotNull String name, @NotNull Stmt.Accessibility acc, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos)
      Adding a new symbol to this module.
    • exportSymbol

      default boolean exportSymbol(@NotNull @NotNull ModuleName modName, @NotNull @NotNull String name, @NotNull @NotNull DefVar<?,?> ref)
      Exporting an AnyVar with qualified id {modName}::{name}
      Returns:
      true if exported successfully, otherwise (when there already exist a symbol with the same name) false.
    • defineSymbol

      default void defineSymbol(@NotNull @NotNull AnyVar ref, @NotNull Stmt.Accessibility accessibility, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos)