gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9534: fix most of bwy new testcases


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9534: fix most of bwy new testcases (more needed)
Date: Thu, 24 Jul 2008 20:52:54 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9534
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Thu 2008-07-24 20:52:54 +0200
message:
  fix most of bwy new testcases (more needed)
modified:
  libcore/as_function.cpp
  testsuite/actionscript.all/Instance.as
    ------------------------------------------------------------
    revno: 9533.1.1
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Thu 2008-07-24 20:11:03 +0200
    message:
      If builtin functions called as constructors do NOT return an object,
      construct a placeholder for them. Might be confused in case builtin
      functions DO actually return an object, finding such cases to add
      in the new Instance.as test would help.
    modified:
      libcore/as_function.cpp
    ------------------------------------------------------------
    revno: 9533.1.2
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Thu 2008-07-24 20:20:21 +0200
    message:
      fix expected results
    modified:
      testsuite/actionscript.all/Instance.as
    ------------------------------------------------------------
    revno: 9533.1.3
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Thu 2008-07-24 20:50:18 +0200
    message:
      make debug prints more readable
    modified:
      libcore/as_function.cpp
=== modified file 'libcore/as_function.cpp'
--- a/libcore/as_function.cpp   2008-07-21 09:55:24 +0000
+++ b/libcore/as_function.cpp   2008-07-24 18:50:18 +0000
@@ -387,10 +387,22 @@
                );
 
                fn_call fn(NULL, &env, nargs, first_arg_index);
+               as_value ret;
                try {
-                       newobj = call(fn).to_object();
+                       ret = call(fn);
+                       //newobj = ret.to_object();
                } catch (std::exception& ex) {
-                       log_debug("Native function called as constructor 
returned %s", ex.what());
+                       log_debug("Native function called as constructor threw 
exception: %s", ex.what());
+                       //newobj = new as_object();
+               }
+
+               if ( ret.is_object() )
+               {
+                       newobj = ret.to_object();
+               }
+               else 
+               {
+                       log_debug("Native function called as constructor 
returned %s", ret);
                        newobj = new as_object();
                }
                assert(newobj); // we assume builtin functions do return 
objects !!
@@ -401,7 +413,7 @@
                int flags = as_prop_flags::dontEnum|as_prop_flags::onlySWF6Up; 
// can delete, hidden in swf5
                newobj->init_member(NSV::PROP_uuCONSTRUCTORuu, as_value(this), 
flags);
 
-               if ( swfversion < 7 )
+               if ( swfversion < 7 ) // && swfversion > 5 ?
                {
                        newobj->init_member(NSV::PROP_CONSTRUCTOR, 
as_value(this), flags);
                }

=== modified file 'testsuite/actionscript.all/Instance.as'
--- a/testsuite/actionscript.all/Instance.as    2008-07-24 16:28:45 +0000
+++ b/testsuite/actionscript.all/Instance.as    2008-07-24 18:20:21 +0000
@@ -41,36 +41,48 @@
 
 o = new Math.cos(9);
 check_equals(typeof(o), "object");
-xcheck_equals(typeof(o.__proto__), "undefined");
+check_equals(typeof(o.__proto__), "undefined");
 ASSetPropFlags(o, null, 6, 1);
 #if OUTPUT_VERSION < 7
-check_equals(typeof(o.constructor), "function");
+    #if OUTPUT_VERSION == 6
+    // SWF6 passes
+    check_equals(typeof(o.constructor), "function");
+    #else
+    // SWF5 doesn't
+    xcheck_equals(typeof(o.constructor), "function");
+    #endif
 #else
-xcheck_equals(typeof(o.constructor), "undefined");
+check_equals(typeof(o.constructor), "undefined");
 #endif
 #if OUTPUT_VERSION > 5
 check_equals(typeof(o.__constructor__), "function");
 #else
 check_equals(typeof(o.__constructor__), "undefined");
 #endif
-xcheck_equals(o.toString(), undefined);
-xcheck_equals(o.valueOf(), undefined);
-xcheck(!o instanceOf Object);
-xcheck(!o instanceOf Number);
+check_equals(o.toString(), undefined);
+check_equals(o.valueOf(), undefined);
+check(!o instanceOf Object);
+check(!o instanceOf Number);
 check(!o instanceOf String);
 
 o = new Math.cos();
 check_equals(typeof(o), "object");
-xcheck_equals(typeof(o.__proto__), "undefined");
+check_equals(typeof(o.__proto__), "undefined");
 #if OUTPUT_VERSION < 7
-check_equals(typeof(o.constructor), "function");
+    #if OUTPUT_VERSION == 6
+    // SWF6 passes
+    check_equals(typeof(o.constructor), "function");
+    #else
+    // SWF5 doesn't
+    xcheck_equals(typeof(o.constructor), "function");
+    #endif
 #else
-xcheck_equals(typeof(o.constructor), "undefined");
+check_equals(typeof(o.constructor), "undefined");
 #endif
-xcheck_equals(o.toString(), undefined);
-xcheck_equals(o.valueOf(), undefined);
-xcheck(!o instanceOf Object);
-xcheck(!o instanceOf Number);
+check_equals(o.toString(), undefined);
+check_equals(o.valueOf(), undefined);
+check(!o instanceOf Object);
+check(!o instanceOf Number);
 check(!o instanceOf String);
 
 o = new Mouse.hide();
@@ -97,9 +109,9 @@
 check_equals(typeof(o), "undefined");
 
 o = new Date.UTC();
-xcheck_equals(typeof(o), "object");
+check_equals(typeof(o), "object");
 check_equals(o.toString(), undefined);
 check_equals(o.valueOf(), undefined);
 check(!o instanceOf Object);
 
-totals(32);
+check_totals(32);


reply via email to

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