From: Matthias Kramm <kramm@quiss.org>
Date: Sun, 22 Nov 2009 21:54:44 +0000 (-0800)
Subject: added some more as3 tests
X-Git-Tag: version-0-9-1~236
X-Git-Url: http://git.asbjorn.biz/?a=commitdiff_plain;h=7f7a24c64b3fff28b9230b018ef035e96595d7f5;p=swftools.git

added some more as3 tests
---

diff --git a/lib/as3/ok/forward.as b/lib/as3/ok/forward.as
new file mode 100644
index 0000000..32e3fce
--- /dev/null
+++ b/lib/as3/ok/forward.as
@@ -0,0 +1,12 @@
+package {
+    public class Test extends flash.display.MovieClip
+    {
+	public function Test():void
+	{
+	    trace(ok);
+	    var ok:String = "ok";
+	    trace("[exit]");
+	}
+    }
+}
+
diff --git a/lib/as3/ok/forward2.as b/lib/as3/ok/forward2.as
new file mode 100644
index 0000000..f17c471
--- /dev/null
+++ b/lib/as3/ok/forward2.as
@@ -0,0 +1,37 @@
+package {
+    import flash.events.Event;
+    import flash.display.MovieClip
+
+    public class Main extends flash.display.MovieClip
+    {
+	public function test1(e:Event=null)
+	{
+	    try {
+		var a:Array = new Array
+		throw new Error();
+	    } catch (e:Error) { 
+		if(e instanceof Error)
+		    trace("ok 1/2");
+	    }
+	    var b = a[0]; // to trigger forward variable resolving
+	}
+	public function test2()
+	{
+	    var e:Event;
+	    try {
+		var a:Array = new Array
+		throw new Error();
+	    } catch (e:Error) { 
+		if(e instanceof Error)
+		    trace("ok 2/2");
+	    }
+	    var b = a[0]; // to trigger forward variable resolving
+	}
+
+	public function Main() {
+	    test1();
+	    test2();
+	    trace("[exit]");
+	}
+    }
+}
diff --git a/lib/as3/ok/override_ns.as b/lib/as3/ok/override_ns.as
new file mode 100644
index 0000000..16b06f0
--- /dev/null
+++ b/lib/as3/ok/override_ns.as
@@ -0,0 +1,22 @@
+package {
+    import flash.events.*;
+    import flash.utils.*;
+    import flash.display.MovieClip;
+
+    dynamic public class ExtendProxy extends Proxy
+    {
+	flash_proxy override function callProperty($name:*, ...$args:Array):* 
+	{
+	    trace("ok");
+	}
+    }
+
+    public class Main extends flash.display.MovieClip
+    {
+	public function Main()
+	{
+	    new ExtendProxy().callProperty();
+	    trace("[exit]");
+	}
+    }
+}
diff --git a/lib/as3/parser.y b/lib/as3/parser.y
index 580183c..316ea60 100644
--- a/lib/as3/parser.y
+++ b/lib/as3/parser.y
@@ -1468,7 +1468,7 @@ static abc_method_t* endfunction(modifiers_t*mod, enum yytokentype getset, char*
                     variable_t*v = dict_lookup(state->allvars, vname);
                     if(!v->is_inner_method) {
                         state->method->no_variable_scoping = 1;
-                        as3_warning("function %s uses forward or outer block variable references (%s): switching into compatiblity mode", name, vname);
+                        as3_warning("function %s uses forward or outer block variable references (%s): switching into compatibility mode", name, vname);
                     }
                 }
             }
@@ -2636,6 +2636,7 @@ CLASS_BODY_ITEM : ';'
 CLASS_BODY_ITEM : CONDITIONAL_COMPILATION '{' MAYBE_CLASS_BODY '}' {PASS_ALWAYS as3_pass=$1;}
 CLASS_BODY_ITEM : SLOT_DECLARATION
 CLASS_BODY_ITEM : FUNCTION_DECLARATION
+CLASS_BODY_ITEM : '[' EMBED_START E ']' {PASS_ALWAYS as3_pass=$2;PASS1 as3_warning("embed command ignored");}
 
 CLASS_BODY_ITEM : CODE_STATEMENT {
     code_t*c = state->cls->static_init->header;
@@ -3817,6 +3818,7 @@ VAR_READ : T_NAMESPACE {
     PASS2 
     $$ = resolve_identifier($1);
 }
+
 VAR_READ : T_IDENTIFIER {
     PASS1
     /* Queue unresolved identifiers for checking against the parent