Author: cesar
Date: 2006-01-18 14:35:40 -0500 (Wed, 18 Jan 2006)
New Revision: 55751
Modified:
trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/GlobalObject.cs
Log:
2006-01-18 Evan Briones <[EMAIL PROTECTED]>
* GlobalObject.cs: parsefloat in ms.net version returns NaN for text
strings.
If a match is found the regular expression returns its value.
Otherwise the
value of the object is retained. Previously it would return an empty
string if
nothing matched making. Double.TryParse would then return 0.
Example of this returning NaN : var isnan = 'hello'; print
(parseFloat(e));
Example of it returning 0 : var iszero = 'string'; print (parseFloat
(iszero));
We behave like Rhino.
Modified: trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
===================================================================
--- trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
2006-01-18 19:25:40 UTC (rev 55750)
+++ trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
2006-01-18 19:35:40 UTC (rev 55751)
@@ -1,3 +1,13 @@
+2006-01-18 Evan Briones <[EMAIL PROTECTED]>
+
+ * GlobalObject.cs: parsefloat in ms.net version returns NaN for text
strings.
+ If a match is found the regular expression returns its value.
Otherwise the
+ value of the object is retained. Previously it would return an empty
string if
+ nothing matched making. Double.TryParse would then return 0.
+ Example of this returning NaN : var isnan = 'hello'; print
(parseFloat(e));
+ Example of it returning 0 : var iszero = 'string'; print (parseFloat
(iszero));
+ We behave like Rhino.
+
2006-01-17 Cesar Lopez Nataren <[EMAIL PROTECTED]>
* Parser.cs: Propagate the proper parent. Fixes #75166.
Modified: trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/GlobalObject.cs
===================================================================
--- trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/GlobalObject.cs
2006-01-18 19:25:40 UTC (rev 55750)
+++ trunk/mcs/class/Microsoft.JScript/Microsoft.JScript/GlobalObject.cs
2006-01-18 19:35:40 UTC (rev 55751)
@@ -455,7 +455,9 @@
if (string_obj.Trim () == "")
return 0;
- string_obj = float_re.Match (string_obj).Value;
+ // Would return an empty string if regular expression
match returned 0.
+ object o = float_re.Match (string_obj).Value;
+ string_obj = (o == "") ? string_obj : (string) o;
double result;
if (Double.TryParse (string_obj, NumberStyles.Float,
CultureInfo.InvariantCulture, out result))
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches