/* A Bison parser, made from ./parse.y
- by GNU Bison version 1.25
- */
+ by GNU Bison version 1.28 */
#define YYBISON 1 /* Identify Bison output. */
#define yychar java_char
#define yydebug java_debug
#define yynerrs java_nerrs
-#define PLUS_TK 258
-#define MINUS_TK 259
-#define MULT_TK 260
-#define DIV_TK 261
-#define REM_TK 262
-#define LS_TK 263
-#define SRS_TK 264
-#define ZRS_TK 265
-#define AND_TK 266
-#define XOR_TK 267
-#define OR_TK 268
-#define BOOL_AND_TK 269
-#define BOOL_OR_TK 270
-#define EQ_TK 271
-#define NEQ_TK 272
-#define GT_TK 273
-#define GTE_TK 274
-#define LT_TK 275
-#define LTE_TK 276
-#define PLUS_ASSIGN_TK 277
-#define MINUS_ASSIGN_TK 278
-#define MULT_ASSIGN_TK 279
-#define DIV_ASSIGN_TK 280
-#define REM_ASSIGN_TK 281
-#define LS_ASSIGN_TK 282
-#define SRS_ASSIGN_TK 283
-#define ZRS_ASSIGN_TK 284
-#define AND_ASSIGN_TK 285
-#define XOR_ASSIGN_TK 286
-#define OR_ASSIGN_TK 287
-#define PUBLIC_TK 288
-#define PRIVATE_TK 289
-#define PROTECTED_TK 290
-#define STATIC_TK 291
-#define FINAL_TK 292
-#define SYNCHRONIZED_TK 293
-#define VOLATILE_TK 294
-#define TRANSIENT_TK 295
-#define NATIVE_TK 296
-#define PAD_TK 297
-#define ABSTRACT_TK 298
-#define MODIFIER_TK 299
-#define DECR_TK 300
-#define INCR_TK 301
-#define DEFAULT_TK 302
-#define IF_TK 303
-#define THROW_TK 304
-#define BOOLEAN_TK 305
-#define DO_TK 306
-#define IMPLEMENTS_TK 307
-#define THROWS_TK 308
-#define BREAK_TK 309
-#define IMPORT_TK 310
-#define ELSE_TK 311
-#define INSTANCEOF_TK 312
-#define RETURN_TK 313
-#define VOID_TK 314
-#define CATCH_TK 315
-#define INTERFACE_TK 316
-#define CASE_TK 317
-#define EXTENDS_TK 318
-#define FINALLY_TK 319
-#define SUPER_TK 320
-#define WHILE_TK 321
-#define CLASS_TK 322
-#define SWITCH_TK 323
-#define CONST_TK 324
-#define TRY_TK 325
-#define FOR_TK 326
-#define NEW_TK 327
-#define CONTINUE_TK 328
-#define GOTO_TK 329
-#define PACKAGE_TK 330
-#define THIS_TK 331
-#define BYTE_TK 332
-#define SHORT_TK 333
-#define INT_TK 334
-#define LONG_TK 335
-#define CHAR_TK 336
-#define INTEGRAL_TK 337
-#define FLOAT_TK 338
-#define DOUBLE_TK 339
-#define FP_TK 340
-#define ID_TK 341
-#define REL_QM_TK 342
-#define REL_CL_TK 343
-#define NOT_TK 344
-#define NEG_TK 345
-#define ASSIGN_ANY_TK 346
-#define ASSIGN_TK 347
-#define OP_TK 348
-#define CP_TK 349
-#define OCB_TK 350
-#define CCB_TK 351
-#define OSB_TK 352
-#define CSB_TK 353
-#define SC_TK 354
-#define C_TK 355
-#define DOT_TK 356
-#define STRING_LIT_TK 357
-#define CHAR_LIT_TK 358
-#define INT_LIT_TK 359
-#define FP_LIT_TK 360
-#define TRUE_TK 361
-#define FALSE_TK 362
-#define BOOL_LIT_TK 363
-#define NULL_TK 364
+#define PLUS_TK 257
+#define MINUS_TK 258
+#define MULT_TK 259
+#define DIV_TK 260
+#define REM_TK 261
+#define LS_TK 262
+#define SRS_TK 263
+#define ZRS_TK 264
+#define AND_TK 265
+#define XOR_TK 266
+#define OR_TK 267
+#define BOOL_AND_TK 268
+#define BOOL_OR_TK 269
+#define EQ_TK 270
+#define NEQ_TK 271
+#define GT_TK 272
+#define GTE_TK 273
+#define LT_TK 274
+#define LTE_TK 275
+#define PLUS_ASSIGN_TK 276
+#define MINUS_ASSIGN_TK 277
+#define MULT_ASSIGN_TK 278
+#define DIV_ASSIGN_TK 279
+#define REM_ASSIGN_TK 280
+#define LS_ASSIGN_TK 281
+#define SRS_ASSIGN_TK 282
+#define ZRS_ASSIGN_TK 283
+#define AND_ASSIGN_TK 284
+#define XOR_ASSIGN_TK 285
+#define OR_ASSIGN_TK 286
+#define PUBLIC_TK 287
+#define PRIVATE_TK 288
+#define PROTECTED_TK 289
+#define STATIC_TK 290
+#define FINAL_TK 291
+#define SYNCHRONIZED_TK 292
+#define VOLATILE_TK 293
+#define TRANSIENT_TK 294
+#define NATIVE_TK 295
+#define PAD_TK 296
+#define ABSTRACT_TK 297
+#define MODIFIER_TK 298
+#define DECR_TK 299
+#define INCR_TK 300
+#define DEFAULT_TK 301
+#define IF_TK 302
+#define THROW_TK 303
+#define BOOLEAN_TK 304
+#define DO_TK 305
+#define IMPLEMENTS_TK 306
+#define THROWS_TK 307
+#define BREAK_TK 308
+#define IMPORT_TK 309
+#define ELSE_TK 310
+#define INSTANCEOF_TK 311
+#define RETURN_TK 312
+#define VOID_TK 313
+#define CATCH_TK 314
+#define INTERFACE_TK 315
+#define CASE_TK 316
+#define EXTENDS_TK 317
+#define FINALLY_TK 318
+#define SUPER_TK 319
+#define WHILE_TK 320
+#define CLASS_TK 321
+#define SWITCH_TK 322
+#define CONST_TK 323
+#define TRY_TK 324
+#define FOR_TK 325
+#define NEW_TK 326
+#define CONTINUE_TK 327
+#define GOTO_TK 328
+#define PACKAGE_TK 329
+#define THIS_TK 330
+#define BYTE_TK 331
+#define SHORT_TK 332
+#define INT_TK 333
+#define LONG_TK 334
+#define CHAR_TK 335
+#define INTEGRAL_TK 336
+#define FLOAT_TK 337
+#define DOUBLE_TK 338
+#define FP_TK 339
+#define ID_TK 340
+#define REL_QM_TK 341
+#define REL_CL_TK 342
+#define NOT_TK 343
+#define NEG_TK 344
+#define ASSIGN_ANY_TK 345
+#define ASSIGN_TK 346
+#define OP_TK 347
+#define CP_TK 348
+#define OCB_TK 349
+#define CCB_TK 350
+#define OSB_TK 351
+#define CSB_TK 352
+#define SC_TK 353
+#define C_TK 354
+#define DOT_TK 355
+#define STRING_LIT_TK 356
+#define CHAR_LIT_TK 357
+#define INT_LIT_TK 358
+#define FP_LIT_TK 359
+#define TRUE_TK 360
+#define FALSE_TK 361
+#define BOOL_LIT_TK 362
+#define NULL_TK 363
#line 48 "./parse.y"
static tree lookup_field_wrapper PARAMS ((tree, tree));
static int duplicate_declaration_error_p PARAMS ((tree, tree, tree));
static void register_fields PARAMS ((int, tree, tree));
-static tree parser_qualified_classname PARAMS ((int, tree));
+static tree parser_qualified_classname PARAMS ((tree));
static int parser_check_super PARAMS ((tree, tree, tree));
static int parser_check_super_interface PARAMS ((tree, tree, tree));
static void check_modifiers_consistency PARAMS ((int));
static int process_imports PARAMS ((void));
static void read_import_dir PARAMS ((tree));
static int find_in_imports_on_demand PARAMS ((tree));
-static int find_in_imports PARAMS ((tree));
+static void find_in_imports PARAMS ((tree));
+static void check_inner_class_access PARAMS ((tree, tree, tree));
static int check_pkg_class_access PARAMS ((tree, tree));
+static void register_package PARAMS ((tree));
static tree resolve_package PARAMS ((tree, tree *));
static tree lookup_package_type PARAMS ((const char *, int));
static tree lookup_package_type_and_set_next PARAMS ((const char *, int, tree *));
int *, tree *));
static int breakdown_qualified PARAMS ((tree *, tree *, tree));
static tree resolve_and_layout PARAMS ((tree, tree));
+static tree qualify_and_find PARAMS ((tree, tree, tree));
static tree resolve_no_layout PARAMS ((tree, tree));
static int invocation_mode PARAMS ((tree, int));
static tree find_applicable_accessible_methods_list PARAMS ((int, tree,
static tree java_complete_lhs PARAMS ((tree));
static tree java_complete_tree PARAMS ((tree));
static tree maybe_generate_pre_expand_clinit PARAMS ((tree));
+static int maybe_yank_clinit PARAMS ((tree));
static void java_complete_expand_method PARAMS ((tree));
static int unresolved_type_p PARAMS ((tree, tree *));
static void create_jdep_list PARAMS ((struct parser_ctxt *));
static tree patch_newarray PARAMS ((tree));
static tree resolve_type_during_patch PARAMS ((tree));
static tree build_this PARAMS ((int));
-static tree build_wfl_wrap PARAMS ((tree));
+static tree build_wfl_wrap PARAMS ((tree, int));
static tree build_return PARAMS ((int, tree));
static tree patch_return PARAMS ((tree));
static tree maybe_access_field PARAMS ((tree, tree, tree));
} while (0)
-#line 414 "./parse.y"
+#line 418 "./parse.y"
typedef union {
tree node;
int sub_token;
} operator;
int value;
} YYSTYPE;
-#line 424 "./parse.y"
+#line 428 "./parse.y"
#include "lex.c"
#ifndef YYDEBUG
#define YYFLAG -32768
#define YYNTBASE 110
-#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 272)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 272)
static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
- 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
- 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
- 106, 107, 108, 109
+ 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
+ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
+ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109
};
#if YYDEBUG != 0
#if YYDEBUG != 0
static const short yyrline[] = { 0,
- 573, 579, 581, 582, 583, 584, 585, 589, 591, 594,
- 596, 597, 600, 602, 605, 609, 613, 617, 623, 625,
- 627, 629, 634, 636, 639, 643, 648, 653, 655, 656,
- 657, 658, 659, 660, 661, 664, 669, 675, 677, 680,
- 686, 688, 692, 694, 697, 724, 726, 730, 743, 745,
- 749, 752, 754, 756, 766, 771, 786, 790, 790, 793,
- 793, 795, 797, 802, 806, 808, 810, 812, 816, 818,
- 820, 827, 833, 838, 842, 851, 861, 863, 866, 868,
- 869, 870, 877, 879, 881, 882, 884, 889, 892, 902,
- 905, 907, 911, 914, 921, 927, 935, 937, 939, 941,
- 943, 947, 949, 953, 964, 965, 969, 972, 974, 976,
- 978, 983, 985, 987, 989, 996, 1002, 1004, 1013, 1015,
- 1019, 1024, 1029, 1033, 1038, 1043, 1048, 1055, 1065, 1067,
- 1069, 1073, 1076, 1078, 1082, 1084, 1085, 1090, 1096, 1103,
- 1119, 1126, 1129, 1132, 1136, 1142, 1146, 1155, 1157, 1159,
- 1163, 1165, 1168, 1175, 1183, 1185, 1189, 1196, 1206, 1210,
- 1210, 1213, 1213, 1216, 1216, 1219, 1219, 1221, 1225, 1231,
- 1236, 1238, 1242, 1245, 1249, 1251, 1254, 1256, 1257, 1259,
- 1263, 1267, 1273, 1278, 1281, 1283, 1287, 1293, 1297, 1302,
- 1311, 1315, 1320, 1332, 1334, 1337, 1339, 1341, 1348, 1352,
- 1355, 1359, 1361, 1362, 1363, 1364, 1365, 1369, 1371, 1372,
- 1373, 1374, 1378, 1380, 1381, 1382, 1383, 1384, 1385, 1386,
- 1387, 1388, 1389, 1392, 1397, 1408, 1411, 1415, 1422, 1432,
- 1438, 1444, 1450, 1452, 1457, 1459, 1464, 1466, 1468, 1470,
- 1472, 1476, 1478, 1479, 1480, 1481, 1482, 1483, 1486, 1492,
- 1494, 1496, 1500, 1505, 1510, 1516, 1526, 1532, 1534, 1536,
- 1543, 1546, 1548, 1550, 1554, 1556, 1559, 1563, 1565, 1568,
- 1575, 1581, 1583, 1585, 1589, 1597, 1600, 1602, 1604, 1608,
- 1613, 1622, 1627, 1630, 1637, 1639, 1641, 1645, 1648, 1657,
- 1664, 1666, 1670, 1683, 1685, 1691, 1697, 1701, 1703, 1707,
- 1710, 1712, 1716, 1719, 1721, 1723, 1727, 1730, 1732, 1734,
- 1738, 1741, 1743, 1745, 1749, 1755, 1757, 1761, 1768, 1770,
- 1772, 1774, 1778, 1790, 1793, 1795, 1800, 1804, 1806, 1813,
- 1821, 1838, 1840, 1845, 1849, 1852, 1857, 1859, 1862, 1864,
- 1866, 1868, 1869, 1870, 1871, 1872, 1876, 1881, 1883, 1885,
- 1887, 1894, 1900, 1909, 1912, 1914, 1916, 1920, 1923, 1925,
- 1929, 1935, 1936, 1942, 1943, 1945, 1947, 1949, 1951, 1953,
- 1962, 1966, 1996, 1999, 2013, 2016, 2020, 2026, 2031, 2035,
- 2038, 2040, 2042, 2046, 2055, 2063, 2065, 2069, 2072, 2076,
- 2082, 2084, 2092, 2119, 2121, 2125, 2130, 2137, 2141, 2144,
- 2146, 2157, 2168, 2173, 2182, 2184, 2188, 2191, 2193, 2198,
- 2203, 2208, 2215, 2217, 2218, 2219, 2222, 2227, 2232, 2234,
- 2235, 2237, 2239, 2240, 2242, 2246, 2249, 2253, 2256, 2260,
- 2262, 2264, 2266, 2267, 2269, 2273, 2282, 2284, 2286, 2299,
- 2301, 2307, 2309, 2311, 2315, 2317, 2322, 2327, 2332, 2334,
- 2336, 2340, 2342, 2347, 2352, 2354, 2358, 2360, 2365, 2370,
- 2375, 2377, 2379, 2383, 2385, 2390, 2395, 2400, 2405, 2407,
- 2409, 2411, 2413, 2415, 2419, 2421, 2426, 2431, 2433, 2437,
- 2439, 2444, 2448, 2450, 2455, 2459, 2461, 2466, 2470, 2472,
- 2477, 2481, 2483, 2488, 2492, 2494, 2499, 2505, 2507, 2511,
- 2513, 2516, 2519, 2527, 2529, 2530, 2533, 2535, 2538, 2542
+ 577, 583, 585, 586, 587, 588, 589, 593, 595, 598,
+ 600, 601, 604, 606, 609, 613, 617, 621, 627, 629,
+ 631, 633, 638, 640, 643, 652, 657, 662, 664, 665,
+ 666, 667, 668, 669, 670, 673, 678, 684, 686, 689,
+ 695, 697, 701, 703, 706, 733, 735, 739, 752, 754,
+ 758, 761, 763, 765, 775, 780, 795, 799, 799, 802,
+ 802, 804, 806, 811, 815, 817, 819, 821, 825, 827,
+ 829, 836, 842, 847, 851, 860, 870, 872, 875, 877,
+ 878, 879, 886, 888, 890, 891, 893, 898, 901, 911,
+ 914, 916, 920, 923, 930, 936, 944, 946, 948, 950,
+ 952, 956, 958, 962, 973, 974, 978, 981, 983, 985,
+ 987, 992, 994, 996, 998, 1005, 1011, 1013, 1022, 1024,
+ 1028, 1033, 1038, 1042, 1047, 1052, 1057, 1064, 1074, 1076,
+ 1078, 1082, 1085, 1087, 1091, 1093, 1094, 1099, 1105, 1112,
+ 1128, 1135, 1138, 1141, 1145, 1151, 1155, 1164, 1166, 1168,
+ 1172, 1174, 1177, 1184, 1192, 1194, 1198, 1205, 1215, 1219,
+ 1219, 1222, 1222, 1225, 1225, 1228, 1228, 1230, 1234, 1240,
+ 1245, 1247, 1251, 1254, 1258, 1260, 1263, 1265, 1266, 1268,
+ 1272, 1276, 1282, 1287, 1290, 1292, 1296, 1302, 1306, 1311,
+ 1320, 1324, 1329, 1343, 1345, 1348, 1350, 1352, 1359, 1363,
+ 1366, 1370, 1372, 1373, 1374, 1375, 1376, 1380, 1382, 1383,
+ 1384, 1385, 1389, 1391, 1392, 1393, 1394, 1395, 1396, 1397,
+ 1398, 1399, 1400, 1403, 1408, 1419, 1422, 1426, 1433, 1443,
+ 1449, 1455, 1461, 1463, 1468, 1470, 1475, 1477, 1479, 1481,
+ 1483, 1487, 1489, 1490, 1491, 1492, 1493, 1494, 1497, 1503,
+ 1505, 1507, 1511, 1516, 1521, 1527, 1537, 1543, 1545, 1547,
+ 1554, 1557, 1559, 1561, 1565, 1567, 1570, 1574, 1576, 1579,
+ 1586, 1592, 1594, 1596, 1600, 1608, 1611, 1613, 1615, 1619,
+ 1624, 1633, 1638, 1645, 1652, 1654, 1656, 1660, 1663, 1672,
+ 1679, 1681, 1685, 1698, 1700, 1706, 1712, 1716, 1718, 1722,
+ 1725, 1727, 1731, 1734, 1736, 1738, 1742, 1745, 1747, 1749,
+ 1753, 1756, 1758, 1760, 1764, 1770, 1772, 1776, 1783, 1785,
+ 1787, 1789, 1793, 1805, 1808, 1810, 1815, 1819, 1821, 1828,
+ 1836, 1853, 1855, 1860, 1864, 1867, 1872, 1874, 1877, 1879,
+ 1881, 1883, 1884, 1885, 1886, 1887, 1891, 1896, 1898, 1900,
+ 1902, 1909, 1915, 1924, 1927, 1929, 1931, 1935, 1938, 1940,
+ 1944, 1950, 1951, 1957, 1958, 1960, 1962, 1964, 1966, 1968,
+ 1977, 1981, 2011, 2014, 2028, 2031, 2035, 2041, 2046, 2050,
+ 2053, 2055, 2057, 2061, 2070, 2078, 2080, 2084, 2087, 2091,
+ 2102, 2104, 2112, 2139, 2141, 2145, 2150, 2157, 2161, 2164,
+ 2166, 2177, 2188, 2193, 2202, 2204, 2208, 2211, 2213, 2218,
+ 2223, 2228, 2235, 2237, 2238, 2239, 2242, 2247, 2252, 2254,
+ 2255, 2257, 2259, 2260, 2262, 2266, 2269, 2273, 2276, 2280,
+ 2282, 2284, 2286, 2287, 2289, 2293, 2302, 2304, 2306, 2319,
+ 2321, 2327, 2329, 2331, 2335, 2337, 2342, 2347, 2352, 2354,
+ 2356, 2360, 2362, 2367, 2372, 2374, 2378, 2380, 2385, 2390,
+ 2395, 2397, 2399, 2403, 2405, 2410, 2415, 2420, 2425, 2427,
+ 2429, 2431, 2433, 2435, 2439, 2441, 2446, 2451, 2453, 2457,
+ 2459, 2464, 2468, 2470, 2475, 2479, 2481, 2486, 2490, 2492,
+ 2497, 2501, 2503, 2508, 2512, 2514, 2519, 2525, 2527, 2531,
+ 2533, 2536, 2539, 2547, 2549, 2550, 2553, 2555, 2558, 2562
};
#endif
#define YYPURE 1
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/home/apbianco/install/intel-java-alpha/install-x86//share/bison.simple"
+#line 3 "/usr/lib/bison.simple"
+/* This file comes from bison-1.28. */
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
-#ifndef alloca
+/* This is the parser code that is written into each bison parser
+ when the %semantic_parser declaration is not specified in the grammar.
+ It was written by Richard Stallman by simplifying the hairy parser
+ used when %semantic_parser is specified. */
+
+#ifndef YYSTACK_USE_ALLOCA
+#ifdef alloca
+#define YYSTACK_USE_ALLOCA
+#else /* alloca not defined */
#ifdef __GNUC__
+#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca
#else /* not GNU C. */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
+#define YYSTACK_USE_ALLOCA
#include <alloca.h>
#else /* not sparc */
-#if defined (MSDOS) && !defined (__TURBOC__)
+/* We think this test detects Watcom and Microsoft C. */
+/* This used to test MSDOS, but that is a bad idea
+ since that symbol is in the user namespace. */
+#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
+#if 0 /* No need for malloc.h, which pollutes the namespace;
+ instead, just don't use alloca. */
#include <malloc.h>
+#endif
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
-#include <malloc.h>
+/* I don't know what this was needed for, but it pollutes the namespace.
+ So I turned it off. rms, 2 May 1997. */
+/* #include <malloc.h> */
#pragma alloca
-#else /* not MSDOS, __TURBOC__, or _AIX */
-#ifdef __hpux
-#ifdef __cplusplus
-extern "C" {
-void *alloca (unsigned int);
-};
-#else /* not __cplusplus */
-void *alloca ();
-#endif /* not __cplusplus */
+#define YYSTACK_USE_ALLOCA
+#else /* not MSDOS, or __TURBOC__, or _AIX */
+#if 0
+#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
+ and on HPUX 10. Eventually we can turn this on. */
+#define YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
#endif /* __hpux */
+#endif
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc. */
-#endif /* not GNU C. */
-#endif /* alloca not defined. */
+#endif /* not sparc */
+#endif /* not GNU C */
+#endif /* alloca not defined */
+#endif /* YYSTACK_USE_ALLOCA not defined */
-/* This is the parser code that is written into each bison parser
- when the %semantic_parser declaration is not specified in the grammar.
- It was written by Richard Stallman by simplifying the hairy parser
- used when %semantic_parser is specified. */
+#ifdef YYSTACK_USE_ALLOCA
+#define YYSTACK_ALLOC alloca
+#else
+#define YYSTACK_ALLOC malloc
+#endif
/* Note: there must be only one dollar sign in this file.
It is replaced by the list of actions, each action
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
-#define YYACCEPT return(0)
-#define YYABORT return(1)
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror.
This remains here temporarily to ease the
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-int yyparse (void);
-#endif
\f
+/* Define __yy_memcpy. Note that the size argument
+ should be passed with type unsigned int, because that is what the non-GCC
+ definitions require. With GCC, __builtin_memcpy takes an arg
+ of type size_t, but it can handle unsigned int. */
+
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
#else /* not GNU C or C++ */
__yy_memcpy (to, from, count)
char *to;
char *from;
- int count;
+ unsigned int count;
{
register char *f = from;
register char *t = to;
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
-__yy_memcpy (char *to, char *from, int count)
+__yy_memcpy (char *to, char *from, unsigned int count)
{
- register char *f = from;
register char *t = to;
+ register char *f = from;
register int i = count;
while (i-- > 0)
#endif
#endif
\f
-#line 196 "/home/apbianco/install/intel-java-alpha/install-x86//share/bison.simple"
+#line 217 "/usr/lib/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
#define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */
+/* Prevent warning if -Wstrict-prototypes. */
+#ifdef __GNUC__
+#ifdef YYPARSE_PARAM
+int yyparse (void *);
+#else
+int yyparse (void);
+#endif
+#endif
+
int
yyparse(YYPARSE_PARAM_ARG)
YYPARSE_PARAM_DECL
#endif
int yystacksize = YYINITDEPTH;
+ int yyfree_stacks = 0;
#ifdef YYPURE
int yychar;
if (yystacksize >= YYMAXDEPTH)
{
yyerror("parser stack overflow");
+ if (yyfree_stacks)
+ {
+ free (yyss);
+ free (yyvs);
+#ifdef YYLSP_NEEDED
+ free (yyls);
+#endif
+ }
return 2;
}
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
- yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
- __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
- yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
- __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
+#ifndef YYSTACK_USE_ALLOCA
+ yyfree_stacks = 1;
+#endif
+ yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
+ __yy_memcpy ((char *)yyss, (char *)yyss1,
+ size * (unsigned int) sizeof (*yyssp));
+ yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
+ __yy_memcpy ((char *)yyvs, (char *)yyvs1,
+ size * (unsigned int) sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
- yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
- __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
+ yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
+ __yy_memcpy ((char *)yyls, (char *)yyls1,
+ size * (unsigned int) sizeof (*yylsp));
#endif
#endif /* no yyoverflow */
switch (yyn) {
case 1:
-#line 575 "./parse.y"
+#line 579 "./parse.y"
{;
break;}
case 18:
-#line 619 "./parse.y"
+#line 623 "./parse.y"
{
yyval.node = build_java_array_type (yyvsp[-2].node, -1);
CLASS_LOADED_P (yyval.node) = 1;
;
break;}
case 19:
-#line 624 "./parse.y"
+#line 628 "./parse.y"
{ yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
break;}
case 20:
-#line 626 "./parse.y"
+#line 630 "./parse.y"
{ yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
break;}
case 21:
-#line 628 "./parse.y"
+#line 632 "./parse.y"
{RULE ("']' expected"); RECOVER;;
break;}
case 22:
-#line 630 "./parse.y"
+#line 634 "./parse.y"
{RULE ("']' expected"); RECOVER;;
break;}
-case 26:
+case 25:
#line 645 "./parse.y"
+{
+ if (strchr (IDENTIFIER_POINTER (EXPR_WFL_NODE (yyval.node)), '$'))
+ parse_error_context (yyval.node, "Invalide name `%s'",
+ IDENTIFIER_POINTER (EXPR_WFL_NODE (yyval.node)));
+ ;
+ break;}
+case 26:
+#line 654 "./parse.y"
{ yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
break;}
case 28:
-#line 654 "./parse.y"
+#line 663 "./parse.y"
{yyval.node = NULL;;
break;}
case 36:
-#line 666 "./parse.y"
+#line 675 "./parse.y"
{
yyval.node = NULL;
;
break;}
case 37:
-#line 670 "./parse.y"
+#line 679 "./parse.y"
{
yyval.node = NULL;
;
break;}
case 40:
-#line 682 "./parse.y"
+#line 691 "./parse.y"
{
ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node);
- package_list = tree_cons (ctxp->package, NULL, package_list);
+ register_package (ctxp->package);
;
break;}
case 41:
-#line 687 "./parse.y"
+#line 696 "./parse.y"
{yyerror ("Missing name"); RECOVER;;
break;}
case 42:
-#line 689 "./parse.y"
+#line 698 "./parse.y"
{yyerror ("';' expected"); RECOVER;;
break;}
case 45:
-#line 699 "./parse.y"
+#line 708 "./parse.y"
{
- tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name;
+ tree name = EXPR_WFL_NODE (yyvsp[-1].node), last_name;
int i = IDENTIFIER_LENGTH (name)-1;
const char *last = &IDENTIFIER_POINTER (name)[i];
while (last != IDENTIFIER_POINTER (name))
IDENTIFIER_POINTER (name),
IDENTIFIER_POINTER (err));
else
- REGISTER_IMPORT (yyvsp[-1].node, last_name)
+ REGISTER_IMPORT (yyvsp[-1].node, last_name);
}
else
REGISTER_IMPORT (yyvsp[-1].node, last_name);
;
break;}
case 46:
-#line 725 "./parse.y"
+#line 734 "./parse.y"
{yyerror ("Missing name"); RECOVER;;
break;}
case 47:
-#line 727 "./parse.y"
+#line 736 "./parse.y"
{yyerror ("';' expected"); RECOVER;;
break;}
case 48:
-#line 732 "./parse.y"
+#line 741 "./parse.y"
{
tree name = EXPR_WFL_NODE (yyvsp[-3].node);
/* Don't import java.lang.* twice. */
if (name != java_lang_id)
{
- tree node = build_tree_list (yyvsp[-3].node, NULL_TREE);
read_import_dir (yyvsp[-3].node);
- TREE_CHAIN (node) = ctxp->import_demand_list;
- ctxp->import_demand_list = node;
+ ctxp->import_demand_list =
+ chainon (ctxp->import_demand_list,
+ build_tree_list (yyvsp[-3].node, NULL_TREE));
}
;
break;}
case 49:
-#line 744 "./parse.y"
+#line 753 "./parse.y"
{yyerror ("'*' expected"); RECOVER;;
break;}
case 50:
-#line 746 "./parse.y"
+#line 755 "./parse.y"
{yyerror ("';' expected"); RECOVER;;
break;}
case 51:
-#line 751 "./parse.y"
+#line 760 "./parse.y"
{ end_class_declaration (0); ;
break;}
case 52:
-#line 753 "./parse.y"
+#line 762 "./parse.y"
{ end_class_declaration (0); ;
break;}
case 53:
-#line 755 "./parse.y"
+#line 764 "./parse.y"
{ yyval.node = NULL; ;
break;}
case 54:
-#line 757 "./parse.y"
+#line 766 "./parse.y"
{
YYERROR_NOW;
yyerror ("Class or interface declaration expected");
;
break;}
case 55:
-#line 768 "./parse.y"
+#line 777 "./parse.y"
{
yyval.value = (1 << yyvsp[0].value);
;
break;}
case 56:
-#line 772 "./parse.y"
+#line 781 "./parse.y"
{
int acc = (1 << yyvsp[0].value);
if (yyval.value & acc)
;
break;}
case 57:
-#line 788 "./parse.y"
+#line 797 "./parse.y"
{ create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 59:
-#line 791 "./parse.y"
+#line 800 "./parse.y"
{ create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 61:
-#line 794 "./parse.y"
+#line 803 "./parse.y"
{yyerror ("Missing class name"); RECOVER;;
break;}
case 62:
-#line 796 "./parse.y"
+#line 805 "./parse.y"
{yyerror ("Missing class name"); RECOVER;;
break;}
case 63:
-#line 798 "./parse.y"
+#line 807 "./parse.y"
{
if (!ctxp->class_err) yyerror ("'{' expected");
DRECOVER(class1);
;
break;}
case 64:
-#line 803 "./parse.y"
+#line 812 "./parse.y"
{if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;;
break;}
case 65:
-#line 807 "./parse.y"
+#line 816 "./parse.y"
{ yyval.node = NULL; ;
break;}
case 66:
-#line 809 "./parse.y"
+#line 818 "./parse.y"
{ yyval.node = yyvsp[0].node; ;
break;}
case 67:
-#line 811 "./parse.y"
+#line 820 "./parse.y"
{yyerror ("'{' expected"); ctxp->class_err=1;;
break;}
case 68:
-#line 813 "./parse.y"
+#line 822 "./parse.y"
{yyerror ("Missing super class name"); ctxp->class_err=1;;
break;}
case 69:
-#line 817 "./parse.y"
+#line 826 "./parse.y"
{ yyval.node = NULL_TREE; ;
break;}
case 70:
-#line 819 "./parse.y"
+#line 828 "./parse.y"
{ yyval.node = yyvsp[0].node; ;
break;}
case 71:
-#line 821 "./parse.y"
+#line 830 "./parse.y"
{
ctxp->class_err=1;
yyerror ("Missing interface name");
;
break;}
case 72:
-#line 829 "./parse.y"
+#line 838 "./parse.y"
{
ctxp->interface_number = 1;
yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
;
break;}
case 73:
-#line 834 "./parse.y"
+#line 843 "./parse.y"
{
ctxp->interface_number++;
yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
;
break;}
case 74:
-#line 839 "./parse.y"
+#line 848 "./parse.y"
{yyerror ("Missing interface name"); RECOVER;;
break;}
case 75:
-#line 844 "./parse.y"
+#line 853 "./parse.y"
{
/* Store the location of the `}' when doing xrefs */
if (flag_emit_xref)
;
break;}
case 76:
-#line 852 "./parse.y"
+#line 861 "./parse.y"
{
/* Store the location of the `}' when doing xrefs */
if (flag_emit_xref)
;
break;}
case 82:
-#line 871 "./parse.y"
+#line 880 "./parse.y"
{
TREE_CHAIN (yyvsp[0].node) = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
SET_CPC_INSTANCE_INITIALIZER_STMT (ctxp, yyvsp[0].node);
;
break;}
case 84:
-#line 880 "./parse.y"
+#line 889 "./parse.y"
{ yyval.node = yyvsp[-1].node; ;
break;}
case 86:
-#line 883 "./parse.y"
+#line 892 "./parse.y"
{ end_class_declaration (1); ;
break;}
case 87:
-#line 885 "./parse.y"
+#line 894 "./parse.y"
{ end_class_declaration (1); ;
break;}
case 88:
-#line 891 "./parse.y"
+#line 900 "./parse.y"
{ register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ;
break;}
case 89:
-#line 893 "./parse.y"
+#line 902 "./parse.y"
{
check_modifiers
("Illegal modifier `%s' for field declaration",
;
break;}
case 91:
-#line 906 "./parse.y"
+#line 915 "./parse.y"
{ yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ;
break;}
case 92:
-#line 908 "./parse.y"
+#line 917 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 93:
-#line 913 "./parse.y"
+#line 922 "./parse.y"
{ yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ;
break;}
case 94:
-#line 915 "./parse.y"
+#line 924 "./parse.y"
{
if (java_error_count)
yyvsp[0].node = NULL_TREE;
;
break;}
case 95:
-#line 922 "./parse.y"
+#line 931 "./parse.y"
{
yyerror ("Missing variable initializer");
yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE);
;
break;}
case 96:
-#line 928 "./parse.y"
+#line 937 "./parse.y"
{
yyerror ("';' expected");
yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE);
;
break;}
case 98:
-#line 938 "./parse.y"
+#line 947 "./parse.y"
{ yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
break;}
case 99:
-#line 940 "./parse.y"
+#line 949 "./parse.y"
{yyerror ("Invalid declaration"); DRECOVER(vdi);;
break;}
case 100:
-#line 942 "./parse.y"
+#line 951 "./parse.y"
{yyerror ("']' expected"); DRECOVER(vdi);;
break;}
case 101:
-#line 944 "./parse.y"
+#line 953 "./parse.y"
{yyerror ("Unbalanced ']'"); DRECOVER(vdi);;
break;}
case 104:
-#line 955 "./parse.y"
+#line 964 "./parse.y"
{
current_function_decl = yyvsp[0].node;
if (current_function_decl
;
break;}
case 105:
-#line 964 "./parse.y"
+#line 973 "./parse.y"
{ finish_method_declaration (yyvsp[0].node); ;
break;}
case 106:
-#line 966 "./parse.y"
+#line 975 "./parse.y"
{YYNOT_TWICE yyerror ("'{' expected"); RECOVER;;
break;}
case 107:
-#line 971 "./parse.y"
+#line 980 "./parse.y"
{ yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 108:
-#line 973 "./parse.y"
+#line 982 "./parse.y"
{ yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 109:
-#line 975 "./parse.y"
+#line 984 "./parse.y"
{ yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 110:
-#line 977 "./parse.y"
+#line 986 "./parse.y"
{ yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 111:
-#line 979 "./parse.y"
+#line 988 "./parse.y"
{
yyerror ("Invalid method declaration, method name required");
RECOVER;
;
break;}
case 112:
-#line 984 "./parse.y"
+#line 993 "./parse.y"
{RECOVER;;
break;}
case 113:
-#line 986 "./parse.y"
+#line 995 "./parse.y"
{yyerror ("Identifier expected"); RECOVER;;
break;}
case 114:
-#line 988 "./parse.y"
+#line 997 "./parse.y"
{yyerror ("Identifier expected"); RECOVER;;
break;}
case 115:
-#line 990 "./parse.y"
+#line 999 "./parse.y"
{
yyerror ("Invalid method declaration, return type required");
RECOVER;
;
break;}
case 116:
-#line 998 "./parse.y"
+#line 1007 "./parse.y"
{
ctxp->formal_parameter_number = 0;
yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE);
;
break;}
case 117:
-#line 1003 "./parse.y"
+#line 1012 "./parse.y"
{ yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
break;}
case 118:
-#line 1005 "./parse.y"
+#line 1014 "./parse.y"
{
EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location;
TREE_PURPOSE (yyvsp[-2].node) =
;
break;}
case 119:
-#line 1014 "./parse.y"
+#line 1023 "./parse.y"
{yyerror ("')' expected"); DRECOVER(method_declarator);;
break;}
case 120:
-#line 1016 "./parse.y"
+#line 1025 "./parse.y"
{yyerror ("']' expected"); RECOVER;;
break;}
case 121:
-#line 1021 "./parse.y"
+#line 1030 "./parse.y"
{
ctxp->formal_parameter_number = 1;
;
break;}
case 122:
-#line 1025 "./parse.y"
+#line 1034 "./parse.y"
{
ctxp->formal_parameter_number += 1;
yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 123:
-#line 1030 "./parse.y"
+#line 1039 "./parse.y"
{ yyerror ("Missing formal parameter term"); RECOVER; ;
break;}
case 124:
-#line 1035 "./parse.y"
+#line 1044 "./parse.y"
{
yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
;
break;}
case 125:
-#line 1039 "./parse.y"
+#line 1048 "./parse.y"
{
yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
ARG_FINAL_P (yyval.node) = 1;
;
break;}
case 126:
-#line 1044 "./parse.y"
+#line 1053 "./parse.y"
{
yyerror ("Missing identifier"); RECOVER;
yyval.node = NULL_TREE;
;
break;}
case 127:
-#line 1049 "./parse.y"
+#line 1058 "./parse.y"
{
yyerror ("Missing identifier"); RECOVER;
yyval.node = NULL_TREE;
;
break;}
case 128:
-#line 1057 "./parse.y"
+#line 1066 "./parse.y"
{
check_modifiers ("Illegal modifier `%s'. Only `final' was expected here",
yyvsp[0].value, ACC_FINAL);
;
break;}
case 129:
-#line 1066 "./parse.y"
+#line 1075 "./parse.y"
{ yyval.node = NULL_TREE; ;
break;}
case 130:
-#line 1068 "./parse.y"
+#line 1077 "./parse.y"
{ yyval.node = yyvsp[0].node; ;
break;}
case 131:
-#line 1070 "./parse.y"
+#line 1079 "./parse.y"
{yyerror ("Missing class type term"); RECOVER;;
break;}
case 132:
-#line 1075 "./parse.y"
+#line 1084 "./parse.y"
{ yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ;
break;}
case 133:
-#line 1077 "./parse.y"
+#line 1086 "./parse.y"
{ yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ;
break;}
case 134:
-#line 1079 "./parse.y"
+#line 1088 "./parse.y"
{yyerror ("Missing class type term"); RECOVER;;
break;}
case 137:
-#line 1086 "./parse.y"
+#line 1095 "./parse.y"
{ yyval.node = NULL_TREE; ;
break;}
case 138:
-#line 1092 "./parse.y"
+#line 1101 "./parse.y"
{
TREE_CHAIN (yyvsp[0].node) = CPC_STATIC_INITIALIZER_STMT (ctxp);
SET_CPC_STATIC_INITIALIZER_STMT (ctxp, yyvsp[0].node);
;
break;}
case 139:
-#line 1097 "./parse.y"
+#line 1106 "./parse.y"
{
TREE_CHAIN (yyvsp[-1].node) = CPC_STATIC_INITIALIZER_STMT (ctxp);
SET_CPC_STATIC_INITIALIZER_STMT (ctxp, yyvsp[-1].node);
;
break;}
case 140:
-#line 1105 "./parse.y"
+#line 1114 "./parse.y"
{
check_modifiers ("Illegal modifier `%s' for static initializer", yyvsp[0].value, ACC_STATIC);
/* Can't have a static initializer in an innerclass */
;
break;}
case 141:
-#line 1121 "./parse.y"
+#line 1130 "./parse.y"
{
current_function_decl = yyvsp[0].node;
source_start_java_method (current_function_decl);
;
break;}
case 142:
-#line 1126 "./parse.y"
+#line 1135 "./parse.y"
{ finish_method_declaration (yyvsp[0].node); ;
break;}
case 143:
-#line 1131 "./parse.y"
+#line 1140 "./parse.y"
{ yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 144:
-#line 1133 "./parse.y"
+#line 1142 "./parse.y"
{ yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 145:
-#line 1138 "./parse.y"
+#line 1147 "./parse.y"
{
ctxp->formal_parameter_number = 0;
yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE);
;
break;}
case 146:
-#line 1143 "./parse.y"
+#line 1152 "./parse.y"
{ yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
break;}
case 147:
-#line 1151 "./parse.y"
+#line 1160 "./parse.y"
{
BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node;
yyval.node = yyvsp[0].node;
;
break;}
case 148:
-#line 1156 "./parse.y"
+#line 1165 "./parse.y"
{ yyval.node = yyvsp[0].node; ;
break;}
case 149:
-#line 1158 "./parse.y"
+#line 1167 "./parse.y"
{ yyval.node = yyvsp[0].node; ;
break;}
case 150:
-#line 1160 "./parse.y"
+#line 1169 "./parse.y"
{ yyval.node = yyvsp[0].node; ;
break;}
case 153:
-#line 1170 "./parse.y"
+#line 1179 "./parse.y"
{
yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE);
yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node);
;
break;}
case 154:
-#line 1176 "./parse.y"
+#line 1185 "./parse.y"
{
yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node);
yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node);
;
break;}
case 155:
-#line 1184 "./parse.y"
+#line 1193 "./parse.y"
{yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
break;}
case 156:
-#line 1186 "./parse.y"
+#line 1195 "./parse.y"
{yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
break;}
case 157:
-#line 1191 "./parse.y"
+#line 1200 "./parse.y"
{
tree wfl = build_wfl_node (this_identifier_node);
EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
;
break;}
case 158:
-#line 1197 "./parse.y"
+#line 1206 "./parse.y"
{
tree wfl = build_wfl_node (super_identifier_node);
EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
;
break;}
case 159:
-#line 1208 "./parse.y"
+#line 1217 "./parse.y"
{ create_interface (0, yyvsp[0].node, NULL_TREE); ;
break;}
case 161:
-#line 1211 "./parse.y"
+#line 1220 "./parse.y"
{ create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ;
break;}
case 163:
-#line 1214 "./parse.y"
+#line 1223 "./parse.y"
{ create_interface (0, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 165:
-#line 1217 "./parse.y"
+#line 1226 "./parse.y"
{ create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 167:
-#line 1220 "./parse.y"
+#line 1229 "./parse.y"
{yyerror ("'{' expected"); RECOVER;;
break;}
case 168:
-#line 1222 "./parse.y"
+#line 1231 "./parse.y"
{yyerror ("'{' expected"); RECOVER;;
break;}
case 169:
-#line 1227 "./parse.y"
+#line 1236 "./parse.y"
{
ctxp->interface_number = 1;
yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
;
break;}
case 170:
-#line 1232 "./parse.y"
+#line 1241 "./parse.y"
{
ctxp->interface_number++;
yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
;
break;}
case 171:
-#line 1237 "./parse.y"
+#line 1246 "./parse.y"
{yyerror ("Invalid interface type"); RECOVER;;
break;}
case 172:
-#line 1239 "./parse.y"
+#line 1248 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 173:
-#line 1244 "./parse.y"
+#line 1253 "./parse.y"
{ yyval.node = NULL_TREE; ;
break;}
case 174:
-#line 1246 "./parse.y"
+#line 1255 "./parse.y"
{ yyval.node = NULL_TREE; ;
break;}
case 179:
-#line 1258 "./parse.y"
+#line 1267 "./parse.y"
{ end_class_declaration (1); ;
break;}
case 180:
-#line 1260 "./parse.y"
+#line 1269 "./parse.y"
{ end_class_declaration (1); ;
break;}
case 182:
-#line 1269 "./parse.y"
+#line 1278 "./parse.y"
{
check_abstract_method_header (yyvsp[-1].node);
current_function_decl = NULL_TREE; /* FIXME ? */
;
break;}
case 183:
-#line 1274 "./parse.y"
+#line 1283 "./parse.y"
{yyerror ("';' expected"); RECOVER;;
break;}
case 184:
-#line 1280 "./parse.y"
+#line 1289 "./parse.y"
{ yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ;
break;}
case 185:
-#line 1282 "./parse.y"
+#line 1291 "./parse.y"
{ yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ;
break;}
case 186:
-#line 1284 "./parse.y"
+#line 1293 "./parse.y"
{ yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ;
break;}
case 187:
-#line 1289 "./parse.y"
+#line 1298 "./parse.y"
{
yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node),
yyvsp[0].node, NULL_TREE);
;
break;}
case 188:
-#line 1294 "./parse.y"
+#line 1303 "./parse.y"
{
yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node);
;
break;}
case 189:
-#line 1298 "./parse.y"
+#line 1307 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 190:
-#line 1304 "./parse.y"
+#line 1313 "./parse.y"
{
/* Store the location of the `}' when doing xrefs */
if (current_function_decl && flag_emit_xref)
;
break;}
case 191:
-#line 1312 "./parse.y"
+#line 1321 "./parse.y"
{ yyval.node = yyvsp[0].node; ;
break;}
case 192:
-#line 1317 "./parse.y"
+#line 1326 "./parse.y"
{ enter_block (); ;
break;}
case 193:
-#line 1322 "./parse.y"
+#line 1331 "./parse.y"
{
maybe_absorb_scoping_blocks ();
/* Store the location of the `}' when doing xrefs */
DECL_END_SOURCE_LINE (current_function_decl) =
EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
yyval.node = exit_block ();
+ if (!BLOCK_SUBBLOCKS (yyval.node))
+ BLOCK_SUBBLOCKS (yyval.node) = empty_stmt_node;
;
break;}
case 197:
-#line 1340 "./parse.y"
+#line 1351 "./parse.y"
{ java_method_add_stmt (current_function_decl, yyvsp[0].node); ;
break;}
case 198:
-#line 1342 "./parse.y"
+#line 1353 "./parse.y"
{
LOCAL_CLASS_P (TREE_TYPE (GET_CPC ())) = 1;
end_class_declaration (1);
;
break;}
case 200:
-#line 1354 "./parse.y"
+#line 1365 "./parse.y"
{ declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 201:
-#line 1356 "./parse.y"
+#line 1367 "./parse.y"
{ declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 207:
-#line 1366 "./parse.y"
+#line 1377 "./parse.y"
{ yyval.node = exit_block (); ;
break;}
case 212:
-#line 1375 "./parse.y"
+#line 1386 "./parse.y"
{ yyval.node = exit_block (); ;
break;}
case 224:
-#line 1394 "./parse.y"
+#line 1405 "./parse.y"
{ yyval.node = empty_stmt_node; ;
break;}
case 225:
-#line 1399 "./parse.y"
+#line 1410 "./parse.y"
{
yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node),
EXPR_WFL_NODE (yyvsp[-1].node));
;
break;}
case 226:
-#line 1410 "./parse.y"
+#line 1421 "./parse.y"
{ yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 227:
-#line 1412 "./parse.y"
+#line 1423 "./parse.y"
{yyerror ("':' expected"); RECOVER;;
break;}
case 228:
-#line 1417 "./parse.y"
+#line 1428 "./parse.y"
{ yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 229:
-#line 1424 "./parse.y"
+#line 1435 "./parse.y"
{
/* We have a statement. Generate a WFL around it so
we can debug it */
;
break;}
case 230:
-#line 1433 "./parse.y"
+#line 1444 "./parse.y"
{
if (ctxp->prevent_ese != lineno)
yyerror ("Invalid expression statement");
;
break;}
case 231:
-#line 1439 "./parse.y"
+#line 1450 "./parse.y"
{
if (ctxp->prevent_ese != lineno)
yyerror ("Invalid expression statement");
;
break;}
case 232:
-#line 1445 "./parse.y"
+#line 1456 "./parse.y"
{
if (ctxp->prevent_ese != lineno)
yyerror ("Invalid expression statement");
;
break;}
case 233:
-#line 1451 "./parse.y"
+#line 1462 "./parse.y"
{yyerror ("')' expected"); RECOVER;;
break;}
case 234:
-#line 1453 "./parse.y"
+#line 1464 "./parse.y"
{
parse_ctor_invocation_error ();
RECOVER;
;
break;}
case 235:
-#line 1458 "./parse.y"
+#line 1469 "./parse.y"
{yyerror ("')' expected"); RECOVER;;
break;}
case 236:
-#line 1460 "./parse.y"
+#line 1471 "./parse.y"
{
parse_ctor_invocation_error ();
RECOVER;
;
break;}
case 237:
-#line 1465 "./parse.y"
+#line 1476 "./parse.y"
{yyerror ("'(' expected"); RECOVER;;
break;}
case 238:
-#line 1467 "./parse.y"
+#line 1478 "./parse.y"
{yyerror ("')' expected"); RECOVER;;
break;}
case 239:
-#line 1469 "./parse.y"
+#line 1480 "./parse.y"
{yyerror ("')' expected"); RECOVER;;
break;}
case 240:
-#line 1471 "./parse.y"
+#line 1482 "./parse.y"
{yyerror ("';' expected"); RECOVER;;
break;}
case 241:
-#line 1473 "./parse.y"
+#line 1484 "./parse.y"
{yyerror ("';' expected"); RECOVER;;
break;}
case 249:
-#line 1488 "./parse.y"
+#line 1499 "./parse.y"
{
yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node,
yyvsp[0].node, NULL_TREE);
;
break;}
case 250:
-#line 1493 "./parse.y"
+#line 1504 "./parse.y"
{yyerror ("'(' expected"); RECOVER;;
break;}
case 251:
-#line 1495 "./parse.y"
+#line 1506 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 252:
-#line 1497 "./parse.y"
+#line 1508 "./parse.y"
{yyerror ("')' expected"); RECOVER;;
break;}
case 253:
-#line 1502 "./parse.y"
+#line 1513 "./parse.y"
{ yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
break;}
case 254:
-#line 1507 "./parse.y"
+#line 1518 "./parse.y"
{ yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
break;}
case 255:
-#line 1512 "./parse.y"
+#line 1523 "./parse.y"
{
enter_block ();
;
break;}
case 256:
-#line 1516 "./parse.y"
+#line 1527 "./parse.y"
{
/* Make into "proper list" of COMPOUND_EXPRs.
I.e. make the last statment also have its own
;
break;}
case 257:
-#line 1528 "./parse.y"
+#line 1539 "./parse.y"
{
yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE);
EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
;
break;}
case 258:
-#line 1533 "./parse.y"
+#line 1544 "./parse.y"
{yyerror ("'(' expected"); RECOVER;;
break;}
case 259:
-#line 1535 "./parse.y"
+#line 1546 "./parse.y"
{yyerror ("Missing term or ')'"); DRECOVER(switch_statement);;
break;}
case 260:
-#line 1537 "./parse.y"
+#line 1548 "./parse.y"
{yyerror ("'{' expected"); RECOVER;;
break;}
case 261:
-#line 1545 "./parse.y"
+#line 1556 "./parse.y"
{ yyval.node = NULL_TREE; ;
break;}
case 262:
-#line 1547 "./parse.y"
+#line 1558 "./parse.y"
{ yyval.node = NULL_TREE; ;
break;}
case 263:
-#line 1549 "./parse.y"
+#line 1560 "./parse.y"
{ yyval.node = NULL_TREE; ;
break;}
case 264:
-#line 1551 "./parse.y"
+#line 1562 "./parse.y"
{ yyval.node = NULL_TREE; ;
break;}
case 270:
-#line 1570 "./parse.y"
+#line 1581 "./parse.y"
{
tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node);
EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location;
;
break;}
case 271:
-#line 1576 "./parse.y"
+#line 1587 "./parse.y"
{
tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location;
;
break;}
case 272:
-#line 1582 "./parse.y"
+#line 1593 "./parse.y"
{yyerror ("Missing or invalid constant expression"); RECOVER;;
break;}
case 273:
-#line 1584 "./parse.y"
+#line 1595 "./parse.y"
{yyerror ("':' expected"); RECOVER;;
break;}
case 274:
-#line 1586 "./parse.y"
+#line 1597 "./parse.y"
{yyerror ("':' expected"); RECOVER;;
break;}
case 275:
-#line 1591 "./parse.y"
+#line 1602 "./parse.y"
{
tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0);
yyval.node = build_new_loop (body);
;
break;}
case 276:
-#line 1599 "./parse.y"
+#line 1610 "./parse.y"
{ yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
break;}
case 277:
-#line 1601 "./parse.y"
+#line 1612 "./parse.y"
{YYERROR_NOW; yyerror ("'(' expected"); RECOVER;;
break;}
case 278:
-#line 1603 "./parse.y"
+#line 1614 "./parse.y"
{yyerror ("Missing term and ')' expected"); RECOVER;;
break;}
case 279:
-#line 1605 "./parse.y"
+#line 1616 "./parse.y"
{yyerror ("')' expected"); RECOVER;;
break;}
case 280:
-#line 1610 "./parse.y"
+#line 1621 "./parse.y"
{ yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
break;}
case 281:
-#line 1615 "./parse.y"
+#line 1626 "./parse.y"
{
tree body = build_loop_body (0, NULL_TREE, 1);
yyval.node = build_new_loop (body);
;
break;}
case 282:
-#line 1624 "./parse.y"
+#line 1635 "./parse.y"
{ yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ;
break;}
case 283:
-#line 1629 "./parse.y"
-{ yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
+#line 1640 "./parse.y"
+{
+ if (TREE_CODE_CLASS (TREE_CODE (yyvsp[-4].node)) == 'c')
+ yyvsp[-4].node = build_wfl_node (yyvsp[-4].node);
+ yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
+ ;
break;}
case 284:
-#line 1631 "./parse.y"
+#line 1646 "./parse.y"
{
yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
/* We have not condition, so we get rid of the EXIT_EXPR */
;
break;}
case 285:
-#line 1638 "./parse.y"
+#line 1653 "./parse.y"
{yyerror ("Invalid control expression"); RECOVER;;
break;}
case 286:
-#line 1640 "./parse.y"
+#line 1655 "./parse.y"
{yyerror ("Invalid update expression"); RECOVER;;
break;}
case 287:
-#line 1642 "./parse.y"
+#line 1657 "./parse.y"
{yyerror ("Invalid update expression"); RECOVER;;
break;}
case 288:
-#line 1647 "./parse.y"
+#line 1662 "./parse.y"
{ yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
break;}
case 289:
-#line 1649 "./parse.y"
+#line 1664 "./parse.y"
{
yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
/* We have not condition, so we get rid of the EXIT_EXPR */
;
break;}
case 290:
-#line 1659 "./parse.y"
+#line 1674 "./parse.y"
{
/* This scope defined for local variable that may be
defined within the scope of the for loop */
;
break;}
case 291:
-#line 1665 "./parse.y"
+#line 1680 "./parse.y"
{yyerror ("'(' expected"); DRECOVER(for_1);;
break;}
case 292:
-#line 1667 "./parse.y"
+#line 1682 "./parse.y"
{yyerror ("Invalid init statement"); RECOVER;;
break;}
case 293:
-#line 1672 "./parse.y"
+#line 1687 "./parse.y"
{
/* We now declare the loop body. The loop is
declared as a for loop. */
;
break;}
case 294:
-#line 1684 "./parse.y"
+#line 1699 "./parse.y"
{ yyval.node = empty_stmt_node; ;
break;}
case 295:
-#line 1686 "./parse.y"
+#line 1701 "./parse.y"
{
/* Init statement recorded within the previously
defined block scope */
;
break;}
case 296:
-#line 1692 "./parse.y"
+#line 1707 "./parse.y"
{
/* Local variable are recorded within the previously
defined block scope */
;
break;}
case 297:
-#line 1698 "./parse.y"
+#line 1713 "./parse.y"
{yyerror ("';' expected"); DRECOVER(for_init_1);;
break;}
case 298:
-#line 1702 "./parse.y"
+#line 1717 "./parse.y"
{yyval.node = empty_stmt_node;;
break;}
case 299:
-#line 1704 "./parse.y"
+#line 1719 "./parse.y"
{ yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ;
break;}
case 300:
-#line 1709 "./parse.y"
+#line 1724 "./parse.y"
{ yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ;
break;}
case 301:
-#line 1711 "./parse.y"
+#line 1726 "./parse.y"
{ yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ;
break;}
case 302:
-#line 1713 "./parse.y"
+#line 1728 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 303:
-#line 1718 "./parse.y"
+#line 1733 "./parse.y"
{ yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ;
break;}
case 304:
-#line 1720 "./parse.y"
+#line 1735 "./parse.y"
{ yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ;
break;}
case 305:
-#line 1722 "./parse.y"
+#line 1737 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 306:
-#line 1724 "./parse.y"
+#line 1739 "./parse.y"
{yyerror ("';' expected"); RECOVER;;
break;}
case 307:
-#line 1729 "./parse.y"
+#line 1744 "./parse.y"
{ yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ;
break;}
case 308:
-#line 1731 "./parse.y"
+#line 1746 "./parse.y"
{ yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ;
break;}
case 309:
-#line 1733 "./parse.y"
+#line 1748 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 310:
-#line 1735 "./parse.y"
+#line 1750 "./parse.y"
{yyerror ("';' expected"); RECOVER;;
break;}
case 311:
-#line 1740 "./parse.y"
+#line 1755 "./parse.y"
{ yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ;
break;}
case 312:
-#line 1742 "./parse.y"
+#line 1757 "./parse.y"
{ yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ;
break;}
case 313:
-#line 1744 "./parse.y"
+#line 1759 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 314:
-#line 1746 "./parse.y"
+#line 1761 "./parse.y"
{yyerror ("';' expected"); RECOVER;;
break;}
case 315:
-#line 1751 "./parse.y"
+#line 1766 "./parse.y"
{
yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node);
EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
;
break;}
case 316:
-#line 1756 "./parse.y"
+#line 1771 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 317:
-#line 1758 "./parse.y"
+#line 1773 "./parse.y"
{yyerror ("';' expected"); RECOVER;;
break;}
case 318:
-#line 1763 "./parse.y"
+#line 1778 "./parse.y"
{
yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
EXPR_WFL_LINECOL (yyval.node) =
;
break;}
case 319:
-#line 1769 "./parse.y"
+#line 1784 "./parse.y"
{yyerror ("'{' expected"); RECOVER;;
break;}
case 320:
-#line 1771 "./parse.y"
+#line 1786 "./parse.y"
{yyerror ("'(' expected"); RECOVER;;
break;}
case 321:
-#line 1773 "./parse.y"
+#line 1788 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 322:
-#line 1775 "./parse.y"
+#line 1790 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 323:
-#line 1780 "./parse.y"
+#line 1795 "./parse.y"
{
check_modifiers (
"Illegal modifier `%s'. Only `synchronized' was expected here",
;
break;}
case 324:
-#line 1792 "./parse.y"
+#line 1807 "./parse.y"
{ yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 325:
-#line 1794 "./parse.y"
+#line 1809 "./parse.y"
{ yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
break;}
case 326:
-#line 1796 "./parse.y"
+#line 1811 "./parse.y"
{ yyval.node = build_try_finally_statement
(yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location,
yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node);
;
break;}
case 327:
-#line 1801 "./parse.y"
+#line 1816 "./parse.y"
{yyerror ("'{' expected"); DRECOVER (try_statement);;
break;}
case 329:
-#line 1807 "./parse.y"
+#line 1822 "./parse.y"
{
TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node;
yyval.node = yyvsp[0].node;
;
break;}
case 330:
-#line 1815 "./parse.y"
+#line 1830 "./parse.y"
{
java_method_add_stmt (current_function_decl, yyvsp[0].node);
exit_block ();
;
break;}
case 331:
-#line 1823 "./parse.y"
+#line 1838 "./parse.y"
{
/* We add a block to define a scope for
formal_parameter (CCBP). The formal parameter is
;
break;}
case 332:
-#line 1839 "./parse.y"
+#line 1854 "./parse.y"
{yyerror ("'(' expected"); RECOVER; yyval.node = NULL_TREE;;
break;}
case 333:
-#line 1841 "./parse.y"
+#line 1856 "./parse.y"
{
yyerror ("Missing term or ')' expected");
RECOVER; yyval.node = NULL_TREE;
;
break;}
case 334:
-#line 1846 "./parse.y"
+#line 1861 "./parse.y"
{yyerror ("Missing term"); RECOVER; yyval.node = NULL_TREE;;
break;}
case 335:
-#line 1851 "./parse.y"
+#line 1866 "./parse.y"
{ yyval.node = yyvsp[0].node; ;
break;}
case 336:
-#line 1853 "./parse.y"
+#line 1868 "./parse.y"
{yyerror ("'{' expected"); RECOVER; ;
break;}
case 340:
-#line 1865 "./parse.y"
+#line 1880 "./parse.y"
{ yyval.node = build_this (yyvsp[0].operator.location); ;
break;}
case 341:
-#line 1867 "./parse.y"
+#line 1882 "./parse.y"
{yyval.node = yyvsp[-1].node;;
break;}
case 347:
-#line 1877 "./parse.y"
+#line 1892 "./parse.y"
{
tree wfl = build_wfl_node (this_identifier_node);
yyval.node = make_qualified_primary (yyvsp[-2].node, wfl, EXPR_WFL_LINECOL (yyvsp[-2].node));
;
break;}
case 348:
-#line 1882 "./parse.y"
+#line 1897 "./parse.y"
{yyerror ("')' expected"); RECOVER;;
break;}
case 349:
-#line 1884 "./parse.y"
+#line 1899 "./parse.y"
{yyerror ("'class' or 'this' expected" ); RECOVER;;
break;}
case 350:
-#line 1886 "./parse.y"
+#line 1901 "./parse.y"
{yyerror ("'class' expected" ); RECOVER;;
break;}
case 351:
-#line 1888 "./parse.y"
+#line 1903 "./parse.y"
{yyerror ("'class' expected" ); RECOVER;;
break;}
case 352:
-#line 1896 "./parse.y"
+#line 1911 "./parse.y"
{
yyval.node = build_java_array_type (yyvsp[-2].node, -1);
CLASS_LOADED_P (yyval.node) = 1;
;
break;}
case 353:
-#line 1901 "./parse.y"
+#line 1916 "./parse.y"
{ yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
break;}
case 354:
-#line 1911 "./parse.y"
+#line 1926 "./parse.y"
{ yyval.node = build_incomplete_class_ref (yyvsp[-1].operator.location, yyvsp[-2].node); ;
break;}
case 355:
-#line 1913 "./parse.y"
+#line 1928 "./parse.y"
{ yyval.node = build_incomplete_class_ref (yyvsp[-1].operator.location, yyvsp[-2].node); ;
break;}
case 356:
-#line 1915 "./parse.y"
+#line 1930 "./parse.y"
{ yyval.node = build_class_ref (yyvsp[-2].node); ;
break;}
case 357:
-#line 1917 "./parse.y"
+#line 1932 "./parse.y"
{ yyval.node = build_class_ref (void_type_node); ;
break;}
case 358:
-#line 1922 "./parse.y"
+#line 1937 "./parse.y"
{ yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
break;}
case 359:
-#line 1924 "./parse.y"
+#line 1939 "./parse.y"
{ yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ;
break;}
case 361:
-#line 1930 "./parse.y"
+#line 1945 "./parse.y"
{
tree ctor = build_new_invocation (yyvsp[-2].node, NULL_TREE);
yyval.node = make_qualified_primary (yyvsp[-3].node, ctor,
;
break;}
case 363:
-#line 1937 "./parse.y"
+#line 1952 "./parse.y"
{
tree ctor = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node);
yyval.node = make_qualified_primary (yyvsp[-4].node, ctor,
;
break;}
case 365:
-#line 1944 "./parse.y"
+#line 1959 "./parse.y"
{yyerror ("'(' expected"); DRECOVER(new_1);;
break;}
case 366:
-#line 1946 "./parse.y"
+#line 1961 "./parse.y"
{yyerror ("'(' expected"); RECOVER;;
break;}
case 367:
-#line 1948 "./parse.y"
+#line 1963 "./parse.y"
{yyerror ("')' or term expected"); RECOVER;;
break;}
case 368:
-#line 1950 "./parse.y"
+#line 1965 "./parse.y"
{yyerror ("')' expected"); RECOVER;;
break;}
case 369:
-#line 1952 "./parse.y"
+#line 1967 "./parse.y"
{YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;;
break;}
case 370:
-#line 1954 "./parse.y"
+#line 1969 "./parse.y"
{yyerror ("'(' expected"); RECOVER;;
break;}
case 371:
-#line 1964 "./parse.y"
+#line 1979 "./parse.y"
{ create_anonymous_class (yyvsp[-4].operator.location, yyvsp[-3].node); ;
break;}
case 372:
-#line 1966 "./parse.y"
+#line 1981 "./parse.y"
{
tree id = build_wfl_node (DECL_NAME (GET_CPC ()));
EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL (yyvsp[-5].node);
;
break;}
case 373:
-#line 1997 "./parse.y"
+#line 2012 "./parse.y"
{ create_anonymous_class (yyvsp[-3].operator.location, yyvsp[-2].node); ;
break;}
case 374:
-#line 1999 "./parse.y"
+#line 2014 "./parse.y"
{
tree id = build_wfl_node (DECL_NAME (GET_CPC ()));
EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL (yyvsp[-4].node);
;
break;}
case 375:
-#line 2015 "./parse.y"
+#line 2030 "./parse.y"
{ yyval.node = yyvsp[-2].node; ;
break;}
case 376:
-#line 2017 "./parse.y"
+#line 2032 "./parse.y"
{ yyval.node = yyvsp[-2].node; ;
break;}
case 377:
-#line 2022 "./parse.y"
+#line 2037 "./parse.y"
{
yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE);
ctxp->formal_parameter_number = 1;
;
break;}
case 378:
-#line 2027 "./parse.y"
+#line 2042 "./parse.y"
{
ctxp->formal_parameter_number += 1;
yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node);
;
break;}
case 379:
-#line 2032 "./parse.y"
+#line 2047 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 380:
-#line 2037 "./parse.y"
+#line 2052 "./parse.y"
{ yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
break;}
case 381:
-#line 2039 "./parse.y"
+#line 2054 "./parse.y"
{ yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
break;}
case 382:
-#line 2041 "./parse.y"
+#line 2056 "./parse.y"
{ yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
break;}
case 383:
-#line 2043 "./parse.y"
+#line 2058 "./parse.y"
{ yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
break;}
case 384:
-#line 2047 "./parse.y"
+#line 2062 "./parse.y"
{
char *sig;
while (CURRENT_OSB (ctxp)--)
;
break;}
case 385:
-#line 2056 "./parse.y"
+#line 2071 "./parse.y"
{
tree type = yyvsp[-2].node;
while (CURRENT_OSB (ctxp)--)
;
break;}
case 386:
-#line 2064 "./parse.y"
+#line 2079 "./parse.y"
{yyerror ("'[' expected"); DRECOVER ("]");;
break;}
case 387:
-#line 2066 "./parse.y"
+#line 2081 "./parse.y"
{yyerror ("']' expected"); RECOVER;;
break;}
case 388:
-#line 2071 "./parse.y"
+#line 2086 "./parse.y"
{ yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ;
break;}
case 389:
-#line 2073 "./parse.y"
+#line 2088 "./parse.y"
{ yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ;
break;}
case 390:
-#line 2078 "./parse.y"
+#line 2093 "./parse.y"
{
+ if (JNUMERIC_TYPE_P (TREE_TYPE (yyvsp[-1].node)))
+ {
+ yyvsp[-1].node = build_wfl_node (yyvsp[-1].node);
+ TREE_TYPE (yyvsp[-1].node) = NULL_TREE;
+ }
EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location;
yyval.node = yyvsp[-1].node;
;
break;}
case 391:
-#line 2083 "./parse.y"
+#line 2103 "./parse.y"
{yyerror ("']' expected"); RECOVER;;
break;}
case 392:
-#line 2085 "./parse.y"
+#line 2105 "./parse.y"
{
yyerror ("Missing term");
yyerror ("']' expected");
;
break;}
case 393:
-#line 2094 "./parse.y"
+#line 2114 "./parse.y"
{
int allocate = 0;
/* If not initialized, allocate memory for the osb
;
break;}
case 394:
-#line 2120 "./parse.y"
+#line 2140 "./parse.y"
{ CURRENT_OSB (ctxp)++; ;
break;}
case 395:
-#line 2122 "./parse.y"
+#line 2142 "./parse.y"
{ yyerror ("']' expected"); RECOVER;;
break;}
case 396:
-#line 2127 "./parse.y"
+#line 2147 "./parse.y"
{ yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
break;}
case 397:
-#line 2131 "./parse.y"
+#line 2151 "./parse.y"
{
tree super_wfl =
build_wfl_node (super_identifier_node);
;
break;}
case 398:
-#line 2138 "./parse.y"
+#line 2158 "./parse.y"
{yyerror ("Field expected"); DRECOVER (super_field_acces);;
break;}
case 399:
-#line 2143 "./parse.y"
+#line 2163 "./parse.y"
{ yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ;
break;}
case 400:
-#line 2145 "./parse.y"
+#line 2165 "./parse.y"
{ yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
break;}
case 401:
-#line 2147 "./parse.y"
+#line 2167 "./parse.y"
{
if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR)
yyval.node = build_this_super_qualified_invocation
;
break;}
case 402:
-#line 2158 "./parse.y"
+#line 2178 "./parse.y"
{
if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR)
yyval.node = build_this_super_qualified_invocation
;
break;}
case 403:
-#line 2169 "./parse.y"
+#line 2189 "./parse.y"
{
yyval.node = build_this_super_qualified_invocation
(0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location);
;
break;}
case 404:
-#line 2174 "./parse.y"
+#line 2194 "./parse.y"
{
yyval.node = build_this_super_qualified_invocation
(0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location);
;
break;}
case 405:
-#line 2183 "./parse.y"
+#line 2203 "./parse.y"
{ yyerror ("'(' expected"); DRECOVER (method_invocation); ;
break;}
case 406:
-#line 2185 "./parse.y"
+#line 2205 "./parse.y"
{ yyerror ("'(' expected"); DRECOVER (method_invocation); ;
break;}
case 407:
-#line 2190 "./parse.y"
+#line 2210 "./parse.y"
{ yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
break;}
case 408:
-#line 2192 "./parse.y"
+#line 2212 "./parse.y"
{ yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
break;}
case 409:
-#line 2194 "./parse.y"
+#line 2214 "./parse.y"
{
yyerror ("Missing term and ']' expected");
DRECOVER(array_access);
;
break;}
case 410:
-#line 2199 "./parse.y"
+#line 2219 "./parse.y"
{
yyerror ("']' expected");
DRECOVER(array_access);
;
break;}
case 411:
-#line 2204 "./parse.y"
+#line 2224 "./parse.y"
{
yyerror ("Missing term and ']' expected");
DRECOVER(array_access);
;
break;}
case 412:
-#line 2209 "./parse.y"
+#line 2229 "./parse.y"
{
yyerror ("']' expected");
DRECOVER(array_access);
;
break;}
case 417:
-#line 2224 "./parse.y"
+#line 2244 "./parse.y"
{ yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
break;}
case 418:
-#line 2229 "./parse.y"
+#line 2249 "./parse.y"
{ yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
break;}
case 421:
-#line 2236 "./parse.y"
+#line 2256 "./parse.y"
{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
break;}
case 422:
-#line 2238 "./parse.y"
+#line 2258 "./parse.y"
{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
break;}
case 424:
-#line 2241 "./parse.y"
+#line 2261 "./parse.y"
{yyerror ("Missing term"); RECOVER;
break;}
case 425:
-#line 2243 "./parse.y"
+#line 2263 "./parse.y"
{yyerror ("Missing term"); RECOVER;
break;}
case 426:
-#line 2248 "./parse.y"
+#line 2268 "./parse.y"
{yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
break;}
case 427:
-#line 2250 "./parse.y"
+#line 2270 "./parse.y"
{yyerror ("Missing term"); RECOVER;
break;}
case 428:
-#line 2255 "./parse.y"
+#line 2275 "./parse.y"
{yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
break;}
case 429:
-#line 2257 "./parse.y"
+#line 2277 "./parse.y"
{yyerror ("Missing term"); RECOVER;
break;}
case 431:
-#line 2263 "./parse.y"
+#line 2283 "./parse.y"
{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
break;}
case 432:
-#line 2265 "./parse.y"
+#line 2285 "./parse.y"
{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
break;}
case 434:
-#line 2268 "./parse.y"
+#line 2288 "./parse.y"
{yyerror ("Missing term"); RECOVER;
break;}
case 435:
-#line 2270 "./parse.y"
+#line 2290 "./parse.y"
{yyerror ("Missing term"); RECOVER;
break;}
case 436:
-#line 2275 "./parse.y"
+#line 2295 "./parse.y"
{
tree type = yyvsp[-3].node;
while (CURRENT_OSB (ctxp)--)
;
break;}
case 437:
-#line 2283 "./parse.y"
+#line 2303 "./parse.y"
{ yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
break;}
case 438:
-#line 2285 "./parse.y"
+#line 2305 "./parse.y"
{ yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
break;}
case 439:
-#line 2287 "./parse.y"
+#line 2307 "./parse.y"
{
const char *ptr;
while (CURRENT_OSB (ctxp)--)
;
break;}
case 440:
-#line 2300 "./parse.y"
+#line 2320 "./parse.y"
{yyerror ("']' expected, invalid type expression");;
break;}
case 441:
-#line 2302 "./parse.y"
+#line 2322 "./parse.y"
{
if (ctxp->prevent_ese != lineno)
yyerror ("Invalid type expression"); RECOVER;
;
break;}
case 442:
-#line 2308 "./parse.y"
+#line 2328 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 443:
-#line 2310 "./parse.y"
+#line 2330 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 444:
-#line 2312 "./parse.y"
+#line 2332 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 446:
-#line 2318 "./parse.y"
+#line 2338 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token),
yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 447:
-#line 2323 "./parse.y"
+#line 2343 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 448:
-#line 2328 "./parse.y"
+#line 2348 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 449:
-#line 2333 "./parse.y"
+#line 2353 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 450:
-#line 2335 "./parse.y"
+#line 2355 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 451:
-#line 2337 "./parse.y"
+#line 2357 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 453:
-#line 2343 "./parse.y"
+#line 2363 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 454:
-#line 2348 "./parse.y"
+#line 2368 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 455:
-#line 2353 "./parse.y"
+#line 2373 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 456:
-#line 2355 "./parse.y"
+#line 2375 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 458:
-#line 2361 "./parse.y"
+#line 2381 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 459:
-#line 2366 "./parse.y"
+#line 2386 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 460:
-#line 2371 "./parse.y"
+#line 2391 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 461:
-#line 2376 "./parse.y"
+#line 2396 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 462:
-#line 2378 "./parse.y"
+#line 2398 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 463:
-#line 2380 "./parse.y"
+#line 2400 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 465:
-#line 2386 "./parse.y"
+#line 2406 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 466:
-#line 2391 "./parse.y"
+#line 2411 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 467:
-#line 2396 "./parse.y"
+#line 2416 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 468:
-#line 2401 "./parse.y"
+#line 2421 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 469:
-#line 2406 "./parse.y"
+#line 2426 "./parse.y"
{ yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
break;}
case 470:
-#line 2408 "./parse.y"
+#line 2428 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 471:
-#line 2410 "./parse.y"
+#line 2430 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 472:
-#line 2412 "./parse.y"
+#line 2432 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 473:
-#line 2414 "./parse.y"
+#line 2434 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 474:
-#line 2416 "./parse.y"
+#line 2436 "./parse.y"
{yyerror ("Invalid reference type"); RECOVER;;
break;}
case 476:
-#line 2422 "./parse.y"
+#line 2442 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 477:
-#line 2427 "./parse.y"
+#line 2447 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 478:
-#line 2432 "./parse.y"
+#line 2452 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 479:
-#line 2434 "./parse.y"
+#line 2454 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 481:
-#line 2440 "./parse.y"
+#line 2460 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 482:
-#line 2445 "./parse.y"
+#line 2465 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 484:
-#line 2451 "./parse.y"
+#line 2471 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 485:
-#line 2456 "./parse.y"
+#line 2476 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 487:
-#line 2462 "./parse.y"
+#line 2482 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 488:
-#line 2467 "./parse.y"
+#line 2487 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 490:
-#line 2473 "./parse.y"
+#line 2493 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 491:
-#line 2478 "./parse.y"
+#line 2498 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 493:
-#line 2484 "./parse.y"
+#line 2504 "./parse.y"
{
yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
yyvsp[-2].node, yyvsp[0].node);
;
break;}
case 494:
-#line 2489 "./parse.y"
+#line 2509 "./parse.y"
{yyerror ("Missing term"); RECOVER;;
break;}
case 496:
-#line 2495 "./parse.y"
+#line 2515 "./parse.y"
{
yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
;
break;}
case 497:
-#line 2500 "./parse.y"
+#line 2520 "./parse.y"
{
YYERROR_NOW;
yyerror ("Missing term");
;
break;}
case 498:
-#line 2506 "./parse.y"
+#line 2526 "./parse.y"
{yyerror ("Missing term"); DRECOVER (2);;
break;}
case 499:
-#line 2508 "./parse.y"
+#line 2528 "./parse.y"
{yyerror ("Missing term"); DRECOVER (3);;
break;}
case 502:
-#line 2518 "./parse.y"
+#line 2538 "./parse.y"
{ yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
break;}
case 503:
-#line 2520 "./parse.y"
+#line 2540 "./parse.y"
{
if (ctxp->prevent_ese != lineno)
yyerror ("Missing term");
break;}
}
/* the action file gets copied in in place of this dollarsign */
-#line 498 "/home/apbianco/install/intel-java-alpha/install-x86//share/bison.simple"
+#line 543 "/usr/lib/bison.simple"
\f
yyvsp -= yylen;
yyssp -= yylen;
yystate = yyn;
goto yynewstate;
+
+ yyacceptlab:
+ /* YYACCEPT comes here. */
+ if (yyfree_stacks)
+ {
+ free (yyss);
+ free (yyvs);
+#ifdef YYLSP_NEEDED
+ free (yyls);
+#endif
+ }
+ return 0;
+
+ yyabortlab:
+ /* YYABORT comes here. */
+ if (yyfree_stacks)
+ {
+ free (yyss);
+ free (yyvs);
+#ifdef YYLSP_NEEDED
+ free (yyls);
+#endif
+ }
+ return 1;
}
-#line 2546 "./parse.y"
+#line 2566 "./parse.y"
\f
java_parser_context_suspend ()
{
/* This makes debugging through java_debug_context easier */
- static char *name = "<inner buffer context>";
+ static const char *name = "<inner buffer context>";
/* Duplicate the previous context, use it to save the globals we're
interested in */
else
java_error_count++;
- if (elc.col == 0 && msg[1] == ';')
+ if (elc.col == 0 && msg && msg[1] == ';')
{
elc.col = ctxp->p_line->char_col-1;
elc.line = ctxp->p_line->lineno;
const char *msg;
va_list ap;
{
- char *saved, *saved_input_filename;
+ const char *saved, *saved_input_filename;
char buffer [4096];
vsprintf (buffer, msg, ap);
force_error = 1;
sca = (GET_CPC_LIST () ? ACC_STATIC : 0);
}
- /* Inner classes and interfaces can be declared private or protected
+ /* Inner classes can be declared private or protected
within their enclosing classes. */
if (CPC_INNER_P ())
{
}
}
- if (is_interface)
- check_modifiers ("Illegal modifier `%s' for interface declaration",
- flags, INTERFACE_MODIFIERS);
+ if (is_interface)
+ {
+ if (CPC_INNER_P ())
+ uaaf = INTERFACE_INNER_MODIFIERS;
+ else
+ uaaf = INTERFACE_MODIFIERS;
+
+ check_modifiers ("Illegal modifier `%s' for interface declaration",
+ flags, uaaf);
+ }
else
- check_modifiers ("Illegal modifier `%s' for class declaration",
+ check_modifiers ((current_function_decl ?
+ "Illegal modifier `%s' for local class declaration" :
+ "Illegal modifier `%s' for class declaration"),
flags, uaaf|sca|icaf);
return 0;
}
{
tree acc = NULL_TREE, decl = NULL_TREE, ptr;
- for(qual = EXPR_WFL_QUALIFICATION (cl); qual && !decl;
- qual = TREE_CHAIN (qual))
+ for (qual = EXPR_WFL_QUALIFICATION (cl); qual && !decl;
+ qual = TREE_CHAIN (qual))
{
acc = merge_qualified_name (acc,
EXPR_WFL_NODE (TREE_PURPOSE (qual)));
else
qual = build_tree_list (build_expr_wfl (name, NULL, 0, 0), NULL_TREE);
- return find_as_inner_class_do (qual, enclosing);
+ if (!(to_return = find_as_inner_class_do (qual, enclosing)))
+ {
+ /* It might be the case that the enclosing class was loaded as
+ bytecode, in which case it will be missing the
+ DECL_INNER_CLASS_LIST. We build a fully qualified internal
+ innerclass name and we try to load it. */
+ tree fqin = identifier_subst (name, "", '.', '$', "");
+ tree ptr;
+ BUILD_PTR_FROM_NAME (ptr, fqin);
+ to_return = resolve_class (NULL_TREE, ptr, NULL_TREE, cl);
+ }
+ return to_return;
}
/* We go inside the list of sub classes and try to find a way
if (CPC_INNER_P ())
{
make_nested_class_name (GET_CPC_LIST ());
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (name),
- IDENTIFIER_LENGTH (name));
+ obstack_grow0 (&temporary_obstack,
+ IDENTIFIER_POINTER (name),
+ IDENTIFIER_LENGTH (name));
id = get_identifier (obstack_finish (&temporary_obstack));
if (ctxp->package)
QUALIFIED_P (id) = 1;
tree id, super;
{
tree raw_name = EXPR_WFL_NODE (id);
- tree q_name = parser_qualified_classname (flags & ACC_STATIC, raw_name);
+ tree q_name = parser_qualified_classname (raw_name);
tree decl = IDENTIFIER_CLASS_VALUE (q_name);
EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */
return class;
}
-/* Create an class in pass1 and return its decl. Return class
+/* Create a class in pass1 and return its decl. Return class
interface's decl in pass 2. */
static tree
tree class_id, decl;
tree super_decl_type;
- class_id = parser_qualified_classname (0, raw_name);
+ class_id = parser_qualified_classname (raw_name);
decl = IDENTIFIER_CLASS_VALUE (class_id);
EXPR_WFL_NODE (id) = class_id;
CLASS_COMPLETE_P (decl) = 1;
add_superinterfaces (decl, interfaces);
- /* If the class is a top level inner class, install an alias. */
- if (INNER_CLASS_DECL_P (decl) && CLASS_STATIC (decl))
- {
- tree alias = parser_qualified_classname (1, raw_name);
- IDENTIFIER_GLOBAL_VALUE (alias) = decl;
- }
-
/* Add the private this$<n> field, Replicate final locals still in
scope as private final fields mangled like val$<local_name>.
This doesn't not occur for top level (static) inner classes. */
POP_CPC ();
if (resume && no_error_occured)
java_parser_context_resume ();
+
+ /* We're ending a class declaration, this is a good time to reset
+ the interface cout. Note that might have been already done in
+ create_interface, but if at that time an inner class was being
+ dealt with, the interface count was reset in a context created
+ for the sake of handling inner classes declaration. */
+ ctxp->interface_number = 0;
}
static void
tree class, name;
{
tree type = class;
- tree decl;
+ tree decl = NULL_TREE;
java_parser_context_save_global ();
- decl = lookup_field (&type, name);
+
+ /* Last chance: if we're within the context of an inner class, we
+ might be trying to access a local variable defined in an outer
+ context. We try to look for it now. */
+ if (INNER_CLASS_TYPE_P (class))
+ {
+ char *alias_buffer;
+ tree new_name;
+ MANGLE_OUTER_LOCAL_VARIABLE_NAME (alias_buffer, name);
+ new_name = get_identifier (alias_buffer);
+ decl = lookup_field (&type, new_name);
+ if (decl && decl != error_mark_node)
+ FIELD_LOCAL_ALIAS_USED (decl) = 1;
+ }
+ if (!decl || decl == error_mark_node)
+ {
+ type = class;
+ decl = lookup_field (&type, name);
+ }
+
java_parser_context_restore_global ();
return decl == error_mark_node ? NULL : decl;
}
tree init = TREE_VALUE (current);
tree current_name = EXPR_WFL_NODE (cl);
- /* Can't declare static fields in inner classes */
+ /* Can't declare non-final static fields in inner classes */
if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (class_type)
- && !CLASS_INTERFACE (TYPE_NAME (class_type)))
+ && !(flags & ACC_FINAL))
parse_error_context
- (cl, "Field `%s' can't be static in innerclass `%s'. Only members of interfaces and top-level classes can be static",
+ (cl, "Field `%s' can't be static in inner class `%s' unless it is final",
IDENTIFIER_POINTER (EXPR_WFL_NODE (cl)),
lang_printable_name (class_type, 0));
&& !CLASS_INTERFACE (TYPE_NAME (this_class)))
parse_error_context
(id, "Class `%s' must be declared abstract to define abstract method `%s'",
- IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)),
+ IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())),
IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
}
&& TREE_TYPE (current_function_decl)
&& TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node)
method_body = build1 (RETURN_EXPR, void_type_node, NULL);
-
+
BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body;
maybe_absorb_scoping_blocks ();
/* Exit function's body */
int acc_count = 0;
tree cl = NULL_TREE;
- THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl);
+ THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, PUBLIC_TK, acc_count, cl);
+ THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, PRIVATE_TK, acc_count, cl);
+ THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, PROTECTED_TK, acc_count, cl);
if (acc_count > 1)
parse_error_context
- (cl, "Inconsistent member declaration. At most one of `public', `private', or `protected' may be specified");
+ (cl, "Inconsistent member declaration. At most one of `public', `private', or `protected' may be specified");
+
+ acc_count = 0;
+ cl = NULL_TREE;
+ THIS_MODIFIER_ONLY (flags, ACC_FINAL, FINAL_TK, acc_count, cl);
+ THIS_MODIFIER_ONLY (flags, ACC_VOLATILE, VOLATILE_TK, acc_count, cl);
+ if (acc_count > 1)
+ parse_error_context (cl,
+ "Inconsistent member declaration. At most one of `final' or `volatile' may be specified");
}
/* Check the methode header METH for abstract specifics features */
/* Then this$<n> */
type = TREE_TYPE (DECL_CONTEXT (GET_CPC ()));
- thisn = build_current_thisn (TYPE_NAME (GET_CPC ()));
+ thisn = build_current_thisn (TREE_TYPE (GET_CPC ()));
list = tree_cons (build_wfl_node (thisn), build_pointer_type (type),
list);
}
qualification from the current package definition. */
static tree
-parser_qualified_classname (is_static, name)
- int is_static;
+parser_qualified_classname (name)
tree name;
{
tree nested_class_name;
- if (!is_static
- && (nested_class_name = maybe_make_nested_class_name (name)))
+ if ((nested_class_name = maybe_make_nested_class_name (name)))
return nested_class_name;
if (ctxp->package)
JDEP_WFL (new) = wfl;
JDEP_CHAIN (new) = NULL;
JDEP_MISC (new) = NULL_TREE;
- if ((kind == JDEP_SUPER || kind == JDEP_INTERFACE)
+ /* For some dependencies, set the enclosing class of the current
+ class to be the enclosing context */
+ if ((kind == JDEP_SUPER || kind == JDEP_INTERFACE || kind == JDEP_ANONYMOUS)
&& GET_ENCLOSING_CPC ())
JDEP_ENCLOSING (new) = TREE_VALUE (GET_ENCLOSING_CPC ());
else
tree class;
{
tree save_current_class = current_class;
- char *save_input_filename = input_filename;
+ const char *save_input_filename = input_filename;
int save_lineno = lineno;
push_obstacks (&permanent_obstack, &permanent_obstack);
if (!decl)
complete_class_report_errors (dep);
+ if (PURE_INNER_CLASS_DECL_P (decl))
+ check_inner_class_access (decl, JDEP_ENCLOSING (dep), JDEP_WFL (dep));
return decl;
}
push_obstacks (&permanent_obstack, &permanent_obstack);
- /* Process imports and reverse the import on demand list */
+ /* Process imports */
process_imports ();
- if (ctxp->import_demand_list)
- ctxp->import_demand_list = nreverse (ctxp->import_demand_list);
/* Rever things so we have the right order */
ctxp->class_list = nreverse (ctxp->class_list);
pop_obstacks ();
TREE_TYPE (field_decl) = field_type;
DECL_ALIGN (field_decl) = 0;
+ DECL_USER_ALIGN (field_decl) = 0;
layout_decl (field_decl, 0);
SOURCE_FRONTEND_DEBUG
(("Completed field/var decl `%s' with `%s'",
tree enclosing, class_type, decl, cl;
{
tree new_class_decl;
- tree original_name = NULL_TREE;
/* Do not try to replace TYPE_NAME (class_type) by a variable, since
- its is changed by find_in_imports{_on_demand} */
+ it is changed by find_in_imports{_on_demand} and (but it doesn't
+ really matter) qualify_and_find */
/* 0- Search in the current class as an inner class */
/* Maybe some code here should be added to load the class or
something, at least if the class isn't an inner class and ended
being loaded from class file. FIXME. */
- if ((new_class_decl = find_as_inner_class (enclosing, class_type, cl)))
- return new_class_decl;
+ while (enclosing)
+ {
+ tree name;
- /* 1- Check for the type in single imports */
- if (find_in_imports (class_type))
- return NULL_TREE;
+ if ((new_class_decl = find_as_inner_class (enclosing, class_type, cl)))
+ return new_class_decl;
+
+ /* Explore enclosing contexts. */
+ while (INNER_CLASS_DECL_P (enclosing))
+ {
+ enclosing = DECL_CONTEXT (enclosing);
+ if ((new_class_decl = find_as_inner_class (enclosing,
+ class_type, cl)))
+ return new_class_decl;
+ }
+
+ /* Now go to the upper classes, bail out if necessary. */
+ enclosing = CLASSTYPE_SUPER (TREE_TYPE (enclosing));
+ if (!enclosing || enclosing == object_type_node)
+ break;
+
+ if (TREE_CODE (enclosing) == RECORD_TYPE)
+ {
+ enclosing = TYPE_NAME (enclosing);
+ continue;
+ }
- /* 2- And check for the type in the current compilation unit. If it fails,
- try with a name qualified with the package name we've seen so far */
+ if (TREE_CODE (enclosing) == IDENTIFIER_NODE)
+ BUILD_PTR_FROM_NAME (name, enclosing);
+ else
+ name = enclosing;
+ enclosing = do_resolve_class (NULL, name, NULL, NULL);
+ }
+
+ /* 1- Check for the type in single imports. This will change
+ TYPE_NAME() if something relevant is found */
+ find_in_imports (class_type);
+
+ /* 2- And check for the type in the current compilation unit */
if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
{
if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
}
- original_name = TYPE_NAME (class_type);
+ /* 3- Search according to the current package definition */
if (!QUALIFIED_P (TYPE_NAME (class_type)))
{
- tree package;
- for (package = package_list; package; package = TREE_CHAIN (package))
- {
- tree new_qualified;
-
- new_qualified = merge_qualified_name (TREE_PURPOSE (package),
- original_name);
- TYPE_NAME (class_type) = new_qualified;
- new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- if (!new_class_decl)
- load_class (TYPE_NAME (class_type), 0);
- new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- if (new_class_decl)
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
- !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
- load_class (TYPE_NAME (class_type), 0);
- return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- }
- }
+ if ((new_class_decl = qualify_and_find (class_type, ctxp->package,
+ TYPE_NAME (class_type))))
+ return new_class_decl;
}
- TYPE_NAME (class_type) = original_name;
+ /* 4- Check the import on demands. Don't allow bar.baz to be
+ imported from foo.* */
+ if (!QUALIFIED_P (TYPE_NAME (class_type)))
+ if (find_in_imports_on_demand (class_type))
+ return NULL_TREE;
+
+ /* If found in find_in_imports_on_demant, the type has already been
+ loaded. */
+ if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
+ return new_class_decl;
- /* 3- Check an other compilation unit that bears the name of type */
+ /* 5- Try with a name qualified with the package name we've seen so far */
+ if (!QUALIFIED_P (TYPE_NAME (class_type)))
+ {
+ tree package;
+
+ /* If there is a current package (ctxp->package), it's the first
+ element of package_list and we can skip it. */
+ for (package = (ctxp->package ?
+ TREE_CHAIN (package_list) : package_list);
+ package; package = TREE_CHAIN (package))
+ if ((new_class_decl = qualify_and_find (class_type,
+ TREE_PURPOSE (package),
+ TYPE_NAME (class_type))))
+ return new_class_decl;
+ }
+
+ /* 5- Check an other compilation unit that bears the name of type */
load_class (TYPE_NAME (class_type), 0);
if (check_pkg_class_access (TYPE_NAME (class_type),
(cl ? cl : lookup_cl (decl))))
return NULL_TREE;
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- return new_class_decl;
+ /* 6- Last call for a resolution */
+ return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
+}
- /* 4- Check the import on demands. Don't allow bar.baz to be
- imported from foo.* */
- if (!QUALIFIED_P (TYPE_NAME (class_type)))
- if (find_in_imports_on_demand (class_type))
- return NULL_TREE;
+static tree
+qualify_and_find (class_type, package, name)
+ tree class_type, package, name;
+{
+ tree new_qualified = merge_qualified_name (package, name);
+ tree new_class_decl;
- /* 5- Last call for a resolution */
- return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
+ if (!IDENTIFIER_CLASS_VALUE (new_qualified))
+ load_class (new_qualified, 0);
+ if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_qualified)))
+ {
+ if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
+ !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
+ load_class (new_qualified, 0);
+ TYPE_NAME (class_type) = new_qualified;
+ return IDENTIFIER_CLASS_VALUE (new_qualified);
+ }
+ return NULL_TREE;
}
/* Resolve NAME and lay it out (if not done and if not the current
other_name = EXPR_WFL_NODE (other_name);
if (!DECL_CLINIT_P (other_method)
&& !DECL_CONSTRUCTOR_P (other_method)
- && method_name == other_name && method_sig == s)
+ && method_name == other_name
+ && method_sig == s
+ && !METHOD_ABSTRACT (other_method))
{
found = 1;
break;
return 0;
}
-/* Possibly find a class imported by a single-type import statement. Return
- 1 if an error occured, 0 otherwise. */
+/* Possibly find and mark a class imported by a single-type import
+ statement. */
-static int
+static void
find_in_imports (class_type)
tree class_type;
{
TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import));
QUALIFIED_P (TYPE_NAME (class_type)) = 1;
}
- return 0;
}
static int
return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
}
+/* Add package NAME to the list of package encountered so far. To
+ speed up class lookup in do_resolve_class, we make sure a
+ particular package is added only once. */
+
+static void
+register_package (name)
+ tree name;
+{
+ static struct hash_table _pht, *pht = NULL;
+
+ if (!pht)
+ {
+ hash_table_init (&_pht, hash_newfunc,
+ java_hash_hash_tree_node, java_hash_compare_tree_node);
+ pht = &_pht;
+ }
+
+ if (!hash_lookup (pht, (const hash_table_key) name, FALSE, NULL))
+ {
+ package_list = chainon (package_list, build_tree_list (name, NULL));
+ hash_lookup (pht, (const hash_table_key) name, TRUE, NULL);
+ }
+}
+
static tree
resolve_package (pkg, next)
tree pkg, *next;
if ((type_name = resolve_no_layout (acc, NULL_TREE)))
{
type_name = acc;
- *next = TREE_CHAIN (current);
+ /* resolve_package should be used in a loop, hence we
+ point at this one to naturally process the next one at
+ the next iteration. */
+ *next = current;
break;
}
}
return get_identifier (subname);
}
+static void
+check_inner_class_access (decl, enclosing_decl, cl)
+ tree decl, enclosing_decl, cl;
+{
+ int access = 0;
+
+ /* We don't issue an error message when CL is null. CL can be null
+ as a result of processing a JDEP crafted by source_start_java_method
+ for the purpose of patching its parm decl. But the error would
+ have been already trapped when fixing the method's signature.
+ DECL can also be NULL in case of earlier errors. */
+ if (!decl || !cl)
+ return;
+
+ /* We grant access to private and protected inner classes if the
+ location from where we're trying to access DECL is an enclosing
+ context for DECL or if both have a common enclosing context. */
+ if (CLASS_PRIVATE (decl))
+ access = 1;
+ if (CLASS_PROTECTED (decl))
+ access = 2;
+ if (!access)
+ return;
+
+ if (common_enclosing_context_p (TREE_TYPE (enclosing_decl),
+ TREE_TYPE (decl))
+ || enclosing_context_p (TREE_TYPE (enclosing_decl),
+ TREE_TYPE (decl)))
+ return;
+
+ parse_error_context (cl, "Can't access %s nested %s %s. Only public classes and interfaces in other packages can be accessed",
+ (access == 1 ? "private" : "protected"),
+ (CLASS_INTERFACE (decl) ? "interface" : "class"),
+ lang_printable_name (decl, 0));
+}
+
/* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
access violations were found, 1 otherwise. */
tree tem;
tree parm_decl;
int i;
-#if 0
- int flag_inner = DECL_CONSTRUCTOR_P (fndecl)
- && (INNER_CLASS_TYPE_P (DECL_CONTEXT (fndecl)) ? 1 : 0);
-#endif
if (!fndecl)
return;
LOCAL_FINAL (parm_decl) = 1;
BLOCK_CHAIN_DECL (parm_decl);
-
-#if 0
- /* If this is a constructor of a inner class, hide the extra
- this$<n> parameter */
- if (i == 0 && flag_inner)
- {
- tree link = TREE_CHAIN (tem);
- tree type = DECL_CONTEXT (TYPE_NAME (DECL_CONTEXT (fndecl)));
-
- type = build_pointer_type (TREE_TYPE (type));
- parm_decl = build_decl (PARM_DECL,
- build_current_thisn (current_class), type);
- BLOCK_CHAIN_DECL (parm_decl);
- /* We hide the this$<n> decl in the name field of its
- parameter declaration. */
- parm_decl = build_tree_list (DECL_NAME (parm_decl), type);
- TREE_CHAIN (tem) = parm_decl;
- TREE_CHAIN (parm_decl) = link;
- tem = parm_decl;
- i++;
- }
-#endif
-
}
tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) =
/* First, do the ordinary methods. */
for (decl = first_decl; decl; decl = TREE_CHAIN (decl))
{
- /* Skip abstract or native methods */
- if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl)
+ /* Skip abstract or native methods -- but do handle native
+ methods when generating JNI stubs. */
+ if (METHOD_ABSTRACT (decl)
+ || (! flag_jni && METHOD_NATIVE (decl))
|| DECL_CONSTRUCTOR_P (decl) || DECL_CLINIT_P (decl))
continue;
+
+ if (METHOD_NATIVE (decl))
+ {
+ tree body = build_jni_stub (decl);
+ BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (decl)) = body;
+ }
+
java_complete_expand_method (decl);
}
for (current = TYPE_CLINIT_STMT_LIST (class_type); current;
current = TREE_CHAIN (current))
{
+ tree stmt = current;
/* We build the assignment expression that will initialize the
field to its value. There are strict rules on static
initializers (8.5). FIXME */
- tree stmt = build_debugable_stmt (EXPR_WFL_LINECOL (current), current);
+ if (TREE_CODE (stmt) != BLOCK && stmt != empty_stmt_node)
+ stmt = build_debugable_stmt (EXPR_WFL_LINECOL (stmt), stmt);
java_method_add_stmt (mdecl, stmt);
}
end_artificial_method_body (mdecl);
- /* Now we want to place <clinit> as the last method for interface so
- that it doesn't interfere with the dispatch table based
- lookup. */
- if (CLASS_INTERFACE (TYPE_NAME (class_type))
- && TREE_CHAIN (TYPE_METHODS (class_type)))
+ /* Now we want to place <clinit> as the last method (because we need
+ it at least for interface so that it doesn't interfere with the
+ dispatch table based lookup. */
+ if (TREE_CHAIN (TYPE_METHODS (class_type)))
{
- tree current =
- TYPE_METHODS (class_type) = TREE_CHAIN (TYPE_METHODS (class_type));
+ current = TREE_CHAIN (TYPE_METHODS (class_type));
+ TYPE_METHODS (class_type) = current;
while (TREE_CHAIN (current))
current = TREE_CHAIN (current);
+
TREE_CHAIN (current) = mdecl;
TREE_CHAIN (mdecl) = NULL_TREE;
}
return mdecl;
}
+/* See whether we could get rid of <clinit>. Criteria are: all static
+ final fields have constant initial values and the body of <clinit>
+ is empty. Return 1 if <clinit> was discarded, 0 otherwise. */
+
+static int
+maybe_yank_clinit (mdecl)
+ tree mdecl;
+{
+ tree type, current;
+ tree fbody, bbody;
+
+ if (!DECL_CLINIT_P (mdecl))
+ return 0;
+
+ /* If the body isn't empty, then we keep <clinit> */
+ fbody = DECL_FUNCTION_BODY (mdecl);
+ if ((bbody = BLOCK_EXPR_BODY (fbody)))
+ bbody = BLOCK_EXPR_BODY (bbody);
+ if (bbody && bbody != empty_stmt_node)
+ return 0;
+
+ type = DECL_CONTEXT (mdecl);
+ current = TYPE_FIELDS (type);
+
+ for (current = (current ? TREE_CHAIN (current) : current);
+ current; current = TREE_CHAIN (current))
+ if (!(FIELD_STATIC (current) && FIELD_FINAL (current)
+ && DECL_INITIAL (current) && TREE_CONSTANT (DECL_INITIAL (current))))
+ break;
+
+ if (current)
+ return 0;
+
+ /* Get rid of <clinit> in the class' list of methods */
+ if (TYPE_METHODS (type) == mdecl)
+ TYPE_METHODS (type) = TREE_CHAIN (mdecl);
+ else
+ for (current = TYPE_METHODS (type); current;
+ current = TREE_CHAIN (current))
+ if (TREE_CHAIN (current) == mdecl)
+ {
+ TREE_CHAIN (current) = TREE_CHAIN (mdecl);
+ break;
+ }
+
+ return 1;
+}
+
+
/* Complete and expand a method. */
static void
java_complete_expand_method (mdecl)
tree mdecl;
{
+ int yank_clinit = 0;
+
current_function_decl = mdecl;
/* Fix constructors before expanding them */
if (DECL_CONSTRUCTOR_P (mdecl))
{
block_body = java_complete_tree (block_body);
- if (!flag_emit_xref)
+ if (! flag_emit_xref && ! METHOD_NATIVE (mdecl))
check_for_initialization (block_body);
ctxp->explicit_constructor_p = 0;
}
+
BLOCK_EXPR_BODY (fbody) = block_body;
/* If we saw a return but couldn't evaluate it properly, we'll
&& !flag_emit_xref)
missing_return_error (current_function_decl);
- complete_start_java_method (mdecl);
-
+ /* Check wether we could just get rid of clinit, now the picture
+ is complete. */
+ if (!(yank_clinit = maybe_yank_clinit (mdecl)))
+ complete_start_java_method (mdecl);
+
/* Don't go any further if we've found error(s) during the
- expansion */
- if (!java_error_count)
+ expansion */
+ if (!java_error_count && !yank_clinit)
source_end_java_method ();
else
{
- pushdecl_force_head (DECL_ARGUMENTS (mdecl));
+ if (java_error_count)
+ pushdecl_force_head (DECL_ARGUMENTS (mdecl));
poplevel (1, 0, 1);
}
/* Build an access function to the this$<n> local to TYPE. NULL_TREE
is returned if nothing needs to be generated. Otherwise, the method
- generated, fully walked and a method decl is returned.
+ generated and a method decl is returned.
NOTE: These generated methods should be declared in a class file
attribute so that they can't be referred to directly. */
tree mdecl;
{
tree class = CLASSTYPE_SUPER (current_class);
+ int super_inner = PURE_INNER_CLASS_TYPE_P (class);
tree sdecl;
if (!class)
for (sdecl = TYPE_METHODS (class); sdecl; sdecl = TREE_CHAIN (sdecl))
if (DECL_CONSTRUCTOR_P (sdecl))
{
- tree arg_type;
- for (arg_type = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)));
- arg_type != end_params_node &&
- mdecl_arg_type != end_params_node;
+ tree m_arg_type;
+ tree arg_type = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)));
+ if (super_inner)
+ arg_type = TREE_CHAIN (arg_type);
+ for (m_arg_type = mdecl_arg_type;
+ (arg_type != end_params_node
+ && m_arg_type != end_params_node);
arg_type = TREE_CHAIN (arg_type),
- mdecl_arg_type = TREE_CHAIN (mdecl_arg_type))
- if (TREE_VALUE (arg_type) != TREE_VALUE (mdecl_arg_type))
+ m_arg_type = TREE_CHAIN (m_arg_type))
+ if (TREE_VALUE (arg_type) != TREE_VALUE (m_arg_type))
break;
- if (arg_type == end_params_node &&
- mdecl_arg_type == end_params_node)
+ if (arg_type == end_params_node && m_arg_type == end_params_node)
return 0;
}
}
{
for (sdecl = TYPE_METHODS (class); sdecl; sdecl = TREE_CHAIN (sdecl))
{
- if (DECL_CONSTRUCTOR_P (sdecl)
- && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)))
- == end_params_node)
+ tree arg = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)));
+ if (super_inner)
+ arg = TREE_CHAIN (arg);
+ if (DECL_CONSTRUCTOR_P (sdecl) && arg == end_params_node)
return 0;
}
}
tree wfl;
if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
- wfl = build_wfl_wrap (primary);
+ wfl = build_wfl_wrap (primary, location);
else
{
wfl = primary;
else
{
decl = lookup_field_wrapper (current_class, name);
-
- /* Last chance: if we're within the context of an inner
- class, we might be trying to access a local variable
- defined in an outer context. We try to look for it
- now. */
- if (!decl && INNER_CLASS_TYPE_P (current_class))
- {
- char *alias_buffer;
- MANGLE_OUTER_LOCAL_VARIABLE_NAME (alias_buffer, name);
- name = get_identifier (alias_buffer);
- decl = lookup_field_wrapper (current_class, name);
- if (decl)
- FIELD_LOCAL_ALIAS_USED (decl) = 1;
- }
-
if (decl)
{
tree access = NULL_TREE;
int fs = FIELD_STATIC (decl);
+
+ /* If we're accessing an outer scope local alias, make
+ sure we change the name of the field we're going to
+ build access to. */
+ if (FIELD_LOCAL_ALIAS_USED (decl))
+ name = DECL_NAME (decl);
+
/* Instance variable (8.3.1.1) can't appear within
static method, static initializer or initializer for
a static variable. */
return error_mark_node;
/* Resolve the LENGTH field of an array here */
- if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found)
+ if (DECL_P (decl) && DECL_NAME (decl) == length_identifier_node
+ && type_found && TYPE_ARRAY_P (type_found)
&& ! flag_emit_class_files && ! flag_emit_xref)
{
tree length = build_java_array_length_access (where_found);
field_ref =
build_java_arraynull_check (type_found, length, int_type_node);
+
+ /* In case we're dealing with a static array, we need to
+ initialize its class before the array length can be fetched.
+ It's also a good time to create a DECL_RTL for the field if
+ none already exists, otherwise if the field was declared in a
+ class found in an external file and hasn't been (and won't
+ be) accessed for its value, none will be created. */
+ if (TREE_CODE (where_found) == VAR_DECL && FIELD_STATIC (where_found))
+ {
+ build_static_field_ref (where_found);
+ field_ref = build_class_init (DECL_CONTEXT (where_found), field_ref);
+ }
}
/* We might have been trying to resolve field.method(). In which
case, the resolution is over and decl is the answer */
if (!type_found)
type_found = DECL_CONTEXT (decl);
is_static = JDECL_P (decl) && FIELD_STATIC (decl);
- if (FIELD_FINAL (decl)
+ if (FIELD_FINAL (decl) && FIELD_STATIC (decl)
&& JPRIMITIVE_TYPE_P (TREE_TYPE (decl))
- && DECL_LANG_SPECIFIC (decl)
&& DECL_INITIAL (decl))
{
- field_ref = DECL_INITIAL (decl);
+ /* When called on a FIELD_DECL of the right (primitive)
+ type, java_complete_tree will try to substitue the decl
+ for it's initial value. */
+ field_ref = java_complete_tree (decl);
static_final_found = 1;
}
else
return error_mark_node;
if (is_static && !static_final_found
&& !flag_emit_class_files && !flag_emit_xref)
- field_ref = build_class_init (type_found, field_ref);
+ field_ref = build_class_init (DECL_CONTEXT (decl), field_ref);
}
else
field_ref = decl;
*where_found = decl = current_this;
*type_found = type = QUAL_DECL_TYPE (decl);
}
- /* We're trying to access the this from somewhere else... */
+ /* We're trying to access the this from somewhere else. Make sure
+ it's allowed before doing so. */
else
{
+ if (!enclosing_context_p (type, current_class))
+ {
+ char *p = xstrdup (lang_printable_name (type, 0));
+ parse_error_context (qual_wfl, "Can't use variable `%s.this': type `%s' isn't an outer type of type `%s'",
+ p, p,
+ lang_printable_name (current_class, 0));
+ free (p);
+ return 1;
+ }
*where_found = decl = build_current_thisn (type);
from_qualified_this = 1;
}
{
tree list;
*where_found = decl = resolve_no_layout (name, qual_wfl);
- /* We wan't to be absolutely that the class is laid
+ /* We want to be absolutely sure that the class is laid
out. We're going to search something inside it. */
*type_found = type = TREE_TYPE (decl);
layout_class (type);
field_decl = lookup_field_wrapper (type,
EXPR_WFL_NODE (qual_wfl));
+
+ /* Maybe what we're trying to access an inner class. */
+ if (!field_decl)
+ {
+ tree ptr, inner_decl;
+
+ BUILD_PTR_FROM_NAME (ptr, EXPR_WFL_NODE (qual_wfl));
+ inner_decl = resolve_class (decl, ptr, NULL_TREE, qual_wfl);
+ if (inner_decl)
+ {
+ check_inner_class_access (inner_decl, decl, qual_wfl);
+ type = TREE_TYPE (inner_decl);
+ decl = inner_decl;
+ from_type = 1;
+ continue;
+ }
+ }
+
if (field_decl == NULL_TREE)
{
parse_error_context
}
/* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
- can't be accessed from REFERENCE (a record type). */
+ can't be accessed from REFERENCE (a record type). This should be
+ used when decl is a field or a method.*/
static int
not_accessible_p (reference, member, from_super)
{
int access_flag = get_access_flags_from_decl (member);
+ /* Inner classes are processed by check_inner_class_access */
+ if (INNER_CLASS_TYPE_P (reference))
+ return 0;
+
/* Access always granted for members declared public */
if (access_flag & ACC_PUBLIC)
return 0;
return 0;
/* Otherwise, access is granted if occuring from the class where
- member is declared or a subclass of it */
- if (inherits_from_p (reference, current_class))
+ member is declared or a subclass of it. Find the right
+ context to perform the check */
+ if (PURE_INNER_CLASS_TYPE_P (reference))
+ {
+ while (INNER_CLASS_TYPE_P (reference))
+ {
+ if (inherits_from_p (reference, DECL_CONTEXT (member)))
+ return 0;
+ reference = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (reference)));
+ }
+ }
+ if (inherits_from_p (reference, DECL_CONTEXT (member)))
return 0;
return 1;
}
/* Check access on private members. Access is granted only if it
- occurs from within the class in witch it is declared. Exceptions
- are access from inner-classes. This section is probably not
- complete. FIXME */
+ occurs from within the class in which it is declared. Exceptions
+ are accesses from inner-classes. */
if (access_flag & ACC_PRIVATE)
return (current_class == DECL_CONTEXT (member) ? 0 :
(INNER_CLASS_TYPE_P (current_class) ? 0 : 1));
REFERENCE is defined in the current package */
if (ctxp->package)
return !class_in_current_package (reference);
-
+
/* Otherwise, access is granted */
return 0;
}
type = GET_SKIP_TYPE (resolved);
resolve_and_layout (type, NULL_TREE);
+
+ if (JPRIMITIVE_TYPE_P (type))
+ {
+ parse_error_context
+ (identifier_wfl,
+ "Can't invoke a method on primitive type `%s'",
+ IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
+ PATCH_METHOD_RETURN_ERROR ();
+ }
+
list = lookup_method_invoke (0, identifier_wfl, type, identifier, args);
args = nreverse (args);
access$0(access$0(...(this$0))).
maybe_use_access_method returns a non zero value if the
- this_arg has to be deplaced into the (then generated)
- stub argument list. In the mean time, the selected
- function might have be replaced by a generated stub. */
+ this_arg has to be moved into the (then generated) stub
+ argument list. In the meantime, the selected function
+ might have be replaced by a generated stub. */
if (maybe_use_access_method (is_super_init, &list, &this_arg))
args = tree_cons (NULL_TREE, this_arg, args);
}
args = tree_cons (NULL_TREE, integer_zero_node, args);
}
+ /* This handles the situation where a constructor invocation needs
+ to have an enclosing context passed as a second parameter (the
+ constructor is one of an inner class. We extract it from the
+ current function. */
+ if (is_super_init && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
+ {
+ tree enclosing_decl = DECL_CONTEXT (TYPE_NAME (current_class));
+ tree extra_arg;
+
+ if (ANONYMOUS_CLASS_P (current_class) || !DECL_CONTEXT (enclosing_decl))
+ {
+ extra_arg = DECL_FUNCTION_BODY (current_function_decl);
+ extra_arg = TREE_CHAIN (BLOCK_EXPR_DECLS (extra_arg));
+ }
+ else
+ {
+ tree dest = TREE_TYPE (DECL_CONTEXT (enclosing_decl));
+ extra_arg =
+ build_access_to_thisn (TREE_TYPE (enclosing_decl), dest, 0);
+ extra_arg = java_complete_tree (extra_arg);
+ }
+ args = tree_cons (NULL_TREE, extra_arg, args);
+ }
+
is_static_flag = METHOD_STATIC (list);
if (! METHOD_STATIC (list) && this_arg != NULL_TREE)
args = tree_cons (NULL_TREE, this_arg, args);
if (non_static_context)
{
ctx = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current_class)));
- if (ctx == DECL_CONTEXT (md))
+ if (inherits_from_p (ctx, DECL_CONTEXT (md)))
{
ta = build_current_thisn (current_class);
ta = build_wfl_node (ta);
while (type)
{
maybe_build_thisn_access_method (type);
- if (type == DECL_CONTEXT (md))
+ if (inherits_from_p (type, DECL_CONTEXT (md)))
{
ta = build_access_to_thisn (ctx, type, 0);
break;
{
tree dtable, func;
tree original_call, t, ta;
+ tree cond = NULL_TREE;
/* Last step for args: convert build-in types. If we're dealing with
a new TYPE() type call, the first argument to the constructor
- isn't found in the incomming argument list, but delivered by
+ isn't found in the incoming argument list, but delivered by
`new' */
t = TYPE_ARG_TYPES (TREE_TYPE (method));
if (TREE_CODE (patch) == NEW_CLASS_EXPR)
func = build_invokevirtual (dtable, method);
break;
+ case INVOKE_NONVIRTUAL:
+ /* If the object for the method call is null, we throw an
+ exception. We don't do this if the object is the current
+ method's `this'. In other cases we just rely on an
+ optimization pass to eliminate redundant checks. */
+ if (TREE_VALUE (args) != current_this)
+ {
+ /* We use a SAVE_EXPR here to make sure we only evaluate
+ the new `self' expression once. */
+ tree save_arg = save_expr (TREE_VALUE (args));
+ TREE_VALUE (args) = save_arg;
+ cond = build (EQ_EXPR, boolean_type_node, save_arg,
+ null_pointer_node);
+ }
+ /* Fall through. */
+
case INVOKE_SUPER:
case INVOKE_STATIC:
func = build_known_method_ref (method, TREE_TYPE (method),
TREE_OPERAND (patch, 1) = args;
original_call = patch;
- /* We're processing a `new TYPE ()' form. New is called an its
+ /* We're processing a `new TYPE ()' form. New is called and its
returned value is the first argument to the constructor. We build
a COMPOUND_EXPR and use saved expression so that the overall NEW
expression value is a pointer to a newly created and initialized
TREE_SET_CODE (original_call, CALL_EXPR);
patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
}
+
+ /* If COND is set, then we are building a check to see if the object
+ is NULL. */
+ if (cond != NULL_TREE)
+ {
+ /* We have to make the `then' branch a compound expression to
+ make the types turn out right. This seems bizarre. */
+ patch = build (COND_EXPR, TREE_TYPE (patch), cond,
+ build (COMPOUND_EXPR, TREE_TYPE (patch),
+ build (CALL_EXPR, void_type_node,
+ build_address_of (soft_nullpointer_node),
+ NULL_TREE, NULL_TREE),
+ (FLOAT_TYPE_P (TREE_TYPE (patch))
+ ? build_real (TREE_TYPE (patch), dconst0)
+ : build1 (CONVERT_EXPR, TREE_TYPE (patch),
+ integer_zero_node))),
+ patch);
+ TREE_SIDE_EFFECTS (patch) = 1;
+ }
+
return patch;
}
if (super)
return INVOKE_SUPER;
- if (access & ACC_STATIC || access & ACC_FINAL || access & ACC_PRIVATE)
+ if (access & ACC_STATIC)
return INVOKE_STATIC;
- if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
+ /* We have to look for a constructor before we handle nonvirtual
+ calls; otherwise the constructor will look nonvirtual. */
+ if (DECL_CONSTRUCTOR_P (method))
return INVOKE_STATIC;
-
+
+ if (access & ACC_FINAL || access & ACC_PRIVATE)
+ return INVOKE_NONVIRTUAL;
+
+ if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
+ return INVOKE_NONVIRTUAL;
+
if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
return INVOKE_INTERFACE;
-
- if (DECL_CONSTRUCTOR_P (method))
- return INVOKE_STATIC;
return INVOKE_VIRTUAL;
}
int lc;
tree class, name, arglist;
{
- static int object_done = 0;
+ static struct hash_table t, *searched_classes = NULL;
+ static int search_not_done = 0;
tree list = NULL_TREE, all_list = NULL_TREE;
+ /* Check the hash table to determine if this class has been searched
+ already. */
+ if (searched_classes)
+ {
+ if (hash_lookup (searched_classes,
+ (const hash_table_key) class, FALSE, NULL))
+ return NULL;
+ }
+ else
+ {
+ hash_table_init (&t, hash_newfunc, java_hash_hash_tree_node,
+ java_hash_compare_tree_node);
+ searched_classes = &t;
+ }
+
+ search_not_done++;
+ hash_lookup (searched_classes,
+ (const hash_table_key) class, TRUE, NULL);
+
if (!CLASS_LOADED_P (class) && !CLASS_FROM_SOURCE_P (class))
{
load_class (class, 1);
}
/* Search interfaces */
- if (CLASS_INTERFACE (TYPE_NAME (class)))
+ if (TREE_CODE (TYPE_NAME (class)) == TYPE_DECL
+ && CLASS_INTERFACE (TYPE_NAME (class)))
{
- static struct hash_table t, *searched_interfaces = NULL;
- static int search_not_done = 0;
int i, n;
tree basetype_vec = TYPE_BINFO_BASETYPES (class);
-
- /* Search in the hash table, otherwise create a new one if
- necessary and insert the new entry. */
-
- if (searched_interfaces)
- {
- if (hash_lookup (searched_interfaces,
- (const hash_table_key) class, FALSE, NULL))
- return NULL;
- }
- else
- {
- hash_table_init (&t, hash_newfunc, java_hash_hash_tree_node,
- java_hash_compare_tree_node);
- searched_interfaces = &t;
- }
-
- hash_lookup (searched_interfaces,
- (const hash_table_key) class, TRUE, NULL);
-
search_applicable_methods_list (lc, TYPE_METHODS (class),
name, arglist, &list, &all_list);
n = TREE_VEC_LENGTH (basetype_vec);
tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
tree rlist;
- search_not_done++;
rlist = find_applicable_accessible_methods_list (lc, t, name,
arglist);
list = chainon (rlist, list);
- search_not_done--;
- }
-
- /* We're done. Reset the searched interfaces list and finally search
- java.lang.Object */
- if (!search_not_done)
- {
- if (!object_done)
- search_applicable_methods_list (lc,
- TYPE_METHODS (object_type_node),
- name, arglist, &list, &all_list);
- hash_table_free (searched_interfaces);
- searched_interfaces = NULL;
}
}
/* Search classes */
{
tree basetype_vec = TYPE_BINFO_BASETYPES (sc);
int n = TREE_VEC_LENGTH (basetype_vec), i;
- object_done = 1;
for (i = 1; i < n; i++)
{
tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
- tree rlist;
if (t != object_type_node)
- rlist = find_applicable_accessible_methods_list (lc, t,
- name, arglist);
- list = chainon (rlist, list);
+ {
+ tree rlist
+ = find_applicable_accessible_methods_list (lc, t,
+ name, arglist);
+ list = chainon (rlist, list);
+ }
}
- object_done = 0;
}
/* Search enclosing context of inner classes before looking
else
class = sc;
- for (class = (lc ? NULL_TREE : CLASSTYPE_SUPER (class));
- class; class = CLASSTYPE_SUPER (class))
- search_applicable_methods_list (lc, TYPE_METHODS (class),
- name, arglist, &list, &all_list);
+ /* Search superclass */
+ if (!lc && CLASSTYPE_SUPER (class) != NULL_TREE)
+ {
+ tree rlist;
+ class = CLASSTYPE_SUPER (class);
+ rlist = find_applicable_accessible_methods_list (lc, class,
+ name, arglist);
+ list = chainon (rlist, list);
+ }
+ }
+
+ search_not_done--;
+
+ /* We're done. Reset the searched classes list and finally search
+ java.lang.Object if it wasn't searched already. */
+ if (!search_not_done)
+ {
+ if (!lc
+ && TYPE_METHODS (object_type_node)
+ && !hash_lookup (searched_classes,
+ (const hash_table_key) object_type_node,
+ FALSE, NULL))
+ {
+ search_applicable_methods_list (lc,
+ TYPE_METHODS (object_type_node),
+ name, arglist, &list, &all_list);
+ }
+ hash_table_free (searched_classes);
+ searched_classes = NULL;
}
/* Either return the list obtained or all selected (but
return (!list ? all_list : list);
}
-/* Effectively search for the approriate method in method */
+/* Effectively search for the appropriate method in method */
static void
search_applicable_methods_list (lc, method, name, arglist, list, all_list)
*all_list = tree_cons (NULL_TREE, method, *list);
}
}
-}
+}
/* 15.11.2.2 Choose the Most Specific Method */
tree list;
{
int max = 0;
+ int abstract, candidates;
tree current, new_list = NULL_TREE;
for (current = list; current; current = TREE_CHAIN (current))
{
for (method = list; method; method = TREE_CHAIN (method))
{
+ tree method_v, current_v;
/* Don't test a method against itself */
if (method == current)
continue;
- /* Compare arguments and location where method where declared */
- if (argument_types_convertible (TREE_VALUE (method),
- TREE_VALUE (current))
- && valid_method_invocation_conversion_p
- (DECL_CONTEXT (TREE_VALUE (method)),
- DECL_CONTEXT (TREE_VALUE (current))))
+ method_v = TREE_VALUE (method);
+ current_v = TREE_VALUE (current);
+
+ /* Compare arguments and location where methods where declared */
+ if (argument_types_convertible (method_v, current_v))
{
- int v = ++DECL_SPECIFIC_COUNT (TREE_VALUE (current));
- max = (v > max ? v : max);
+ if (valid_method_invocation_conversion_p
+ (DECL_CONTEXT (method_v), DECL_CONTEXT (current_v))
+ || (INNER_CLASS_TYPE_P (DECL_CONTEXT (current_v))
+ && enclosing_context_p (DECL_CONTEXT (method_v),
+ DECL_CONTEXT (current_v))))
+ {
+ int v = (DECL_SPECIFIC_COUNT (current_v) +=
+ (INNER_CLASS_TYPE_P (DECL_CONTEXT (current_v)) ? 2 : 1));
+ max = (v > max ? v : max);
+ }
}
}
}
/* Review the list and select the maximally specific methods */
- for (current = list; current; current = TREE_CHAIN (current))
+ for (current = list, abstract = -1, candidates = -1;
+ current; current = TREE_CHAIN (current))
if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
- new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
+ {
+ new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
+ abstract += (METHOD_ABSTRACT (TREE_VALUE (current)) ? 1 : 0);
+ candidates++;
+ }
/* If we have several and they're all abstract, just pick the
closest one. */
+ if (candidates > 0 && (candidates == abstract))
+ {
+ new_list = nreverse (new_list);
+ TREE_CHAIN (new_list) = NULL_TREE;
+ }
- if (new_list && TREE_CHAIN (new_list))
+ /* We have several, we couldn't find a most specific, all but one are
+ abstract, we pick the only non abstract one. */
+ if (candidates > 0 && !max && (candidates == abstract+1))
{
- tree c;
- for (c = new_list; c && METHOD_ABSTRACT (TREE_VALUE (c));
- c = TREE_CHAIN (c))
- ;
- if (!c)
- {
- new_list = nreverse (new_list);
- TREE_CHAIN (new_list) = NULL_TREE;
- }
+ for (current = new_list; current; current = TREE_CHAIN (current))
+ if (!METHOD_ABSTRACT (TREE_VALUE (current)))
+ {
+ TREE_CHAIN (current) = NULL_TREE;
+ new_list = current;
+ }
}
/* If we can't find one, lower expectations and try to gather multiple
qual = TREE_CHAIN (qual);
again = new_array_found = 1;
continue;
- case NEW_CLASS_EXPR:
case CONVERT_EXPR:
+ break;
+ case NEW_CLASS_EXPR:
qual_wfl = TREE_OPERAND (qual_wfl, 0);
break;
case ARRAY_REF:
}
} while (again);
- /* If name appears within the scope of a location variable
- declaration or parameter declaration, then it is an expression
- name. We don't carry this test out if we're in the context of the
- use of SUPER or THIS */
+ /* If name appears within the scope of a local variable declaration
+ or parameter declaration, then it is an expression name. We don't
+ carry this test out if we're in the context of the use of SUPER
+ or THIS */
if (!this_found && !super_found
&& TREE_CODE (name) != STRING_CST && TREE_CODE (name) != INTEGER_CST
&& (decl = IDENTIFIER_LOCAL_VALUE (name)))
QUAL_RESOLUTION (qual) = decl;
}
- /* Method call are expression name */
+ /* Method call, array references and cast are expression name */
else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
|| TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF
|| TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR)
tree node;
{
node = java_complete_lhs (node);
- if (TREE_CODE (node) == VAR_DECL && FIELD_STATIC (node)
- && FIELD_FINAL (node) && DECL_INITIAL (node) != NULL_TREE
+ if (JDECL_P (node) && FIELD_STATIC (node) && FIELD_FINAL (node)
+ && DECL_INITIAL (node) != NULL_TREE
&& !flag_emit_xref)
{
tree value = DECL_INITIAL (node);
else
node = patch_switch_statement (node);
- if (TREE_OPERAND (node, 0) == error_mark_node)
+ if (node == error_mark_node || TREE_OPERAND (node, 0) == error_mark_node)
nn = error_mark_node;
else
{
(type == string_ptr_type_node && ! flag_emit_class_files))
return empty_stmt_node;
}
- DECL_INITIAL (nn) = NULL_TREE;
+ if (! flag_emit_class_files)
+ DECL_INITIAL (nn) = NULL_TREE;
}
wfl_op2 = TREE_OPERAND (node, 1);
nn = java_complete_tree (wfl_op1);
if (nn == error_mark_node)
return error_mark_node;
- if ((cn = patch_string (nn)))
- nn = cn;
+
TREE_OPERAND (node, 0) = nn;
}
if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2))
nn = java_complete_tree (wfl_op2);
if (nn == error_mark_node)
return error_mark_node;
- if ((cn = patch_string (nn)))
- nn = cn;
+
TREE_OPERAND (node, 1) = nn;
}
return force_evaluation_order (patch_binop (node, wfl_op1, wfl_op2));
/* Wrap a non WFL node around a WFL. */
static tree
-build_wfl_wrap (node)
+build_wfl_wrap (node, location)
tree node;
+ int location;
{
tree wfl, node_to_insert = node;
else
wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
- EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (node);
+ EXPR_WFL_LINECOL (wfl) = location;
EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (node_to_insert, NULL_TREE);
return wfl;
}
&& JDECL_P (TREE_OPERAND (lvalue, 1)))
lvalue = TREE_OPERAND (lvalue, 1);
- if (TREE_CODE (lvalue) == FIELD_DECL
- && FIELD_FINAL (lvalue)
- && !DECL_CLINIT_P (current_function_decl)
- && !DECL_FINIT_P (current_function_decl))
+ /* When generating class files, references to the `length' field
+ look a bit different. */
+ if ((flag_emit_class_files
+ && TREE_CODE (lvalue) == COMPONENT_REF
+ && TYPE_ARRAY_P (TREE_TYPE (TREE_OPERAND (lvalue, 0)))
+ && FIELD_FINAL (TREE_OPERAND (lvalue, 1)))
+ || (TREE_CODE (lvalue) == FIELD_DECL
+ && FIELD_FINAL (lvalue)
+ && !DECL_CLINIT_P (current_function_decl)
+ && !DECL_FINIT_P (current_function_decl)))
{
parse_error_context
(wfl, "Can't assign a value to the final variable `%s'",
tree n = TREE_OPERAND (rhs, 1);
if (TREE_CODE (n) == VAR_DECL
&& DECL_NAME (n) == TYPE_identifier_node
- && rhs_type == class_ptr_type)
+ && rhs_type == class_ptr_type
+ && TREE_CODE (EXPR_WFL_NODE (wfl)) == IDENTIFIER_NODE)
{
const char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));
if (!strncmp (self_name, "java.lang.", 10))
if (TYPE_CLASS_P (dest))
return (source == dest
|| inherits_from_p (source, dest)
- || enclosing_context_p (dest, source /*source, dest*/)
|| (cast && inherits_from_p (dest, source)));
if (TYPE_INTERFACE_P (dest))
{
tree op2 = TREE_OPERAND (node, 1);
tree op1_type = TREE_TYPE (op1);
tree op2_type = TREE_TYPE (op2);
- tree prom_type = NULL_TREE;
+ tree prom_type = NULL_TREE, cn;
int code = TREE_CODE (node);
/* If 1, tell the routine that we have to return error_mark_node
}
/* Otherwise we have to invoke instance of to figure it out */
else
- {
- tree call =
- build (CALL_EXPR, boolean_type_node,
- build_address_of (soft_instanceof_node),
- tree_cons
- (NULL_TREE, op1,
- build_tree_list (NULL_TREE,
- build_class_ref (op2_type))),
- NULL_TREE);
- TREE_SIDE_EFFECTS (call) = TREE_SIDE_EFFECTS (op1);
- return call;
- }
+ return build_instanceof (op1, op2_type);
}
/* There is no way the expression operand can be an instance of
the type operand. This is a compile time error. */
/* 15.20 Equality Operator */
case EQ_EXPR:
case NE_EXPR:
+ /* It's time for us to patch the strings. */
+ if ((cn = patch_string (op1)))
+ {
+ op1 = cn;
+ op1_type = TREE_TYPE (op1);
+ }
+ if ((cn = patch_string (op2)))
+ {
+ op2 = cn;
+ op2_type = TREE_TYPE (op2);
+ }
+
/* 15.20.1 Numerical Equality Operators == and != */
/* Binary numeric promotion is performed on the operands */
if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type))
return error_mark_node;
if (!flag_emit_class_files || JPRIMITIVE_TYPE_P (ref_type))
- return build_class_ref (ref_type);
+ {
+ /* A class referenced by `foo.class' is initialized. */
+ return build_class_init (ref_type, build_class_ref (ref_type));
+ }
/* If we're emitting class files and we have to deal with non
primitive types, we invoke (and consider generating) the
{
if (unresolved_type_p (type, NULL))
{
- tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE);
+ tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), type);
if (!type_decl)
{
parse_error_context (type,
TREE_PURPOSE (current) = NULL_TREE;
all_constant = 0;
}
- if (elt && TREE_VALUE (elt) == error_mark_node)
+ if (elt && TREE_CODE (elt) == TREE_LIST
+ && TREE_VALUE (elt) == error_mark_node)
error_seen = 1;
}
if (new_value)
{
- new_value = maybe_build_primttype_type_ref (new_value, wfl_operator);
+ new_value = maybe_build_primttype_type_ref (new_value, wfl_value);
TREE_VALUE (entry) = new_value;
}
tree op0, op1, val;
enum tree_code code = TREE_CODE (node);
- if (code == STRING_CST)
+ if (code == STRING_CST || code == INTEGER_CST || code == REAL_CST)
return node;
- if (code == INTEGER_CST || code == REAL_CST)
- return convert (TREE_TYPE (context), node);
- if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
- return NULL_TREE;
-
switch (code)
{
case PLUS_EXPR: