some cleanups, extended testcases forward2, override_ns
authorMatthias Kramm <kramm@quiss.org>
Sun, 13 Dec 2009 04:20:11 +0000 (20:20 -0800)
committerMatthias Kramm <kramm@quiss.org>
Sun, 13 Dec 2009 04:20:11 +0000 (20:20 -0800)
lib/as3/ok/forward2.as
lib/as3/ok/override_ns.as
lib/as3/parser.y

index f17c471..8ea4683 100644 (file)
@@ -11,7 +11,7 @@ package {
                throw new Error();
            } catch (e:Error) { 
                if(e instanceof Error)
                throw new Error();
            } catch (e:Error) { 
                if(e instanceof Error)
-                   trace("ok 1/2");
+                   trace("ok 1/4");
            }
            var b = a[0]; // to trigger forward variable resolving
        }
            }
            var b = a[0]; // to trigger forward variable resolving
        }
@@ -23,14 +23,27 @@ package {
                throw new Error();
            } catch (e:Error) { 
                if(e instanceof Error)
                throw new Error();
            } catch (e:Error) { 
                if(e instanceof Error)
-                   trace("ok 2/2");
+                   trace("ok 2/4");
            }
            var b = a[0]; // to trigger forward variable resolving
        }
 
            }
            var b = a[0]; // to trigger forward variable resolving
        }
 
+       public function test3()
+       {
+           if(x instanceof Error) 
+               trace("ok 3/4")
+           var x:Error;
+           try {
+               if(true) throw new Error();
+           } catch (x:Error) { 
+               trace("ok 4/4");
+           }
+       }
+
        public function Main() {
            test1();
            test2();
        public function Main() {
            test1();
            test2();
+           test3();
            trace("[exit]");
        }
     }
            trace("[exit]");
        }
     }
index 16b06f0..7bee035 100644 (file)
@@ -3,11 +3,20 @@ package {
     import flash.utils.*;
     import flash.display.MovieClip;
 
     import flash.utils.*;
     import flash.display.MovieClip;
 
-    dynamic public class ExtendProxy extends Proxy
+    dynamic public class ExtendProxy1 extends Proxy
     {
     {
+       import flash.utils.flash_proxy;
        flash_proxy override function callProperty($name:*, ...$args:Array):* 
        {
        flash_proxy override function callProperty($name:*, ...$args:Array):* 
        {
-           trace("ok");
+           trace("ok 1/2");
+       }
+    }
+    dynamic public class ExtendProxy2 extends Proxy 
+    {
+       import flash.utils.*;
+       flash_proxy override function callProperty($name:*, ...$args:Array):* 
+       {
+           trace("ok 2/2");
        }
     }
 
        }
     }
 
@@ -15,7 +24,8 @@ package {
     {
        public function Main()
        {
     {
        public function Main()
        {
-           new ExtendProxy().callProperty();
+           new ExtendProxy1().callProperty();
+           new ExtendProxy2().callProperty();
            trace("[exit]");
        }
     }
            trace("[exit]");
        }
     }
index 8bddc15..c692c9d 100644 (file)
@@ -2373,7 +2373,7 @@ SWITCH : T_SWITCH '(' {PASS12 new_state();state->switch_var=alloc_local();} E ')
 
 CATCH: "catch" '(' T_IDENTIFIER MAYBETYPE ')' {PASS12 new_state();
                                                       state->exception_name=$3;
 
 CATCH: "catch" '(' T_IDENTIFIER MAYBETYPE ')' {PASS12 new_state();
                                                       state->exception_name=$3;
-                                               PASS1 new_variable(state->method, $3, 0, 0, 0);
+                                               PASS1 new_variable(state->method, $3, $4, 0, 0);
                                                PASS2 new_variable(state->method, $3, $4, 0, 0);
                                               } 
         '{' MAYBECODE '}' {
                                                PASS2 new_variable(state->method, $3, $4, 0, 0);
                                               } 
         '{' MAYBECODE '}' {
@@ -2572,6 +2572,9 @@ IMPORT : "import" PACKAGEANDCLASS {
        if(!s && as3_pass==1) {// || !(s->flags&FLAG_BUILTIN)) {
            as3_schedule_class($2->package, $2->name);
        }
        if(!s && as3_pass==1) {// || !(s->flags&FLAG_BUILTIN)) {
            as3_schedule_class($2->package, $2->name);
        }
+       /*if(s && s->kind == INFOTYPE_VAR && TYPE_IS_NAMESPACE(s->type)) {
+           trie_put(active_namespaces, (unsigned char*)$2->name, 0);
+       }*/
        state_has_imports();
        dict_put(state->imports, $2->name, $2);
        import_toplevel($2->package);
        state_has_imports();
        dict_put(state->imports, $2->name, $2);
        import_toplevel($2->package);
@@ -3917,7 +3920,6 @@ DEFAULT_NAMESPACE : "default xml" "namespace" '=' E
 
 USE_NAMESPACE : "use" "namespace" CLASS_SPEC {
     PASS12
 
 USE_NAMESPACE : "use" "namespace" CLASS_SPEC {
     PASS12
-    const char*url = $3->name;
 
     varinfo_t*s = (varinfo_t*)$3;
     if(s->kind == INFOTYPE_UNRESOLVED) {
 
     varinfo_t*s = (varinfo_t*)$3;
     if(s->kind == INFOTYPE_UNRESOLVED) {
@@ -3930,8 +3932,8 @@ USE_NAMESPACE : "use" "namespace" CLASS_SPEC {
         syntaxerror("%s.%s is not a public namespace (%d)", $3->package, $3->name, s?s->kind:-1);
     if(!s->value || !NS_TYPE(s->value->type))
         syntaxerror("%s.%s is not a namespace", $3->package, $3->name);
         syntaxerror("%s.%s is not a public namespace (%d)", $3->package, $3->name, s?s->kind:-1);
     if(!s->value || !NS_TYPE(s->value->type))
         syntaxerror("%s.%s is not a namespace", $3->package, $3->name);
-    url = s->value->ns->name;
 
 
+    const char*url = s->value->ns->name;
     trie_put(active_namespaces, (unsigned char*)$3->name, (void*)url);
     add_active_url(url);
     $$=0;
     trie_put(active_namespaces, (unsigned char*)$3->name, (void*)url);
     add_active_url(url);
     $$=0;