Methods Summary |
---|
public boolean | equals(java.lang.Object obj)Two variable references are deemed equal if they refer to the
same variable.
try {
return (_variable == ((VariableRefBase) obj)._variable);
}
catch (ClassCastException e) {
return false;
}
|
public com.sun.org.apache.xalan.internal.xsltc.compiler.VariableBase | findParentVariable()Returns a reference to any parent variable
SyntaxTreeNode node = this;
while (node != null && !(node instanceof VariableBase)) {
node = node.getParent();
}
return (VariableBase) node;
|
public com.sun.org.apache.xalan.internal.xsltc.compiler.VariableBase | getVariable()Returns a reference to the associated variable
return _variable;
|
public java.lang.String | toString()Returns a string representation of this variable reference on the
format 'variable-ref()'.
return "variable-ref("+_variable.getName()+'/"+_variable.getType()+')";
|
public com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type | typeCheck(com.sun.org.apache.xalan.internal.xsltc.compiler.SymbolTable stable)
// Returned cached type if available
if (_type != null) return _type;
// Find nearest closure to add a variable reference
if (_variable.isLocal()) {
SyntaxTreeNode node = getParent();
do {
if (node instanceof Closure) {
_closure = (Closure) node;
break;
}
if (node instanceof TopLevelElement) {
break; // way up in the tree
}
node = node.getParent();
} while (node != null);
if (_closure != null) {
_closure.addVariable(this);
}
}
// Insert a dependency link from one variable to another
VariableBase parent = findParentVariable();
if (parent != null) {
VariableBase var = _variable;
if (_variable._ignore) {
if (_variable instanceof Variable) {
var = parent.getSymbolTable()
.lookupVariable(_variable._name);
} else if (_variable instanceof Param) {
var = parent.getSymbolTable().lookupParam(_variable._name);
}
}
parent.addDependency(var);
}
// Attempt to get the cached variable type
_type = _variable.getType();
// If that does not work we must force a type-check (this is normally
// only needed for globals in included/imported stylesheets
if (_type == null) {
_variable.typeCheck(stable);
_type = _variable.getType();
}
// Return the type of the referenced variable
return _type;
|