Module aya.base

Record Class ExprResolver

java.lang.Object
java.lang.Record
org.aya.resolve.visitor.ExprResolver
Record Components:
allowedGeneralizes - will be filled with generalized vars if ExprResolver.Options.allowIntroduceGeneralized, and represents the allowed generalized level vars otherwise
All Implemented Interfaces:
BiFunction<org.aya.util.error.SourcePos,org.aya.syntax.concrete.Expr,org.aya.syntax.concrete.Expr>, org.aya.util.error.PosedUnaryOperator<org.aya.syntax.concrete.Expr>

public record ExprResolver(@NotNull Context ctx, @NotNull ExprResolver.Options options, @NotNull kala.collection.mutable.MutableMap<org.aya.syntax.ref.GeneralizedVar,org.aya.syntax.concrete.Expr.Param> allowedGeneralizes, @NotNull kala.collection.mutable.MutableList<org.aya.generic.stmt.TyckOrder> reference, @NotNull kala.collection.mutable.MutableStack<ExprResolver.Where> where) extends Record implements org.aya.util.error.PosedUnaryOperator<org.aya.syntax.concrete.Expr>
Resolves bindings.
See Also:
Implementation Requirements:
allowedGeneralizes must be linked map
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
     
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final @NotNull ExprResolver.Options
     
    static final @NotNull ExprResolver.Options
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExprResolver(@NotNull Context ctx, @NotNull ExprResolver.Options options)
     
    ExprResolver(@NotNull Context ctx, @NotNull ExprResolver.Options options, @NotNull kala.collection.mutable.MutableMap<org.aya.syntax.ref.GeneralizedVar,org.aya.syntax.concrete.Expr.Param> allowedGeneralizes, @NotNull kala.collection.mutable.MutableList<org.aya.generic.stmt.TyckOrder> reference, @NotNull kala.collection.mutable.MutableStack<ExprResolver.Where> where)
    Creates an instance of a ExprResolver record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull kala.collection.mutable.MutableMap<org.aya.syntax.ref.GeneralizedVar,org.aya.syntax.concrete.Expr.Param>
    Returns the value of the allowedGeneralizes record component.
    @NotNull org.aya.syntax.concrete.Expr
    apply(@NotNull org.aya.util.error.SourcePos pos, @NotNull org.aya.syntax.concrete.Expr expr)
    Special handling of terms with binding structure.
    @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.concrete.Expr.DoBind>
    bind(@NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.concrete.Expr.DoBind> binds, @NotNull kala.value.MutableValue<Context> ctx)
     
    org.aya.syntax.concrete.Expr.Param
    bind(org.aya.syntax.concrete.Expr.Param param, @NotNull kala.value.MutableValue<Context> ctx)
     
    org.aya.syntax.concrete.Pattern.Clause
    clause(org.aya.syntax.concrete.Pattern.Clause clause)
     
    @NotNull Context
    ctx()
    Returns the value of the ctx record component.
    @NotNull ExprResolver
    The intended usage is to create an ExprResolver that resolves the body/bodies of something.
    @NotNull ExprResolver
     
    void
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    void
     
    final int
    Returns a hash code value for this object.
    Returns the value of the options record component.
    @NotNull org.aya.syntax.concrete.Expr
    pre(@NotNull org.aya.syntax.concrete.Expr expr)
     
    @NotNull kala.collection.mutable.MutableList<org.aya.generic.stmt.TyckOrder>
    Returns the value of the reference record component.
    void
     
    static org.aya.util.error.WithPos<org.aya.syntax.concrete.Expr>
    resolveLax(@NotNull ModuleContext context, @NotNull org.aya.util.error.WithPos<org.aya.syntax.concrete.Expr> expr)
    Do !!!NOT!!! use in the type checker.
    @NotNull org.aya.util.error.WithPos<org.aya.syntax.concrete.Pattern>
    resolvePattern(@NotNull org.aya.util.error.WithPos<org.aya.syntax.concrete.Pattern> pattern, kala.value.MutableValue<Context> ctx)
     
    final String
    Returns a string representation of this record class.
    @NotNull kala.collection.mutable.MutableStack<ExprResolver.Where>
    Returns the value of the where record component.

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface java.util.function.BiFunction

    andThen

    Methods inherited from interface org.aya.util.error.PosedUnaryOperator

    apply, forceApply
  • Field Details

  • Constructor Details

    • ExprResolver

      public ExprResolver(@NotNull @NotNull Context ctx, @NotNull @NotNull ExprResolver.Options options)
    • ExprResolver

      public ExprResolver(@NotNull @NotNull Context ctx, @NotNull @NotNull ExprResolver.Options options, @NotNull @NotNull kala.collection.mutable.MutableMap<org.aya.syntax.ref.GeneralizedVar,org.aya.syntax.concrete.Expr.Param> allowedGeneralizes, @NotNull @NotNull kala.collection.mutable.MutableList<org.aya.generic.stmt.TyckOrder> reference, @NotNull @NotNull kala.collection.mutable.MutableStack<ExprResolver.Where> where)
      Creates an instance of a ExprResolver record class.
      Parameters:
      ctx - the value for the ctx record component
      options - the value for the options record component
      allowedGeneralizes - the value for the allowedGeneralizes record component
      reference - the value for the reference record component
      where - the value for the where record component
  • Method Details

    • resolveLax

      @Contract(pure=true) public static org.aya.util.error.WithPos<org.aya.syntax.concrete.Expr> resolveLax(@NotNull @NotNull ModuleContext context, @NotNull @NotNull org.aya.util.error.WithPos<org.aya.syntax.concrete.Expr> expr)
      Do !!!NOT!!! use in the type checker. This is solely for cosmetic features, such as literate mode inline expressions, or repl.
    • resetRefs

      public void resetRefs()
    • enter

      public void enter(ExprResolver.Where loc)
    • exit

      public void exit()
    • enter

      @NotNull public @NotNull ExprResolver enter(Context ctx)
    • deriveRestrictive

      @NotNull public @NotNull ExprResolver deriveRestrictive()
      The intended usage is to create an ExprResolver that resolves the body/bodies of something.
    • pre

      @NotNull public @NotNull org.aya.syntax.concrete.Expr pre(@NotNull @NotNull org.aya.syntax.concrete.Expr expr)
    • apply

      @NotNull public @NotNull org.aya.syntax.concrete.Expr apply(@NotNull @NotNull org.aya.util.error.SourcePos pos, @NotNull @NotNull org.aya.syntax.concrete.Expr expr)
      Special handling of terms with binding structure. We need to invoke a resolver with a different context under the binders.
      Specified by:
      apply in interface BiFunction<org.aya.util.error.SourcePos,org.aya.syntax.concrete.Expr,org.aya.syntax.concrete.Expr>
    • clause

      @NotNull public org.aya.syntax.concrete.Pattern.Clause clause(@NotNull org.aya.syntax.concrete.Pattern.Clause clause)
    • resolvePattern

      @NotNull public @NotNull org.aya.util.error.WithPos<org.aya.syntax.concrete.Pattern> resolvePattern(@NotNull @NotNull org.aya.util.error.WithPos<org.aya.syntax.concrete.Pattern> pattern, kala.value.MutableValue<Context> ctx)
    • bind

      @NotNull public org.aya.syntax.concrete.Expr.Param bind(@NotNull org.aya.syntax.concrete.Expr.Param param, @NotNull @NotNull kala.value.MutableValue<Context> ctx)
    • bind

      @NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.concrete.Expr.DoBind> bind(@NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.syntax.concrete.Expr.DoBind> binds, @NotNull @NotNull kala.value.MutableValue<Context> ctx)
    • 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.
    • ctx

      @NotNull public @NotNull Context ctx()
      Returns the value of the ctx record component.
      Returns:
      the value of the ctx record component
    • options

      @NotNull public @NotNull ExprResolver.Options options()
      Returns the value of the options record component.
      Returns:
      the value of the options record component
    • allowedGeneralizes

      @NotNull public @NotNull kala.collection.mutable.MutableMap<org.aya.syntax.ref.GeneralizedVar,org.aya.syntax.concrete.Expr.Param> allowedGeneralizes()
      Returns the value of the allowedGeneralizes record component.
      Returns:
      the value of the allowedGeneralizes record component
    • reference

      @NotNull public @NotNull kala.collection.mutable.MutableList<org.aya.generic.stmt.TyckOrder> reference()
      Returns the value of the reference record component.
      Returns:
      the value of the reference record component
    • where

      @NotNull public @NotNull kala.collection.mutable.MutableStack<ExprResolver.Where> where()
      Returns the value of the where record component.
      Returns:
      the value of the where record component