Module aya.base

Record Class EmptyContext

java.lang.Object
java.lang.Record
org.aya.resolve.context.EmptyContext
All Implemented Interfaces:
Context

public record EmptyContext(@NotNull org.aya.util.reporter.Reporter reporter, @NotNull Path underlyingFile) extends Record implements Context
API Note:
in each file's dependency tree there should be one and only one EmptyContext which is also the tree root.
Implementation Note:
EmptyContext is the context storing the underlying file, and its Reporter in the resolving stage.
  • Constructor Details

    • EmptyContext

      public EmptyContext(@NotNull @NotNull org.aya.util.reporter.Reporter reporter, @NotNull @NotNull Path underlyingFile)
      Creates an instance of a EmptyContext record class.
      Parameters:
      reporter - the value for the reporter record component
      underlyingFile - the value for the underlyingFile record component
  • Method Details

    • parent

      @Nullable public @Nullable Context parent()
      Specified by:
      parent in interface Context
    • getUnqualifiedLocalMaybe

      @Nullable public @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 public @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
    • derive

      @NotNull public @NotNull PhysicalModuleContext derive(@NotNull @NotNull kala.collection.immutable.ImmutableSeq<@NotNull String> extraName)
      Specified by:
      derive in interface Context
    • modulePath

      @NotNull public @NotNull ModulePath modulePath()
      Description copied from interface: Context
      The path of this module
      Specified by:
      modulePath in interface Context
    • getModuleLocalMaybe

      @Nullable public @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.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • reporter

      @NotNull public @NotNull org.aya.util.reporter.Reporter reporter()
      Returns the value of the reporter record component.
      Specified by:
      reporter in interface Context
      Returns:
      the value of the reporter record component
    • underlyingFile

      @NotNull public @NotNull Path underlyingFile()
      Returns the value of the underlyingFile record component.
      Specified by:
      underlyingFile in interface Context
      Returns:
      the value of the underlyingFile record component