orc.ast.oil.expression.argument
Class Variable
java.lang.Object
orc.ast.oil.expression.Expression
orc.ast.oil.expression.argument.Argument
orc.ast.oil.expression.argument.Variable
- All Implemented Interfaces:
- java.lang.Comparable<Variable>
public class Variable
- extends Argument
- implements java.lang.Comparable<Variable>
Bound variables, represented using deBruijn indices.
These occur in argument and expression position.
- Author:
- dkitchin
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
index
public int index
Variable
public Variable(int index)
hashCode
public int hashCode()
- Specified by:
hashCode
in class Argument
equals
public boolean equals(java.lang.Object v)
- Specified by:
equals
in class Argument
compareTo
public int compareTo(Variable o)
- Specified by:
compareTo
in interface java.lang.Comparable<Variable>
resolve
public java.lang.Object resolve(Env<java.lang.Object> env)
- Specified by:
resolve
in class Argument
resolveGeneric
public <T> T resolveGeneric(Env<T> env)
addIndices
public void addIndices(java.util.Set<java.lang.Integer> indices,
int depth)
- Description copied from class:
Expression
- If this expression has any indices which are >= depth,
add (index - depth) to the index set accumulator. The depth
increases each time this method recurses through a binder.
The default implementation is to assume the expression
has no free variables, and thus do nothing. Expressions
which contain variables or subexpressions override this
behavior.
- Overrides:
addIndices
in class Argument
- Parameters:
indices
- The index set accumulator.depth
- The minimum index for a free variable.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
accept
public <E> E accept(Visitor<E> visitor)
- Specified by:
accept
in class Expression
typesynth
public Type typesynth(TypingContext ctx)
throws TypeException
- Specified by:
typesynth
in class Expression
- Throws:
TypeException
marshal
public Argument marshal()
throws CompilationException
- Specified by:
marshal
in class Argument
- Throws:
CompilationException