CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 08/02/01 16:28:37
Modified files: . : ChangeLog server : swf_function.cpp testsuite/actionscript.all: Function.as Log message: still declare named arguments as locals no matter if they were passed or not. Fixes bug #22203 CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5548&r2=1.5549 http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.cpp?cvsroot=gnash&r1=1.46&r2=1.47 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Function.as?cvsroot=gnash&r1=1.64&r2=1.65 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5548 retrieving revision 1.5549 diff -u -b -r1.5548 -r1.5549 --- ChangeLog 1 Feb 2008 15:49:59 -0000 1.5548 +++ ChangeLog 1 Feb 2008 16:28:36 -0000 1.5549 @@ -1,5 +1,7 @@ 2008-02-01 Sandro Santilli <[EMAIL PROTECTED]> + * server/swf_function.cpp (call operator): still declare named + arguments as locals no matter if they were passed or not. * testsuite/actionscript.all/Function.as: add test for bug #22203. * server/parser/button_character_def.cpp (read): robustness improvement, fixes bug #22200. Index: server/swf_function.cpp =================================================================== RCS file: /sources/gnash/gnash/server/swf_function.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -u -b -r1.46 -r1.47 --- server/swf_function.cpp 21 Jan 2008 20:55:52 -0000 1.46 +++ server/swf_function.cpp 1 Feb 2008 16:28:37 -0000 1.47 @@ -126,12 +126,21 @@ // Conventional function. // Push the arguments onto the local frame. - int args_to_pass = imin(fn.nargs, m_args.size()); - for (int i = 0; i < args_to_pass; i++) + for (size_t i=0, n=m_args.size(); i<n; ++i) { assert(m_args[i].m_register == 0); + if ( i < fn.nargs ) + { our_env->add_local(m_args[i].m_name, fn.arg(i)); } + else + { + // Still declare named arguments, even if + // they are not passed from caller + // See bug #22203 + our_env->declare_local(m_args[i].m_name); + } + } // Add 'this' assert(fn.this_ptr); @@ -154,20 +163,37 @@ our_env->add_local_registers(m_local_register_count); // Handle the explicit args. - int args_to_pass = imin(fn.nargs, m_args.size()); - for (int i = 0; i < args_to_pass; i++) + for (size_t i=0, n=m_args.size(); i<n; ++i) + { + if ( ! m_args[i].m_register ) // not a register, declare as local { - if (m_args[i].m_register == 0) + if ( i < fn.nargs ) { // Conventional arg passing: create a local var. our_env->add_local(m_args[i].m_name, fn.arg(i)); } else { + // Still declare named arguments, even if + // they are not passed from caller + // See bug #22203 + our_env->declare_local(m_args[i].m_name); + } + } + else + { + if ( i < fn.nargs ) + { // Pass argument into a register. int reg = m_args[i].m_register; our_env->local_register(reg) = fn.arg(i); } + else + { + // The argument was not passed, no + // need to setup a register I guess.. + } + } } // Handle the implicit args. Index: testsuite/actionscript.all/Function.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Function.as,v retrieving revision 1.64 retrieving revision 1.65 diff -u -b -r1.64 -r1.65 --- testsuite/actionscript.all/Function.as 1 Feb 2008 15:49:59 -0000 1.64 +++ testsuite/actionscript.all/Function.as 1 Feb 2008 16:28:37 -0000 1.65 @@ -21,7 +21,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.64 2008/02/01 15:49:59 strk Exp $"; +rcsid="$Id: Function.as,v 1.65 2008/02/01 16:28:37 strk Exp $"; #include "check.as" @@ -908,7 +908,7 @@ a={count:1}; b={count:1}; inc(a); check_equals(a.count, 2); -xcheck_equals(b.count, 1); // See bug #22203 +check_equals(b.count, 1); // See bug #22203 #if OUTPUT_VERSION == 5 check_totals(146); // SWF5 _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit