Fix HopObject.list() which was broken after adding HopObject.list(start, length) yesterday.

(ScriptableObject.defineClass does not support method overloading)
This commit is contained in:
hns 2003-12-03 10:45:57 +00:00
parent d155ee6b1a
commit f2938295ec

View file

@ -435,11 +435,12 @@ public class HopObject extends ScriptableObject implements Wrapper {
}
/**
* Return the full list of child objects in a JavaScript Array.
* This is called by jsFunction_list() if called with no arguments.
*
*
* @return ...
* @return A JavaScript Array containing all child objects
*/
public Scriptable jsFunction_list() {
private Scriptable list() {
checkNode();
Enumeration e = node.getSubnodes();
@ -455,9 +456,16 @@ public class HopObject extends ScriptableObject implements Wrapper {
/**
* Return a JS array of child objects with the given start and length.
*
* @return A JavaScript Array containing the specified child objexts
* @return A JavaScript Array containing the specified child objects
*/
public Scriptable jsFunction_list(int start, int length) {
public Scriptable jsFunction_list(Object startArg, Object lengthArg) {
if (startArg == Undefined.instance && lengthArg == Undefined.instance) {
return list();
}
int start = (int) ScriptRuntime.toNumber(startArg);
int length = (int) ScriptRuntime.toNumber(lengthArg);
if (start < 0 || length < 0) {
throw new EvaluatorException("Arguments must not be negative in HopObject.list(start, length)");
}