- All Superinterfaces:
Context
- 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 AnyVar ref, 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 ModuleName modName, @NotNull String name, @NotNull DefVar<?, ?> ref) Exporting anAnyVarwith qualified id{modName}::{name}default @Nullable ModuleExportgetModuleLocalMaybe(ModuleName.Qualified modName) Trying to get aModuleExportby a module inthiscontext.default @Nullable AnyVargetQualifiedLocalMaybe(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 AnyVargetUnqualifiedLocalMaybe(@NotNull String name, @NotNull org.aya.util.error.SourcePos sourcePos) Trying to get a symbol by unqualified name inthiscontext.default voidimportModule(ModuleName.Qualified modName, @NotNull ModuleContext module, Stmt.Accessibility accessibility, @NotNull org.aya.util.error.SourcePos sourcePos) Import the whole module (including itself and its re-exports)default voidimportModule(ModuleName.Qualified modName, @NotNull ModuleExport moduleExport, Stmt.Accessibility accessibility, @NotNull org.aya.util.error.SourcePos sourcePos) Importing one module export.default voidimportSymbol(boolean imported, @NotNull AnyVar ref, @NotNull ModuleName modName, @NotNull String name, Stmt.Accessibility acc, @NotNull org.aya.util.error.SourcePos sourcePos) Adding a new symbol to this module.@NotNull kala.collection.mutable.MutableMap<ModuleName.Qualified,ModuleExport> modules()All imported modules in this context.
Qualified Module -> Module Exportdefault voidopenModule(ModuleName.Qualified modName, Stmt.Accessibility accessibility, @NotNull kala.collection.immutable.ImmutableSeq<QualifiedID> filter, @NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.error.WithPos<UseHide.Rename>> rename, @NotNull org.aya.util.error.SourcePos sourcePos, UseHide.Strategy strategy) Open an imported moduledefault voidopenModule(ModuleName.Qualified modName, Stmt.Accessibility accessibility, @NotNull org.aya.util.error.SourcePos sourcePos, @NotNull UseHide useHide) @NotNull Contextparent()default @NotNull org.aya.util.reporter.Reporterreporter()@NotNull ModuleSymbol<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, reportAndThrow
-
Method Details
-
parent
-
reporter
@NotNull default @NotNull org.aya.util.reporter.Reporter reporter() -
underlyingFile
- Specified by:
underlyingFilein interfaceContext
-
symbols
All available symbols in this context -
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
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 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 AnyVar getQualifiedLocalMaybe(@NotNull 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 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 modulemoduleExport- the moduleaccessibility- 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 modulefilter- use or hide which definitionsrename- 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 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 AnyVar ref, @NotNull Stmt.Accessibility accessibility, @NotNull @NotNull org.aya.util.error.SourcePos sourcePos)
-