[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Func...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Func... |
Date: |
Wed, 07 Feb 2007 10:28:40 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/02/07 10:28:40
Modified files:
. : ChangeLog
testsuite/actionscript.all: Function.as Inheritance.as
MovieClip.as
server : as_object.cpp as_object.h
server/asobj : Object.cpp Object.h
Log message:
* server/asobj/Object.{cpp,h}: export getObjectInterface()
* server/asobj/as_object.{cpp,h} (get_prototype): return
Object class interface when hit top of inheritance chain;
make sure to never access m_prototype directly but always
use get_prototype() instead. This ensures that *every* object
ends up being an Object instance.
* testsuite/actionscript.all/Function.as: a few more tests to
ensure that functions are instance of Object.
* testsuite/actionscript.all/: MovieClip.as, Inheritance.as:
Don't expect failures while checking for objects being
instance of Object class.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2259&r2=1.2260
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Function.as?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Inheritance.as?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/MovieClip.as?cvsroot=gnash&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Object.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Object.h?cvsroot=gnash&r1=1.3&r2=1.4
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2259
retrieving revision 1.2260
diff -u -b -r1.2259 -r1.2260
--- ChangeLog 7 Feb 2007 09:07:36 -0000 1.2259
+++ ChangeLog 7 Feb 2007 10:28:39 -0000 1.2260
@@ -1,5 +1,19 @@
2007-02-07 Sandro Santilli <address@hidden>
+ * server/asobj/Object.{cpp,h}: export getObjectInterface()
+ * server/asobj/as_object.{cpp,h} (get_prototype): return
+ Object class interface when hit top of inheritance chain;
+ make sure to never access m_prototype directly but always
+ use get_prototype() instead. This ensures that *every* object
+ ends up being an Object instance.
+ * testsuite/actionscript.all/Function.as: a few more tests to
+ ensure that functions are instance of Object.
+ * testsuite/actionscript.all/: MovieClip.as, Inheritance.as:
+ Don't expect failures while checking for objects being
+ instance of Object class.
+
+2007-02-07 Sandro Santilli <address@hidden>
+
* server/swf/tag_loaders.cpp (define_shape_loader): neater parse
print.
* server/types.{cpp,h}: add output operator and toString
Index: testsuite/actionscript.all/Function.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Function.as,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- testsuite/actionscript.all/Function.as 8 Jan 2007 11:54:09 -0000
1.21
+++ testsuite/actionscript.all/Function.as 7 Feb 2007 10:28:40 -0000
1.22
@@ -20,11 +20,10 @@
// compile this test case with Ming makeswf, and then
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: Function.as,v 1.21 2007/01/08 11:54:09 strk Exp $";
+rcsid="$Id: Function.as,v 1.22 2007/02/07 10:28:40 strk Exp $";
#include "check.as"
-
// Define a function returning 'this'.name and the given args
function getThisName(a,b,c) { return this.name+a+b+c; }
@@ -175,6 +174,19 @@
// Test inheritance
check (testInstance.__proto__ != undefined);
check (testInstance.__proto__ == TestClass.prototype);
+check (testInstance instanceOf TestClass);
+check (testInstance instanceOf Object);
+#if OUTPUT_VERSION > 5
+// Function was added in version 5
+check_equals (typeOf(Function.prototype.addProperty), 'function');
+check_equals (testInstance.__proto__, TestClass.prototype)
+check_equals (TestClass.__proto__, Function.prototype)
+check_equals (testInstance.addProperty, Object.prototype.addProperty)
+Object.prototype.addProperty = function() { return 7; };
+var t = testInstance.addProperty();
+check_equals(t, 7);
+check (Function instanceOf Object);
+#endif
check_equals (typeOf(TestClass.prototype.constructor), 'function');
Index: testsuite/actionscript.all/Inheritance.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Inheritance.as,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- testsuite/actionscript.all/Inheritance.as 2 Feb 2007 11:36:57 -0000
1.23
+++ testsuite/actionscript.all/Inheritance.as 7 Feb 2007 10:28:40 -0000
1.24
@@ -20,7 +20,7 @@
// compile this test case with Ming makeswf, and then
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: Inheritance.as,v 1.23 2007/02/02 11:36:57 strk Exp $";
+rcsid="$Id: Inheritance.as,v 1.24 2007/02/07 10:28:40 strk Exp $";
#include "check.as"
@@ -126,7 +126,7 @@
// Test the instanceOf operator
check(subInstance instanceOf SubClass);
check(subInstance instanceOf SuperClass);
-xcheck(subInstance instanceOf Object);
+check(subInstance instanceOf Object);
//------------------------------------------------
@@ -169,8 +169,8 @@
check_equals(sobj1.__proto__.constructor, SubObj1);
#if OUTPUT_VERSION > 5
check(SubObj1 instanceOf Function);
-xcheck(Function instanceOf Object);
-xcheck(SubObj1 instanceOf Object);
+check(Function instanceOf Object);
+check(SubObj1 instanceOf Object);
#endif
// inheritance chain is NOT subobj1,SubObj1,Function,Object, as the
@@ -178,7 +178,7 @@
check(!sobj1 instanceOf Function);
// but still, sobj1 is an instance of Object *and* SubObj1
-xcheck(sobj1 instanceOf Object);
+check(sobj1 instanceOf Object);
check(sobj1 instanceOf SubObj1);
check(SubObj1.prototype != undefined);
Index: testsuite/actionscript.all/MovieClip.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/MovieClip.as,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- testsuite/actionscript.all/MovieClip.as 2 Feb 2007 12:57:51 -0000
1.30
+++ testsuite/actionscript.all/MovieClip.as 7 Feb 2007 10:28:40 -0000
1.31
@@ -22,7 +22,7 @@
// compile this test case with Ming makeswf, and then
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: MovieClip.as,v 1.30 2007/02/02 12:57:51 strk Exp $";
+rcsid="$Id: MovieClip.as,v 1.31 2007/02/07 10:28:40 strk Exp $";
#include "check.as"
@@ -275,7 +275,7 @@
var cl = new MovieClip();
check_equals(cl.__proto__.constructor, MovieClip);
check(cl instanceOf MovieClip);
-xcheck(cl instanceOf Object);
+check(cl instanceOf Object);
check_equals(typeof(cl), "object");
check_equals(typeof(cl.attachMovie), "function");
check_equals(typeof(cl._width), "undefined");
Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- server/as_object.cpp 1 Feb 2007 11:55:04 -0000 1.33
+++ server/as_object.cpp 7 Feb 2007 10:28:40 -0000 1.34
@@ -31,6 +31,7 @@
#include "VM.h"
#include "GnashException.h"
#include "fn_call.h" // for generic methods
+#include "Object.h" // for getObjectInterface
#include <set>
#include <string>
@@ -104,12 +105,9 @@
//
if (name == "__proto__")
{
- if ( ! m_prototype )
- {
- log_msg("as_object %p has no prototype\n", (void*)this);
- return false;
- }
- val->set_as_object(m_prototype.get());
+ as_object* p = get_prototype();
+ assert(p);
+ val->set_as_object(get_prototype());
return true;
}
@@ -142,7 +140,7 @@
{
Property* prop = obj->_members.getProperty(key);
if ( prop ) return prop;
- else obj = obj->m_prototype.get();
+ else obj = obj->get_prototype();
}
// No Property found
@@ -168,7 +166,7 @@
// NOT a getter/setter ?
return prop;
}
- obj = obj->m_prototype.get();
+ obj = obj->get_prototype();
}
// No Getter/Setter property found
@@ -436,7 +434,7 @@
while ( obj && visited.insert(obj).second )
{
obj->_members.enumerateValues(env);
- obj = obj->m_prototype.get();
+ obj = obj->get_prototype();
}
if ( obj ) log_warning("prototype loop during Enumeration");
@@ -508,5 +506,13 @@
*(fn.result) = obj->get_primitive_value();
}
+as_object*
+as_object::get_prototype()
+{
+ if ( m_prototype ) return m_prototype.get();
+ //log_msg("as_object::get_prototype(): Hit top of inheritance chain");
+ return getObjectInterface();
+}
+
} // end of gnash namespace
Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- server/as_object.h 6 Feb 2007 23:06:18 -0000 1.36
+++ server/as_object.h 7 Feb 2007 10:28:40 -0000 1.37
@@ -324,12 +324,11 @@
/// The __proto__ member is the exported interface ('prototype')
/// of the class this object is an instance of.
///
- as_object* get_prototype() {
- return m_prototype.get();
- }
+ as_object* get_prototype();
const as_object* get_prototype() const {
- return m_prototype.get();
+ // cast away constness
+ return const_cast<as_object*>(this)->get_prototype();
}
/// Set this object's '__proto__' member
Index: server/asobj/Object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Object.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/asobj/Object.cpp 1 Feb 2007 11:57:19 -0000 1.12
+++ server/asobj/Object.cpp 7 Feb 2007 10:28:40 -0000 1.13
@@ -18,7 +18,7 @@
//
//
-/* $Id: Object.cpp,v 1.12 2007/02/01 11:57:19 strk Exp $ */
+/* $Id: Object.cpp,v 1.13 2007/02/07 10:28:40 strk Exp $ */
// Implementation of ActionScript Object class.
@@ -66,7 +66,7 @@
o.set_member_flags("addProperty", 1); // hidden
}
-static as_object*
+as_object*
getObjectInterface()
{
static boost::intrusive_ptr<as_object> o;
@@ -74,6 +74,7 @@
{
o = new as_object();
attachObjectInterface(*o);
+ o->set_prototype(o.get());
}
return o.get();
}
Index: server/asobj/Object.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Object.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/asobj/Object.h 29 Oct 2006 18:34:12 -0000 1.3
+++ server/asobj/Object.h 7 Feb 2007 10:28:40 -0000 1.4
@@ -35,6 +35,9 @@
/// Return an Object instance
std::auto_ptr<as_object> init_object_instance();
+as_object* getObjectInterface();
+
+
}
#endif // GNASH_OBJECT_H
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Func...,
Sandro Santilli <=