gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/as_environment.cpp serve...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/as_environment.cpp serve...
Date: Sat, 28 Apr 2007 07:22:44 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/04/28 07:22:44

Modified files:
        .              : ChangeLog 
        server         : as_environment.cpp as_environment.h 
        testsuite/actionscript.all: Function.as 

Log message:
                * server/as_environment.{cpp,h}: stop descending
                  the CallStack looking into the callers locals!
                * testsuite/actionscript.all/Function.as: success
                  with SWF5 and (missing) scope chain.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3028&r2=1.3029
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.75&r2=1.76
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.h?cvsroot=gnash&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Function.as?cvsroot=gnash&r1=1.48&r2=1.49

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3028
retrieving revision 1.3029
diff -u -b -r1.3028 -r1.3029
--- ChangeLog   28 Apr 2007 00:04:25 -0000      1.3028
+++ ChangeLog   28 Apr 2007 07:22:43 -0000      1.3029
@@ -1,4 +1,11 @@
-2007-04-26  Rob Savoye  <address@hidden>
+2007-04-28 Sandro Santilli <address@hidden>
+
+       * server/as_environment.{cpp,h}: stop descending
+         the CallStack looking into the callers locals!
+       * testsuite/actionscript.all/Function.as: success
+         with SWF5 and (missing) scope chain.
+
+2007-04-27  Rob Savoye  <address@hidden>
 
        * gui/fltk.cpp: Cast the key::code so it compiles on Darwin.
        * macros/agg.m4: Don't inherit the -rpath setting fropm

Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- server/as_environment.cpp   27 Apr 2007 16:09:00 -0000      1.75
+++ server/as_environment.cpp   28 Apr 2007 07:22:43 -0000      1.76
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: as_environment.cpp,v 1.75 2007/04/27 16:09:00 strk Exp $ */
+/* $Id: as_environment.cpp,v 1.76 2007/04/28 07:22:43 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -120,7 +120,7 @@
 
     // Check locals for getting them
     //as_environment::frame_slot slot;
-    if ( findLocal(varname, val, true, retTarget) ) // do we really want to 
descend here ??
+    if ( findLocal(varname, val, retTarget) ) 
     {
        return val;
     }
@@ -281,7 +281,8 @@
 {
 
        // Check locals for setting them
-       if ( setLocal(varname, val, true) )
+       // TODO: check if local variable takes precedence over 'with' scope 
when setting
+       if ( setLocal(varname, val) )
        {
                return;
        }
@@ -321,10 +322,7 @@
        assert(_localFrames.size());
 
        // Is it in the current frame already?
-       // TODO: should we descend to upper frames ?
-       //       (probably not as we want to update it)
-       //as_environment::frame_slot slot;
-       if ( setLocal(varname, val, false) )
+       if ( setLocal(varname, val) )
        {
                return;
        }
@@ -343,12 +341,8 @@
 void
 as_environment::declare_local(const std::string& varname)
 {
-       // TODO: should we descend to upper frames ?
-       //       (probably not as we want to declare it)
-       //as_environment::frame_slot slot;
-
        as_value tmp;
-       if ( ! findLocal(varname, tmp, false) )
+       if ( ! findLocal(varname, tmp) )
        {
                // Not in frame; create a new local var.
                assert(_localFrames.size());
@@ -929,32 +923,15 @@
 
 /*private*/
 bool
-as_environment::findLocal(const std::string& varname, as_value& ret, bool 
descend, as_object** retTarget)
+as_environment::findLocal(const std::string& varname, as_value& ret, 
as_object** retTarget)
 {
        if ( _localFrames.empty() ) return false;
-       if ( ! descend )
-       {
                if ( findLocal(_localFrames.back().locals, varname, ret) )
                {
                        if ( retTarget ) *retTarget = 
_localFrames.back().locals.get();
                        return true;
                }
                return false;
-       }
-
-       for (CallStack::reverse_iterator it=_localFrames.rbegin(),
-                       itEnd=_localFrames.rend();
-                       it != itEnd;
-                       ++it)
-       {
-               LocalVars& locals = it->locals;
-               if ( findLocal(locals, varname, ret) )
-               {
-                       if ( retTarget ) *retTarget = locals.get();
-                       return true;
-               }
-       }
-       return false;
 }
 
 /* static private */
@@ -962,18 +939,6 @@
 as_environment::findLocal(LocalVars& locals, const std::string& name, 
as_value& ret)
 {
        return locals->get_member(name, &ret);
-#if 0
-       for (size_t i=0; i<locals.size(); ++i)
-       {
-               const as_environment::frame_slot& slot = locals[i];
-               if (slot.m_name == name)
-               {
-                       ret = slot;
-                       return true;
-               }
-       }
-       return false;
-#endif
 }
 
 /* static private */
@@ -981,60 +946,22 @@
 as_environment::delLocal(LocalVars& locals, const std::string& varname)
 {
        return locals->delProperty(varname).second;
-#if 0
-       for (size_t i=0; i<locals.size(); ++i)
-       {
-               const as_environment::frame_slot& slot = locals[i];
-               if (slot.m_name == varname)
-               {
-                       locals.erase(locals.begin()+i);
-                       return true;
-               }
-       }
-       return false;
-#endif
 }
 
 /* private */
 bool
-as_environment::delLocal(const std::string& varname, bool descend)
+as_environment::delLocal(const std::string& varname)
 {
        if ( _localFrames.empty() ) return false;
-       if ( ! descend ) return delLocal(_localFrames.back().locals, varname);
-
-       for (CallStack::reverse_iterator it=_localFrames.rbegin(),
-                       itEnd=_localFrames.rend();
-                       it != itEnd;
-                       ++it)
-       {
-               LocalVars& locals = it->locals;
-               if ( delLocal(locals, varname) )
-               {
-                       return true;
-               }
-       }
-       return false;
+       return delLocal(_localFrames.back().locals, varname);
 }
 
 /* private */
 bool
-as_environment::setLocal(const std::string& varname, const as_value& val, bool 
descend)
+as_environment::setLocal(const std::string& varname, const as_value& val)
 {
        if ( _localFrames.empty() ) return false;
-       if ( ! descend ) return setLocal(_localFrames.back().locals, varname, 
val);
-
-       for (CallStack::reverse_iterator it=_localFrames.rbegin(),
-                       itEnd=_localFrames.rend();
-                       it != itEnd;
-                       ++it)
-       {
-               LocalVars& locals = it->locals;
-               if ( setLocal(locals, varname, val) )
-               {
-                       return true;
-               }
-       }
-       return false;
+       return setLocal(_localFrames.back().locals, varname, val);
 }
 
 /* static private */
@@ -1046,18 +973,6 @@
        if ( ! prop ) return false;
        prop->setValue(*locals, val);
        return true;
-#if 0
-       for (size_t i=0; i<locals.size(); ++i)
-       {
-               as_environment::frame_slot& slot = locals[i];
-               if (slot.m_name == varname)
-               {
-                       slot.m_value = val;
-                       return true;
-               }
-       }
-       return false;
-#endif
 }
 
 

Index: server/as_environment.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- server/as_environment.h     27 Apr 2007 16:09:01 -0000      1.49
+++ server/as_environment.h     28 Apr 2007 07:22:43 -0000      1.50
@@ -523,21 +523,17 @@
        ///     If a variable is found it's assigned to this parameter.
        ///     Untouched if the variable is not found.
        ///
-       /// @param descend
-       ///     If true the seek don't stop at current call frame, but
-       ///     descends in upper frames. By default it is false.
-       ///
        /// @param retTarget
        ///     If not NULL, the pointer will be set to the actual object 
containing the
        ///     found variable (if found).
        ///
        /// @return true if the variable was found, false otherwise
        ///
-       bool findLocal(const std::string& varname, as_value& ret, bool descend, 
as_object** retTarget=NULL);
+       bool findLocal(const std::string& varname, as_value& ret, as_object** 
retTarget=NULL);
 
-       bool findLocal(const std::string& varname, as_value& ret, bool descend, 
as_object** retTarget=NULL) const
+       bool findLocal(const std::string& varname, as_value& ret, as_object** 
retTarget=NULL) const
        {
-               return const_cast<as_environment*>(this)->findLocal(varname, 
ret, descend, retTarget);
+               return const_cast<as_environment*>(this)->findLocal(varname, 
ret, retTarget);
        }
 
        /// Find a variable in the given LocalVars
@@ -558,13 +554,9 @@
        /// @param varname
        ///     Name of the local variable
        ///
-       /// @param descend
-       ///     If true the seek don't stop at current call frame, but
-       ///     descends in upper frames. By default it is false.
-       ///
        /// @return true if the variable was found and deleted, false otherwise
        ///
-       bool delLocal(const std::string& varname, bool descend=false);
+       bool delLocal(const std::string& varname);
 
        /// Delete a variable from the given LocalVars
        //
@@ -583,13 +575,9 @@
        /// @param val
        ///     Value to assign to the variable
        ///
-       /// @param descend
-       ///     If true the seek don't stop at current call frame, but
-       ///     descends in upper frames. By default it is false.
-       ///
        /// @return true if the variable was found, false otherwise
        ///
-       bool setLocal(const std::string& varname, const as_value& val, bool 
descend=false);
+       bool setLocal(const std::string& varname, const as_value& val);
 
        /// Set a variable from the given LocalVars, if it exists.
        //

Index: testsuite/actionscript.all/Function.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Function.as,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- testsuite/actionscript.all/Function.as      27 Apr 2007 16:47:10 -0000      
1.48
+++ testsuite/actionscript.all/Function.as      28 Apr 2007 07:22:43 -0000      
1.49
@@ -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: Function.as,v 1.48 2007/04/27 16:47:10 strk Exp $";
+rcsid="$Id: Function.as,v 1.49 2007/04/28 07:22:43 strk Exp $";
 
 #include "check.as"
 
@@ -307,16 +307,11 @@
 #if OUTPUT_VERSION >= 6
 
   check_equals ( result1, "hello" );
-
-  // Gnash fails here, we want this fixed!
   check_equals ( result2, "hello" );
 
-#else // SWF5 or lower seems unable to work with nested functions
-
-  xcheck_equals ( result1, undefined );
+#else // SWF5 or lower doesn't use a scope chain
 
-  // Gnash succeeds here, but that's for the same reason why it
-  // fails in the SWF6+ section above...
+  check_equals ( result1, undefined );
   check_equals ( result2, undefined );
 
 #endif




reply via email to

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