From: Wolfgang M. M. <wol...@us...> - 2005-04-27 21:24:00
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2465/src/org/exist/xquery/functions/util Modified Files: DescribeFunction.java FunctionFunction.java Log Message: Added support for function overloading. User defined XQuery functions are now consistently identified by their function name AND arity. It is thus possible two define two functions with the same name if their parameter list have different lengths. Index: FunctionFunction.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/util/FunctionFunction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FunctionFunction.java 1 Jan 2005 21:53:23 -0000 1.1 --- FunctionFunction.java 27 Apr 2005 21:23:35 -0000 1.2 *************** *** 87,95 **** UserDefinedFunction func; if(module == null) { ! func = context.resolveFunction(qname); } else { if(module.isInternalModule()) throw new XPathException(getASTNode(), "Cannot create a reference to an internal Java function"); ! func = ((ExternalModule)module).getFunction(qname); } FunctionCall call = new FunctionCall(context, func); --- 87,95 ---- UserDefinedFunction func; if(module == null) { ! func = context.resolveFunction(qname, arity); } else { if(module.isInternalModule()) throw new XPathException(getASTNode(), "Cannot create a reference to an internal Java function"); ! func = ((ExternalModule)module).getFunction(qname, arity); } FunctionCall call = new FunctionCall(context, func); Index: DescribeFunction.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/util/DescribeFunction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DescribeFunction.java 8 Oct 2004 11:12:01 -0000 1.6 --- DescribeFunction.java 27 Apr 2005 21:23:35 -0000 1.7 *************** *** 88,94 **** } } else { ! UserDefinedFunction func = context.resolveFunction(qname); ! signature = func.getSignature(); ! writeSignature(signature, builder); } builder.endElement(); --- 88,96 ---- } } else { ! Iterator i = context.getSignaturesForFunction(qname); ! while(i.hasNext()) { ! signature = (FunctionSignature) i.next(); ! writeSignature(signature, builder); ! } } builder.endElement(); |