## net.sf.saxon.expr
Class LocalVariableReference

    java.lang.Object
      net.sf.saxon.expr.Expression
          net.sf.saxon.expr.VariableReference
              net.sf.saxon.expr.LocalVariableReference

All Implemented Interfaces:
  java.io.Serializable, javax.xml.transform.SourceLocator, LocationProvider, SaxonLocator, BindingReference, EvaluableItem, SequenceIterable, InstructionInfo, org.xml.sax.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:
  Serialized Form

Field Summary

Fields inherited from class net.sf.saxon.expr.VariableReference
`binding, constantValue, staticType`

Fields inherited from class net.sf.saxon.expr.Expression
`EVALUATE_METHOD, ITERATE_METHOD, locationId, PROCESS_METHOD, staticProperties`

Constructor Summary
`LocalVariableReference()` Create a local variable reference.
`LocalVariableReference(Binding binding)` Create a LocalVariableReference bound to a given Binding

Method Summary
`Expression` `copy()` Create a clone copy of this VariableReference
`ValueRepresentation` `evaluateVariable(XPathContext c)` Return the value of the variable
`int` `getSlotNumber()` Get the slot number allocated to this local variable
`void` `setSlotNumber(int slotNumber)` Set the slot number for this local variable, that is, its position in the local stack frame

Methods inherited from class net.sf.saxon.expr.VariableReference
`addToPathMap, computeCardinality, computeSpecialProperties, equals, evaluateItem, explain, fixup, getBinding, getDisplayName, getImplementationMethod, getIntrinsicDependencies, getItemType, hashCode, isFiltered, isFlattened, isInLoop, iterate, optimize, process, promote, refineVariableType, setFiltered, setFlattened, setStaticType, toString, typeCheck`

Methods inherited from class net.sf.saxon.expr.Expression

`adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, display, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, findParentOf, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getExecutable, getHostLanguage, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, getSystemId, hasLoopingSubexpression, implementsStaticTypeCheck, isUpdatingExpression, iterateEvents, iterateSubExpressions, markTailFunctionCalls, replaceSubExpression, resetLocalStaticProperties, setContainer, setLocationId, simplify, staticTypeCheck, suppressValidation, typeError`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### 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 Detail

### 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

Copyright (c) Saxonica Limited. All rights reserved.