Methods Summary |
---|
public java.lang.Object | evaluateAtCompileTime()Returns an object representing the compile-time evaluation
of an expression. We are only using this for function-available
and element-available at this time.
return getResult() ? Boolean.TRUE : Boolean.FALSE;
|
public boolean | getResult()Returns the result that this function will return
try {
final LiteralExpr arg = (LiteralExpr) argument();
final String qname = arg.getValue();
final int index = qname.indexOf(':");
final String localName = (index > 0) ?
qname.substring(index + 1) : qname;
return getParser().elementSupported(arg.getNamespace(),
localName);
}
catch (ClassCastException e) {
return false;
}
|
public void | translate(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen)Calls to 'element-available' are resolved at compile time since
the namespaces declared in the stylsheet are not available at run
time. Consequently, arguments to this function must be literals.
final ConstantPoolGen cpg = classGen.getConstantPool();
final boolean result = getResult();
methodGen.getInstructionList().append(new PUSH(cpg, result));
|
public com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type | typeCheck(com.sun.org.apache.xalan.internal.xsltc.compiler.SymbolTable stable)Force the argument to this function to be a literal string.
if (argument() instanceof LiteralExpr) {
return _type = Type.Boolean;
}
ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
"element-available", this);
throw new TypeCheckError(err);
|