gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11406: Clean up Number class.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11406: Clean up Number class.
Date: Tue, 11 Aug 2009 14:59:44 +0200
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11406
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-08-11 14:59:44 +0200
message:
  Clean up Number class.
modified:
  libcore/asobj/Number_as.cpp
=== modified file 'libcore/asobj/Number_as.cpp'
--- a/libcore/asobj/Number_as.cpp       2009-08-11 09:17:11 +0000
+++ b/libcore/asobj/Number_as.cpp       2009-08-11 12:59:44 +0000
@@ -37,7 +37,6 @@
 
 namespace {
     as_object* getNumberInterface();
-    as_object* getNumberClass();
 }
 
 class Number_as : public as_object
@@ -135,9 +134,7 @@
 attachNumberInterface(as_object& o)
 {
     Global_as* gl = getGlobal(o);
-
     o.init_member("toString", gl->createFunction(number_toString));
-
     o.init_member("valueOf", gl->createFunction(number_valueOf));
 }
 
@@ -145,9 +142,7 @@
 attachNumberStaticInterface(as_object& o)
 {
     // constant flags
-    const int cflags = PropFlags::dontEnum | 
-        PropFlags::dontDelete | 
-        PropFlags::readOnly;
+    const int cflags = as_object::DefaultFlags | PropFlags::readOnly;
 
     // Set __proto__ and constructor to constant.
     as_value null; null.set_null();
@@ -165,22 +160,6 @@
 }
 
 as_object*
-getNumberClass(Global_as& gl)
-{
-    // This is going to be the global Number "class"/"function"
-    static as_object* cl = 0;
-
-    as_object* proto = getNumberInterface();
-    if (!cl) {
-        cl = gl.createClass(&number_ctor, proto);
-        attachNumberStaticInterface(*cl);
-        VM::get().addStatic(cl);
-    }
-
-    return cl;
-}
-
-as_object*
 getNumberInterface()
 {
     static boost::intrusive_ptr<as_object> o=NULL;
@@ -199,12 +178,15 @@
 
 // extern (used by Global.cpp)
 void
-number_class_init(as_object& global, const ObjectURI& uri)
+number_class_init(as_object& where, const ObjectURI& uri)
 {
-    boost::intrusive_ptr<as_object> cl = getNumberClass(*getGlobal(global));
+    Global_as* gl = getGlobal(where);
+    as_object* proto = getNumberInterface();
+    as_object* cl = gl->createClass(&number_ctor, proto);
+    attachNumberStaticInterface(*cl);
 
     // Register _global.Number
-    global.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
+    where.init_member(getName(uri), cl, as_object::DefaultFlags,
             getNamespace(uri));
 
 }


reply via email to

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