gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp
Date: Fri, 16 Mar 2007 13:36:44 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/03/16 13:36:44

Modified files:
        .              : ChangeLog 
        server/vm      : ASHandlers.cpp 

Log message:
                * server/vm/ASHandlers.cpp (construct_object): set up the
                  undocumented and non-standard __constructor__ member.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2611&r2=1.2612
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.62&r2=1.63

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2611
retrieving revision 1.2612
diff -u -b -r1.2611 -r1.2612
--- ChangeLog   16 Mar 2007 12:16:46 -0000      1.2611
+++ ChangeLog   16 Mar 2007 13:36:44 -0000      1.2612
@@ -1,5 +1,7 @@
 2007-03-16 Sandro Santilli <address@hidden>
 
+       * server/vm/ASHandlers.cpp (construct_object): set up the
+         undocumented and non-standard __constructor__ member.
        * server/asobj/Object.cpp (object_registerClass): don't forget
          to return a boolean value !
        * server/sprite_instance.cpp: allow overriding the _name property.

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- server/vm/ASHandlers.cpp    16 Mar 2007 10:12:58 -0000      1.62
+++ server/vm/ASHandlers.cpp    16 Mar 2007 13:36:44 -0000      1.63
@@ -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: ASHandlers.cpp,v 1.62 2007/03/16 10:12:58 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.63 2007/03/16 13:36:44 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -93,21 +93,6 @@
 
     as_value new_obj;
 
-#if 0 // C_FUNCTION values do not exist anymore !
-    if ( constructor.is_c_function() )
-    {
-        IF_VERBOSE_ACTION (
-            log_action("Constructor is a C_FUNCTION");
-            );
-
-        // C function is responsible for creating the new object and setting 
members.
-        fn_call call(&new_obj, NULL, &env, nargs, first_arg_index);
-
-        (constructor.to_c_function())(call);
-    }
-    else
-#endif // C_FUNCTION values do not exist anymore !
-
     if (as_function* ctor_as_func = constructor.to_as_function())
     {
         // This function is being used as a constructor; make sure
@@ -127,6 +112,17 @@
 
             fn_call call(&new_obj, NULL, &env, nargs, first_arg_index);
             (*ctor_as_func)(call);
+
+            // Add a __constructor__ member to the new object, but only for 
SWF6 up
+           // (to be checked). NOTE that we assume the builtin constructors
+           // won't set __constructor__ to some other value...
+           if ( VM::get().getSWFVersion() > 5 )
+           {
+                   as_object* newobj = new_obj.to_object();
+                   assert(newobj); // we assume builtin functions do return 
objects !!
+                    newobj->init_member("__constructor__", constructor);
+            }
+
         }
        else
        {
@@ -146,6 +142,13 @@
             // Create an empty object, with a ref to the constructor's 
prototype.
             boost::intrusive_ptr<as_object> new_obj_ptr(new 
as_object(proto.to_object()));
             
+            // Add a __constructor__ member to the new object, but only for 
SWF6 up
+           // (to be checked)
+           if ( VM::get().getSWFVersion() > 5 )
+           {
+               new_obj_ptr->init_member("__constructor__", constructor);
+            }
+            
             new_obj.set_as_object(new_obj_ptr.get());
             
             // Call the actual constructor function; new_obj is its 'this'.




reply via email to

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