- 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 TypeMethodDescriptiondefault voiddefineSymbol(@NotNull org.aya.syntax.ref.AnyVar ref, org.aya.syntax.concrete.stmt.Stmt.Accessibility accessibility, @NotNull org.aya.util.error.SourcePos sourcePos) @NotNull ModuleExportexports()Things (symbol or module) that are exported by this module.default booleanexportSymbol(@NotNull org.aya.syntax.concrete.stmt.ModuleName modName, @NotNull String name, @NotNull org.aya.syntax.ref.AnyDefVar ref) Exporting anAnyVarwith qualified id{modName}::{name}default @Nullable ModuleExportgetModuleLocalMaybe(org.aya.syntax.concrete.stmt.ModuleName.Qualified modName) Trying to get aModuleExportby a module inthiscontext.default @Nullable org.aya.syntax.ref.AnyVargetQualifiedLocalMaybe(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}inthiscontextdefault @Nullable org.aya.syntax.ref.AnyVargetUnqualifiedLocalMaybe(@NotNull String name, @NotNull org.aya.util.error.SourcePos sourcePos) Trying to get a symbol by unqualified name inthiscontext.default voidimportModule(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 voidimportModule(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 voidimportSymbol(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> modules()All imported modules in this context.
Qualified Module -> Module Exportdefault voidopenModule(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 moduledefault voidopenModule(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 Contextparent()default @NotNull org.aya.util.reporter.Reporterreporter()@NotNull ModuleSymbol<org.aya.syntax.ref.AnyVar> symbols()All available symbols in this contextdefault @NotNull PathMethods inherited from interface org.aya.resolve.context.Context
bind, bind, bind, collect, derive, derive, get, getMaybe, getModuleMaybe, getQualified, getQualifiedMaybe, getUnqualified, getUnqualifiedMaybe, iterate, modulePath, reportAll, reportAllAndThrow, reportAndThrowMethods inherited from interface org.aya.tyck.tycker.Problematic
fail, fail, fail
-
Method Details
-
parent
-
reporter
@NotNull default @NotNull org.aya.util.reporter.Reporter reporter()- Specified by:
reporterin interfaceContext- Specified by:
reporterin interfaceProblematic
-
underlyingFile
- Specified by:
underlyingFilein interfaceContext
-
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
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:ContextTrying to get aModuleExportby a module inthiscontext.- Specified by:
getModuleLocalMaybein interfaceContext- 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:ContextTrying to get a symbol by unqualified name inthiscontext.- Specified by:
getUnqualifiedLocalMaybein interfaceContext
-
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:ContextTrying to get a symbol by qualified id{modName}::{name}inthiscontext- Specified by:
getQualifiedLocalMaybein interfaceContext- 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 modulemoduleExport- the moduleaccessibility- 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 modulefilter- use or hide which definitionsrename- 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 anAnyVarwith 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)
-