Search in sources :

Example 1 with StaticFunctNameError

use of org.eclipse.wst.xml.xpath2.processor.internal.StaticFunctNameError in project webtools.sourceediting by eclipse.

the class StaticNameResolver method visit.

/**
 * Validate a cast expression.
 *
 * @param cexp
 *            is the expression.
 * @return null.
 */
public Object visit(CastExpr cexp) {
    printBinExpr("CAST", cexp);
    SingleType st = (SingleType) cexp.right();
    QName type = st.type();
    javax.xml.namespace.QName qName = type.asQName();
    Function f = _sc.resolveFunction(qName, 1);
    if (f == null)
        reportError(new StaticFunctNameError("Type does not exist: " + type.toString()));
    cexp.set_function(f);
    _resolvedFunctions.add(qName);
    return null;
}
Also used : Function(org.eclipse.wst.xml.xpath2.api.Function) SingleType(org.eclipse.wst.xml.xpath2.processor.internal.ast.SingleType) QName(org.eclipse.wst.xml.xpath2.processor.internal.types.QName) StaticFunctNameError(org.eclipse.wst.xml.xpath2.processor.internal.StaticFunctNameError)

Example 2 with StaticFunctNameError

use of org.eclipse.wst.xml.xpath2.processor.internal.StaticFunctNameError in project webtools.sourceediting by eclipse.

the class StaticNameResolver method visit.

/**
 * Validate a function call.
 *
 * @param e
 *            is the expression.
 * @return null.
 */
public Object visit(FunctionCall e) {
    QName name = e.name();
    if (!expandFunctionQName(name))
        reportBadPrefix(name.prefix());
    javax.xml.namespace.QName qName = name.asQName();
    Function f = _sc.resolveFunction(qName, e.arity());
    if (f == null)
        reportError(new StaticFunctNameError("Function does not exist: " + name.string() + " arity: " + e.arity()));
    e.set_function(f);
    _resolvedFunctions.add(qName);
    visitExprs(e.iterator());
    return null;
}
Also used : Function(org.eclipse.wst.xml.xpath2.api.Function) QName(org.eclipse.wst.xml.xpath2.processor.internal.types.QName) StaticFunctNameError(org.eclipse.wst.xml.xpath2.processor.internal.StaticFunctNameError)

Aggregations

Function (org.eclipse.wst.xml.xpath2.api.Function)2 StaticFunctNameError (org.eclipse.wst.xml.xpath2.processor.internal.StaticFunctNameError)2 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)2 SingleType (org.eclipse.wst.xml.xpath2.processor.internal.ast.SingleType)1