|
Re: FunctionSignature, rev 2: msg#00203text.xml.exist
Seems reasonable. Can you check this in? Wolfgang > This checks under- and over-flow of arguments to a function. Instead of > trying to determine how many arguments a signature allows (not always > possible), instead Function asks Signature if a certain number are > allowed. > > > Index: src/org/exist/xquery/FunctionSignature.java > =================================================================== > RCS file: > /cvsroot/exist/eXist-1.0/src/org/exist/xquery/FunctionSignature.java,v > > retrieving revision 1.1 > diff -r1.1 FunctionSignature.java > 88,89c88,113 > < return arguments != null ? arguments.length : 0; > < } > --- > > > if (arguments == null || arguments.length == 0) > > return 0; > > > > int len = arguments.length; > > if ((arguments[len - 1].getCardinality() & Cardinality.ZERO) == > > Cardinality.ZERO) return len - 1; > > else > > return len; > > } > > > > public boolean isUnlimitedArguments() { > > if (arguments == null || arguments.length == 0) > > return false; > > > > int len = arguments.length; > > return ((arguments[len - 1].getCardinality() & Cardinality.MANY) > > == Cardinality.MANY); } > > > > public boolean isArgumentCountAllowed(int count) { > > int minArgs = getArgumentCount(); > > if (count < minArgs) > > return false; > > if (count == minArgs) > > return true; > > return isUnlimitedArguments(); > > } > > Index: src/org/exist/xquery/Function.java > =================================================================== > RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/Function.java,v > retrieving revision 1.6 > diff -r1.6 Function.java > 162,163c162 > < if ((!mySignature.isOverloaded()) > < && arguments.size() != > mySignature.getArgumentCount()) --- > > > if ((!mySignature.isOverloaded()) && > > (!mySignature.isArgumentCountAllowed(arguments.size()))) > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > Exist-open mailing list > Exist-open@xxxxxxxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/exist-open ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | FunctionSignature, rev 2: 00203, finder |
|---|---|
| Next by Date: | XUpdate specifications: 00203, Sergey Prohorenko |
| Previous by Thread: | FunctionSignature, rev 2i: 00203, finder |
| Next by Thread: | Re: FunctionSignature, rev 2: 00203, finder |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |