gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-commit] gnash ChangeLog server/asobj/Number.cpp testsui...


From: zou lunkai
Subject: Re: [Gnash-commit] gnash ChangeLog server/asobj/Number.cpp testsui...
Date: Fri, 23 Mar 2007 17:47:13 +0800

check_equals(typeof(Number.valueOf()), 'function'); // this is odd
maybe a Ming bug?
typeof(Number.prototype.valueOf()) == undefined  here!



On 3/22/07, Sandro Santilli <address@hidden> wrote:
CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/03/22 13:19:05

Modified files:
       .              : ChangeLog
       server/asobj   : Number.cpp
       testsuite/actionscript.all: Number.as

Log message:
               * server/asobj/Number.cpp: don't attach Number interface
                 to the Number class itself.
               * testsuite/actionscript.all/Number.as: more tests
                 for valueOf,toString (many still fail for SWF5).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2672&r2=1.2673
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Number.cpp?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Number.as?cvsroot=gnash&r1=1.15&r2=1.16

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2672
retrieving revision 1.2673
diff -u -b -r1.2672 -r1.2673
--- ChangeLog   22 Mar 2007 10:51:48 -0000      1.2672
+++ ChangeLog   22 Mar 2007 13:19:04 -0000      1.2673
@@ -1,5 +1,12 @@
 2007-03-22 Sandro Santilli <address@hidden>

+       * server/asobj/Number.cpp: don't attach Number interface
+         to the Number class itself.
+       * testsuite/actionscript.all/Number.as: more tests
+         for valueOf,toString (many still fail for SWF5).
+
+2007-03-22 Sandro Santilli <address@hidden>
+
       * server/font.cpp, server/stream.cpp, server/swf/tag_loaders.cpp:
         Fixed signedness warnings after stream interface update.


Index: server/asobj/Number.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Number.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/asobj/Number.cpp     20 Mar 2007 16:41:00 -0000      1.26
+++ server/asobj/Number.cpp     22 Mar 2007 13:19:04 -0000      1.27
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

-/* $Id: Number.cpp,v 1.26 2007/03/20 16:41:00 strk Exp $ */
+/* $Id: Number.cpp,v 1.27 2007/03/22 13:19:04 strk Exp $ */

 // Implementation of ActionScript Number class.

@@ -284,9 +284,9 @@
       if ( cl == NULL )
       {
               cl=new builtin_function(&number_ctor, getNumberInterface());
-               // replicate all interface to class, to be able to access
-               // all methods as static functions
-               attachNumberInterface(*cl);
+               // We don't want to attach Number prototype methods to the 
Number
+               // class itself.
+               //attachNumberInterface(*cl);
       }

       return cl;

Index: testsuite/actionscript.all/Number.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Number.as,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- testsuite/actionscript.all/Number.as        22 Mar 2007 00:30:45 -0000      
1.15
+++ testsuite/actionscript.all/Number.as        22 Mar 2007 13:19:04 -0000      
1.16
@@ -26,7 +26,7 @@
 // TODO: test with SWF target != 6 (the only one tested so far)
 //

-rcsid="$Id: Number.as,v 1.15 2007/03/22 00:30:45 strk Exp $";
+rcsid="$Id: Number.as,v 1.16 2007/03/22 13:19:04 strk Exp $";

 #include "check.as"

@@ -53,8 +53,13 @@
 check_equals(n1.toString(), "268"); // doesn't inherit from Object
 Object.prototype.toString = backup;

+//------------------------------------
 // Test Number.valueOf
+//------------------------------------
+
 check_equals(typeof(n1.valueOf), "function");
+check_equals(typeof(n1.__proto__.valueOf), "function");
+check_equals(typeof(n1.__proto__.__proto__.valueOf), "function");
 check_equals(typeof(n1.valueOf()), "number");
 check_equals(n1.valueOf(), 268);

@@ -236,3 +241,62 @@
 check_equals((-7>undefined), false);
 #endif

+note(2+Number);
+note(Number+2);
+note(null+2);
+note(2+null);
+note(2-Number);
+note(Number-2);
+note(null-2);
+note(2-null);
+note(2*Number);
+note(Number*2);
+note(null*2);
+note(2*null);
+note(2/Number);
+note(Number/2);
+note(null/2);
+note(2/null);
+
+check_equals(typeof(Number.prototype.valueOf), 'function');
+check_equals(typeof(Number.prototype.toString), 'function');
+#if OUTPUT_VERSION > 5
+xcheck(isNaN(Number.valueOf()));
+check_equals(typeof(Number.toString), 'function');
+check_equals(typeof(Number.valueOf), 'function');
+check(!Number.hasOwnProperty('valueOf'));
+check(!Number.hasOwnProperty('toString'));
+check(!Number.__proto__.hasOwnProperty('valueOf'));
+check(!Number.__proto__.hasOwnProperty('toString'));
+check(Number.__proto__.__proto__.hasOwnProperty('valueOf'));
+check(Number.__proto__.__proto__.hasOwnProperty('toString'));
+check(Number.__proto__.__proto__ === Object.prototype);
+
+check_equals(typeof(Number.valueOf()), 'function'); // this is odd
+#else // OUTPUT_VERSION <= 5
+check(!isNaN(Number.valueOf()) );
+check_equals(typeof(Number), 'function');
+xcheck_equals(typeof(Number.valueOf), 'undefined');
+xcheck_equals(typeof(Number.__proto__), 'undefined');
+xcheck_equals(typeof(Number.toString), 'undefined');
+xcheck_equals(typeof(Function), 'undefined');
+#endif
+
+a = 1;
+check_equals(typeof(a.toString), 'function');
+check_equals(typeof(a.valueOf), 'function');
+#if OUTPUT_VERSION > 5
+check(!a.hasOwnProperty('valueOf'));
+check(a.__proto__.hasOwnProperty('valueOf'));
+check(!a.hasOwnProperty('toString'));
+#endif
+
+anum = new Number(1);
+check_equals(typeof(anum.toString), 'function');
+check_equals(typeof(anum.valueOf), 'function');
+#if OUTPUT_VERSION > 5
+check(!anum.hasOwnProperty('valueOf'));
+check(anum.__proto__.hasOwnProperty('valueOf'));
+check(!anum.hasOwnProperty('toString'));
+#endif
+


_______________________________________________
Gnash-commit mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/gnash-commit





reply via email to

[Prev in Thread] Current Thread [Next in Thread]