char*package;
import_list_t*wildcard_imports;
- namespace_list_t*active_namespaces;
+ dict_t*import_toplevel_packages;
dict_t*imports;
+ namespace_list_t*active_namespaces;
char has_own_imports;
char new_vars; // e.g. transition between two functions
if(!s->imports) {
s->imports = dict_new();
}
+ if(!s->import_toplevel_packages) {
+ s->import_toplevel_packages = dict_new();
+ }
state = s;
state->level++;
state->has_own_imports = 0;
state->imports = dict_clone(state->imports);
state->has_own_imports = 1;
}
+static void import_toplevel(const char*package)
+{
+ char* s = strdup(package);
+ while(1) {
+ dict_put(state->import_toplevel_packages, s, 0);
+ char*x = strrchr(s, '.');
+ if(!x)
+ break;
+ *x = 0;
+ }
+ free(s);
+}
static void state_destroy(state_t*state)
{
}
return ns;
}
+static slotinfo_t* find_class(const char*name);
static void function_initvars(methodstate_t*m, params_t*params, int flags, char var0)
{
that those variable indices are reserved. It's up to the
optimizer to later shuffle the variables down to lower
indices */
- m->variable_count = m->uses_slots;
+ m->variable_count = m->uses_slots;
+ DICT_ITERATE_ITEMS(m->slots, char*, name, variable_t*, v) {
+ if(v->type) {
+ if(v->type->package)
+ v->type = (classinfo_t*)registry_find(v->type->package, v->type->name);
+ else
+ v->type = (classinfo_t*)find_class(v->type->name);
+ if(!v->type || v->type->kind != INFOTYPE_CLASS) {
+ syntaxerror("Couldn't find class %s", v->type->name);
+ }
+ }
+ }
}
if(params) {
if(state->cls) {
syntaxerror("inner classes now allowed");
}
+
new_state();
token_list_t*t=0;
classinfo_list_t*mlist=0;
if((mod->flags&(FLAG_PUBLIC|FLAG_PACKAGEINTERNAL)) == (FLAG_PUBLIC|FLAG_PACKAGEINTERNAL))
syntaxerror("public and internal not supported at the same time.");
+
+ if(!(mod->flags&FLAG_INTERFACE) && !extends) {
+ // all classes extend object
+ extends = registry_getobjectclass();
+ }
/* create the class name, together with the proper attributes */
int access=0;
syntaxerror("Can't extend final class '%s'", extends->name);
/* fill out interfaces and extends (we couldn't resolve those during the first pass) */
- state->cls->info->superclass = extends?extends:TYPE_OBJECT;
+ state->cls->info->superclass = extends;
int pos = 0;
classinfo_list_t*l = implements;
for(l=implements;l;l=l->next) {
char*name = string_cstr(c->data[0]);
syntaxerror("Unresolved \"continue %s\"", name);
}
+ if(c->opcode == OPCODE___PUSHPACKAGE__) {
+ char*name = string_cstr(c->data[0]);
+ syntaxerror("Can't reference a package (%s) as such", name);
+ }
c=c->prev;
}
}
return;
if(m->flags & FLAG_FINAL)
syntaxerror("can't override final member %s", m->name);
+
+ /* allow this. it's no issue.
if((m->flags & FLAG_STATIC) && !(flags&FLAG_STATIC))
- syntaxerror("can't override static member %s", m->name);
+ syntaxerror("can't override static member %s", m->name);*/
+
if(!(m->flags & FLAG_STATIC) && (flags&FLAG_STATIC))
syntaxerror("can't override non-static member %s with static declaration", m->name);
- if(!(flags&FLAG_OVERRIDE)) {
+ if(!(flags&FLAG_OVERRIDE) && !(flags&FLAG_STATIC) && !(m->flags&FLAG_STATIC)) {
if(m->parent && !(m->parent->flags&FLAG_INTERFACE)) {
if(m->kind == INFOTYPE_METHOD)
syntaxerror("can't override without explicit 'override' declaration");
list_append(parent_method->innerfunctions, state->method);
dict_put(global->token2info, (void*)(ptroff_t)as3_tokencount, state->method);
-
+
function_initvars(state->method, params, 0, 1);
}
function_initvars(state->method, 0, 0, 0);
methodstate_list_t*ml = state->method->innerfunctions;
+
dict_t*xvars = dict_new();
+
while(ml) {
methodstate_t*m = ml->methodstate;
parserassert(m->inner);
dictentry_t*l = d->slots[t];
while(l) {
/* check parent method's variables */
- if(find_variable(state, l->key)) {
+ variable_t*v;
+ if((v=find_variable(state, l->key))) {
m->uses_parent_function = 1;
state->method->uses_slots = 1;
dict_put(xvars, l->key, 0);
}
ml = ml->next;
}
+
if(state->method->uses_slots) {
state->method->slots = dict_new();
int i = 1;
state->method->uses_slots = i;
dict_destroy(state->vars);state->vars = 0;
}
- dict_destroy(xvars);
-
old_state();
return 0;
}
check_code_for_break(body);
if(state->method->exceptions &&
- (state->method->late_binding || state->method->uses_slots))
- syntaxerror("try/catch and activation or late binding not supported yet within the same method");
+ (state->method->late_binding || state->method->uses_slots)) {
+ //syntaxerror("try/catch and activation or late binding not supported yet within the same method");
+ as3_warning("try/catch and activation or late binding not supported yet within the same method");
+ }
if(f->body) {
f->body->code = body;
return (c && !c->prev && !c->next && c->opcode == OPCODE_PUSHUNDEFINED);
}
-static slotinfo_t* find_class(char*name)
+static slotinfo_t* find_class(const char*name)
{
slotinfo_t*c=0;
return 0;
}
+typedcode_t push_class(slotinfo_t*a)
+{
+ typedcode_t x;
+ x.c = 0;
+ x.t = 0;
+ if(a->access == ACCESS_PACKAGEINTERNAL &&
+ strcmp(a->package, state->package) &&
+ strcmp(a->package, internal_filename_package)
+ ) {
+ syntaxerror("Can't access internal %s %s in package '%s' from package '%s'",
+ infotypename(a), a->name, a->package, state->package);
+ }
+
+ if(a->kind != INFOTYPE_CLASS) {
+ MULTINAME(m, a);
+ x.c = abc_findpropstrict2(x.c, &m);
+ x.c = abc_getproperty2(x.c, &m);
+ if(a->kind == INFOTYPE_METHOD) {
+ methodinfo_t*f = (methodinfo_t*)a;
+ x.t = TYPE_FUNCTION(f);
+ } else {
+ varinfo_t*v = (varinfo_t*)a;
+ x.t = v->type;
+ }
+ } else {
+ classinfo_t*c = (classinfo_t*)a;
+ if(c->slot) {
+ x.c = abc_getglobalscope(x.c);
+ x.c = abc_getslot(x.c, c->slot);
+ } else {
+ MULTINAME(m, c);
+ x.c = abc_getlex2(x.c, &m);
+ }
+ x.t = TYPE_CLASS(c);
+ }
+ return x;
+}
static char is_getlocal(code_t*c)
{
} else {
prefix = 0;
}
-
+
char use_temp_var = readbefore;
/* generate the write instruction, and maybe append a dup to the prefix code */
write->opcode = OPCODE_SETLOCAL_2;
} else if(r->opcode == OPCODE_GETLOCAL_3) {
write->opcode = OPCODE_SETLOCAL_3;
+ } else if(r->opcode == OPCODE_GETSUPER) {
+ write->opcode = OPCODE_SETSUPER;
+ multiname_t*m = (multiname_t*)r->data[0];
+ write->data[0] = multiname_clone(m);
} else {
code_dump(r);
syntaxerror("illegal lvalue: can't assign a value to this expression");
/* Line 273 of skeleton.m4 */
-#line 1930 "parser.tab.c"
+#line 2016 "parser.tab.c"
#ifdef short
# undef short
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 1907, 1907, 1909, 1909, 1910, 1911, 1913, 1914, 1915,
- 1916, 1917, 1918, 1919, 1920, 1922, 1922, 1923, 1924, 1926,
- 1927, 1928, 1929, 1930, 1931, 1932, 1934, 1935, 1937, 1938,
- 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950,
- 1951, 1952, 1953, 1954, 1957, 1958, 1959, 1960, 1961, 1962,
- 1963, 1964, 1968, 1969, 1973, 1980, 1984, 1985, 1989, 1990,
- 1992, 1993, 1995, 2056, 2057, 2060, 2060, 2079, 2080, 2081,
- 2086, 2090, 2095, 2096, 2098, 2118, 2162, 2162, 2181, 2181,
- 2196, 2199, 2202, 2205, 2209, 2210, 2211, 2212, 2213, 2214,
- 2216, 2227, 2230, 2230, 2259, 2259, 2283, 2283, 2299, 2300,
- 2301, 2302, 2310, 2319, 2319, 2364, 2368, 2379, 2388, 2389,
- 2391, 2392, 2394, 2394, 2396, 2396, 2399, 2414, 2430, 2431,
- 2432, 2433, 2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448,
- 2449, 2450, 2454, 2455, 2457, 2458, 2460, 2461, 2465, 2463,
- 2471, 2469, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485,
- 2487, 2493, 2494, 2495, 2496, 2497, 2498, 2501, 2514, 2514,
- 2516, 2516, 2518, 2519, 2521, 2596, 2597, 2599, 2600, 2601,
- 2602, 2603, 2605, 2606, 2607, 2608, 2617, 2621, 2627, 2633,
- 2641, 2646, 2652, 2660, 2668, 2669, 2670, 2673, 2672, 2689,
- 2690, 2692, 2691, 2715, 2726, 2739, 2740, 2742, 2743, 2745,
- 2746, 2747, 2756, 2757, 2761, 2762, 2764, 2765, 2766, 2768,
- 2772, 2773, 2778, 2779, 2815, 2861, 2882, 2903, 2906, 2913,
- 2914, 2915, 2921, 2927, 2929, 2931, 2933, 2935, 2937, 2939,
- 2956, 2961, 2964, 2967, 2970, 2973, 2976, 2979, 2982, 2985,
- 2989, 2992, 2995, 2998, 3001, 3004, 3007, 3010, 3014, 3025,
- 3043, 3048, 3053, 3058, 3063, 3068, 3072, 3076, 3081, 3085,
- 3089, 3098, 3107, 3117, 3122, 3134, 3140, 3145, 3151, 3157,
- 3161, 3163, 3174, 3183, 3190, 3191, 3193, 3199, 3208, 3215,
- 3227, 3233, 3239, 3245, 3251, 3257, 3263, 3269, 3282, 3293,
- 3300, 3313, 3340, 3354, 3368, 3382, 3397, 3404, 3411, 3418,
- 3425, 3436, 3470, 3591, 3597, 3600, 3603, 3606
+ 0, 1993, 1993, 1995, 1995, 1996, 1997, 1999, 2000, 2001,
+ 2002, 2003, 2004, 2005, 2006, 2008, 2008, 2009, 2010, 2012,
+ 2013, 2014, 2015, 2016, 2017, 2018, 2020, 2021, 2023, 2024,
+ 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036,
+ 2037, 2038, 2039, 2040, 2043, 2044, 2045, 2046, 2047, 2048,
+ 2049, 2050, 2054, 2055, 2059, 2066, 2070, 2071, 2075, 2076,
+ 2078, 2079, 2081, 2142, 2143, 2146, 2146, 2165, 2166, 2167,
+ 2172, 2176, 2181, 2182, 2184, 2204, 2252, 2252, 2271, 2271,
+ 2286, 2289, 2292, 2295, 2299, 2300, 2301, 2302, 2303, 2304,
+ 2306, 2317, 2320, 2320, 2349, 2349, 2373, 2373, 2389, 2390,
+ 2391, 2392, 2400, 2409, 2409, 2454, 2458, 2469, 2478, 2479,
+ 2481, 2482, 2484, 2484, 2486, 2486, 2489, 2505, 2522, 2523,
+ 2524, 2525, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540,
+ 2541, 2542, 2546, 2547, 2549, 2550, 2552, 2553, 2557, 2555,
+ 2563, 2561, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577,
+ 2579, 2585, 2586, 2587, 2588, 2589, 2590, 2593, 2606, 2606,
+ 2608, 2608, 2610, 2611, 2613, 2688, 2689, 2691, 2692, 2693,
+ 2694, 2695, 2697, 2698, 2699, 2700, 2712, 2716, 2722, 2728,
+ 2736, 2741, 2747, 2755, 2763, 2764, 2765, 2768, 2767, 2784,
+ 2785, 2787, 2786, 2810, 2826, 2841, 2842, 2844, 2845, 2847,
+ 2848, 2849, 2858, 2859, 2863, 2864, 2866, 2867, 2868, 2870,
+ 2874, 2875, 2880, 2881, 2917, 2963, 2984, 3005, 3008, 3015,
+ 3016, 3017, 3023, 3029, 3031, 3033, 3035, 3037, 3039, 3041,
+ 3058, 3063, 3066, 3069, 3072, 3075, 3078, 3081, 3084, 3087,
+ 3091, 3094, 3097, 3100, 3103, 3106, 3109, 3112, 3116, 3127,
+ 3145, 3150, 3155, 3160, 3165, 3170, 3174, 3178, 3183, 3187,
+ 3191, 3200, 3209, 3219, 3224, 3236, 3242, 3247, 3253, 3259,
+ 3263, 3265, 3276, 3285, 3292, 3293, 3295, 3301, 3310, 3317,
+ 3329, 3335, 3341, 3347, 3353, 3359, 3365, 3371, 3384, 3395,
+ 3402, 3415, 3442, 3456, 3470, 3484, 3499, 3506, 3513, 3520,
+ 3527, 3538, 3588, 3693, 3699, 3702, 3705, 3708
};
#endif
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1934 "parser.y"
+#line 2020 "parser.y"
{(yyval.code)=(yyvsp[(1) - (1)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1935 "parser.y"
+#line 2021 "parser.y"
{(yyval.code)=code_new();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1937 "parser.y"
+#line 2023 "parser.y"
{(yyval.code)=code_append((yyvsp[(1) - (2)].code),(yyvsp[(2) - (2)].code));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1938 "parser.y"
+#line 2024 "parser.y"
{(yyval.code)=(yyvsp[(1) - (1)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1953 "parser.y"
+#line 2039 "parser.y"
{(yyval.code)=(yyvsp[(2) - (3)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1954 "parser.y"
+#line 2040 "parser.y"
{(yyval.code)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1957 "parser.y"
+#line 2043 "parser.y"
{(yyval.code)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1964 "parser.y"
+#line 2050 "parser.y"
{(yyval.code)=(yyvsp[(3) - (4)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1968 "parser.y"
+#line 2054 "parser.y"
{(yyval.code)=(yyvsp[(1) - (2)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1969 "parser.y"
+#line 2055 "parser.y"
{(yyval.code)=(yyvsp[(1) - (1)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1973 "parser.y"
+#line 2059 "parser.y"
{
code_t**cc = &global->init->method->body->code;
*cc = code_append(*cc, (yyvsp[(1) - (1)].code));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1984 "parser.y"
+#line 2070 "parser.y"
{(yyval.value)=(yyvsp[(2) - (2)].value);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1985 "parser.y"
+#line 2071 "parser.y"
{(yyval.value).c=abc_pushundefined(0);
(yyval.value).t=TYPE_ANY;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1989 "parser.y"
+#line 2075 "parser.y"
{(yyval.code)=(yyvsp[(2) - (2)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1990 "parser.y"
+#line 2076 "parser.y"
{(yyval.code)=(yyvsp[(2) - (2)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1992 "parser.y"
+#line 2078 "parser.y"
{(yyval.code) = (yyvsp[(1) - (1)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1993 "parser.y"
+#line 2079 "parser.y"
{(yyval.code) = code_append((yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 1996 "parser.y"
+#line 2082 "parser.y"
{
PASS12
if(variable_exists((yyvsp[(1) - (3)].id)))
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2056 "parser.y"
+#line 2142 "parser.y"
{(yyval.code) = code_new();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2057 "parser.y"
+#line 2143 "parser.y"
{(yyval.code)=(yyvsp[(2) - (2)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2060 "parser.y"
+#line 2146 "parser.y"
{PASS12 new_state();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2060 "parser.y"
+#line 2146 "parser.y"
{
(yyval.code) = code_new();
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2079 "parser.y"
+#line 2165 "parser.y"
{(yyval.code)=code_new();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2086 "parser.y"
+#line 2172 "parser.y"
{
PASS1 (yyval.id)=(yyvsp[(2) - (3)].id);new_variable((yyvsp[(2) - (3)].id),0,1,0);
PASS2 (yyval.id)=(yyvsp[(2) - (3)].id);new_variable((yyvsp[(2) - (3)].id),(yyvsp[(3) - (3)].classinfo),1,0);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2090 "parser.y"
+#line 2176 "parser.y"
{
PASS12
(yyval.id)=(yyvsp[(1) - (1)].id);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2095 "parser.y"
+#line 2181 "parser.y"
{PASS12 new_state();(yyval.for_start).name=(yyvsp[(1) - (2)].id);(yyval.for_start).each=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2096 "parser.y"
+#line 2182 "parser.y"
{PASS12 new_state();(yyval.for_start).name=(yyvsp[(1) - (3)].id);(yyval.for_start).each=1;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2098 "parser.y"
+#line 2184 "parser.y"
{
if((yyvsp[(1) - (8)].for_start).each) syntaxerror("invalid syntax: ; not allowed in for each statement");
(yyval.code) = code_new();
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2118 "parser.y"
+#line 2204 "parser.y"
{
variable_t*var = find_variable(state, (yyvsp[(2) - (6)].id));
+ if(!var) {
+ syntaxerror("variable %s not known in this scope", (yyvsp[(2) - (6)].id));
+ }
+
char*tmp1name = concat2((yyvsp[(2) - (6)].id), "__tmp1__");
int it = new_variable(tmp1name, TYPE_INT, 0, 0);
char*tmp2name = concat2((yyvsp[(2) - (6)].id), "__array__");
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2162 "parser.y"
+#line 2252 "parser.y"
{PASS12 new_state();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2162 "parser.y"
+#line 2252 "parser.y"
{
(yyval.code) = code_new();
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2181 "parser.y"
+#line 2271 "parser.y"
{PASS12 new_state();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2181 "parser.y"
+#line 2271 "parser.y"
{
(yyval.code) = code_new();
code_t*loopstart = (yyval.code) = abc_label((yyval.code));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2196 "parser.y"
+#line 2286 "parser.y"
{
(yyval.code) = abc___break__(0, "");
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2199 "parser.y"
+#line 2289 "parser.y"
{
(yyval.code) = abc___break__(0, (yyvsp[(2) - (2)].id));
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2202 "parser.y"
+#line 2292 "parser.y"
{
(yyval.code) = abc___continue__(0, "");
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2205 "parser.y"
+#line 2295 "parser.y"
{
(yyval.code) = abc___continue__(0, (yyvsp[(2) - (2)].id));
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2209 "parser.y"
+#line 2299 "parser.y"
{(yyval.code)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2210 "parser.y"
+#line 2300 "parser.y"
{(yyval.code)=(yyvsp[(1) - (1)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2211 "parser.y"
+#line 2301 "parser.y"
{(yyval.code)=(yyvsp[(1) - (1)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2212 "parser.y"
+#line 2302 "parser.y"
{(yyval.code)=code_append((yyvsp[(1) - (2)].code),(yyvsp[(2) - (2)].code));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2213 "parser.y"
+#line 2303 "parser.y"
{(yyval.code)=(yyvsp[(1) - (1)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2214 "parser.y"
+#line 2304 "parser.y"
{(yyval.code)=code_append((yyval.code),(yyvsp[(2) - (2)].code));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2216 "parser.y"
+#line 2306 "parser.y"
{
(yyval.code) = abc_dup(0);
(yyval.code) = code_append((yyval.code), (yyvsp[(2) - (4)].value).c);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2227 "parser.y"
+#line 2317 "parser.y"
{
(yyval.code) = (yyvsp[(3) - (3)].code);
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2230 "parser.y"
+#line 2320 "parser.y"
{PASS12 new_state();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2230 "parser.y"
+#line 2320 "parser.y"
{
(yyval.code)=(yyvsp[(4) - (8)].value).c;
(yyval.code) = code_append((yyval.code), (yyvsp[(7) - (8)].code));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2259 "parser.y"
+#line 2349 "parser.y"
{PASS12 new_state();
state->exception_name=(yyvsp[(3) - (5)].id);
PASS1 new_variable((yyvsp[(3) - (5)].id), 0, 0, 0);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2264 "parser.y"
+#line 2354 "parser.y"
{
namespace_t name_ns = {ACCESS_PACKAGE, ""};
multiname_t name = {QNAME, &name_ns, 0, (yyvsp[(3) - (9)].id)};
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2283 "parser.y"
+#line 2373 "parser.y"
{PASS12 new_state();state->exception_name=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2283 "parser.y"
+#line 2373 "parser.y"
{
(yyvsp[(4) - (5)].code) = var_block((yyvsp[(4) - (5)].code));
if(!(yyvsp[(4) - (5)].code)) {
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2299 "parser.y"
+#line 2389 "parser.y"
{(yyval.catch_list).l=list_new();(yyval.catch_list).finally=0;list_append((yyval.catch_list).l,(yyvsp[(1) - (1)].exception));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2300 "parser.y"
+#line 2390 "parser.y"
{(yyval.catch_list)=(yyvsp[(1) - (2)].catch_list);list_append((yyval.catch_list).l,(yyvsp[(2) - (2)].exception));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2301 "parser.y"
+#line 2391 "parser.y"
{(yyval.catch_list)=(yyvsp[(1) - (1)].catch_list);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2302 "parser.y"
+#line 2392 "parser.y"
{
(yyval.catch_list) = (yyvsp[(1) - (2)].catch_list);
(yyval.catch_list).finally = 0;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2310 "parser.y"
+#line 2400 "parser.y"
{
(yyval.catch_list).l=list_new();
(yyval.catch_list).finally = 0;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2319 "parser.y"
+#line 2409 "parser.y"
{PASS12 new_state();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2319 "parser.y"
+#line 2409 "parser.y"
{
code_t*out = abc_nop(0);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2364 "parser.y"
+#line 2454 "parser.y"
{
(yyval.code)=(yyvsp[(2) - (2)].value).c;
(yyval.code)=abc_throw((yyval.code));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2368 "parser.y"
+#line 2458 "parser.y"
{
if(!state->exception_name)
syntaxerror("re-throw only possible within a catch block");
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2379 "parser.y"
+#line 2469 "parser.y"
{
(yyval.code) = (yyvsp[(3) - (5)].value).c;
(yyval.code) = abc_pushwith((yyval.code));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2389 "parser.y"
+#line 2479 "parser.y"
{PASS12 (yyval.id)="package";}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2391 "parser.y"
+#line 2481 "parser.y"
{PASS12 (yyval.id) = concat3((yyvsp[(1) - (3)].id),".",(yyvsp[(3) - (3)].id));free((yyvsp[(1) - (3)].id));(yyvsp[(1) - (3)].id)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2392 "parser.y"
+#line 2482 "parser.y"
{PASS12 (yyval.id)=strdup((yyvsp[(1) - (1)].id));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2394 "parser.y"
+#line 2484 "parser.y"
{PASS12 startpackage((yyvsp[(2) - (3)].id));free((yyvsp[(2) - (3)].id));(yyvsp[(2) - (3)].id)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2395 "parser.y"
+#line 2485 "parser.y"
{PASS12 endpackage();(yyval.code)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2396 "parser.y"
+#line 2486 "parser.y"
{PASS12 startpackage("");}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2397 "parser.y"
+#line 2487 "parser.y"
{PASS12 endpackage();(yyval.code)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2399 "parser.y"
+#line 2489 "parser.y"
{
PASS12
slotinfo_t*s = registry_find((yyvsp[(2) - (2)].classinfo)->package, (yyvsp[(2) - (2)].classinfo)->name);
- if(!s) {// || !(s->flags&FLAG_BUILTIN)) {
+ if(!s && as3_pass==1) {// || !(s->flags&FLAG_BUILTIN)) {
as3_schedule_class((yyvsp[(2) - (2)].classinfo)->package, (yyvsp[(2) - (2)].classinfo)->name);
}
syntaxerror("Couldn't import class\n");
state_has_imports();
dict_put(state->imports, c->name, c);
+ import_toplevel(c->package);
(yyval.code)=0;
}
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2414 "parser.y"
+#line 2505 "parser.y"
{
PASS12
- if(strncmp("flash.", (yyvsp[(2) - (4)].id), 6)) {
+ if(strncmp("flash.", (yyvsp[(2) - (4)].id), 6) && as3_pass==1) {
as3_schedule_package((yyvsp[(2) - (4)].id));
}
i->package = (yyvsp[(2) - (4)].id);
state_has_imports();
list_append(state->wildcard_imports, i);
+ import_toplevel(i->package);
(yyval.code)=0;
}
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2430 "parser.y"
+#line 2522 "parser.y"
{PASS12 (yyval.flags).flags=0;(yyval.flags).ns=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2431 "parser.y"
+#line 2523 "parser.y"
{PASS12 (yyval.flags)=(yyvsp[(1) - (1)].flags);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2432 "parser.y"
+#line 2524 "parser.y"
{PASS12 (yyval.flags)=(yyvsp[(1) - (1)].flags);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2433 "parser.y"
+#line 2525 "parser.y"
{
PASS12
(yyval.flags).flags=(yyvsp[(1) - (2)].flags).flags|(yyvsp[(2) - (2)].flags).flags;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2441 "parser.y"
+#line 2533 "parser.y"
{PASS12 (yyval.flags).flags=FLAG_PUBLIC;(yyval.flags).ns=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2442 "parser.y"
+#line 2534 "parser.y"
{PASS12 (yyval.flags).flags=FLAG_PRIVATE;(yyval.flags).ns=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2443 "parser.y"
+#line 2535 "parser.y"
{PASS12 (yyval.flags).flags=FLAG_PROTECTED;(yyval.flags).ns=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2444 "parser.y"
+#line 2536 "parser.y"
{PASS12 (yyval.flags).flags=FLAG_STATIC;(yyval.flags).ns=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2445 "parser.y"
+#line 2537 "parser.y"
{PASS12 (yyval.flags).flags=FLAG_DYNAMIC;(yyval.flags).ns=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2446 "parser.y"
+#line 2538 "parser.y"
{PASS12 (yyval.flags).flags=FLAG_FINAL;(yyval.flags).ns=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2447 "parser.y"
+#line 2539 "parser.y"
{PASS12 (yyval.flags).flags=FLAG_OVERRIDE;(yyval.flags).ns=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2448 "parser.y"
+#line 2540 "parser.y"
{PASS12 (yyval.flags).flags=FLAG_NATIVE;(yyval.flags).ns=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2449 "parser.y"
+#line 2541 "parser.y"
{PASS12 (yyval.flags).flags=FLAG_PACKAGEINTERNAL;(yyval.flags).ns=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2450 "parser.y"
+#line 2542 "parser.y"
{PASS12 (yyval.flags).flags=FLAG_NAMESPACE;
(yyval.flags).ns=(yyvsp[(1) - (1)].id);
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2454 "parser.y"
- {(yyval.classinfo)=registry_getobjectclass();}
+#line 2546 "parser.y"
+ {(yyval.classinfo)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2455 "parser.y"
+#line 2547 "parser.y"
{(yyval.classinfo)=(yyvsp[(2) - (2)].classinfo);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2457 "parser.y"
+#line 2549 "parser.y"
{PASS12 (yyval.classinfo_list)=list_new();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2458 "parser.y"
+#line 2550 "parser.y"
{PASS12 (yyval.classinfo_list)=(yyvsp[(2) - (2)].classinfo_list);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2460 "parser.y"
+#line 2552 "parser.y"
{PASS12 (yyval.classinfo_list)=list_new();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2461 "parser.y"
+#line 2553 "parser.y"
{PASS12 (yyval.classinfo_list)=(yyvsp[(2) - (2)].classinfo_list);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2465 "parser.y"
+#line 2557 "parser.y"
{PASS12 startclass(&(yyvsp[(1) - (6)].flags),(yyvsp[(3) - (6)].id),(yyvsp[(4) - (6)].classinfo),(yyvsp[(5) - (6)].classinfo_list));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2467 "parser.y"
+#line 2559 "parser.y"
{PASS12 endclass();(yyval.code)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2471 "parser.y"
+#line 2563 "parser.y"
{PASS12 (yyvsp[(1) - (5)].flags).flags|=FLAG_INTERFACE;
startclass(&(yyvsp[(1) - (5)].flags),(yyvsp[(3) - (5)].id),0,(yyvsp[(4) - (5)].classinfo_list));}
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2474 "parser.y"
+#line 2566 "parser.y"
{PASS12 endclass();(yyval.code)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2487 "parser.y"
+#line 2579 "parser.y"
{
code_t*c = state->cls->static_init->header;
c = code_append(c, (yyvsp[(1) - (1)].code));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2498 "parser.y"
+#line 2590 "parser.y"
{
syntaxerror("variable declarations not allowed in interfaces");
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2501 "parser.y"
+#line 2593 "parser.y"
{
PASS12
(yyvsp[(1) - (8)].flags).flags |= FLAG_PUBLIC;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2516 "parser.y"
+#line 2608 "parser.y"
{setslotstate(&(yyvsp[(1) - (2)].flags),(yyvsp[(2) - (2)].token));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2516 "parser.y"
+#line 2608 "parser.y"
{(yyval.code)=(yyvsp[(4) - (4)].code);setslotstate(0, 0);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2518 "parser.y"
+#line 2610 "parser.y"
{(yyval.code) = (yyvsp[(1) - (1)].code);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2519 "parser.y"
+#line 2611 "parser.y"
{(yyval.code) = code_append((yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2522 "parser.y"
+#line 2614 "parser.y"
{
int flags = slotstate_flags->flags;
namespace_t ns = modifiers2access(slotstate_flags);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2596 "parser.y"
+#line 2688 "parser.y"
{(yyval.constant)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2597 "parser.y"
+#line 2689 "parser.y"
{(yyval.constant)=(yyvsp[(2) - (2)].constant);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2599 "parser.y"
+#line 2691 "parser.y"
{(yyval.constant) = constant_new_int((yyvsp[(1) - (1)].number_uint));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2600 "parser.y"
+#line 2692 "parser.y"
{(yyval.constant) = constant_new_int((yyvsp[(1) - (1)].number_int));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2601 "parser.y"
+#line 2693 "parser.y"
{(yyval.constant) = constant_new_uint((yyvsp[(1) - (1)].number_uint));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2602 "parser.y"
+#line 2694 "parser.y"
{(yyval.constant) = constant_new_float((yyvsp[(1) - (1)].number_float));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2603 "parser.y"
+#line 2695 "parser.y"
{(yyval.constant) = constant_new_string2((yyvsp[(1) - (1)].str).str,(yyvsp[(1) - (1)].str).len);free((char*)(yyvsp[(1) - (1)].str).str);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2605 "parser.y"
+#line 2697 "parser.y"
{(yyval.constant) = constant_new_true((yyvsp[(1) - (1)].token));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2606 "parser.y"
+#line 2698 "parser.y"
{(yyval.constant) = constant_new_false((yyvsp[(1) - (1)].token));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2607 "parser.y"
+#line 2699 "parser.y"
{(yyval.constant) = constant_new_null((yyvsp[(1) - (1)].token));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2608 "parser.y"
+#line 2700 "parser.y"
{
- // TODO
- as3_warning("Couldn't evaluate constant value of %s", (yyvsp[(1) - (1)].id));
- (yyval.constant) = constant_new_null((yyvsp[(1) - (1)].id));
+ if(!strcmp((yyvsp[(1) - (1)].id), "NaN")) {
+ (yyval.constant) = constant_new_float(__builtin_nan(""));
+ } else {
+ as3_warning("Couldn't evaluate constant value of %s", (yyvsp[(1) - (1)].id));
+ (yyval.constant) = constant_new_null((yyvsp[(1) - (1)].id));
+ }
}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2617 "parser.y"
+#line 2712 "parser.y"
{
PASS12
memset(&(yyval.params),0,sizeof((yyval.params)));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2621 "parser.y"
+#line 2716 "parser.y"
{
PASS12
(yyval.params)=(yyvsp[(1) - (1)].params);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2627 "parser.y"
+#line 2722 "parser.y"
{
PASS12
memset(&(yyval.params),0,sizeof((yyval.params)));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2633 "parser.y"
+#line 2728 "parser.y"
{
PASS12
(yyval.params) =(yyvsp[(1) - (4)].params);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2641 "parser.y"
+#line 2736 "parser.y"
{
PASS12
(yyval.params) = (yyvsp[(1) - (3)].params);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2646 "parser.y"
+#line 2741 "parser.y"
{
PASS12
memset(&(yyval.params),0,sizeof((yyval.params)));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2652 "parser.y"
+#line 2747 "parser.y"
{
PASS12
(yyval.param) = rfx_calloc(sizeof(param_t));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2660 "parser.y"
+#line 2755 "parser.y"
{
PASS12
(yyval.param) = rfx_calloc(sizeof(param_t));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2670 "parser.y"
+#line 2765 "parser.y"
{PASS12 (yyval.token)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2673 "parser.y"
+#line 2768 "parser.y"
{PASS12 startfunction(&(yyvsp[(1) - (9)].flags),(yyvsp[(3) - (9)].token),(yyvsp[(4) - (9)].id),&(yyvsp[(6) - (9)].params),(yyvsp[(8) - (9)].classinfo));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2674 "parser.y"
+#line 2769 "parser.y"
{
PASS1
endfunction(&(yyvsp[(1) - (12)].flags),(yyvsp[(3) - (12)].token),(yyvsp[(4) - (12)].id),&(yyvsp[(6) - (12)].params),0,0);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2690 "parser.y"
+#line 2785 "parser.y"
{PASS12 (yyval.id)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2692 "parser.y"
+#line 2787 "parser.y"
{PASS12 innerfunction((yyvsp[(2) - (7)].id),&(yyvsp[(4) - (7)].params),(yyvsp[(6) - (7)].classinfo));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2693 "parser.y"
+#line 2788 "parser.y"
{
PASS1
endfunction(0,0,(yyvsp[(2) - (10)].id),&(yyvsp[(4) - (10)].params),0,0);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2715 "parser.y"
+#line 2810 "parser.y"
{
- PASS1 static slotinfo_t c;
+ PASS1 static classinfo_t c;
memset(&c, 0, sizeof(c));
+ c.kind = INFOTYPE_CLASS;
+ c.subtype = 255;
c.name = (yyvsp[(1) - (1)].id);
- (yyval.classinfo) = (classinfo_t*)&c;
+ (yyval.classinfo) = &c;
+
+ /* let the compiler know that we might be looking for this soon */
+ as3_schedule_class_noerror(state->package, (yyvsp[(1) - (1)].id));
PASS2
slotinfo_t*s = find_class((yyvsp[(1) - (1)].id));
if(!s) syntaxerror("Could not find class/method %s (current package: %s)\n", (yyvsp[(1) - (1)].id), state->package);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2726 "parser.y"
+#line 2826 "parser.y"
{
- PASS1 static slotinfo_t c;
+ PASS1 static classinfo_t c;
memset(&c, 0, sizeof(c));
+ c.kind = INFOTYPE_CLASS;
+ c.subtype = 255;
c.package = (yyvsp[(1) - (3)].id);
c.name = (yyvsp[(3) - (3)].id);
- (yyval.classinfo)=(classinfo_t*)&c;
+ (yyval.classinfo) = &c;
PASS2
slotinfo_t*s = registry_find((yyvsp[(1) - (3)].id), (yyvsp[(3) - (3)].id));
if(!s) syntaxerror("Couldn't find class/method %s.%s\n", (yyvsp[(1) - (3)].id), (yyvsp[(3) - (3)].id));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2742 "parser.y"
+#line 2844 "parser.y"
{PASS12 (yyval.classinfo_list)=list_new();list_append((yyval.classinfo_list), (yyvsp[(1) - (1)].classinfo));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2743 "parser.y"
+#line 2845 "parser.y"
{PASS12 (yyval.classinfo_list)=(yyvsp[(1) - (3)].classinfo_list);list_append((yyval.classinfo_list),(yyvsp[(3) - (3)].classinfo));}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2745 "parser.y"
+#line 2847 "parser.y"
{PASS12 (yyval.classinfo)=(yyvsp[(1) - (1)].classinfo);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2746 "parser.y"
+#line 2848 "parser.y"
{PASS12 (yyval.classinfo)=registry_getanytype();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2747 "parser.y"
+#line 2849 "parser.y"
{PASS12 (yyval.classinfo)=registry_getanytype();}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2756 "parser.y"
+#line 2858 "parser.y"
{PASS12 (yyval.classinfo)=(yyvsp[(2) - (2)].classinfo);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2757 "parser.y"
+#line 2859 "parser.y"
{PASS12 (yyval.classinfo)=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2761 "parser.y"
+#line 2863 "parser.y"
{(yyval.value_list).cc=0;(yyval.value_list).len=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2762 "parser.y"
+#line 2864 "parser.y"
{(yyval.value_list)=(yyvsp[(2) - (3)].value_list);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2764 "parser.y"
+#line 2866 "parser.y"
{(yyval.value_list).cc=0;(yyval.value_list).len=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2768 "parser.y"
+#line 2870 "parser.y"
{(yyval.value_list).len=1;
(yyval.value_list).cc = (yyvsp[(1) - (1)].value).c;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2772 "parser.y"
+#line 2874 "parser.y"
{(yyval.value_list) = (yyvsp[(1) - (2)].value_list);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2773 "parser.y"
+#line 2875 "parser.y"
{
(yyval.value_list).len= (yyvsp[(1) - (2)].value_list).len+1;
(yyval.value_list).cc = code_append((yyvsp[(1) - (2)].value_list).cc, (yyvsp[(2) - (2)].value).c);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2779 "parser.y"
+#line 2881 "parser.y"
{
(yyval.value).c = (yyvsp[(2) - (4)].value).c;
if((yyval.value).c->opcode == OPCODE_COERCE_A) (yyval.value).c = code_cutlast((yyval.value).c);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2815 "parser.y"
+#line 2917 "parser.y"
{
(yyval.value).c = (yyvsp[(1) - (4)].value).c;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2861 "parser.y"
+#line 2963 "parser.y"
{
if(!state->cls) syntaxerror("super() not allowed outside of a class");
if(!state->method) syntaxerror("super() not allowed outside of a function");
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2882 "parser.y"
+#line 2984 "parser.y"
{
(yyval.value).c = (yyvsp[(2) - (2)].value).c;
if((yyval.value).c->opcode == OPCODE_COERCE_A) {
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2903 "parser.y"
+#line 3005 "parser.y"
{
(yyval.code) = abc_returnvoid(0);
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2906 "parser.y"
+#line 3008 "parser.y"
{
(yyval.code) = (yyvsp[(2) - (2)].value).c;
(yyval.code) = abc_returnvalue((yyval.code));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2913 "parser.y"
+#line 3015 "parser.y"
{(yyval.value)=(yyvsp[(1) - (1)].value);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2914 "parser.y"
+#line 3016 "parser.y"
{(yyval.value) = (yyvsp[(1) - (1)].value);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2915 "parser.y"
+#line 3017 "parser.y"
{
(yyval.value).c = (yyvsp[(1) - (3)].value).c;
(yyval.value).c = cut_last_push((yyval.value).c);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2921 "parser.y"
+#line 3023 "parser.y"
{
(yyval.code)=cut_last_push((yyvsp[(1) - (1)].value).c);
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2927 "parser.y"
+#line 3029 "parser.y"
{(yyval.value) = (yyvsp[(1) - (1)].value);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2931 "parser.y"
+#line 3033 "parser.y"
{(yyval.value) = (yyvsp[(1) - (1)].value);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2933 "parser.y"
+#line 3035 "parser.y"
{(yyval.value) = (yyvsp[(1) - (1)].value);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2935 "parser.y"
+#line 3037 "parser.y"
{(yyval.value) = (yyvsp[(1) - (1)].value);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2939 "parser.y"
+#line 3041 "parser.y"
{
(yyval.value).c = 0;
namespace_t ns = {ACCESS_PACKAGE, ""};
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2956 "parser.y"
+#line 3058 "parser.y"
{(yyval.value).c = abc_pushbyte(0, (yyvsp[(1) - (1)].number_uint));
//MULTINAME(m, registry_getintclass());
//$$.c = abc_coerce2($$.c, &m); // FIXME
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2961 "parser.y"
+#line 3063 "parser.y"
{(yyval.value).c = abc_pushshort(0, (yyvsp[(1) - (1)].number_uint));
(yyval.value).t = TYPE_INT;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2964 "parser.y"
+#line 3066 "parser.y"
{(yyval.value).c = abc_pushint(0, (yyvsp[(1) - (1)].number_int));
(yyval.value).t = TYPE_INT;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2967 "parser.y"
+#line 3069 "parser.y"
{(yyval.value).c = abc_pushuint(0, (yyvsp[(1) - (1)].number_uint));
(yyval.value).t = TYPE_UINT;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2970 "parser.y"
+#line 3072 "parser.y"
{(yyval.value).c = abc_pushdouble(0, (yyvsp[(1) - (1)].number_float));
(yyval.value).t = TYPE_FLOAT;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2973 "parser.y"
+#line 3075 "parser.y"
{(yyval.value).c = abc_pushstring2(0, &(yyvsp[(1) - (1)].str));free((char*)(yyvsp[(1) - (1)].str).str);
(yyval.value).t = TYPE_STRING;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2976 "parser.y"
+#line 3078 "parser.y"
{(yyval.value).c = abc_pushundefined(0);
(yyval.value).t = TYPE_ANY;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2979 "parser.y"
+#line 3081 "parser.y"
{(yyval.value).c = abc_pushtrue(0);
(yyval.value).t = TYPE_BOOLEAN;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2982 "parser.y"
+#line 3084 "parser.y"
{(yyval.value).c = abc_pushfalse(0);
(yyval.value).t = TYPE_BOOLEAN;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2985 "parser.y"
+#line 3087 "parser.y"
{(yyval.value).c = abc_pushnull(0);
(yyval.value).t = TYPE_NULL;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2989 "parser.y"
+#line 3091 "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;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2992 "parser.y"
+#line 3094 "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;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2995 "parser.y"
+#line 3097 "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;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 2998 "parser.y"
+#line 3100 "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;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3001 "parser.y"
+#line 3103 "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;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3004 "parser.y"
+#line 3106 "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;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3007 "parser.y"
+#line 3109 "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;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3010 "parser.y"
+#line 3112 "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;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3014 "parser.y"
+#line 3116 "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);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3025 "parser.y"
+#line 3127 "parser.y"
{
(yyval.value).t = join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, 'A');
/*printf("%08x:\n",$1.t);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3043 "parser.y"
+#line 3145 "parser.y"
{(yyval.value).c=(yyvsp[(2) - (2)].value).c;
(yyval.value).c = abc_not((yyval.value).c);
(yyval.value).t = TYPE_BOOLEAN;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3048 "parser.y"
+#line 3150 "parser.y"
{(yyval.value).c=(yyvsp[(2) - (2)].value).c;
(yyval.value).c = abc_bitnot((yyval.value).c);
(yyval.value).t = TYPE_INT;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3053 "parser.y"
+#line 3155 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3058 "parser.y"
+#line 3160 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3063 "parser.y"
+#line 3165 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3068 "parser.y"
+#line 3170 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3072 "parser.y"
+#line 3174 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3076 "parser.y"
+#line 3178 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3081 "parser.y"
+#line 3183 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3085 "parser.y"
+#line 3187 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3089 "parser.y"
+#line 3191 "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);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3098 "parser.y"
+#line 3200 "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);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3107 "parser.y"
+#line 3209 "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);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3117 "parser.y"
+#line 3219 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3122 "parser.y"
+#line 3224 "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));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3135 "parser.y"
+#line 3237 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3140 "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_istypelate((yyval.value).c);
(yyval.value).t = TYPE_BOOLEAN;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3145 "parser.y"
+#line 3247 "parser.y"
{
(yyval.value).c = (yyvsp[(3) - (4)].value).c;
(yyval.value).c = abc_typeof((yyval.value).c);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3151 "parser.y"
+#line 3253 "parser.y"
{
(yyval.value).c = cut_last_push((yyvsp[(2) - (2)].value).c);
(yyval.value).c = abc_pushundefined((yyval.value).c);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3157 "parser.y"
+#line 3259 "parser.y"
{ (yyval.value).c = abc_pushundefined(0);
(yyval.value).t = TYPE_ANY;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3161 "parser.y"
+#line 3263 "parser.y"
{(yyval.value)=(yyvsp[(2) - (3)].value);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3163 "parser.y"
+#line 3265 "parser.y"
{
(yyval.value)=(yyvsp[(2) - (2)].value);
if(IS_INT((yyvsp[(2) - (2)].value).t)) {
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3174 "parser.y"
+#line 3276 "parser.y"
{
(yyval.value).c = (yyvsp[(1) - (4)].value).c;
(yyval.value).c = code_append((yyval.value).c, (yyvsp[(3) - (4)].value).c);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3183 "parser.y"
+#line 3285 "parser.y"
{
(yyval.value).c = code_new();
(yyval.value).c = code_append((yyval.value).c, (yyvsp[(2) - (3)].value_list).cc);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3190 "parser.y"
+#line 3292 "parser.y"
{(yyval.value_list).cc=0;(yyval.value_list).len=0;}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3191 "parser.y"
+#line 3293 "parser.y"
{(yyval.value_list)=(yyvsp[(1) - (1)].value_list);}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3193 "parser.y"
+#line 3295 "parser.y"
{
(yyval.value_list).cc = 0;
(yyval.value_list).cc = code_append((yyval.value_list).cc, (yyvsp[(1) - (3)].value).c);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3199 "parser.y"
+#line 3301 "parser.y"
{
(yyval.value_list).cc = (yyvsp[(1) - (5)].value_list).cc;
(yyval.value_list).len = (yyvsp[(1) - (5)].value_list).len+2;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3208 "parser.y"
+#line 3310 "parser.y"
{
(yyval.value).c = code_new();
(yyval.value).c = code_append((yyval.value).c, (yyvsp[(2) - (3)].value_list).cc);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3215 "parser.y"
+#line 3317 "parser.y"
{
code_t*c = (yyvsp[(3) - (3)].value).c;
if(BOTH_INT((yyvsp[(1) - (3)].value).t,(yyvsp[(3) - (3)].value).t)) {
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3227 "parser.y"
+#line 3329 "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);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3233 "parser.y"
+#line 3335 "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);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3239 "parser.y"
+#line 3341 "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);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3245 "parser.y"
+#line 3347 "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);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3251 "parser.y"
+#line 3353 "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);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3257 "parser.y"
+#line 3359 "parser.y"
{
code_t*c = abc_bitor((yyvsp[(3) - (3)].value).c);
c=converttype(c, TYPE_INT, (yyvsp[(1) - (3)].value).t);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3263 "parser.y"
+#line 3365 "parser.y"
{
code_t*c = abc_bitxor((yyvsp[(3) - (3)].value).c);
c=converttype(c, TYPE_INT, (yyvsp[(1) - (3)].value).t);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3269 "parser.y"
+#line 3371 "parser.y"
{
code_t*c = (yyvsp[(3) - (3)].value).c;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3282 "parser.y"
+#line 3384 "parser.y"
{ code_t*c = (yyvsp[(3) - (3)].value).c;
if(TYPE_IS_INT((yyvsp[(1) - (3)].value).t)) {
c=abc_subtract_i(c);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3293 "parser.y"
+#line 3395 "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);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3300 "parser.y"
+#line 3402 "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;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3313 "parser.y"
+#line 3415 "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)) {
+ if(is_getlocal((yyvsp[(1) - (2)].value).c) && (TYPE_IS_INT((yyvsp[(1) - (2)].value).t) || TYPE_IS_NUMBER((yyvsp[(1) - (2)].value).t))) {
int nr = getlocalnr((yyvsp[(1) - (2)].value).c);
code_free((yyvsp[(1) - (2)].value).c);(yyvsp[(1) - (2)].value).c=0;
if(TYPE_IS_INT((yyvsp[(1) - (2)].value).t)) {
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3340 "parser.y"
+#line 3442 "parser.y"
{ code_t*c = 0;
classinfo_t*type = (yyvsp[(1) - (2)].value).t;
if(TYPE_IS_INT(type) || TYPE_IS_UINT(type)) {
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3354 "parser.y"
+#line 3456 "parser.y"
{ code_t*c = 0;
classinfo_t*type = (yyvsp[(2) - (2)].value).t;
if(TYPE_IS_INT(type) || TYPE_IS_UINT(type)) {
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3368 "parser.y"
+#line 3470 "parser.y"
{ code_t*c = 0;
classinfo_t*type = (yyvsp[(2) - (2)].value).t;
if(TYPE_IS_INT(type) || TYPE_IS_UINT(type)) {
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3383 "parser.y"
+#line 3485 "parser.y"
{ if(!state->cls->info)
syntaxerror("super keyword not allowed outside a class");
classinfo_t*t = state->cls->info->superclass;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3397 "parser.y"
+#line 3499 "parser.y"
{
// attribute TODO
(yyval.value).c = abc_pushundefined(0);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3404 "parser.y"
+#line 3506 "parser.y"
{
// child attribute TODO
(yyval.value).c = abc_pushundefined(0);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3411 "parser.y"
+#line 3513 "parser.y"
{
// namespace declaration TODO
(yyval.value).c = abc_pushundefined(0);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3418 "parser.y"
+#line 3520 "parser.y"
{
// descendants TODO
(yyval.value).c = abc_pushundefined(0);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3425 "parser.y"
+#line 3527 "parser.y"
{
// filter TODO
(yyval.value).c = abc_pushundefined(0);
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3437 "parser.y"
- {(yyval.value).c = (yyvsp[(1) - (3)].value).c;
- classinfo_t*t = (yyvsp[(1) - (3)].value).t;
- char is_static = 0;
- if(TYPE_IS_CLASS(t) && t->data) {
- t = t->data;
- is_static = 1;
- }
- if(t) {
- memberinfo_t*f = registry_findmember_nsset(t, state->active_namespaces, (yyvsp[(3) - (3)].id), 1);
- char noslot = 0;
- if(f && !is_static != !(f->flags&FLAG_STATIC))
- noslot=1;
- if(f && f->slot && !noslot) {
- (yyval.value).c = abc_getslot((yyval.value).c, f->slot);
- } else {
- MEMBER_MULTINAME(m, f, (yyvsp[(3) - (3)].id));
- (yyval.value).c = abc_getproperty2((yyval.value).c, &m);
- }
- /* determine type */
- (yyval.value).t = slotinfo_gettype((slotinfo_t*)f);
- if(!(yyval.value).t)
- (yyval.value).c = abc_coerce_a((yyval.value).c);
- } else {
- /* 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 */
- 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);
- (yyval.value).t = registry_getanytype();
- }
- }
+#line 3538 "parser.y"
+ {
+ (yyval.value).c = (yyvsp[(1) - (3)].value).c;
+ classinfo_t*t = (yyvsp[(1) - (3)].value).t;
+ char is_static = 0;
+ if(TYPE_IS_CLASS(t) && t->data) {
+ t = t->data;
+ is_static = 1;
+ }
+ if(t) {
+ if(t->subtype==0xff) {
+ syntaxerror("syntaxerror: trying to resolve property '%s' on incomplete object '%s'", (yyvsp[(3) - (3)].id), t->name);
+ }
+ memberinfo_t*f = registry_findmember_nsset(t, state->active_namespaces, (yyvsp[(3) - (3)].id), 1);
+ char noslot = 0;
+ if(f && !is_static != !(f->flags&FLAG_STATIC))
+ noslot=1;
+ if(f && f->slot && !noslot) {
+ (yyval.value).c = abc_getslot((yyval.value).c, f->slot);
+ } else {
+ MEMBER_MULTINAME(m, f, (yyvsp[(3) - (3)].id));
+ (yyval.value).c = abc_getproperty2((yyval.value).c, &m);
+ }
+ /* determine type */
+ (yyval.value).t = slotinfo_gettype((slotinfo_t*)f);
+ if(!(yyval.value).t)
+ (yyval.value).c = abc_coerce_a((yyval.value).c);
+ } else if((yyvsp[(1) - (3)].value).c && (yyvsp[(1) - (3)].value).c->opcode == OPCODE___PUSHPACKAGE__) {
+ string_t*package = (yyvsp[(1) - (3)].value).c->data[0];
+ char*package2 = concat3(package->str, ".", (yyvsp[(3) - (3)].id));
+ if(dict_contains(state->import_toplevel_packages, package2)) {
+ (yyval.value).c = (yyvsp[(1) - (3)].value).c;
+ (yyval.value).c->data[0] = string_new4(package2);
+ (yyval.value).t = 0;
+ } else {
+ slotinfo_t*a = registry_find(package->str, (yyvsp[(3) - (3)].id));
+ if(!a)
+ syntaxerror("couldn't resolve %s", package2);
+ (yyval.value) = push_class(a);
+ }
+ } else {
+ /* 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 */
+ 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);
+ (yyval.value).t = registry_getanytype();
+ }
+}
}
break;
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3470 "parser.y"
+#line 3588 "parser.y"
{
PASS1
/* Queue unresolved identifiers for checking against the parent
function's variables.
We consider everything which is not a local variable "unresolved".
This encompasses class names, members of the surrounding class
- etc. which *correct* because local variables of the parent function
+ etc. which is *correct* because local variables of the parent function
would shadow those.
*/
if(state->method->inner && !find_variable(state, (yyvsp[(1) - (1)].id))) {
unknown_variable((yyvsp[(1) - (1)].id));
}
+
+ /* let the compiler know that it might check the current directory/package
+ for this identifier- maybe there's a file $1.as defining $1. */
+ as3_schedule_class_noerror(state->package, (yyvsp[(1) - (1)].id));
PASS2
(yyval.value).t = 0;
/* look at actual classes, in the current package and imported */
if((a = find_class((yyvsp[(1) - (1)].id)))) {
- if(a->access == ACCESS_PACKAGEINTERNAL &&
- strcmp(a->package, state->package) &&
- strcmp(a->package, internal_filename_package)
- )
- syntaxerror("Can't access internal %s %s in package '%s' from package '%s'",
- infotypename(a),(yyvsp[(1) - (1)].id), a->package, state->package);
-
- if(a->kind != INFOTYPE_CLASS) {
- MULTINAME(m, a);
- (yyval.value).c = abc_findpropstrict2((yyval.value).c, &m);
- (yyval.value).c = abc_getproperty2((yyval.value).c, &m);
- if(a->kind == INFOTYPE_METHOD) {
- methodinfo_t*f = (methodinfo_t*)a;
- (yyval.value).t = TYPE_FUNCTION(f);
- } else {
- varinfo_t*v = (varinfo_t*)a;
- (yyval.value).t = v->type;
- }
- } else {
- classinfo_t*c = (classinfo_t*)a;
- if(c->slot) {
- (yyval.value).c = abc_getglobalscope((yyval.value).c);
- (yyval.value).c = abc_getslot((yyval.value).c, c->slot);
- } else {
- MULTINAME(m, c);
- (yyval.value).c = abc_getlex2((yyval.value).c, &m);
- }
- (yyval.value).t = TYPE_CLASS(c);
- }
+ (yyval.value) = push_class(a);
+ break;
+ }
+
+ /* look through package prefixes */
+ if(dict_contains(state->import_toplevel_packages, (yyvsp[(1) - (1)].id))) {
+ (yyval.value).c = abc___pushpackage__((yyval.value).c, (yyvsp[(1) - (1)].id));
+ (yyval.value).t = 0;
break;
}
/* unknown object, let the avm2 resolve it */
if(1) {
- as3_softwarning("Couldn't resolve '%s', doing late binding", (yyvsp[(1) - (1)].id));
+ //as3_softwarning("Couldn't resolve '%s', doing late binding", $1);
+ as3_warning("Couldn't resolve '%s', doing late binding", (yyvsp[(1) - (1)].id));
state->method->late_binding = 1;
multiname_t m = {MULTINAME, 0, &nopackage_namespace_set, (yyvsp[(1) - (1)].id)};
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3591 "parser.y"
+#line 3693 "parser.y"
{
PASS12
tokenizer_register_namespace((yyvsp[(2) - (2)].id));
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3597 "parser.y"
+#line 3699 "parser.y"
{
(yyval.code)=0;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3600 "parser.y"
+#line 3702 "parser.y"
{
(yyval.code)=0;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3603 "parser.y"
+#line 3705 "parser.y"
{
(yyval.code)=0;
}
if(as3_pass==2) {
/* Line 1464 of skeleton.m4 */
-#line 3606 "parser.y"
+#line 3708 "parser.y"
{
PASS12
tokenizer_register_namespace((yyvsp[(3) - (3)].classinfo)->name);
/* Line 1464 of skeleton.m4 */
-#line 7956 "parser.tab.c"
+#line 8059 "parser.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
char*package;
import_list_t*wildcard_imports;
- namespace_list_t*active_namespaces;
+ dict_t*import_toplevel_packages;
dict_t*imports;
+ namespace_list_t*active_namespaces;
char has_own_imports;
char new_vars; // e.g. transition between two functions
if(!s->imports) {
s->imports = dict_new();
}
+ if(!s->import_toplevel_packages) {
+ s->import_toplevel_packages = dict_new();
+ }
state = s;
state->level++;
state->has_own_imports = 0;
state->imports = dict_clone(state->imports);
state->has_own_imports = 1;
}
+static void import_toplevel(const char*package)
+{
+ char* s = strdup(package);
+ while(1) {
+ dict_put(state->import_toplevel_packages, s, 0);
+ char*x = strrchr(s, '.');
+ if(!x)
+ break;
+ *x = 0;
+ }
+ free(s);
+}
static void state_destroy(state_t*state)
{
}
return ns;
}
+static slotinfo_t* find_class(const char*name);
static void function_initvars(methodstate_t*m, params_t*params, int flags, char var0)
{
that those variable indices are reserved. It's up to the
optimizer to later shuffle the variables down to lower
indices */
- m->variable_count = m->uses_slots;
+ m->variable_count = m->uses_slots;
+ DICT_ITERATE_ITEMS(m->slots, char*, name, variable_t*, v) {
+ if(v->type) {
+ if(v->type->package)
+ v->type = (classinfo_t*)registry_find(v->type->package, v->type->name);
+ else
+ v->type = (classinfo_t*)find_class(v->type->name);
+ if(!v->type || v->type->kind != INFOTYPE_CLASS) {
+ syntaxerror("Couldn't find class %s", v->type->name);
+ }
+ }
+ }
}
if(params) {
if(state->cls) {
syntaxerror("inner classes now allowed");
}
+
new_state();
token_list_t*t=0;
classinfo_list_t*mlist=0;
if((mod->flags&(FLAG_PUBLIC|FLAG_PACKAGEINTERNAL)) == (FLAG_PUBLIC|FLAG_PACKAGEINTERNAL))
syntaxerror("public and internal not supported at the same time.");
+
+ if(!(mod->flags&FLAG_INTERFACE) && !extends) {
+ // all classes extend object
+ extends = registry_getobjectclass();
+ }
/* create the class name, together with the proper attributes */
int access=0;
syntaxerror("Can't extend final class '%s'", extends->name);
/* fill out interfaces and extends (we couldn't resolve those during the first pass) */
- state->cls->info->superclass = extends?extends:TYPE_OBJECT;
+ state->cls->info->superclass = extends;
int pos = 0;
classinfo_list_t*l = implements;
for(l=implements;l;l=l->next) {
char*name = string_cstr(c->data[0]);
syntaxerror("Unresolved \"continue %s\"", name);
}
+ if(c->opcode == OPCODE___PUSHPACKAGE__) {
+ char*name = string_cstr(c->data[0]);
+ syntaxerror("Can't reference a package (%s) as such", name);
+ }
c=c->prev;
}
}
return;
if(m->flags & FLAG_FINAL)
syntaxerror("can't override final member %s", m->name);
+
+ /* allow this. it's no issue.
if((m->flags & FLAG_STATIC) && !(flags&FLAG_STATIC))
- syntaxerror("can't override static member %s", m->name);
+ syntaxerror("can't override static member %s", m->name);*/
+
if(!(m->flags & FLAG_STATIC) && (flags&FLAG_STATIC))
syntaxerror("can't override non-static member %s with static declaration", m->name);
- if(!(flags&FLAG_OVERRIDE)) {
+ if(!(flags&FLAG_OVERRIDE) && !(flags&FLAG_STATIC) && !(m->flags&FLAG_STATIC)) {
if(m->parent && !(m->parent->flags&FLAG_INTERFACE)) {
if(m->kind == INFOTYPE_METHOD)
syntaxerror("can't override without explicit 'override' declaration");
list_append(parent_method->innerfunctions, state->method);
dict_put(global->token2info, (void*)(ptroff_t)as3_tokencount, state->method);
-
+
function_initvars(state->method, params, 0, 1);
}
function_initvars(state->method, 0, 0, 0);
methodstate_list_t*ml = state->method->innerfunctions;
+
dict_t*xvars = dict_new();
+
while(ml) {
methodstate_t*m = ml->methodstate;
parserassert(m->inner);
dictentry_t*l = d->slots[t];
while(l) {
/* check parent method's variables */
- if(find_variable(state, l->key)) {
+ variable_t*v;
+ if((v=find_variable(state, l->key))) {
m->uses_parent_function = 1;
state->method->uses_slots = 1;
dict_put(xvars, l->key, 0);
}
ml = ml->next;
}
+
if(state->method->uses_slots) {
state->method->slots = dict_new();
int i = 1;
state->method->uses_slots = i;
dict_destroy(state->vars);state->vars = 0;
}
- dict_destroy(xvars);
-
old_state();
return 0;
}
check_code_for_break(body);
if(state->method->exceptions &&
- (state->method->late_binding || state->method->uses_slots))
- syntaxerror("try/catch and activation or late binding not supported yet within the same method");
+ (state->method->late_binding || state->method->uses_slots)) {
+ //syntaxerror("try/catch and activation or late binding not supported yet within the same method");
+ as3_warning("try/catch and activation or late binding not supported yet within the same method");
+ }
if(f->body) {
f->body->code = body;
return (c && !c->prev && !c->next && c->opcode == OPCODE_PUSHUNDEFINED);
}
-static slotinfo_t* find_class(char*name)
+static slotinfo_t* find_class(const char*name)
{
slotinfo_t*c=0;
return 0;
}
+typedcode_t push_class(slotinfo_t*a)
+{
+ typedcode_t x;
+ x.c = 0;
+ x.t = 0;
+ if(a->access == ACCESS_PACKAGEINTERNAL &&
+ strcmp(a->package, state->package) &&
+ strcmp(a->package, internal_filename_package)
+ ) {
+ syntaxerror("Can't access internal %s %s in package '%s' from package '%s'",
+ infotypename(a), a->name, a->package, state->package);
+ }
+
+ if(a->kind != INFOTYPE_CLASS) {
+ MULTINAME(m, a);
+ x.c = abc_findpropstrict2(x.c, &m);
+ x.c = abc_getproperty2(x.c, &m);
+ if(a->kind == INFOTYPE_METHOD) {
+ methodinfo_t*f = (methodinfo_t*)a;
+ x.t = TYPE_FUNCTION(f);
+ } else {
+ varinfo_t*v = (varinfo_t*)a;
+ x.t = v->type;
+ }
+ } else {
+ classinfo_t*c = (classinfo_t*)a;
+ if(c->slot) {
+ x.c = abc_getglobalscope(x.c);
+ x.c = abc_getslot(x.c, c->slot);
+ } else {
+ MULTINAME(m, c);
+ x.c = abc_getlex2(x.c, &m);
+ }
+ x.t = TYPE_CLASS(c);
+ }
+ return x;
+}
static char is_getlocal(code_t*c)
{
} else {
prefix = 0;
}
-
+
char use_temp_var = readbefore;
/* generate the write instruction, and maybe append a dup to the prefix code */
write->opcode = OPCODE_SETLOCAL_2;
} else if(r->opcode == OPCODE_GETLOCAL_3) {
write->opcode = OPCODE_SETLOCAL_3;
+ } else if(r->opcode == OPCODE_GETSUPER) {
+ write->opcode = OPCODE_SETSUPER;
+ multiname_t*m = (multiname_t*)r->data[0];
+ write->data[0] = multiname_clone(m);
} else {
code_dump(r);
syntaxerror("illegal lvalue: can't assign a value to this expression");
FOR_IN : FOR_START FOR_IN_INIT "in" EXPRESSION ')' CODEBLOCK {
variable_t*var = find_variable(state, $2);
+ if(!var) {
+ syntaxerror("variable %s not known in this scope", $2);
+ }
+
char*tmp1name = concat2($2, "__tmp1__");
int it = new_variable(tmp1name, TYPE_INT, 0, 0);
char*tmp2name = concat2($2, "__array__");
IMPORT : "import" PACKAGEANDCLASS {
PASS12
slotinfo_t*s = registry_find($2->package, $2->name);
- if(!s) {// || !(s->flags&FLAG_BUILTIN)) {
+ if(!s && as3_pass==1) {// || !(s->flags&FLAG_BUILTIN)) {
as3_schedule_class($2->package, $2->name);
}
syntaxerror("Couldn't import class\n");
state_has_imports();
dict_put(state->imports, c->name, c);
+ import_toplevel(c->package);
$$=0;
}
IMPORT : "import" PACKAGE '.' '*' {
PASS12
- if(strncmp("flash.", $2, 6)) {
+ if(strncmp("flash.", $2, 6) && as3_pass==1) {
as3_schedule_package($2);
}
i->package = $2;
state_has_imports();
list_append(state->wildcard_imports, i);
+ import_toplevel(i->package);
$$=0;
}
$$.ns=$1;
}
-EXTENDS : {$$=registry_getobjectclass();}
+EXTENDS : {$$=0;}
EXTENDS : KW_EXTENDS CLASS_SPEC {$$=$2;}
EXTENDS_LIST : {PASS12 $$=list_new();}
STATICCONSTANT : "false" {$$ = constant_new_false($1);}
STATICCONSTANT : "null" {$$ = constant_new_null($1);}
STATICCONSTANT : T_IDENTIFIER {
- // TODO
- as3_warning("Couldn't evaluate constant value of %s", $1);
- $$ = constant_new_null($1);
+ if(!strcmp($1, "NaN")) {
+ $$ = constant_new_float(__builtin_nan(""));
+ } else {
+ as3_warning("Couldn't evaluate constant value of %s", $1);
+ $$ = constant_new_null($1);
+ }
}
/* ------------ classes and interfaces (body, functions) ------- */
/* ------------- package + class ids --------------- */
CLASS: T_IDENTIFIER {
- PASS1 static slotinfo_t c;
+ PASS1 static classinfo_t c;
memset(&c, 0, sizeof(c));
+ c.kind = INFOTYPE_CLASS;
+ c.subtype = 255;
c.name = $1;
- $$ = (classinfo_t*)&c;
+ $$ = &c;
+
+ /* let the compiler know that we might be looking for this soon */
+ as3_schedule_class_noerror(state->package, $1);
PASS2
slotinfo_t*s = find_class($1);
if(!s) syntaxerror("Could not find class/method %s (current package: %s)\n", $1, state->package);
}
PACKAGEANDCLASS : PACKAGE '.' T_IDENTIFIER {
- PASS1 static slotinfo_t c;
+ PASS1 static classinfo_t c;
memset(&c, 0, sizeof(c));
+ c.kind = INFOTYPE_CLASS;
+ c.subtype = 255;
c.package = $1;
c.name = $3;
- $$=(classinfo_t*)&c;
+ $$ = &c;
PASS2
slotinfo_t*s = registry_find($1, $3);
if(!s) syntaxerror("Couldn't find class/method %s.%s\n", $1, $3);
E : E "++" { code_t*c = 0;
classinfo_t*type = $1.t;
- if((is_getlocal($1.c) && TYPE_IS_INT($1.t)) || TYPE_IS_NUMBER($1.t)) {
+ if(is_getlocal($1.c) && (TYPE_IS_INT($1.t) || TYPE_IS_NUMBER($1.t))) {
int nr = getlocalnr($1.c);
code_free($1.c);$1.c=0;
if(TYPE_IS_INT($1.t)) {
-E : E '.' T_IDENTIFIER
- {$$.c = $1.c;
- classinfo_t*t = $1.t;
- char is_static = 0;
- if(TYPE_IS_CLASS(t) && t->data) {
- t = t->data;
- is_static = 1;
- }
- if(t) {
- memberinfo_t*f = registry_findmember_nsset(t, state->active_namespaces, $3, 1);
- char noslot = 0;
- if(f && !is_static != !(f->flags&FLAG_STATIC))
- noslot=1;
- if(f && f->slot && !noslot) {
- $$.c = abc_getslot($$.c, f->slot);
- } else {
- MEMBER_MULTINAME(m, f, $3);
- $$.c = abc_getproperty2($$.c, &m);
- }
- /* determine type */
- $$.t = slotinfo_gettype((slotinfo_t*)f);
- if(!$$.t)
- $$.c = abc_coerce_a($$.c);
- } else {
- /* 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 */
- multiname_t m = {MULTINAME, 0, &nopackage_namespace_set, $3};
- $$.c = abc_getproperty2($$.c, &m);
- $$.c = abc_coerce_a($$.c);
- $$.t = registry_getanytype();
- }
- }
+E : E '.' T_IDENTIFIER {
+ $$.c = $1.c;
+ classinfo_t*t = $1.t;
+ char is_static = 0;
+ if(TYPE_IS_CLASS(t) && t->data) {
+ t = t->data;
+ is_static = 1;
+ }
+ if(t) {
+ if(t->subtype==0xff) {
+ syntaxerror("syntaxerror: trying to resolve property '%s' on incomplete object '%s'", $3, t->name);
+ }
+ memberinfo_t*f = registry_findmember_nsset(t, state->active_namespaces, $3, 1);
+ char noslot = 0;
+ if(f && !is_static != !(f->flags&FLAG_STATIC))
+ noslot=1;
+ if(f && f->slot && !noslot) {
+ $$.c = abc_getslot($$.c, f->slot);
+ } else {
+ MEMBER_MULTINAME(m, f, $3);
+ $$.c = abc_getproperty2($$.c, &m);
+ }
+ /* determine type */
+ $$.t = slotinfo_gettype((slotinfo_t*)f);
+ if(!$$.t)
+ $$.c = abc_coerce_a($$.c);
+ } else if($1.c && $1.c->opcode == OPCODE___PUSHPACKAGE__) {
+ string_t*package = $1.c->data[0];
+ char*package2 = concat3(package->str, ".", $3);
+ if(dict_contains(state->import_toplevel_packages, package2)) {
+ $$.c = $1.c;
+ $$.c->data[0] = string_new4(package2);
+ $$.t = 0;
+ } else {
+ slotinfo_t*a = registry_find(package->str, $3);
+ if(!a)
+ syntaxerror("couldn't resolve %s", package2);
+ $$ = push_class(a);
+ }
+ } else {
+ /* 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 */
+ multiname_t m = {MULTINAME, 0, &nopackage_namespace_set, $3};
+ $$.c = abc_getproperty2($$.c, &m);
+ $$.c = abc_coerce_a($$.c);
+ $$.t = registry_getanytype();
+ }
+}
VAR_READ : T_IDENTIFIER {
PASS1
function's variables.
We consider everything which is not a local variable "unresolved".
This encompasses class names, members of the surrounding class
- etc. which *correct* because local variables of the parent function
+ etc. which is *correct* because local variables of the parent function
would shadow those.
*/
if(state->method->inner && !find_variable(state, $1)) {
unknown_variable($1);
}
+
+ /* let the compiler know that it might check the current directory/package
+ for this identifier- maybe there's a file $1.as defining $1. */
+ as3_schedule_class_noerror(state->package, $1);
PASS2
$$.t = 0;
/* look at actual classes, in the current package and imported */
if((a = find_class($1))) {
- if(a->access == ACCESS_PACKAGEINTERNAL &&
- strcmp(a->package, state->package) &&
- strcmp(a->package, internal_filename_package)
- )
- syntaxerror("Can't access internal %s %s in package '%s' from package '%s'",
- infotypename(a),$1, a->package, state->package);
-
- if(a->kind != INFOTYPE_CLASS) {
- MULTINAME(m, a);
- $$.c = abc_findpropstrict2($$.c, &m);
- $$.c = abc_getproperty2($$.c, &m);
- if(a->kind == INFOTYPE_METHOD) {
- methodinfo_t*f = (methodinfo_t*)a;
- $$.t = TYPE_FUNCTION(f);
- } else {
- varinfo_t*v = (varinfo_t*)a;
- $$.t = v->type;
- }
- } else {
- classinfo_t*c = (classinfo_t*)a;
- if(c->slot) {
- $$.c = abc_getglobalscope($$.c);
- $$.c = abc_getslot($$.c, c->slot);
- } else {
- MULTINAME(m, c);
- $$.c = abc_getlex2($$.c, &m);
- }
- $$.t = TYPE_CLASS(c);
- }
+ $$ = push_class(a);
+ break;
+ }
+
+ /* look through package prefixes */
+ if(dict_contains(state->import_toplevel_packages, $1)) {
+ $$.c = abc___pushpackage__($$.c, $1);
+ $$.t = 0;
break;
}
/* unknown object, let the avm2 resolve it */
if(1) {
- as3_softwarning("Couldn't resolve '%s', doing late binding", $1);
+ //as3_softwarning("Couldn't resolve '%s', doing late binding", $1);
+ as3_warning("Couldn't resolve '%s', doing late binding", $1);
state->method->late_binding = 1;
multiname_t m = {MULTINAME, 0, &nopackage_namespace_set, $1};