From: Matthias Kramm Date: Fri, 3 Apr 2009 20:28:18 +0000 (+0200) Subject: as3compile: added -R option, fixed some namespace bugs X-Git-Tag: release-0-9-0~27 X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;h=4da50aa69285c6f5abd97e41dd195648b8df49fe;p=swftools.git as3compile: added -R option, fixed some namespace bugs --- diff --git a/lib/as3/compiler.c b/lib/as3/compiler.c index 36bb1fa..8bd8dd2 100644 --- a/lib/as3/compiler.c +++ b/lib/as3/compiler.c @@ -39,6 +39,8 @@ extern int a3_parse(); extern int as3_lex(); extern int as3_lex_destroy(); +static char config_recurse = 0; + void as3_setverbosity(int level) { as3_verbosity=level; @@ -47,6 +49,12 @@ void as3_add_include_dir(char*dir) { add_include_dir(dir); } +void as3_set_option(char*key, char*value) +{ + if(!strcmp(key, "recurse")) { + config_recurse=atoi(value); + } +} static char registry_initialized = 0; static char parser_initialized = 0; @@ -319,7 +327,9 @@ void as3_schedule_class(const char*package, const char*cls) void as3_schedule_class_noerror(const char*package, const char*cls) { - schedule_class(package, cls, 0); + if(config_recurse) { + schedule_class(package, cls, 0); + } } diff --git a/lib/as3/main.c b/lib/as3/main.c index 0727c12..d97f7da 100644 --- a/lib/as3/main.c +++ b/lib/as3/main.c @@ -78,6 +78,9 @@ int main(int argn, char*argv[]) if(!strcmp(argv[t], "-q")) { as3_verbosity--; } + if(!strcmp(argv[t], "-R")) { + as3_set_option("recurse","1"); + } if(!strcmp(argv[t], "-I")) { as3_add_include_dir(argv[++t]); } diff --git a/lib/as3/ok/namespaces2.as b/lib/as3/ok/namespaces2.as new file mode 100644 index 0000000..337116d --- /dev/null +++ b/lib/as3/ok/namespaces2.as @@ -0,0 +1,28 @@ +package { + + import flash.utils.*; + import flash.display.MovieClip; + + use namespace flash_proxy; + + /** + * This class acts as the public interface for both the flash api and the javascript api + * It is a proxy class that wraps ApiInternal. It provides a method interface, as well as + * exposing an event interface to flash. + */ + dynamic public class Main extends flash.display.MovieClip { + + flash_proxy function tf(x:int):* + { + trace("ok "+x+"/2"); + return null; + } + + public function Main() + { + this.tf(1); + tf(2); + } + + } +} diff --git a/lib/as3/parser.tab.c b/lib/as3/parser.tab.c index bcf326c..d2ed21d 100644 --- a/lib/as3/parser.tab.c +++ b/lib/as3/parser.tab.c @@ -2577,15 +2577,15 @@ static const yytype_uint16 yyrline[] = 2920, 2937, 2938, 2940, 2939, 2963, 2982, 2996, 2997, 2999, 3000, 3002, 3003, 3004, 3013, 3014, 3018, 3019, 3021, 3022, 3023, 3025, 3029, 3030, 3035, 3036, 3072, 3118, 3139, 3160, - 3163, 3170, 3171, 3172, 3178, 3184, 3186, 3188, 3190, 3192, - 3194, 3196, 3213, 3218, 3221, 3224, 3227, 3230, 3233, 3236, - 3239, 3242, 3246, 3249, 3252, 3255, 3258, 3261, 3264, 3267, - 3271, 3282, 3300, 3305, 3310, 3315, 3320, 3325, 3329, 3333, - 3338, 3342, 3346, 3355, 3364, 3374, 3379, 3391, 3397, 3402, - 3408, 3414, 3418, 3420, 3431, 3440, 3447, 3448, 3450, 3456, - 3465, 3472, 3484, 3490, 3496, 3502, 3508, 3514, 3520, 3526, - 3539, 3550, 3557, 3570, 3597, 3611, 3625, 3639, 3654, 3661, - 3668, 3675, 3682, 3693, 3745, 3854, 3861, 3868, 3875, 3890 + 3163, 3170, 3171, 3172, 3178, 3184, 3185, 3186, 3187, 3188, + 3190, 3192, 3209, 3214, 3217, 3220, 3223, 3226, 3229, 3232, + 3235, 3238, 3242, 3245, 3248, 3251, 3254, 3257, 3260, 3263, + 3267, 3278, 3296, 3301, 3306, 3311, 3316, 3321, 3325, 3329, + 3334, 3338, 3342, 3351, 3360, 3370, 3375, 3387, 3393, 3398, + 3404, 3410, 3414, 3416, 3427, 3436, 3443, 3444, 3446, 3452, + 3461, 3468, 3480, 3486, 3492, 3498, 3504, 3510, 3516, 3522, + 3535, 3546, 3553, 3566, 3593, 3607, 3621, 3635, 3650, 3657, + 3664, 3671, 3678, 3693, 3749, 3858, 3865, 3872, 3879, 3894 }; #endif @@ -6357,7 +6357,7 @@ PASS2 c->nsset = get_current_imports(); /* make the compiler look for this class in the current directory, just in case: */ - //as3_schedule_class_noerror(state->package, $1); + as3_schedule_class_noerror(state->package, (yyvsp[(1) - (1)].id)); } (yyval.classinfo) = (classinfo_t*)c; PASS2 @@ -6790,7 +6790,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3188 "parser.y" +#line 3186 "parser.y" {(yyval.value) = (yyvsp[(1) - (1)].value);} } break; @@ -6801,7 +6801,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3190 "parser.y" +#line 3187 "parser.y" {(yyval.value) = (yyvsp[(1) - (1)].value);} } break; @@ -6812,7 +6812,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3192 "parser.y" +#line 3188 "parser.y" {(yyval.value) = (yyvsp[(1) - (1)].value);} } break; @@ -6823,7 +6823,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3196 "parser.y" +#line 3192 "parser.y" { (yyval.value).c = 0; namespace_t ns = {ACCESS_PACKAGE, ""}; @@ -6849,7 +6849,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3213 "parser.y" +#line 3209 "parser.y" {(yyval.value).c = abc_pushbyte(0, (yyvsp[(1) - (1)].number_uint)); //MULTINAME(m, registry_getintclass()); //$$.c = abc_coerce2($$.c, &m); // FIXME @@ -6864,7 +6864,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3218 "parser.y" +#line 3214 "parser.y" {(yyval.value).c = abc_pushshort(0, (yyvsp[(1) - (1)].number_uint)); (yyval.value).t = TYPE_INT; } @@ -6877,7 +6877,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3221 "parser.y" +#line 3217 "parser.y" {(yyval.value).c = abc_pushint(0, (yyvsp[(1) - (1)].number_int)); (yyval.value).t = TYPE_INT; } @@ -6890,7 +6890,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3224 "parser.y" +#line 3220 "parser.y" {(yyval.value).c = abc_pushuint(0, (yyvsp[(1) - (1)].number_uint)); (yyval.value).t = TYPE_UINT; } @@ -6903,7 +6903,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3227 "parser.y" +#line 3223 "parser.y" {(yyval.value).c = abc_pushdouble(0, (yyvsp[(1) - (1)].number_float)); (yyval.value).t = TYPE_FLOAT; } @@ -6916,7 +6916,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3230 "parser.y" +#line 3226 "parser.y" {(yyval.value).c = abc_pushstring2(0, &(yyvsp[(1) - (1)].str));free((char*)(yyvsp[(1) - (1)].str).str); (yyval.value).t = TYPE_STRING; } @@ -6929,7 +6929,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3233 "parser.y" +#line 3229 "parser.y" {(yyval.value).c = abc_pushundefined(0); (yyval.value).t = TYPE_ANY; } @@ -6942,7 +6942,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3236 "parser.y" +#line 3232 "parser.y" {(yyval.value).c = abc_pushtrue(0); (yyval.value).t = TYPE_BOOLEAN; } @@ -6955,7 +6955,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3239 "parser.y" +#line 3235 "parser.y" {(yyval.value).c = abc_pushfalse(0); (yyval.value).t = TYPE_BOOLEAN; } @@ -6968,7 +6968,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3242 "parser.y" +#line 3238 "parser.y" {(yyval.value).c = abc_pushnull(0); (yyval.value).t = TYPE_NULL; } @@ -6981,7 +6981,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3246 "parser.y" +#line 3242 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_greaterequals((yyval.value).c);(yyval.value).c=abc_not((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; } @@ -6994,7 +6994,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3249 "parser.y" +#line 3245 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_greaterthan((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; } @@ -7007,7 +7007,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3252 "parser.y" +#line 3248 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_greaterthan((yyval.value).c);(yyval.value).c=abc_not((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; } @@ -7020,7 +7020,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3255 "parser.y" +#line 3251 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_greaterequals((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; } @@ -7033,7 +7033,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3258 "parser.y" +#line 3254 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_equals((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; } @@ -7046,7 +7046,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3261 "parser.y" +#line 3257 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_strictequals((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; } @@ -7059,7 +7059,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3264 "parser.y" +#line 3260 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_strictequals((yyval.value).c);(yyval.value).c = abc_not((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; } @@ -7072,7 +7072,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3267 "parser.y" +#line 3263 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_equals((yyval.value).c);(yyval.value).c = abc_not((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; } @@ -7085,7 +7085,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3271 "parser.y" +#line 3267 "parser.y" {(yyval.value).t = join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, 'O'); (yyval.value).c = (yyvsp[(1) - (3)].value).c; (yyval.value).c = converttype((yyval.value).c, (yyvsp[(1) - (3)].value).t, (yyval.value).t); @@ -7106,7 +7106,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3282 "parser.y" +#line 3278 "parser.y" { (yyval.value).t = join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, 'A'); /*printf("%08x:\n",$1.t); @@ -7133,7 +7133,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3300 "parser.y" +#line 3296 "parser.y" {(yyval.value).c=(yyvsp[(2) - (2)].value).c; (yyval.value).c = abc_not((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; @@ -7147,7 +7147,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3305 "parser.y" +#line 3301 "parser.y" {(yyval.value).c=(yyvsp[(2) - (2)].value).c; (yyval.value).c = abc_bitnot((yyval.value).c); (yyval.value).t = TYPE_INT; @@ -7161,7 +7161,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3310 "parser.y" +#line 3306 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_bitand((yyval.value).c); (yyval.value).t = TYPE_INT; @@ -7175,7 +7175,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3315 "parser.y" +#line 3311 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_bitxor((yyval.value).c); (yyval.value).t = TYPE_INT; @@ -7189,7 +7189,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3320 "parser.y" +#line 3316 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_bitor((yyval.value).c); (yyval.value).t = TYPE_INT; @@ -7203,7 +7203,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3325 "parser.y" +#line 3321 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_rshift((yyval.value).c); (yyval.value).t = TYPE_INT; @@ -7217,7 +7217,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3329 "parser.y" +#line 3325 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_urshift((yyval.value).c); (yyval.value).t = TYPE_INT; @@ -7231,7 +7231,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3333 "parser.y" +#line 3329 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_lshift((yyval.value).c); (yyval.value).t = TYPE_INT; @@ -7245,7 +7245,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3338 "parser.y" +#line 3334 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_divide((yyval.value).c); (yyval.value).t = TYPE_NUMBER; @@ -7259,7 +7259,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3342 "parser.y" +#line 3338 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_modulo((yyval.value).c); (yyval.value).t = TYPE_NUMBER; @@ -7273,7 +7273,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3346 "parser.y" +#line 3342 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); if(BOTH_INT((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t)) { (yyval.value).c = abc_add_i((yyval.value).c); @@ -7292,7 +7292,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3355 "parser.y" +#line 3351 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); if(BOTH_INT((yyvsp[(1) - (3)].value).t,(yyvsp[(3) - (3)].value).t)) { (yyval.value).c = abc_subtract_i((yyval.value).c); @@ -7311,7 +7311,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3364 "parser.y" +#line 3360 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); if(BOTH_INT((yyvsp[(1) - (3)].value).t,(yyvsp[(3) - (3)].value).t)) { (yyval.value).c = abc_multiply_i((yyval.value).c); @@ -7330,7 +7330,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3374 "parser.y" +#line 3370 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_in((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; @@ -7344,7 +7344,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3379 "parser.y" +#line 3375 "parser.y" {char use_astype=0; // flash player's astype works differently than astypelate if(use_astype && TYPE_IS_CLASS((yyvsp[(3) - (3)].value).t) && (yyvsp[(3) - (3)].value).t->data) { MULTINAME(m, (classinfo_t*)((yyvsp[(3) - (3)].value).t->data)); @@ -7365,7 +7365,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3392 "parser.y" +#line 3388 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c, (yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_instanceof((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; @@ -7379,7 +7379,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3397 "parser.y" +#line 3393 "parser.y" {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c, (yyvsp[(3) - (3)].value).c); (yyval.value).c = abc_istypelate((yyval.value).c); (yyval.value).t = TYPE_BOOLEAN; @@ -7393,7 +7393,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3402 "parser.y" +#line 3398 "parser.y" { (yyval.value).c = (yyvsp[(3) - (4)].value).c; (yyval.value).c = abc_typeof((yyval.value).c); @@ -7408,7 +7408,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3408 "parser.y" +#line 3404 "parser.y" { (yyval.value).c = cut_last_push((yyvsp[(2) - (2)].value).c); (yyval.value).c = abc_pushundefined((yyval.value).c); @@ -7423,7 +7423,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3414 "parser.y" +#line 3410 "parser.y" { (yyval.value).c = abc_pushundefined(0); (yyval.value).t = TYPE_ANY; } @@ -7436,7 +7436,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3418 "parser.y" +#line 3414 "parser.y" {(yyval.value)=(yyvsp[(2) - (3)].value);} } break; @@ -7447,7 +7447,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3420 "parser.y" +#line 3416 "parser.y" { (yyval.value)=(yyvsp[(2) - (2)].value); if(IS_INT((yyvsp[(2) - (2)].value).t)) { @@ -7467,7 +7467,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3431 "parser.y" +#line 3427 "parser.y" { (yyval.value).c = (yyvsp[(1) - (4)].value).c; (yyval.value).c = code_append((yyval.value).c, (yyvsp[(3) - (4)].value).c); @@ -7485,7 +7485,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3440 "parser.y" +#line 3436 "parser.y" { (yyval.value).c = code_new(); (yyval.value).c = code_append((yyval.value).c, (yyvsp[(2) - (3)].value_list).cc); @@ -7501,7 +7501,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3447 "parser.y" +#line 3443 "parser.y" {(yyval.value_list).cc=0;(yyval.value_list).number=0;} } break; @@ -7512,7 +7512,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3448 "parser.y" +#line 3444 "parser.y" {(yyval.value_list)=(yyvsp[(1) - (1)].value_list);} } break; @@ -7523,7 +7523,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3450 "parser.y" +#line 3446 "parser.y" { (yyval.value_list).cc = 0; (yyval.value_list).cc = code_append((yyval.value_list).cc, (yyvsp[(1) - (3)].value).c); @@ -7539,7 +7539,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3456 "parser.y" +#line 3452 "parser.y" { (yyval.value_list).cc = (yyvsp[(1) - (5)].value_list).cc; (yyval.value_list).number = (yyvsp[(1) - (5)].value_list).number+2; @@ -7555,7 +7555,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3465 "parser.y" +#line 3461 "parser.y" { (yyval.value).c = code_new(); (yyval.value).c = code_append((yyval.value).c, (yyvsp[(2) - (3)].value_list).cc); @@ -7571,7 +7571,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3472 "parser.y" +#line 3468 "parser.y" { code_t*c = (yyvsp[(3) - (3)].value).c; if(BOTH_INT((yyvsp[(1) - (3)].value).t,(yyvsp[(3) - (3)].value).t)) { @@ -7592,7 +7592,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3484 "parser.y" +#line 3480 "parser.y" { code_t*c = abc_modulo((yyvsp[(3) - (3)].value).c); c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '%'), (yyvsp[(1) - (3)].value).t); @@ -7608,7 +7608,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3490 "parser.y" +#line 3486 "parser.y" { code_t*c = abc_lshift((yyvsp[(3) - (3)].value).c); c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '<'), (yyvsp[(1) - (3)].value).t); @@ -7624,7 +7624,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3496 "parser.y" +#line 3492 "parser.y" { code_t*c = abc_rshift((yyvsp[(3) - (3)].value).c); c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '>'), (yyvsp[(1) - (3)].value).t); @@ -7640,7 +7640,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3502 "parser.y" +#line 3498 "parser.y" { code_t*c = abc_urshift((yyvsp[(3) - (3)].value).c); c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, 'U'), (yyvsp[(1) - (3)].value).t); @@ -7656,7 +7656,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3508 "parser.y" +#line 3504 "parser.y" { code_t*c = abc_divide((yyvsp[(3) - (3)].value).c); c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '/'), (yyvsp[(1) - (3)].value).t); @@ -7672,7 +7672,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3514 "parser.y" +#line 3510 "parser.y" { code_t*c = abc_bitor((yyvsp[(3) - (3)].value).c); c=converttype(c, TYPE_INT, (yyvsp[(1) - (3)].value).t); @@ -7688,7 +7688,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3520 "parser.y" +#line 3516 "parser.y" { code_t*c = abc_bitxor((yyvsp[(3) - (3)].value).c); c=converttype(c, TYPE_INT, (yyvsp[(1) - (3)].value).t); @@ -7704,7 +7704,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3526 "parser.y" +#line 3522 "parser.y" { code_t*c = (yyvsp[(3) - (3)].value).c; @@ -7727,7 +7727,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3539 "parser.y" +#line 3535 "parser.y" { code_t*c = (yyvsp[(3) - (3)].value).c; if(TYPE_IS_INT((yyvsp[(1) - (3)].value).t)) { c=abc_subtract_i(c); @@ -7748,7 +7748,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3550 "parser.y" +#line 3546 "parser.y" { code_t*c = 0; c = code_append(c, (yyvsp[(3) - (3)].value).c); c = converttype(c, (yyvsp[(3) - (3)].value).t, (yyvsp[(1) - (3)].value).t); @@ -7764,7 +7764,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3557 "parser.y" +#line 3553 "parser.y" { (yyval.value).t = join_types((yyvsp[(3) - (5)].value).t,(yyvsp[(5) - (5)].value).t,'?'); (yyval.value).c = (yyvsp[(1) - (5)].value).c; @@ -7786,7 +7786,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3570 "parser.y" +#line 3566 "parser.y" { code_t*c = 0; classinfo_t*type = (yyvsp[(1) - (2)].value).t; if(is_getlocal((yyvsp[(1) - (2)].value).c) && (TYPE_IS_INT((yyvsp[(1) - (2)].value).t) || TYPE_IS_NUMBER((yyvsp[(1) - (2)].value).t))) { @@ -7821,7 +7821,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3597 "parser.y" +#line 3593 "parser.y" { code_t*c = 0; classinfo_t*type = (yyvsp[(1) - (2)].value).t; if(TYPE_IS_INT(type) || TYPE_IS_UINT(type)) { @@ -7844,7 +7844,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3611 "parser.y" +#line 3607 "parser.y" { code_t*c = 0; classinfo_t*type = (yyvsp[(2) - (2)].value).t; if(TYPE_IS_INT(type) || TYPE_IS_UINT(type)) { @@ -7867,7 +7867,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3625 "parser.y" +#line 3621 "parser.y" { code_t*c = 0; classinfo_t*type = (yyvsp[(2) - (2)].value).t; if(TYPE_IS_INT(type) || TYPE_IS_UINT(type)) { @@ -7890,7 +7890,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3640 "parser.y" +#line 3636 "parser.y" { if(!state->cls->info) syntaxerror("super keyword not allowed outside a class"); classinfo_t*t = state->cls->info->superclass; @@ -7913,7 +7913,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3654 "parser.y" +#line 3650 "parser.y" { // attribute TODO (yyval.value).c = abc_pushundefined(0); @@ -7929,7 +7929,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3661 "parser.y" +#line 3657 "parser.y" { // child attribute TODO (yyval.value).c = abc_pushundefined(0); @@ -7945,7 +7945,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3668 "parser.y" +#line 3664 "parser.y" { // namespace declaration TODO (yyval.value).c = abc_pushundefined(0); @@ -7961,7 +7961,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3675 "parser.y" +#line 3671 "parser.y" { // descendants TODO (yyval.value).c = abc_pushundefined(0); @@ -7977,7 +7977,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3682 "parser.y" +#line 3678 "parser.y" { // filter TODO (yyval.value).c = abc_pushundefined(0); @@ -8013,6 +8013,9 @@ PASS2 if(f && f->slot && !noslot) { (yyval.value).c = abc_getslot((yyval.value).c, f->slot); } else { + if(!f) + as3_warning("Access of undefined property '%s' in %s", (yyvsp[(3) - (3)].id), t->name); + MEMBER_MULTINAME(m, f, (yyvsp[(3) - (3)].id)); (yyval.value).c = abc_getproperty2((yyval.value).c, &m); } @@ -8039,6 +8042,7 @@ PASS2 /* when resolving a property on an unknown type, we do know the name of the property (and don't seem to need the package), but we need to make avm2 try out all access modes */ + as3_warning("Resolving %s on unknown type", (yyvsp[(3) - (3)].id)); multiname_t m = {MULTINAME, 0, &nopackage_namespace_set, (yyvsp[(3) - (3)].id)}; (yyval.value).c = abc_getproperty2((yyval.value).c, &m); (yyval.value).c = abc_coerce_a((yyval.value).c); @@ -8054,7 +8058,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3745 "parser.y" +#line 3749 "parser.y" { PASS1 /* Queue unresolved identifiers for checking against the parent @@ -8070,7 +8074,7 @@ PASS2 /* let the compiler know that it might want to check the current directory/package for this identifier- maybe there's a file $1.as defining $1. */ - //as3_schedule_class_noerror(state->package, $1); + as3_schedule_class_noerror(state->package, (yyvsp[(1) - (1)].id)); PASS2 (yyval.value).t = 0; @@ -8116,7 +8120,7 @@ PASS2 static properties of a class */ state->method->late_binding = 1; (yyval.value).t = f->type; - namespace_t ns = {f->access, ""}; + namespace_t ns = {f->access, f->package}; multiname_t m = {QNAME, &ns, 0, (yyvsp[(1) - (1)].id)}; (yyval.value).c = abc_findpropstrict2((yyval.value).c, &m); (yyval.value).c = abc_getproperty2((yyval.value).c, &m); @@ -8126,7 +8130,7 @@ PASS2 (yyval.value).c = abc_getslot((yyval.value).c, f->slot); break; } else { - namespace_t ns = {f->access, ""}; + namespace_t ns = {f->access, f->package}; multiname_t m = {QNAME, &ns, 0, (yyvsp[(1) - (1)].id)}; (yyval.value).c = abc_getlocal_0((yyval.value).c); (yyval.value).c = abc_getproperty2((yyval.value).c, &m); @@ -8170,7 +8174,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3854 "parser.y" +#line 3858 "parser.y" { PASS12 NEW(namespace_decl_t,n); @@ -8187,7 +8191,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3861 "parser.y" +#line 3865 "parser.y" { PASS12 NEW(namespace_decl_t,n); @@ -8204,7 +8208,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3868 "parser.y" +#line 3872 "parser.y" { PASS12 NEW(namespace_decl_t,n); @@ -8221,7 +8225,7 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3875 "parser.y" +#line 3879 "parser.y" { PASS12 trie_put(active_namespaces, (yyvsp[(2) - (2)].namespace_decl)->name, (void*)(yyvsp[(2) - (2)].namespace_decl)->url); @@ -8245,11 +8249,18 @@ PASS2 if(as3_pass==2) { /* Line 1464 of skeleton.m4 */ -#line 3890 "parser.y" +#line 3894 "parser.y" { - + PASS12 const char*url = (yyvsp[(3) - (3)].classinfo)->name; + varinfo_t*s = (varinfo_t*)(yyvsp[(3) - (3)].classinfo); + if(s->kind == INFOTYPE_UNRESOLVED) { + s = (varinfo_t*)registry_resolve((slotinfo_t*)s); + if(!s) + syntaxerror("Couldn't resolve namespace %s", (yyvsp[(3) - (3)].classinfo)->name); + } + if(!s || s->kind != INFOTYPE_SLOT) syntaxerror("%s.%s is not a public namespace (%d)", (yyvsp[(3) - (3)].classinfo)->package, (yyvsp[(3) - (3)].classinfo)->name, s?s->kind:-1); if(!s->value || !NS_TYPE(s->value->type)) @@ -8267,7 +8278,7 @@ PASS2 /* Line 1464 of skeleton.m4 */ -#line 8271 "parser.tab.c" +#line 8282 "parser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/lib/as3/parser.y b/lib/as3/parser.y index 3abeaa3..d0927b2 100644 --- a/lib/as3/parser.y +++ b/lib/as3/parser.y @@ -2970,7 +2970,7 @@ CLASS: X_IDENTIFIER { c->nsset = get_current_imports(); /* make the compiler look for this class in the current directory, just in case: */ - //as3_schedule_class_noerror(state->package, $1); + as3_schedule_class_noerror(state->package, $1); } $$ = (classinfo_t*)c; PASS2 @@ -3182,13 +3182,9 @@ VOIDEXPRESSION : EXPRESSION %prec below_minus { // ----------------------- expression evaluation ------------------------------------- E : INNERFUNCTION %prec prec_none {$$ = $1;} -//V : CONSTANT {$$ = 0;} E : CONSTANT -//V : VAR_READ %prec T_IDENTIFIER {$$ = 0;} E : VAR_READ %prec T_IDENTIFIER {$$ = $1;} -//V : NEW {$$ = $1.c;} E : NEW {$$ = $1;} -//V : DELETE {$$ = $1.c;} E : DELETE {$$ = $1;} E : FUNCTIONCALL @@ -3686,8 +3682,12 @@ E : E '.' '(' E ')' { as3_warning("ignored .() operator"); } -//VARIABLE : VARIABLE "::" '[' EXPRESSION ']' // qualified expression - +//E : E "::" '[' E ']' { +// // qualified expression TODO +// $$.c = abc_pushundefined(0); +// $$.t = 0; +// as3_warning("ignored ::[] operator"); +// } E : E '.' T_IDENTIFIER { @@ -3709,6 +3709,9 @@ E : E '.' T_IDENTIFIER { if(f && f->slot && !noslot) { $$.c = abc_getslot($$.c, f->slot); } else { + if(!f) + as3_warning("Access of undefined property '%s' in %s", $3, t->name); + MEMBER_MULTINAME(m, f, $3); $$.c = abc_getproperty2($$.c, &m); } @@ -3735,6 +3738,7 @@ E : E '.' T_IDENTIFIER { /* when resolving a property on an unknown type, we do know the name of the property (and don't seem to need the package), but we need to make avm2 try out all access modes */ + as3_warning("Resolving %s on unknown type", $3); multiname_t m = {MULTINAME, 0, &nopackage_namespace_set, $3}; $$.c = abc_getproperty2($$.c, &m); $$.c = abc_coerce_a($$.c); @@ -3757,7 +3761,7 @@ VAR_READ : T_IDENTIFIER { /* let the compiler know that it might want to check the current directory/package for this identifier- maybe there's a file $1.as defining $1. */ - //as3_schedule_class_noerror(state->package, $1); + as3_schedule_class_noerror(state->package, $1); PASS2 $$.t = 0; @@ -3803,7 +3807,7 @@ VAR_READ : T_IDENTIFIER { static properties of a class */ state->method->late_binding = 1; $$.t = f->type; - namespace_t ns = {f->access, ""}; + namespace_t ns = {f->access, f->package}; multiname_t m = {QNAME, &ns, 0, $1}; $$.c = abc_findpropstrict2($$.c, &m); $$.c = abc_getproperty2($$.c, &m); @@ -3813,7 +3817,7 @@ VAR_READ : T_IDENTIFIER { $$.c = abc_getslot($$.c, f->slot); break; } else { - namespace_t ns = {f->access, ""}; + namespace_t ns = {f->access, f->package}; multiname_t m = {QNAME, &ns, 0, $1}; $$.c = abc_getlocal_0($$.c); $$.c = abc_getproperty2($$.c, &m); @@ -3888,9 +3892,16 @@ NAMESPACE_DECLARATION : MAYBE_MODIFIERS NAMESPACE_ID { } USE_NAMESPACE : "use" "namespace" CLASS_SPEC { - + PASS12 const char*url = $3->name; + varinfo_t*s = (varinfo_t*)$3; + if(s->kind == INFOTYPE_UNRESOLVED) { + s = (varinfo_t*)registry_resolve((slotinfo_t*)s); + if(!s) + syntaxerror("Couldn't resolve namespace %s", $3->name); + } + if(!s || s->kind != INFOTYPE_SLOT) 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)) diff --git a/src/as3compile.c b/src/as3compile.c index 89252f5..8810cec 100644 --- a/src/as3compile.c +++ b/src/as3compile.c @@ -53,6 +53,7 @@ static struct options_t options[] = { {"l", "library"}, {"I", "include"}, {"T", "flashversion"}, +{"R", "recurse"}, {"o", "output"}, {0,0} }; @@ -96,14 +97,18 @@ int args_callback_option(char*name,char*val) do_cgi = 1; return 0; } - else if(!strcmp(name, "-l")) { + else if(!strcmp(name, "l")) { as3_import_file(val); return 1; } - else if(!strcmp(name, "-I")) { + else if(!strcmp(name, "I")) { as3_add_include_dir(val); return 1; } + else if(!strcmp(name, "R")) { + as3_set_option("recurse","1"); + return 0; + } else if (!strcmp(name, "N")) { local_with_networking = 1;