Module aya.ide
Package org.aya.ide

Record Class Resolver.XYResolver

java.lang.Object
java.lang.Record
org.aya.ide.Resolver.XYResolver
All Implemented Interfaces:
Function<org.aya.concrete.stmt.Stmt,kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>, org.aya.concrete.visitor.ExprFolder<kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>, org.aya.concrete.visitor.PatternFolder<kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>, org.aya.concrete.visitor.StmtFolder<kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>
Enclosing interface:
Resolver

public static record Resolver.XYResolver(XY xy) extends Record implements org.aya.concrete.visitor.StmtFolder<kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>
In short, this class resolves cursor position to PsiNameIdentifierOwner or PsiNamedElement.

This class should traverse all AnyVars, ignoring the differences between variable declaration and variable references, unlike StmtFolder and SyntaxHighlight.

The rationale is that users may place the cursor at the name part of a function, a tele, an import command, etc. And we are expected to find the correct AnyVar no matter if it is a declaration or a reference.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of a XYResolver record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>
    foldModuleDecl(@NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> acc, @NotNull org.aya.util.error.SourcePos pos, @NotNull org.aya.resolve.context.ModuleName path)
     
    @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>
    foldModuleRef(@NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> acc, @NotNull org.aya.util.error.SourcePos pos, @NotNull org.aya.resolve.context.ModuleName path)
     
    @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>
    foldVar(@NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> targets, @NotNull org.aya.ref.AnyVar var, @NotNull org.aya.util.error.SourcePos pos, @NotNull kala.value.LazyValue<org.aya.core.term.Term> type)
     
    @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>
    foldVarDecl(@NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> acc, @NotNull org.aya.ref.AnyVar var, @NotNull org.aya.util.error.SourcePos pos, @NotNull kala.value.LazyValue<@Nullable org.aya.core.term.Term> type)
     
    final int
    Returns a hash code value for this object.
    @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>
     
    final String
    Returns a string representation of this record class.
    xy()
    Returns the value of the xy record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.aya.concrete.visitor.ExprFolder

    fold, foldParamDecl, withTermType

    Methods inherited from interface java.util.function.Function

    andThen, compose

    Methods inherited from interface org.aya.concrete.visitor.PatternFolder

    apply, fold, foldVarRef, lazyType, noType, varType

    Methods inherited from interface org.aya.concrete.visitor.StmtFolder

    apply, fold, fold
  • Constructor Details

    • XYResolver

      public XYResolver(XY xy)
      Creates an instance of a XYResolver record class.
      Parameters:
      xy - the value for the xy record component
  • Method Details

    • init

      @NotNull public @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> init()
      Specified by:
      init in interface org.aya.concrete.visitor.ExprFolder<kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>
      Specified by:
      init in interface org.aya.concrete.visitor.PatternFolder<kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>
    • foldVar

      @NotNull public @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> foldVar(@NotNull @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> targets, @NotNull @NotNull org.aya.ref.AnyVar var, @NotNull @NotNull org.aya.util.error.SourcePos pos, @NotNull @NotNull kala.value.LazyValue<org.aya.core.term.Term> type)
      Specified by:
      foldVar in interface org.aya.concrete.visitor.PatternFolder<kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>
    • foldVarDecl

      @NotNull public @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> foldVarDecl(@NotNull @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> acc, @NotNull @NotNull org.aya.ref.AnyVar var, @NotNull @NotNull org.aya.util.error.SourcePos pos, @NotNull @NotNull kala.value.LazyValue<@Nullable org.aya.core.term.Term> type)
      Specified by:
      foldVarDecl in interface org.aya.concrete.visitor.PatternFolder<kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>
    • foldModuleRef

      @NotNull public @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> foldModuleRef(@NotNull @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> acc, @NotNull @NotNull org.aya.util.error.SourcePos pos, @NotNull @NotNull org.aya.resolve.context.ModuleName path)
      Specified by:
      foldModuleRef in interface org.aya.concrete.visitor.StmtFolder<kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>
    • foldModuleDecl

      @NotNull public @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> foldModuleDecl(@NotNull @NotNull kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>> acc, @NotNull @NotNull org.aya.util.error.SourcePos pos, @NotNull @NotNull org.aya.resolve.context.ModuleName path)
      Specified by:
      foldModuleDecl in interface org.aya.concrete.visitor.StmtFolder<kala.collection.SeqView<org.aya.util.error.WithPos<org.aya.ref.AnyVar>>>
    • 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.
    • xy

      public XY xy()
      Returns the value of the xy record component.
      Returns:
      the value of the xy record component