Module aya.base

Interface ModuleContext

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

public sealed interface ModuleContext extends Context permits NoExportContext, PhysicalModuleContext
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.aya.resolve.context.Context

    Context.ResolvingInterruptedException
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    defineSymbol(@NotNull org.aya.syntax.ref.AnyVar ref, org.aya.syntax.concrete.stmt.Stmt.Accessibility accessibility, @NotNull org.aya.util.error.SourcePos sourcePos)
     
    @NotNull ModuleExport
    Things (symbol or module) that are exported by this module.
    default boolean
    exportSymbol(@NotNull org.aya.syntax.concrete.stmt.ModuleName modName, @NotNull String name, @NotNull org.aya.syntax.ref.AnyDefVar ref)
    Exporting an AnyVar with qualified id {modName}::{name}
    default @Nullable ModuleExport
    getModuleLocalMaybe(org.aya.syntax.concrete.stmt.ModuleName.Qualified modName)
    Trying to get a ModuleExport by a module in this context.
    default @Nullable org.aya.syntax.ref.AnyVar
    getQualifiedLocalMaybe(org.aya.syntax.concrete.stmt.ModuleName.Qualified modName, @NotNull String name, @NotNull org.aya.util.error.SourcePos sourcePos)
    Trying to get a symbol by qualified id {modName}::{name} in this context
    default @Nullable org.aya.syntax.ref.AnyVar
    getUnqualifiedLocalMaybe(@NotNull String name, @NotNull org.aya.util.error.SourcePos sourcePos)
    Trying to get a symbol by unqualified name in this context.
    default void
    importModule(org.aya.syntax.concrete.stmt.ModuleName.Qualified modName, @NotNull ModuleContext module, org.aya.syntax.concrete.stmt.Stmt.Accessibility accessibility, @NotNull org.aya.util.error.SourcePos sourcePos)
    Import the whole module (including itself and its re-exports)
    default void
    importModule(org.aya.syntax.concrete.stmt.ModuleName.Qualified modName, @NotNull ModuleExport moduleExport, org.aya.syntax.concrete.stmt.Stmt.Accessibility accessibility, @NotNull org.aya.util.error.SourcePos sourcePos)
    Importing one module export.
    default void
    importSymbol(boolean imported, @NotNull org.aya.syntax.ref.AnyVar ref, @NotNull org.aya.syntax.concrete.stmt.ModuleName modName, @NotNull String name, org.aya.syntax.concrete.stmt.Stmt.Accessibility acc, @NotNull org.aya.util.error.SourcePos sourcePos)
    Adding a new symbol to this module.
    @NotNull kala.collection.mutable.MutableMap<org.aya.syntax.concrete.stmt.ModuleName.Qualified,ModuleExport>
    All imported modules in this context.
    Qualified Module -> Module Export
    default void
    openModule(org.aya.syntax.concrete.stmt.ModuleName.Qualified modName, org.aya.syntax.concrete.stmt.Stmt.Accessibility accessibility, @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.concrete.stmt.QualifiedID> filter, @NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.error.WithPos<org.aya.syntax.concrete.stmt.UseHide.Rename>> rename, @NotNull org.aya.util.error.SourcePos sourcePos, org.aya.syntax.concrete.stmt.UseHide.Strategy strategy)
    Open an imported module
    default void
    openModule(org.aya.syntax.concrete.stmt.ModuleName.Qualified modName, org.aya.syntax.concrete.stmt.Stmt.Accessibility accessibility, @NotNull org.aya.util.error.SourcePos sourcePos, @NotNull org.aya.syntax.concrete.stmt.UseHide useHide)
     
    @NotNull Context
     
    default @NotNull org.aya.util.reporter.Reporter
     
    @NotNull ModuleSymbol<org.aya.syntax.ref.AnyVar>
    All available symbols in this context
    default @NotNull Path
     

    Methods inherited from interface org.aya.tyck.tycker.Problematic

    fail, fail, fail
  • 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
      Specified by:
      reporter in interface Problematic
    • underlyingFile

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

      @NotNull @NotNull ModuleSymbol<org.aya.syntax.ref.AnyVar> symbols()
      All available symbols in this context
    • modules

      @NotNull @NotNull kala.collection.mutable.MutableMap<org.aya.syntax.concrete.stmt.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 org.aya.syntax.concrete.stmt.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 org.aya.syntax.ref.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 org.aya.syntax.ref.AnyVar getQualifiedLocalMaybe(@NotNull org.aya.syntax.concrete.stmt.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 org.aya.syntax.concrete.stmt.ModuleName.Qualified modName, @NotNull @NotNull ModuleContext module, @NotNull org.aya.syntax.concrete.stmt.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 org.aya.syntax.concrete.stmt.ModuleName.Qualified modName, @NotNull @NotNull ModuleExport moduleExport, @NotNull org.aya.syntax.concrete.stmt.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 org.aya.syntax.concrete.stmt.ModuleName.Qualified modName, @NotNull org.aya.syntax.concrete.stmt.Stmt.Accessibility accessibility, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos, @NotNull @NotNull org.aya.syntax.concrete.stmt.UseHide useHide)
    • openModule

      default void openModule(@NotNull org.aya.syntax.concrete.stmt.ModuleName.Qualified modName, @NotNull org.aya.syntax.concrete.stmt.Stmt.Accessibility accessibility, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.concrete.stmt.QualifiedID> filter, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.error.WithPos<org.aya.syntax.concrete.stmt.UseHide.Rename>> rename, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos, org.aya.syntax.concrete.stmt.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 org.aya.syntax.ref.AnyVar ref, @NotNull @NotNull org.aya.syntax.concrete.stmt.ModuleName modName, @NotNull @NotNull String name, @NotNull org.aya.syntax.concrete.stmt.Stmt.Accessibility acc, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos)
      Adding a new symbol to this module.
    • exportSymbol

      default boolean exportSymbol(@NotNull @NotNull org.aya.syntax.concrete.stmt.ModuleName modName, @NotNull @NotNull String name, @NotNull @NotNull org.aya.syntax.ref.AnyDefVar 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 org.aya.syntax.ref.AnyVar ref, @NotNull org.aya.syntax.concrete.stmt.Stmt.Accessibility accessibility, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos)