- if(flags&FLAG_STATIC)
- f = abc_class_staticmethod(state->cls->abc, type2, &mname);
- else
- f = abc_class_method(state->cls->abc, type2, &mname);
- slot = f->trait->slot_id;
- } else {
- namespace_t mname_ns = {state->method->info->access, state->package};
- multiname_t mname = {QNAME, &mname_ns, 0, name};
-
- f = abc_method_new(global->file, type2, 1);
- trait_t*t = trait_new_method(&global->init->traits, multiname_clone(&mname), f);
- //abc_code_t*c = global->init->method->body->code;
- }
- //flash doesn't seem to allow us to access function slots
- //state->method->info->slot = slot;
-
- if(flags&FLAG_OVERRIDE) f->trait->attributes |= TRAIT_ATTR_OVERRIDE;
- if(getset == KW_GET) f->trait->kind = TRAIT_GETTER;
- if(getset == KW_SET) f->trait->kind = TRAIT_SETTER;
- if(params->varargs) f->flags |= METHOD_NEED_REST;
-
- char opt=0;
- param_list_t*p=0;
- for(p=params->list;p;p=p->next) {
- if(params->varargs && !p->next) {
- break; //varargs: omit last parameter in function signature
+ multiname_t*type2 = sig2mname(return_type);
+ int slot = 0;
+ if(state->method->inner) {
+ f = state->method->abc;
+ abc_method_init(f, global->file, type2, 1);
+ } else if(state->method->is_constructor) {
+ f = abc_class_getconstructor(state->cls->abc, type2);
+ } else if(!state->method->is_global) {
+ namespace_t mname_ns = {state->method->info->access, ""};
+ multiname_t mname = {QNAME, &mname_ns, 0, name};
+
+ if(flags&FLAG_STATIC)
+ f = abc_class_staticmethod(state->cls->abc, type2, &mname);
+ else
+ f = abc_class_method(state->cls->abc, type2, &mname);
+ slot = f->trait->slot_id;
+ } else {
+ namespace_t mname_ns = {state->method->info->access, state->package};
+ multiname_t mname = {QNAME, &mname_ns, 0, name};
+
+ f = abc_method_new(global->file, type2, 1);
+ trait_t*t = trait_new_method(&global->init->traits, multiname_clone(&mname), f);
+ //abc_code_t*c = global->init->method->body->code;
+ }
+ //flash doesn't seem to allow us to access function slots
+ //state->method->info->slot = slot;
+
+ if(flags&FLAG_OVERRIDE) f->trait->attributes |= TRAIT_ATTR_OVERRIDE;
+ if(getset == KW_GET) f->trait->kind = TRAIT_GETTER;
+ if(getset == KW_SET) f->trait->kind = TRAIT_SETTER;
+ if(params->varargs) f->flags |= METHOD_NEED_REST;
+
+ char opt=0;
+ param_list_t*p=0;
+ for(p=params->list;p;p=p->next) {
+ if(params->varargs && !p->next) {
+ break; //varargs: omit last parameter in function signature
+ }
+ multiname_t*m = sig2mname(p->param->type);
+ list_append(f->parameters, m);
+ if(p->param->value) {
+ check_constant_against_type(p->param->type, p->param->value);
+ opt=1;list_append(f->optional_parameters, p->param->value);
+ } else if(opt) {
+ syntaxerror("non-optional parameter not allowed after optional parameters");
+ }
- 0, 1742, 1742, 1744, 1744, 1745, 1746, 1748, 1749, 1750,
- 1751, 1752, 1753, 1754, 1755, 1757, 1757, 1758, 1759, 1761,
- 1762, 1763, 1764, 1765, 1766, 1767, 1769, 1770, 1772, 1773,
- 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785,
- 1786, 1787, 1788, 1791, 1792, 1793, 1794, 1795, 1796, 1797,
- 1798, 1800, 1804, 1805, 1809, 1816, 1820, 1821, 1825, 1826,
- 1828, 1829, 1831, 1874, 1875, 1878, 1878, 1897, 1898, 1899,
- 1902, 1905, 1909, 1910, 1912, 1932, 1975, 1975, 1994, 1994,
- 2009, 2012, 2015, 2018, 2022, 2023, 2024, 2025, 2026, 2027,
- 2029, 2040, 2043, 2043, 2072, 2072, 2092, 2092, 2109, 2110,
- 2111, 2112, 2120, 2129, 2129, 2174, 2178, 2189, 2198, 2199,
- 2201, 2202, 2204, 2204, 2206, 2206, 2209, 2223, 2239, 2240,
- 2241, 2242, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251,
- 2252, 2253, 2255, 2256, 2258, 2259, 2261, 2262, 2266, 2264,
- 2272, 2270, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285,
- 2287, 2293, 2294, 2295, 2296, 2297, 2298, 2301, 2314, 2314,
- 2316, 2316, 2389, 2390, 2392, 2393, 2394, 2395, 2396, 2398,
- 2399, 2400, 2401, 2410, 2414, 2420, 2426, 2434, 2439, 2445,
- 2453, 2461, 2462, 2463, 2466, 2465, 2480, 2481, 2483, 2482,
- 2504, 2513, 2526, 2527, 2529, 2530, 2532, 2533, 2534, 2543,
- 2544, 2548, 2549, 2551, 2552, 2553, 2555, 2559, 2560, 2565,
- 2566, 2602, 2648, 2669, 2690, 2693, 2700, 2701, 2702, 2708,
- 2714, 2716, 2718, 2720, 2722, 2724, 2726, 2743, 2748, 2751,
- 2754, 2757, 2760, 2763, 2766, 2769, 2772, 2776, 2779, 2782,
- 2785, 2788, 2791, 2794, 2797, 2801, 2812, 2830, 2835, 2840,
- 2845, 2850, 2855, 2859, 2863, 2868, 2872, 2876, 2885, 2894,
- 2904, 2909, 2921, 2927, 2932, 2938, 2944, 2948, 2950, 2961,
- 2970, 2977, 2978, 2980, 2986, 2995, 3002, 3014, 3020, 3026,
- 3032, 3038, 3044, 3050, 3056, 3069, 3080, 3087, 3100, 3127,
- 3141, 3155, 3169, 3184, 3191, 3198, 3205, 3212, 3223, 3257,
- 3359, 3360, 3361, 3363
+ 0, 1875, 1875, 1877, 1877, 1878, 1879, 1881, 1882, 1883,
+ 1884, 1885, 1886, 1887, 1888, 1890, 1890, 1891, 1892, 1894,
+ 1895, 1896, 1897, 1898, 1899, 1900, 1902, 1903, 1905, 1906,
+ 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918,
+ 1919, 1920, 1921, 1924, 1925, 1926, 1927, 1928, 1929, 1930,
+ 1931, 1933, 1937, 1938, 1942, 1949, 1953, 1954, 1958, 1959,
+ 1961, 1962, 1964, 2025, 2026, 2029, 2029, 2048, 2049, 2050,
+ 2055, 2059, 2064, 2065, 2067, 2087, 2131, 2131, 2150, 2150,
+ 2165, 2168, 2171, 2174, 2178, 2179, 2180, 2181, 2182, 2183,
+ 2185, 2196, 2199, 2199, 2228, 2228, 2252, 2252, 2268, 2269,
+ 2270, 2271, 2279, 2288, 2288, 2333, 2337, 2348, 2357, 2358,
+ 2360, 2361, 2363, 2363, 2365, 2365, 2368, 2383, 2399, 2400,
+ 2401, 2402, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411,
+ 2412, 2413, 2415, 2416, 2418, 2419, 2421, 2422, 2426, 2424,
+ 2432, 2430, 2438, 2439, 2440, 2441, 2442, 2443, 2444, 2445,
+ 2447, 2453, 2454, 2455, 2456, 2457, 2458, 2461, 2474, 2474,
+ 2476, 2476, 2549, 2550, 2552, 2553, 2554, 2555, 2556, 2558,
+ 2559, 2560, 2561, 2570, 2574, 2580, 2586, 2594, 2599, 2605,
+ 2613, 2621, 2622, 2623, 2626, 2625, 2642, 2643, 2645, 2644,
+ 2668, 2676, 2689, 2690, 2692, 2693, 2695, 2696, 2697, 2706,
+ 2707, 2711, 2712, 2714, 2715, 2716, 2718, 2722, 2723, 2728,
+ 2729, 2765, 2811, 2832, 2853, 2856, 2863, 2864, 2865, 2871,
+ 2877, 2879, 2881, 2883, 2885, 2887, 2889, 2906, 2911, 2914,
+ 2917, 2920, 2923, 2926, 2929, 2932, 2935, 2939, 2942, 2945,
+ 2948, 2951, 2954, 2957, 2960, 2964, 2975, 2993, 2998, 3003,
+ 3008, 3013, 3018, 3022, 3026, 3031, 3035, 3039, 3048, 3057,
+ 3067, 3072, 3084, 3090, 3095, 3101, 3107, 3111, 3113, 3124,
+ 3133, 3140, 3141, 3143, 3149, 3158, 3165, 3177, 3183, 3189,
+ 3195, 3201, 3207, 3213, 3219, 3232, 3243, 3250, 3263, 3290,
+ 3304, 3318, 3332, 3346, 3353, 3360, 3367, 3374, 3385, 3419,
+ 3540, 3541, 3542, 3544