continues with the nested function.
I extract the tests from Function.as, around line 280.
Suppose that OUTPUT_VERSION is 5
var result1 = "initial_result1_value";
var result2 = "initial_result2_value";
check_equals(eval("result1"), "initial_result1_value");
outer_func = function()
{
var a = "hello";
inner_func = function(var_ref)
{
return(eval(var_ref));
};
result1 = inner_func("a"); <---------------------------- [1]
};
//call outer_func to set result1
check_equals(typeof(outer_func), 'function');
outer_func();
// call inner_func to set result2
check_equals(typeof(inner_func), 'function');
result2 = inner_func("a");
xcheck_equals ( result1, undefined ); <--------------------- [2]
check_equals ( result2, undefined );
[2] while fails here?
inner_func() is a main timeline function. It's expected that inner_func()
can not find the variable "a" defined in another main timeline function
outer_func().
On 4/28/07, Sandro Santilli <[EMAIL PROTECTED]> wrote:
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/04/27 16:47:10
Modified files:
testsuite/actionscript.all: Function.as
. : ChangeLog
Log message:
* testsuite/actionscript.all/Function.as: add another test for
nested functions and scope chain.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Function.as?cvsroot=gnash&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3023&r2=1.3024
Patches:
Index: testsuite/actionscript.all/Function.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Function.as,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- testsuite/actionscript.all/Function.as 27 Apr 2007 16:09:01 -0000
1.47
+++ testsuite/actionscript.all/Function.as 27 Apr 2007 16:47:10 -0000
1.48
@@ -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.47 2007/04/27 16:09:01 strk Exp $";
+rcsid="$Id: Function.as,v 1.48 2007/04/27 16:47:10 strk Exp $";
#include "check.as"
@@ -321,6 +321,24 @@
#endif
+function bla (num)
+{
+ bla = function ()
+ {
+ return num;
+ };
+ return num;
+}
+
+check_equals(typeof(bla), 'function');
+check_equals(bla(42), 42);
+check_equals(typeof(bla), 'function');
+#if OUTPUT_VERSION < 6
+check_equals(typeof(bla(43)), 'undefined');
+#else
+check_equals(bla(43), 42);
+#endif
+
//----------------------------------------------------------
//
// Test case for "this" in Object's context
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3023
retrieving revision 1.3024
diff -u -b -r1.3023 -r1.3024
--- ChangeLog 27 Apr 2007 16:43:09 -0000 1.3023
+++ ChangeLog 27 Apr 2007 16:47:10 -0000 1.3024
@@ -2,6 +2,8 @@
* testsuite/actionscript.all/Global.as: check that _global._global
is undefined.
+ * testsuite/actionscript.all/Function.as: add another test for
+ nested functions and scope chain.
2007-04-27 Sandro Santilli <[EMAIL PROTECTED]>
_______________________________________________
Gnash-commit mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-commit
_______________________________________________
Gnash-commit mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-commit