gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11179: Go the whole hog with settin


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11179: Go the whole hog with setting Global as the prototype in the absence of
Date: Mon, 29 Jun 2009 13:40:42 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11179
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2009-06-29 13:40:42 +0200
message:
  Go the whole hog with setting Global as the prototype in the absence of
  any testing.
modified:
  libcore/parser/abc_block.cpp
    ------------------------------------------------------------
    revno: 11169.1.6
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Mon 2009-06-29 13:36:39 +0200
    message:
      The last script, not the first, is the entry script. Set all script
      prototypes to global as the apparently most likely implementation; there
      is no easy way of testing it yet.
    modified:
      libcore/parser/abc_block.cpp
=== modified file 'libcore/parser/abc_block.cpp'
--- a/libcore/parser/abc_block.cpp      2009-06-29 09:42:53 +0000
+++ b/libcore/parser/abc_block.cpp      2009-06-29 11:36:39 +0000
@@ -339,18 +339,17 @@
     std::for_each(_classes.begin(), _classes.end(),
             std::mem_fun(&asClass::initPrototype));
 
-    // The first (entry) script has Global as its prototype.
+    // The last (entry) script has Global as its prototype.
     // This can be deduced because the global classes are initialized with a
     // slot on script 0 (entry script). OpNewClass then attempts to set the
     // corresponding slot once the class has been constructed. At this point,
     // global should verifiably be on the stack, so the slots are expected
     // to be set on the global object.
-    if (!_scripts.empty()) {
-        _scripts.front()->setPrototype(mach->global());
-
-        std::for_each(_scripts.begin() + 1, _scripts.end(),
-                std::mem_fun(&asClass::initPrototype));
-    }
+    // It seems likely, though testing it is not straightforward, that all
+    // scripts have Global as a target object (prototype), so for now we
+    // will do that.
+    std::for_each(_scripts.begin(), _scripts.end(),
+            boost::bind(&asClass::setPrototype, _1, mach->global()));
  
     std::for_each(_methods.begin(), _methods.end(),
             boost::bind(&asMethod::initPrototype, _1, mach));


reply via email to

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