Class LocalVariableReference

All Implemented Interfaces:
Serializable, SourceLocator, LocationProvider, SaxonLocator, BindingReference, InstructionInfo, Locator

public class LocalVariableReference extends VariableReference
Variable reference: a reference to a local variable. This subclass of VariableReference bypasses the Binding object to get the value directly from the relevant slot in the local stackframe.
See Also:
  • Field Details

    • slotNumber

      int slotNumber
  • Constructor Details

    • LocalVariableReference

      public LocalVariableReference()
      Create a local variable reference. The binding and slot number will be supplied later
    • LocalVariableReference

      public LocalVariableReference(Binding binding)
      Create a LocalVariableReference bound to a given Binding
      Parameters:
      binding - the binding (that is, the declaration of this local variable)
  • Method Details

    • copy

      public Expression copy()
      Create a clone copy of this VariableReference
      Overrides:
      copy in class VariableReference
      Returns:
      the cloned copy
    • setSlotNumber

      public void setSlotNumber(int slotNumber)
      Set the slot number for this local variable, that is, its position in the local stack frame
      Parameters:
      slotNumber - the slot number to be used
    • getSlotNumber

      public int getSlotNumber()
      Get the slot number allocated to this local variable
      Returns:
      the slot number
    • evaluateVariable

      public ValueRepresentation evaluateVariable(XPathContext c) throws XPathException
      Return the value of the variable
      Overrides:
      evaluateVariable in class VariableReference
      Parameters:
      c - the XPath dynamic context
      Returns:
      the value of the variable
      Throws:
      XPathException - if any dynamic error occurs while evaluating the variable