Class StackMetadata

java.lang.Object
ai.timefold.jpyinterpreter.StackMetadata

public class StackMetadata extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • isDeadCode

      public boolean isDeadCode()
    • getStackSize

      public int getStackSize()
    • getValueSourceForStackIndex

      public ValueSourceInfo getValueSourceForStackIndex(int index)
      Returns the value source for the given stack index (stack index is how many elements below TOS (i.e. 0 is TOS, 1 is TOS1)).
      Parameters:
      index - The stack index (how many elements below TOS)
      Returns:
      The type at the given stack index
    • getValueSourcesUpToStackIndex

      public List<ValueSourceInfo> getValueSourcesUpToStackIndex(int index)
      Returns the value sources up to (and not including) the given stack index (stack index is how many elements below TOS (i.e. 0 is TOS, 1 is TOS1)).
      Parameters:
      index - The stack index (how many elements below TOS)
      Returns:
      The value sources up to (and not including) the given stack index
    • getTypeAtStackIndex

      public PythonLikeType getTypeAtStackIndex(int index)
      Returns the type at the given stack index (stack index is how many elements below TOS (i.e. 0 is TOS, 1 is TOS1)).
      Parameters:
      index - The stack index (how many elements below TOS)
      Returns:
      The type at the given stack index
    • getLocalVariableValueSource

      public ValueSourceInfo getLocalVariableValueSource(int index)
      Returns the value source for the local variable in slot index
      Parameters:
      index - The slot
      Returns:
      The type for the local variable in the given slot
    • getCellVariableValueSource

      public ValueSourceInfo getCellVariableValueSource(int index)
      Returns the value source for the cell variable in slot index
      Parameters:
      index - The slot
      Returns:
      The type for the cell variable in the given slot
    • getTOSType

      public PythonLikeType getTOSType()
    • getTOSValueSource

      public ValueSourceInfo getTOSValueSource()
    • copy

      public StackMetadata copy()
    • unifyWith

      public StackMetadata unifyWith(StackMetadata other)
    • push

      public StackMetadata push(ValueSourceInfo type)
      Return a new StackMetadata with type added as the new TOS element.
      Parameters:
      type - The type to push to TOS
    • set

      public StackMetadata set(int index, ValueSourceInfo type)
    • pushTemp

      public StackMetadata pushTemp(PythonLikeType type)
    • push

      public StackMetadata push(ValueSourceInfo... types)
      Return a new StackMetadata with types added as the new elements. The last element of types is TOS.
      Parameters:
      types - The types to push to TOS
    • pushTemps

      public StackMetadata pushTemps(PythonLikeType... types)
    • stack

      public StackMetadata stack(ValueSourceInfo... types)
      Return a new StackMetadata with types as the stack; The original stack is cleared.
      Parameters:
      types - The stack types.
    • pop

      public StackMetadata pop()
      Return a new StackMetadata with TOS popped
    • pop

      public StackMetadata pop(int count)
      Return a new StackMetadata with the top count items popped.
    • setLocalVariableValueSource

      public StackMetadata setLocalVariableValueSource(int index, ValueSourceInfo type)
      Return a new StackMetadata with the local variable in slot index type set to type.
    • locals

      public StackMetadata locals(ValueSourceInfo... types)
      Return a new StackMetadata with the given local types. Throws IllegalArgumentException if types.length != localVariableTypes.size().
    • setCellVariableValueSource

      public StackMetadata setCellVariableValueSource(int index, ValueSourceInfo type)
      Return a new StackMetadata with the cell variable in slot index type set to type.
    • getCallKeywordNameList

      public List<String> getCallKeywordNameList()
    • setCallKeywordNameList

      public StackMetadata setCallKeywordNameList(List<String> callKeywordNameList)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object