From c9ef8a6292a3d3dd78f1a73cf55bdc26692c3719 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Sat, 12 Dec 2009 20:20:11 -0800 Subject: [PATCH] some cleanups, extended testcases forward2, override_ns --- lib/as3/ok/forward2.as | 17 +++++++++++++++-- lib/as3/ok/override_ns.as | 16 +++++++++++++--- lib/as3/parser.y | 8 +++++--- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/as3/ok/forward2.as b/lib/as3/ok/forward2.as index f17c471..8ea4683 100644 --- a/lib/as3/ok/forward2.as +++ b/lib/as3/ok/forward2.as @@ -11,7 +11,7 @@ package { 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 } @@ -23,14 +23,27 @@ package { 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 } + 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(); + test3(); trace("[exit]"); } } diff --git a/lib/as3/ok/override_ns.as b/lib/as3/ok/override_ns.as index 16b06f0..7bee035 100644 --- a/lib/as3/ok/override_ns.as +++ b/lib/as3/ok/override_ns.as @@ -3,11 +3,20 @@ package { 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):* { - 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() { - new ExtendProxy().callProperty(); + new ExtendProxy1().callProperty(); + new ExtendProxy2().callProperty(); trace("[exit]"); } } diff --git a/lib/as3/parser.y b/lib/as3/parser.y index 8bddc15..c692c9d 100644 --- a/lib/as3/parser.y +++ b/lib/as3/parser.y @@ -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; - 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 '}' { @@ -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 && 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); @@ -3917,7 +3920,6 @@ DEFAULT_NAMESPACE : "default xml" "namespace" '=' E USE_NAMESPACE : "use" "namespace" CLASS_SPEC { PASS12 - const char*url = $3->name; 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); - 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; -- 1.7.10.4