- 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, 1869, 1869, 1871, 1871, 1872, 1873, 1875, 1876, 1877,
+ 1878, 1879, 1880, 1881, 1882, 1884, 1884, 1885, 1886, 1888,
+ 1889, 1890, 1891, 1892, 1893, 1894, 1896, 1897, 1899, 1900,
+ 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912,
+ 1913, 1914, 1915, 1918, 1919, 1920, 1921, 1922, 1923, 1924,
+ 1925, 1927, 1931, 1932, 1936, 1943, 1947, 1948, 1952, 1953,
+ 1955, 1956, 1958, 2019, 2020, 2023, 2023, 2042, 2043, 2044,
+ 2049, 2053, 2058, 2059, 2061, 2081, 2125, 2125, 2144, 2144,
+ 2159, 2162, 2165, 2168, 2172, 2173, 2174, 2175, 2176, 2177,
+ 2179, 2190, 2193, 2193, 2222, 2222, 2246, 2246, 2262, 2263,
+ 2264, 2265, 2273, 2282, 2282, 2327, 2331, 2342, 2351, 2352,
+ 2354, 2355, 2357, 2357, 2359, 2359, 2362, 2377, 2393, 2394,
+ 2395, 2396, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405,
+ 2406, 2407, 2409, 2410, 2412, 2413, 2415, 2416, 2420, 2418,
+ 2426, 2424, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439,
+ 2441, 2447, 2448, 2449, 2450, 2451, 2452, 2455, 2468, 2468,
+ 2470, 2470, 2543, 2544, 2546, 2547, 2548, 2549, 2550, 2552,
+ 2553, 2554, 2555, 2564, 2568, 2574, 2580, 2588, 2593, 2599,
+ 2607, 2615, 2616, 2617, 2620, 2619, 2636, 2637, 2639, 2638,
+ 2662, 2670, 2683, 2684, 2686, 2687, 2689, 2690, 2691, 2700,
+ 2701, 2705, 2706, 2708, 2709, 2710, 2712, 2716, 2717, 2722,
+ 2723, 2759, 2805, 2826, 2847, 2850, 2857, 2858, 2859, 2865,
+ 2871, 2873, 2875, 2877, 2879, 2881, 2883, 2900, 2905, 2908,
+ 2911, 2914, 2917, 2920, 2923, 2926, 2929, 2933, 2936, 2939,
+ 2942, 2945, 2948, 2951, 2954, 2958, 2969, 2987, 2992, 2997,
+ 3002, 3007, 3012, 3016, 3020, 3025, 3029, 3033, 3042, 3051,
+ 3061, 3066, 3078, 3084, 3089, 3095, 3101, 3105, 3107, 3118,
+ 3127, 3134, 3135, 3137, 3143, 3152, 3159, 3171, 3177, 3183,
+ 3189, 3195, 3201, 3207, 3213, 3226, 3237, 3244, 3257, 3284,
+ 3298, 3312, 3326, 3341, 3348, 3355, 3362, 3369, 3380, 3414,
+ 3535, 3536, 3537, 3539