/** * Notify all references to this function of the data type. * @throws XPathException */ public void fixupReferences() throws XPathException { Iterator iter = references.iterator(); while (iter.hasNext()) { ((UserFunctionCall)iter.next()).setStaticType(resultType); } super.fixupReferences(); }
/** * Notify all references to this function of the data type. * @throws XPathException */ public void fixupReferences() throws XPathException { Iterator iter = references.iterator(); while (iter.hasNext()) { ((UserFunctionCall)iter.next()).setStaticType(resultType); } super.fixupReferences(); }
/** * Copy an expression. This makes a deep copy. * @return the copy of the original expression */ public Expression copy() { if (function == null) { // not bound yet, we have no way to register the new copy with the XSLFunction throw new UnsupportedOperationException("copy"); } UserFunctionCall ufc = new UserFunctionCall(); ufc.setFunction(function); ufc.setStaticType(staticType); Expression[] a2 = new Expression[argument.length]; for (int i=0; i<argument.length; i++) { a2[i] = argument[i].copy(); } ufc.argument = a2; if (argumentEvaluationModes != null) { int[] am2 = new int[argumentEvaluationModes.length]; System.arraycopy(argumentEvaluationModes, 0, am2, 0, am2.length); ufc.argumentEvaluationModes = am2; } return ufc; }
/** * Copy an expression. This makes a deep copy. * @return the copy of the original expression */ public Expression copy() { if (function == null) { // not bound yet, we have no way to register the new copy with the XSLFunction throw new UnsupportedOperationException("copy"); } UserFunctionCall ufc = new UserFunctionCall(); ufc.setFunction(function); ufc.setStaticType(staticType); Expression[] a2 = new Expression[argument.length]; for (int i=0; i<argument.length; i++) { a2[i] = argument[i].copy(); } ufc.argument = a2; if (argumentEvaluationModes != null) { int[] am2 = new int[argumentEvaluationModes.length]; System.arraycopy(argumentEvaluationModes, 0, am2, 0, am2.length); ufc.argumentEvaluationModes = am2; } return ufc; }
/** * Copy an expression. This makes a deep copy. * @return the copy of the original expression */ public Expression copy() { if (function == null) { // not bound yet, we have no way to register the new copy with the XSLFunction throw new UnsupportedOperationException("copy"); } UserFunctionCall ufc = new UserFunctionCall(); ufc.setFunction(function); ufc.setStaticType(staticType); Expression[] a2 = new Expression[argument.length]; for (int i=0; i<argument.length; i++) { a2[i] = argument[i].copy(); } ufc.argument = a2; if (argumentEvaluationModes != null) { int[] am2 = new int[argumentEvaluationModes.length]; System.arraycopy(argumentEvaluationModes, 0, am2, 0, am2.length); ufc.argumentEvaluationModes = am2; } return ufc; }
/** * Bind a function, given the URI and local parts of the function name, * and the list of expressions supplied as arguments. This method is called at compile * time. * * @param functionName The name of the function to be called * @param staticArgs The expressions supplied statically in the function call. The intention is * that the static type of the arguments (obtainable via getItemType() and getCardinality() may * be used as part of the binding algorithm. * @param env the static evaluation context * @param reasons If no matching function is found by the function library, it may add * a diagnostic explanation to this list explaining why none of the available * functions could be used. * @return An object representing the extension function to be called, if one is found; * null if no extension function was found matching the required name and arity. */ public Expression bind(SymbolicName.F functionName, Expression[] staticArgs, StaticContext env, List<String> reasons) { UserFunction fn = functions.get(functionName); if (fn == null) { return null; } UserFunctionCall fc = new UserFunctionCall(); fc.setFunctionName(functionName.getComponentName()); fc.setArguments(staticArgs); fc.setFunction(fn); fc.setStaticType(fn.getResultType()); return fc; }
/** * Bind a function, given the URI and local parts of the function name, * and the list of expressions supplied as arguments. This method is called at compile * time. * * @param functionName The name of the function to be called * @param staticArgs The expressions supplied statically in the function call. The intention is * that the static type of the arguments (obtainable via getItemType() and getCardinality() may * be used as part of the binding algorithm. * @param env the static evaluation context * @param reasons If no matching function is found by the function library, it may add * a diagnostic explanation to this list explaining why none of the available * functions could be used. * @return An object representing the extension function to be called, if one is found; * null if no extension function was found matching the required name and arity. */ public Expression bind(SymbolicName.F functionName, Expression[] staticArgs, StaticContext env, List<String> reasons) { UserFunction fn = functions.get(functionName); if (fn == null) { return null; } UserFunctionCall fc = new UserFunctionCall(); fc.setFunctionName(functionName.getComponentName()); fc.setArguments(staticArgs); fc.setFunction(fn); fc.setStaticType(fn.getResultType()); return fc; }
/** * Copy an expression. This makes a deep copy. * * @param rebindings variable bindings that need to be changed * @return the copy of the original expression */ /*@NotNull*/ public Expression copy(RebindingMap rebindings) { if (function == null) { // not bound yet, we have no way to register the new copy with the XSLFunction throw new UnsupportedOperationException("UserFunctionCall.copy()"); } UserFunctionCall ufc = new UserFunctionCall(); ufc.setFunction(function); ufc.setStaticType(staticType); int numArgs = getArity(); Expression[] a2 = new Expression[numArgs]; for (int i = 0; i < numArgs; i++) { a2[i] = getArg(i).copy(rebindings); } ufc.setArguments(a2); ExpressionTool.copyLocationInfo(this, ufc); return ufc; }
/** * Copy an expression. This makes a deep copy. * * @param rebindings variable bindings that need to be changed * @return the copy of the original expression */ /*@NotNull*/ public Expression copy(RebindingMap rebindings) { if (function == null) { // not bound yet, we have no way to register the new copy with the XSLFunction throw new UnsupportedOperationException("UserFunctionCall.copy()"); } UserFunctionCall ufc = new UserFunctionCall(); ufc.setFunction(function); ufc.setStaticType(staticType); int numArgs = getArity(); Expression[] a2 = new Expression[numArgs]; for (int i = 0; i < numArgs; i++) { a2[i] = getArg(i).copy(rebindings); } ufc.setArguments(a2); ExpressionTool.copyLocationInfo(this, ufc); return ufc; }
if (fd != null) { fd.registerReference(ufc); ufc.setStaticType(fd.getResultType()); ufc.setConfirmed(true);
if (fd != null) { fd.registerReference(ufc); ufc.setStaticType(fd.getResultType()); ufc.setConfirmed(true);
fc.setFunction(fn); fc.checkFunctionCall(fn, visitor); fc.setStaticType(fn.getResultType(config.getTypeHierarchy())); return fc;
fc.setFunction(fn); fc.checkFunctionCall(fn, visitor); fc.setStaticType(fn.getResultType(config.getTypeHierarchy())); return fc;
ufc.setFunctionName(fd.getFunctionName()); ufc.setArguments(arguments); ufc.setStaticType(fd.getResultType()); UserFunction fn = fd.getUserFunction(); if (fn == null) {
ufc.setFunctionName(fd.getFunctionName()); ufc.setArguments(arguments); ufc.setStaticType(fd.getResultType()); UserFunction fn = fd.getUserFunction(); if (fn == null) {
protected boolean processComponentReference(StylesheetPackage pack, ComponentInvocation call) throws XPathException { SymbolicName sn = call.getSymbolicName(); Component c = pack.getComponent(sn); if (c == null) { if (sn.getComponentName().hasURI(NamespaceConstant.XSLT) && sn.getComponentName().getLocalPart().equals("original")) { return true; } else { throw new XPathException("Loading compiled package: unresolved component reference to " + sn); } } if (call instanceof GlobalVariableReference) { ((GlobalVariableReference) call).setTarget(c); } else if (call instanceof UserFunctionCall) { ((UserFunctionCall) call).setFunction((UserFunction) c.getActor()); ((UserFunctionCall) call).setStaticType(((UserFunction) c.getActor()).getResultType()); // } else if (call instanceof UserFunctionReference) { // ((UserFunctionReference) call).setFunction((UserFunction) c.getActor()); } else if (call instanceof CallTemplate) { ((CallTemplate) call).setTargetTemplate((NamedTemplate) c.getActor()); } else if (call instanceof UseAttributeSet) { ((UseAttributeSet) call).setTarget((AttributeSet) c.getActor()); } else if (call instanceof ApplyTemplates) { ((ApplyTemplates) call).setMode((SimpleMode) c.getActor()); } else { throw new XPathException("Unknown component reference " + call.getClass()); } return false; }
protected boolean processComponentReference(StylesheetPackage pack, ComponentInvocation call) throws XPathException { SymbolicName sn = call.getSymbolicName(); Component c = pack.getComponent(sn); if (c == null) { if (sn.getComponentName().hasURI(NamespaceConstant.XSLT) && sn.getComponentName().getLocalPart().equals("original")) { return true; } else { throw new XPathException("Loading compiled package: unresolved component reference to " + sn); } } if (call instanceof GlobalVariableReference) { ((GlobalVariableReference) call).setTarget(c); } else if (call instanceof UserFunctionCall) { ((UserFunctionCall) call).setFunction((UserFunction) c.getActor()); ((UserFunctionCall) call).setStaticType(((UserFunction) c.getActor()).getResultType()); // } else if (call instanceof UserFunctionReference) { // ((UserFunctionReference) call).setFunction((UserFunction) c.getActor()); } else if (call instanceof CallTemplate) { ((CallTemplate) call).setTargetTemplate((NamedTemplate) c.getActor()); } else if (call instanceof UseAttributeSet) { ((UseAttributeSet) call).setTarget((AttributeSet) c.getActor()); } else if (call instanceof ApplyTemplates) { ((ApplyTemplates) call).setMode((SimpleMode) c.getActor()); } else { throw new XPathException("Unknown component reference " + call.getClass()); } return false; }
ufc.setFunctionName(fd.getFunctionName()); ufc.setArguments(arguments); ufc.setStaticType(fd.getResultType()); UserFunction fn = fd.getUserFunction(); if (fn == null) {
ufc.setFunctionName(fd.getFunctionName()); ufc.setArguments(arguments); ufc.setStaticType(fd.getResultType()); UserFunction fn = fd.getUserFunction(); if (fn == null) {
if (fn1 != null) { fc.allocateArgumentEvaluators(); fc.setStaticType(fn1.getResultType()); } else { XPathException err = new XPathException("There is no available function named " + fc.getDisplayName() +