From 5e46da0224a2bb5bb748ff1191d10c25ab9040f4 Mon Sep 17 00:00:00 2001 From: "norris%netscape.com" Date: Thu, 2 Sep 1999 16:48:20 +0000 Subject: [PATCH] Long not supported here. Fix up comments so that is clear. --- .../org/mozilla/javascript/FunctionObject.java | 16 +++++++++++----- .../org/mozilla/javascript/FunctionObject.java | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/js/rhino/org/mozilla/javascript/FunctionObject.java b/js/rhino/org/mozilla/javascript/FunctionObject.java index 595033002c2..b23a6f2019a 100644 --- a/js/rhino/org/mozilla/javascript/FunctionObject.java +++ b/js/rhino/org/mozilla/javascript/FunctionObject.java @@ -34,9 +34,11 @@ public class FunctionObject extends NativeFunction { * * The first form is a member with zero or more parameters * of the following types: Object, String, boolean, Scriptable, - * byte, short, int, long, float, or double. If the member is - * a Method, the return value must be void or one of the types - * allowed for parameters.

+ * byte, short, int, float, or double. The Long type is not supported + * because the double representation of a long (which is the + * EMCA-mandated storage type for Numbers) may lose precision. + * If the member is a Method, the return value must be void or one + * of the types allowed for parameters.

* * The runtime will perform appropriate conversions based * upon the type of the parameter. A parameter type of @@ -168,7 +170,9 @@ public class FunctionObject extends NativeFunction { } else if (type == Double.TYPE) { hasConversions = true; types[i] = ScriptRuntime.DoubleClass; - } else { + } + // Note that long is not supported; see comments above + else { Object[] errArgs = { methodName }; throw Context.reportRuntimeError( Context.getMessage("msg.bad.parms", errArgs)); @@ -333,7 +337,7 @@ public class FunctionObject extends NativeFunction { } static public Object convertArg(Scriptable scope, - Object arg, Class desired) + Object arg, Class desired) { if (desired == ScriptRuntime.BooleanClass || desired == Boolean.TYPE) @@ -349,6 +353,8 @@ public class FunctionObject extends NativeFunction { return new Double(ScriptRuntime.toNumber(arg)); else if (desired == ScriptRuntime.ScriptableClass) return ScriptRuntime.toObject(scope, arg); + // Note that the long type is not supported; see the javadoc for + // the constructor for this class else { Object[] errArgs = { desired.getName() }; throw Context.reportRuntimeError( diff --git a/js/rhino/src/org/mozilla/javascript/FunctionObject.java b/js/rhino/src/org/mozilla/javascript/FunctionObject.java index 595033002c2..b23a6f2019a 100644 --- a/js/rhino/src/org/mozilla/javascript/FunctionObject.java +++ b/js/rhino/src/org/mozilla/javascript/FunctionObject.java @@ -34,9 +34,11 @@ public class FunctionObject extends NativeFunction { * * The first form is a member with zero or more parameters * of the following types: Object, String, boolean, Scriptable, - * byte, short, int, long, float, or double. If the member is - * a Method, the return value must be void or one of the types - * allowed for parameters.

+ * byte, short, int, float, or double. The Long type is not supported + * because the double representation of a long (which is the + * EMCA-mandated storage type for Numbers) may lose precision. + * If the member is a Method, the return value must be void or one + * of the types allowed for parameters.

* * The runtime will perform appropriate conversions based * upon the type of the parameter. A parameter type of @@ -168,7 +170,9 @@ public class FunctionObject extends NativeFunction { } else if (type == Double.TYPE) { hasConversions = true; types[i] = ScriptRuntime.DoubleClass; - } else { + } + // Note that long is not supported; see comments above + else { Object[] errArgs = { methodName }; throw Context.reportRuntimeError( Context.getMessage("msg.bad.parms", errArgs)); @@ -333,7 +337,7 @@ public class FunctionObject extends NativeFunction { } static public Object convertArg(Scriptable scope, - Object arg, Class desired) + Object arg, Class desired) { if (desired == ScriptRuntime.BooleanClass || desired == Boolean.TYPE) @@ -349,6 +353,8 @@ public class FunctionObject extends NativeFunction { return new Double(ScriptRuntime.toNumber(arg)); else if (desired == ScriptRuntime.ScriptableClass) return ScriptRuntime.toObject(scope, arg); + // Note that the long type is not supported; see the javadoc for + // the constructor for this class else { Object[] errArgs = { desired.getName() }; throw Context.reportRuntimeError(