1 2/* A Bison parser, made from ./parse.y 3 by GNU Bison version 1.27 4 */ 5 6#define YYBISON 1 /* Identify Bison output. */ 7 8#define yyparse java_parse 9#define yylex java_lex 10#define yyerror java_error 11#define yylval java_lval 12#define yychar java_char 13#define yydebug java_debug 14#define yynerrs java_nerrs 15#define PLUS_TK 257 16#define MINUS_TK 258 17#define MULT_TK 259 18#define DIV_TK 260 19#define REM_TK 261 20#define LS_TK 262 21#define SRS_TK 263 22#define ZRS_TK 264 23#define AND_TK 265 24#define XOR_TK 266 25#define OR_TK 267 26#define BOOL_AND_TK 268 27#define BOOL_OR_TK 269 28#define EQ_TK 270 29#define NEQ_TK 271 30#define GT_TK 272 31#define GTE_TK 273 32#define LT_TK 274 33#define LTE_TK 275 34#define PLUS_ASSIGN_TK 276 35#define MINUS_ASSIGN_TK 277 36#define MULT_ASSIGN_TK 278 37#define DIV_ASSIGN_TK 279 38#define REM_ASSIGN_TK 280 39#define LS_ASSIGN_TK 281 40#define SRS_ASSIGN_TK 282 41#define ZRS_ASSIGN_TK 283 42#define AND_ASSIGN_TK 284 43#define XOR_ASSIGN_TK 285 44#define OR_ASSIGN_TK 286 45#define PUBLIC_TK 287 46#define PRIVATE_TK 288 47#define PROTECTED_TK 289 48#define STATIC_TK 290 49#define FINAL_TK 291 50#define SYNCHRONIZED_TK 292 51#define VOLATILE_TK 293 52#define TRANSIENT_TK 294 53#define NATIVE_TK 295 54#define PAD_TK 296 55#define ABSTRACT_TK 297 56#define MODIFIER_TK 298 57#define DECR_TK 299 58#define INCR_TK 300 59#define DEFAULT_TK 301 60#define IF_TK 302 61#define THROW_TK 303 62#define BOOLEAN_TK 304 63#define DO_TK 305 64#define IMPLEMENTS_TK 306 65#define THROWS_TK 307 66#define BREAK_TK 308 67#define IMPORT_TK 309 68#define ELSE_TK 310 69#define INSTANCEOF_TK 311 70#define RETURN_TK 312 71#define VOID_TK 313 72#define CATCH_TK 314 73#define INTERFACE_TK 315 74#define CASE_TK 316 75#define EXTENDS_TK 317 76#define FINALLY_TK 318 77#define SUPER_TK 319 78#define WHILE_TK 320 79#define CLASS_TK 321 80#define SWITCH_TK 322 81#define CONST_TK 323 82#define TRY_TK 324 83#define FOR_TK 325 84#define NEW_TK 326 85#define CONTINUE_TK 327 86#define GOTO_TK 328 87#define PACKAGE_TK 329 88#define THIS_TK 330 89#define BYTE_TK 331 90#define SHORT_TK 332 91#define INT_TK 333 92#define LONG_TK 334 93#define CHAR_TK 335 94#define INTEGRAL_TK 336 95#define FLOAT_TK 337 96#define DOUBLE_TK 338 97#define FP_TK 339 98#define ID_TK 340 99#define REL_QM_TK 341 100#define REL_CL_TK 342 101#define NOT_TK 343 102#define NEG_TK 344 103#define ASSIGN_ANY_TK 345 104#define ASSIGN_TK 346 105#define OP_TK 347 106#define CP_TK 348 107#define OCB_TK 349 108#define CCB_TK 350 109#define OSB_TK 351 110#define CSB_TK 352 111#define SC_TK 353 112#define C_TK 354 113#define DOT_TK 355 114#define STRING_LIT_TK 356 115#define CHAR_LIT_TK 357 116#define INT_LIT_TK 358 117#define FP_LIT_TK 359 118#define TRUE_TK 360 119#define FALSE_TK 361 120#define BOOL_LIT_TK 362 121#define NULL_TK 363 122 123#line 48 "./parse.y" 124 125#include "config.h" 126#include "system.h" 127#include <dirent.h> 128#include "tree.h" 129#include "rtl.h" 130#include "obstack.h" 131#include "toplev.h" 132#include "flags.h" 133#include "java-tree.h" 134#include "jcf.h" 135#include "lex.h" 136#include "parse.h" 137#include "zipfile.h" 138#include "convert.h" 139#include "buffer.h" 140#include "xref.h" 141#include "except.h" 142 143#ifndef DIR_SEPARATOR 144#define DIR_SEPARATOR '/' 145#endif 146 147/* Local function prototypes */ 148static char *java_accstring_lookup PROTO ((int)); 149static void classitf_redefinition_error PROTO ((char *,tree, tree, tree)); 150static void variable_redefinition_error PROTO ((tree, tree, tree, int)); 151static void check_modifiers PROTO ((char *, int, int)); 152static tree create_class PROTO ((int, tree, tree, tree)); 153static tree create_interface PROTO ((int, tree, tree)); 154static tree find_field PROTO ((tree, tree)); 155static tree lookup_field_wrapper PROTO ((tree, tree)); 156static int duplicate_declaration_error_p PROTO ((tree, tree, tree)); 157static void register_fields PROTO ((int, tree, tree)); 158static tree parser_qualified_classname PROTO ((tree)); 159static int parser_check_super PROTO ((tree, tree, tree)); 160static int parser_check_super_interface PROTO ((tree, tree, tree)); 161static void check_modifiers_consistency PROTO ((int)); 162static tree lookup_cl PROTO ((tree)); 163static tree lookup_java_method2 PROTO ((tree, tree, int)); 164static tree method_header PROTO ((int, tree, tree, tree)); 165static void fix_method_argument_names PROTO ((tree ,tree)); 166static tree method_declarator PROTO ((tree, tree)); 167static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...)) 168 ATTRIBUTE_PRINTF_2; 169static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list)); 170static tree parse_jdk1_1_error PROTO ((char *)); 171static void complete_class_report_errors PROTO ((jdep *)); 172static int process_imports PROTO ((void)); 173static void read_import_dir PROTO ((tree)); 174static int find_in_imports_on_demand PROTO ((tree)); 175static int find_in_imports PROTO ((tree)); 176static int check_pkg_class_access PROTO ((tree, tree)); 177static tree resolve_package PROTO ((tree, tree *)); 178static tree lookup_package_type PROTO ((char *, int)); 179static tree lookup_package_type_and_set_next PROTO ((char *, int, tree *)); 180static tree resolve_class PROTO ((tree, tree, tree)); 181static void declare_local_variables PROTO ((int, tree, tree)); 182static void source_start_java_method PROTO ((tree)); 183static void source_end_java_method PROTO ((void)); 184static void expand_start_java_method PROTO ((tree)); 185static tree find_name_in_single_imports PROTO ((tree)); 186static void check_abstract_method_header PROTO ((tree)); 187static tree lookup_java_interface_method2 PROTO ((tree, tree)); 188static tree resolve_expression_name PROTO ((tree, tree *)); 189static tree maybe_create_class_interface_decl PROTO ((tree, tree, tree)); 190static int check_class_interface_creation PROTO ((int, int, tree, 191 tree, tree, tree)); 192static tree patch_method_invocation PROTO ((tree, tree, tree, 193 int *, tree *)); 194static int breakdown_qualified PROTO ((tree *, tree *, tree)); 195static tree resolve_and_layout PROTO ((tree, tree)); 196static tree resolve_no_layout PROTO ((tree, tree)); 197static int invocation_mode PROTO ((tree, int)); 198static tree find_applicable_accessible_methods_list PROTO ((int, tree, 199 tree, tree)); 200static void search_applicable_methods_list PROTO ((int, tree, tree, tree, 201 tree *, tree *)); 202static tree find_most_specific_methods_list PROTO ((tree)); 203static int argument_types_convertible PROTO ((tree, tree)); 204static tree patch_invoke PROTO ((tree, tree, tree)); 205static tree lookup_method_invoke PROTO ((int, tree, tree, tree, tree)); 206static tree register_incomplete_type PROTO ((int, tree, tree, tree)); 207static tree obtain_incomplete_type PROTO ((tree)); 208static tree java_complete_lhs PROTO ((tree)); 209static tree java_complete_tree PROTO ((tree)); 210static void java_complete_expand_method PROTO ((tree)); 211static int unresolved_type_p PROTO ((tree, tree *)); 212static void create_jdep_list PROTO ((struct parser_ctxt *)); 213static tree build_expr_block PROTO ((tree, tree)); 214static tree enter_block PROTO ((void)); 215static tree enter_a_block PROTO ((tree)); 216static tree exit_block PROTO ((void)); 217static tree lookup_name_in_blocks PROTO ((tree)); 218static void maybe_absorb_scoping_blocks PROTO ((void)); 219static tree build_method_invocation PROTO ((tree, tree)); 220static tree build_new_invocation PROTO ((tree, tree)); 221static tree build_assignment PROTO ((int, int, tree, tree)); 222static tree build_binop PROTO ((enum tree_code, int, tree, tree)); 223static int check_final_assignment PROTO ((tree ,tree)); 224static tree patch_assignment PROTO ((tree, tree, tree )); 225static tree patch_binop PROTO ((tree, tree, tree)); 226static tree build_unaryop PROTO ((int, int, tree)); 227static tree build_incdec PROTO ((int, int, tree, int)); 228static tree patch_unaryop PROTO ((tree, tree)); 229static tree build_cast PROTO ((int, tree, tree)); 230static tree build_null_of_type PROTO ((tree)); 231static tree patch_cast PROTO ((tree, tree)); 232static int valid_ref_assignconv_cast_p PROTO ((tree, tree, int)); 233static int valid_builtin_assignconv_identity_widening_p PROTO ((tree, tree)); 234static int valid_cast_to_p PROTO ((tree, tree)); 235static int valid_method_invocation_conversion_p PROTO ((tree, tree)); 236static tree try_builtin_assignconv PROTO ((tree, tree, tree)); 237static tree try_reference_assignconv PROTO ((tree, tree)); 238static tree build_unresolved_array_type PROTO ((tree)); 239static tree build_array_from_name PROTO ((tree, tree, tree, tree *)); 240static tree build_array_ref PROTO ((int, tree, tree)); 241static tree patch_array_ref PROTO ((tree)); 242static tree make_qualified_name PROTO ((tree, tree, int)); 243static tree merge_qualified_name PROTO ((tree, tree)); 244static tree make_qualified_primary PROTO ((tree, tree, int)); 245static int resolve_qualified_expression_name PROTO ((tree, tree *, 246 tree *, tree *)); 247static void qualify_ambiguous_name PROTO ((tree)); 248static void maybe_generate_clinit PROTO ((void)); 249static tree resolve_field_access PROTO ((tree, tree *, tree *)); 250static tree build_newarray_node PROTO ((tree, tree, int)); 251static tree patch_newarray PROTO ((tree)); 252static tree resolve_type_during_patch PROTO ((tree)); 253static tree build_this PROTO ((int)); 254static tree build_return PROTO ((int, tree)); 255static tree patch_return PROTO ((tree)); 256static tree maybe_access_field PROTO ((tree, tree, tree)); 257static int complete_function_arguments PROTO ((tree)); 258static int check_for_static_method_reference PROTO ((tree, tree, tree, tree, tree)); 259static int not_accessible_p PROTO ((tree, tree, int)); 260static void check_deprecation PROTO ((tree, tree)); 261static int class_in_current_package PROTO ((tree)); 262static tree build_if_else_statement PROTO ((int, tree, tree, tree)); 263static tree patch_if_else_statement PROTO ((tree)); 264static tree add_stmt_to_compound PROTO ((tree, tree, tree)); 265static tree add_stmt_to_block PROTO ((tree, tree, tree)); 266static tree patch_exit_expr PROTO ((tree)); 267static tree build_labeled_block PROTO ((int, tree)); 268static tree finish_labeled_statement PROTO ((tree, tree)); 269static tree build_bc_statement PROTO ((int, int, tree)); 270static tree patch_bc_statement PROTO ((tree)); 271static tree patch_loop_statement PROTO ((tree)); 272static tree build_new_loop PROTO ((tree)); 273static tree build_loop_body PROTO ((int, tree, int)); 274static tree finish_loop_body PROTO ((int, tree, tree, int)); 275static tree build_debugable_stmt PROTO ((int, tree)); 276static tree finish_for_loop PROTO ((int, tree, tree, tree)); 277static tree patch_switch_statement PROTO ((tree)); 278static tree string_constant_concatenation PROTO ((tree, tree)); 279static tree build_string_concatenation PROTO ((tree, tree)); 280static tree patch_string_cst PROTO ((tree)); 281static tree patch_string PROTO ((tree)); 282static tree build_try_statement PROTO ((int, tree, tree)); 283static tree build_try_finally_statement PROTO ((int, tree, tree)); 284static tree patch_try_statement PROTO ((tree)); 285static tree patch_synchronized_statement PROTO ((tree, tree)); 286static tree patch_throw_statement PROTO ((tree, tree)); 287static void check_thrown_exceptions PROTO ((int, tree)); 288static int check_thrown_exceptions_do PROTO ((tree)); 289static void purge_unchecked_exceptions PROTO ((tree)); 290static void check_throws_clauses PROTO ((tree, tree, tree)); 291static void finish_method_declaration PROTO ((tree)); 292static tree build_super_invocation PROTO (()); 293static int verify_constructor_circularity PROTO ((tree, tree)); 294static char *constructor_circularity_msg PROTO ((tree, tree)); 295static tree build_this_super_qualified_invocation PROTO ((int, tree, tree, 296 int, int)); 297static char *get_printable_method_name PROTO ((tree)); 298static tree patch_conditional_expr PROTO ((tree, tree, tree)); 299static void maybe_generate_finit PROTO (()); 300static void fix_constructors PROTO ((tree)); 301static int verify_constructor_super PROTO (()); 302static tree create_artificial_method PROTO ((tree, int, tree, tree, tree)); 303static void start_artificial_method_body PROTO ((tree)); 304static void end_artificial_method_body PROTO ((tree)); 305static int check_method_redefinition PROTO ((tree, tree)); 306static int reset_method_name PROTO ((tree)); 307static void java_check_regular_methods PROTO ((tree)); 308static void java_check_abstract_methods PROTO ((tree)); 309static tree maybe_build_primttype_type_ref PROTO ((tree, tree)); 310static void unreachable_stmt_error PROTO ((tree)); 311static tree find_expr_with_wfl PROTO ((tree)); 312static void missing_return_error PROTO ((tree)); 313static tree build_new_array_init PROTO ((int, tree)); 314static tree patch_new_array_init PROTO ((tree, tree)); 315static tree maybe_build_array_element_wfl PROTO ((tree)); 316static int array_constructor_check_entry PROTO ((tree, tree)); 317static char *purify_type_name PROTO ((char *)); 318static tree fold_constant_for_init PROTO ((tree, tree)); 319static tree strip_out_static_field_access_decl PROTO ((tree)); 320static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *)); 321static void static_ref_err PROTO ((tree, tree, tree)); 322 323/* Number of error found so far. */ 324int java_error_count; 325/* Number of warning found so far. */ 326int java_warning_count; 327/* Tell when not to fold, when doing xrefs */ 328int do_not_fold; 329 330/* The current parser context */ 331struct parser_ctxt *ctxp; 332 333/* List of things that were analyzed for which code will be generated */ 334static struct parser_ctxt *ctxp_for_generation = NULL; 335 336/* binop_lookup maps token to tree_code. It is used where binary 337 operations are involved and required by the parser. RDIV_EXPR 338 covers both integral/floating point division. The code is changed 339 once the type of both operator is worked out. */ 340 341static enum tree_code binop_lookup[19] = 342 { 343 PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR, 344 LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR, 345 BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR, 346 TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, 347 EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR, 348 }; 349#define BINOP_LOOKUP(VALUE) \ 350 binop_lookup [((VALUE) - PLUS_TK)% \ 351 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))] 352 353/* Fake WFL used to report error message. It is initialized once if 354 needed and reused with it's location information is overriden. */ 355tree wfl_operator = NULL_TREE; 356 357/* The "$L" identifier we use to create labels. */ 358static tree label_id = NULL_TREE; 359 360/* The "StringBuffer" identifier used for the String `+' operator. */ 361static tree wfl_string_buffer = NULL_TREE; 362 363/* The "append" identifier used for String `+' operator. */ 364static tree wfl_append = NULL_TREE; 365 366/* The "toString" identifier used for String `+' operator. */ 367static tree wfl_to_string = NULL_TREE; 368 369/* The "java.lang" import qualified name. */ 370static tree java_lang_id = NULL_TREE; 371 372/* The "java.lang.Cloneable" qualified name. */ 373static tree java_lang_cloneable = NULL_TREE; 374 375/* Context and flag for static blocks */ 376static tree current_static_block = NULL_TREE; 377 378 379#line 304 "./parse.y" 380typedef union { 381 tree node; 382 int sub_token; 383 struct { 384 int token; 385 int location; 386 } operator; 387 int value; 388} YYSTYPE; 389#line 314 "./parse.y" 390 391#include "lex.c" 392#ifndef YYDEBUG 393#define YYDEBUG 1 394#endif 395 396#include <stdio.h> 397 398#ifndef __cplusplus 399#ifndef __STDC__ 400#define const 401#endif 402#endif 403 404 405 406#define YYFINAL 777 407#define YYFLAG -32768 408#define YYNTBASE 110 409 410#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 266) 411 412static const char yytranslate[] = { 0, 413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 438 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 439 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 440 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 441 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 442 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 443 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 444 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 445 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 446 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 447 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 448 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 449 107, 108, 109 450}; 451 452#if YYDEBUG != 0 453static const short yyprhs[] = { 0, 454 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 455 20, 22, 24, 26, 28, 30, 32, 34, 38, 42, 456 46, 50, 54, 56, 58, 60, 64, 66, 67, 69, 457 71, 73, 76, 79, 82, 86, 88, 91, 93, 96, 458 100, 103, 107, 109, 111, 115, 118, 122, 128, 133, 459 139, 141, 143, 145, 147, 149, 152, 153, 161, 162, 460 169, 173, 176, 180, 185, 186, 189, 193, 196, 197, 461 200, 203, 205, 209, 213, 216, 220, 222, 225, 227, 462 229, 231, 233, 235, 238, 240, 242, 244, 248, 253, 463 255, 259, 263, 265, 269, 273, 278, 280, 284, 287, 464 291, 295, 297, 299, 300, 304, 307, 311, 315, 320, 465 325, 328, 332, 335, 339, 342, 346, 351, 355, 359, 466 363, 365, 369, 373, 376, 380, 383, 387, 388, 391, 467 394, 396, 400, 404, 406, 409, 411, 414, 418, 420, 468 421, 425, 428, 432, 436, 441, 444, 448, 452, 457, 469 459, 462, 467, 473, 481, 488, 490, 492, 493, 498, 470 499, 505, 506, 512, 513, 520, 524, 529, 532, 536, 471 539, 543, 546, 550, 552, 555, 557, 559, 561, 563, 472 565, 568, 571, 574, 578, 583, 585, 589, 593, 596, 473 600, 602, 604, 606, 609, 611, 613, 615, 618, 621, 474 625, 627, 629, 631, 633, 635, 637, 639, 641, 643, 475 645, 647, 649, 651, 653, 655, 657, 659, 661, 663, 476 665, 667, 669, 671, 674, 677, 680, 683, 686, 689, 477 692, 695, 699, 704, 709, 715, 720, 726, 733, 741, 478 748, 750, 752, 754, 756, 758, 760, 762, 768, 771, 479 775, 780, 788, 796, 797, 801, 806, 809, 813, 819, 480 822, 826, 830, 835, 837, 840, 843, 845, 848, 852, 481 855, 858, 862, 865, 870, 873, 876, 880, 885, 888, 482 890, 898, 906, 913, 917, 923, 928, 936, 943, 946, 483 949, 953, 956, 957, 959, 961, 964, 965, 967, 969, 484 973, 977, 980, 984, 987, 991, 994, 998, 1001, 1005, 485 1008, 1012, 1015, 1019, 1023, 1026, 1030, 1036, 1042, 1045, 486 1050, 1054, 1056, 1060, 1064, 1069, 1072, 1074, 1077, 1080, 487 1085, 1088, 1092, 1097, 1100, 1103, 1105, 1107, 1109, 1111, 488 1115, 1117, 1119, 1121, 1123, 1127, 1131, 1135, 1139, 1143, 489 1147, 1151, 1155, 1161, 1166, 1173, 1179, 1184, 1190, 1196, 490 1203, 1207, 1211, 1216, 1222, 1225, 1229, 1233, 1237, 1239, 491 1243, 1247, 1251, 1255, 1260, 1265, 1270, 1275, 1279, 1283, 492 1285, 1288, 1292, 1296, 1299, 1302, 1306, 1310, 1314, 1318, 493 1321, 1325, 1330, 1336, 1343, 1349, 1356, 1361, 1366, 1371, 494 1376, 1380, 1385, 1389, 1394, 1396, 1398, 1400, 1402, 1405, 495 1408, 1410, 1412, 1415, 1418, 1420, 1423, 1426, 1429, 1432, 496 1435, 1438, 1440, 1443, 1446, 1448, 1451, 1454, 1460, 1465, 497 1470, 1476, 1481, 1484, 1490, 1495, 1501, 1503, 1507, 1511, 498 1515, 1519, 1523, 1527, 1529, 1533, 1537, 1541, 1545, 1547, 499 1551, 1555, 1559, 1563, 1567, 1571, 1573, 1577, 1581, 1585, 500 1589, 1593, 1597, 1601, 1605, 1609, 1613, 1615, 1619, 1623, 501 1627, 1631, 1633, 1637, 1641, 1643, 1647, 1651, 1653, 1657, 502 1661, 1663, 1667, 1671, 1673, 1677, 1681, 1683, 1689, 1694, 503 1698, 1704, 1706, 1708, 1712, 1716, 1718, 1720, 1722, 1724, 504 1726, 1728 505}; 506 507static const short yyrhs[] = { 123, 508 0, 104, 0, 105, 0, 108, 0, 103, 0, 102, 509 0, 109, 0, 113, 0, 114, 0, 82, 0, 85, 510 0, 50, 0, 115, 0, 118, 0, 119, 0, 115, 511 0, 115, 0, 113, 97, 98, 0, 119, 97, 98, 512 0, 118, 97, 98, 0, 113, 97, 1, 0, 118, 513 97, 1, 0, 120, 0, 121, 0, 122, 0, 119, 514 101, 122, 0, 86, 0, 0, 126, 0, 124, 0, 515 125, 0, 126, 124, 0, 126, 125, 0, 124, 125, 516 0, 126, 124, 125, 0, 127, 0, 124, 127, 0, 517 130, 0, 125, 130, 0, 75, 119, 99, 0, 75, 518 1, 0, 75, 119, 1, 0, 128, 0, 129, 0, 519 55, 119, 99, 0, 55, 1, 0, 55, 119, 1, 520 0, 55, 119, 101, 5, 99, 0, 55, 119, 101, 521 1, 0, 55, 119, 101, 5, 1, 0, 132, 0, 522 166, 0, 99, 0, 1, 0, 44, 0, 131, 44, 523 0, 0, 131, 67, 122, 135, 136, 133, 138, 0, 524 0, 67, 122, 135, 136, 134, 138, 0, 131, 67, 525 1, 0, 67, 1, 0, 67, 122, 1, 0, 131, 526 67, 122, 1, 0, 0, 63, 116, 0, 63, 116, 527 1, 0, 63, 1, 0, 0, 52, 137, 0, 52, 528 1, 0, 117, 0, 137, 100, 117, 0, 137, 100, 529 1, 0, 95, 96, 0, 95, 139, 96, 0, 140, 530 0, 139, 140, 0, 141, 0, 156, 0, 158, 0, 531 179, 0, 142, 0, 142, 99, 0, 147, 0, 132, 532 0, 166, 0, 112, 143, 99, 0, 131, 112, 143, 533 99, 0, 144, 0, 143, 100, 144, 0, 143, 100, 534 1, 0, 145, 0, 145, 92, 146, 0, 145, 92, 535 1, 0, 145, 92, 146, 1, 0, 122, 0, 145, 536 97, 98, 0, 122, 1, 0, 145, 97, 1, 0, 537 145, 98, 1, 0, 264, 0, 177, 0, 0, 149, 538 148, 155, 0, 149, 1, 0, 112, 150, 153, 0, 539 59, 150, 153, 0, 131, 112, 150, 153, 0, 131, 540 59, 150, 153, 0, 112, 1, 0, 131, 112, 1, 541 0, 59, 1, 0, 131, 59, 1, 0, 131, 1, 542 0, 122, 93, 94, 0, 122, 93, 151, 94, 0, 543 150, 97, 98, 0, 122, 93, 1, 0, 150, 97, 544 1, 0, 152, 0, 151, 100, 152, 0, 151, 100, 545 1, 0, 112, 145, 0, 131, 112, 145, 0, 112, 546 1, 0, 131, 112, 1, 0, 0, 53, 154, 0, 547 53, 1, 0, 116, 0, 154, 100, 116, 0, 154, 548 100, 1, 0, 179, 0, 179, 99, 0, 99, 0, 549 157, 179, 0, 157, 179, 99, 0, 44, 0, 0, 550 160, 159, 162, 0, 161, 153, 0, 131, 161, 153, 551 0, 120, 93, 94, 0, 120, 93, 151, 94, 0, 552 180, 163, 0, 180, 164, 163, 0, 180, 182, 163, 553 0, 180, 164, 182, 163, 0, 181, 0, 181, 99, 554 0, 165, 93, 94, 99, 0, 165, 93, 233, 94, 555 99, 0, 119, 101, 65, 93, 233, 94, 99, 0, 556 119, 101, 65, 93, 94, 99, 0, 76, 0, 65, 557 0, 0, 61, 122, 167, 172, 0, 0, 131, 61, 558 122, 168, 172, 0, 0, 61, 122, 171, 169, 172, 559 0, 0, 131, 61, 122, 171, 170, 172, 0, 61, 560 122, 1, 0, 131, 61, 122, 1, 0, 63, 117, 561 0, 171, 100, 117, 0, 63, 1, 0, 171, 100, 562 1, 0, 95, 96, 0, 95, 173, 96, 0, 174, 563 0, 173, 174, 0, 175, 0, 176, 0, 132, 0, 564 166, 0, 142, 0, 149, 99, 0, 149, 1, 0, 565 95, 96, 0, 95, 178, 96, 0, 95, 178, 100, 566 96, 0, 146, 0, 178, 100, 146, 0, 178, 100, 567 1, 0, 95, 96, 0, 180, 182, 181, 0, 95, 568 0, 96, 0, 183, 0, 182, 183, 0, 184, 0, 569 186, 0, 132, 0, 185, 99, 0, 112, 143, 0, 570 131, 112, 143, 0, 188, 0, 191, 0, 195, 0, 571 196, 0, 207, 0, 211, 0, 188, 0, 192, 0, 572 197, 0, 208, 0, 212, 0, 179, 0, 189, 0, 573 193, 0, 198, 0, 210, 0, 218, 0, 219, 0, 574 220, 0, 222, 0, 221, 0, 224, 0, 99, 0, 575 122, 88, 0, 190, 186, 0, 122, 1, 0, 190, 576 187, 0, 194, 99, 0, 1, 99, 0, 1, 95, 577 0, 1, 96, 0, 165, 93, 1, 0, 165, 93, 578 94, 1, 0, 165, 93, 233, 1, 0, 165, 93, 579 233, 94, 1, 0, 119, 101, 65, 1, 0, 119, 580 101, 65, 93, 1, 0, 119, 101, 65, 93, 233, 581 1, 0, 119, 101, 65, 93, 233, 94, 1, 0, 582 119, 101, 65, 93, 94, 1, 0, 261, 0, 245, 583 0, 246, 0, 242, 0, 243, 0, 239, 0, 231, 584 0, 48, 93, 264, 94, 186, 0, 48, 1, 0, 585 48, 93, 1, 0, 48, 93, 264, 1, 0, 48, 586 93, 264, 94, 187, 56, 186, 0, 48, 93, 264, 587 94, 187, 56, 187, 0, 0, 200, 199, 201, 0, 588 68, 93, 264, 94, 0, 68, 1, 0, 68, 93, 589 1, 0, 68, 93, 264, 94, 1, 0, 95, 96, 590 0, 95, 204, 96, 0, 95, 202, 96, 0, 95, 591 202, 204, 96, 0, 203, 0, 202, 203, 0, 204, 592 182, 0, 205, 0, 204, 205, 0, 62, 265, 88, 593 0, 47, 88, 0, 62, 1, 0, 62, 265, 1, 594 0, 47, 1, 0, 66, 93, 264, 94, 0, 206, 595 186, 0, 66, 1, 0, 66, 93, 1, 0, 66, 596 93, 264, 1, 0, 206, 187, 0, 51, 0, 209, 597 186, 66, 93, 264, 94, 99, 0, 214, 99, 264, 598 99, 216, 94, 186, 0, 214, 99, 99, 216, 94, 599 186, 0, 214, 99, 1, 0, 214, 99, 264, 99, 600 1, 0, 214, 99, 99, 1, 0, 214, 99, 264, 601 99, 216, 94, 187, 0, 214, 99, 99, 216, 94, 602 187, 0, 71, 93, 0, 71, 1, 0, 71, 93, 603 1, 0, 213, 215, 0, 0, 217, 0, 185, 0, 604 217, 1, 0, 0, 217, 0, 194, 0, 217, 100, 605 194, 0, 217, 100, 1, 0, 54, 99, 0, 54, 606 122, 99, 0, 54, 1, 0, 54, 122, 1, 0, 607 73, 99, 0, 73, 122, 99, 0, 73, 1, 0, 608 73, 122, 1, 0, 58, 99, 0, 58, 264, 99, 609 0, 58, 1, 0, 58, 264, 1, 0, 49, 264, 610 99, 0, 49, 1, 0, 49, 264, 1, 0, 223, 611 93, 264, 94, 179, 0, 223, 93, 264, 94, 1, 612 0, 223, 1, 0, 223, 93, 1, 94, 0, 223, 613 93, 1, 0, 44, 0, 70, 179, 225, 0, 70, 614 179, 228, 0, 70, 179, 225, 228, 0, 70, 1, 615 0, 226, 0, 225, 226, 0, 227, 179, 0, 60, 616 93, 152, 94, 0, 60, 1, 0, 60, 93, 1, 617 0, 60, 93, 1, 94, 0, 64, 179, 0, 64, 618 1, 0, 230, 0, 234, 0, 111, 0, 76, 0, 619 93, 264, 94, 0, 231, 0, 238, 0, 239, 0, 620 240, 0, 119, 101, 67, 0, 113, 101, 67, 0, 621 59, 101, 67, 0, 119, 101, 76, 0, 93, 264, 622 1, 0, 119, 101, 1, 0, 113, 101, 1, 0, 623 59, 101, 1, 0, 72, 116, 93, 233, 94, 0, 624 72, 116, 93, 94, 0, 72, 116, 93, 233, 94, 625 138, 0, 72, 116, 93, 94, 138, 0, 232, 122, 626 93, 94, 0, 232, 122, 93, 94, 138, 0, 232, 627 122, 93, 233, 94, 0, 232, 122, 93, 233, 94, 628 138, 0, 72, 1, 99, 0, 72, 116, 1, 0, 629 72, 116, 93, 1, 0, 72, 116, 93, 233, 1, 630 0, 232, 1, 0, 232, 122, 1, 0, 119, 101, 631 72, 0, 229, 101, 72, 0, 264, 0, 233, 100, 632 264, 0, 233, 100, 1, 0, 72, 113, 235, 0, 633 72, 115, 235, 0, 72, 113, 235, 237, 0, 72, 634 115, 235, 237, 0, 72, 115, 237, 177, 0, 72, 635 113, 237, 177, 0, 72, 1, 98, 0, 72, 1, 636 97, 0, 236, 0, 235, 236, 0, 97, 264, 98, 637 0, 97, 264, 1, 0, 97, 1, 0, 97, 98, 638 0, 237, 97, 98, 0, 237, 97, 1, 0, 229, 639 101, 122, 0, 65, 101, 122, 0, 65, 1, 0, 640 119, 93, 94, 0, 119, 93, 233, 94, 0, 229, 641 101, 122, 93, 94, 0, 229, 101, 122, 93, 233, 642 94, 0, 65, 101, 122, 93, 94, 0, 65, 101, 643 122, 93, 233, 94, 0, 65, 101, 1, 94, 0, 644 65, 101, 1, 101, 0, 119, 97, 264, 98, 0, 645 230, 97, 264, 98, 0, 119, 97, 1, 0, 119, 646 97, 264, 1, 0, 230, 97, 1, 0, 230, 97, 647 264, 1, 0, 229, 0, 119, 0, 242, 0, 243, 648 0, 241, 46, 0, 241, 45, 0, 245, 0, 246, 649 0, 3, 244, 0, 4, 244, 0, 247, 0, 3, 650 1, 0, 4, 1, 0, 46, 244, 0, 46, 1, 651 0, 45, 244, 0, 45, 1, 0, 241, 0, 89, 652 244, 0, 90, 244, 0, 248, 0, 89, 1, 0, 653 90, 1, 0, 93, 113, 237, 94, 244, 0, 93, 654 113, 94, 244, 0, 93, 264, 94, 247, 0, 93, 655 119, 237, 94, 247, 0, 93, 113, 97, 1, 0, 656 93, 1, 0, 93, 113, 237, 94, 1, 0, 93, 657 113, 94, 1, 0, 93, 119, 237, 94, 1, 0, 658 244, 0, 249, 5, 244, 0, 249, 6, 244, 0, 659 249, 7, 244, 0, 249, 5, 1, 0, 249, 6, 660 1, 0, 249, 7, 1, 0, 249, 0, 250, 3, 661 249, 0, 250, 4, 249, 0, 250, 3, 1, 0, 662 250, 4, 1, 0, 250, 0, 251, 8, 250, 0, 663 251, 9, 250, 0, 251, 10, 250, 0, 251, 8, 664 1, 0, 251, 9, 1, 0, 251, 10, 1, 0, 665 251, 0, 252, 20, 251, 0, 252, 18, 251, 0, 666 252, 21, 251, 0, 252, 19, 251, 0, 252, 57, 667 114, 0, 252, 20, 1, 0, 252, 18, 1, 0, 668 252, 21, 1, 0, 252, 19, 1, 0, 252, 57, 669 1, 0, 252, 0, 253, 16, 252, 0, 253, 17, 670 252, 0, 253, 16, 1, 0, 253, 17, 1, 0, 671 253, 0, 254, 11, 253, 0, 254, 11, 1, 0, 672 254, 0, 255, 12, 254, 0, 255, 12, 1, 0, 673 255, 0, 256, 13, 255, 0, 256, 13, 1, 0, 674 256, 0, 257, 14, 256, 0, 257, 14, 1, 0, 675 257, 0, 258, 15, 257, 0, 258, 15, 1, 0, 676 258, 0, 258, 87, 264, 88, 259, 0, 258, 87, 677 88, 1, 0, 258, 87, 1, 0, 258, 87, 264, 678 88, 1, 0, 259, 0, 261, 0, 262, 263, 260, 679 0, 262, 263, 1, 0, 119, 0, 238, 0, 240, 680 0, 91, 0, 92, 0, 260, 0, 264, 0 681}; 682 683#endif 684 685#if YYDEBUG != 0 686static const short yyrline[] = { 0, 687 458, 464, 466, 467, 468, 469, 470, 474, 476, 479, 688 481, 482, 485, 487, 490, 494, 498, 502, 508, 510, 689 512, 514, 519, 521, 524, 528, 533, 538, 540, 541, 690 542, 543, 544, 545, 546, 549, 554, 560, 562, 565, 691 568, 570, 574, 576, 579, 606, 608, 612, 625, 627, 692 631, 638, 643, 645, 655, 660, 675, 679, 682, 685, 693 688, 690, 692, 697, 701, 703, 705, 707, 711, 713, 694 715, 722, 728, 733, 737, 746, 756, 758, 761, 763, 695 764, 765, 769, 771, 773, 774, 776, 781, 784, 794, 696 797, 799, 803, 806, 813, 819, 827, 829, 831, 833, 697 835, 839, 841, 845, 852, 853, 857, 860, 862, 864, 698 866, 868, 870, 872, 874, 881, 884, 886, 895, 897, 699 901, 906, 911, 915, 920, 925, 927, 934, 936, 938, 700 942, 945, 947, 951, 953, 954, 959, 965, 972, 980, 701 987, 990, 993, 997, 1000, 1004, 1013, 1015, 1017, 1021, 702 1023, 1026, 1033, 1041, 1043, 1047, 1054, 1064, 1068, 1071, 703 1074, 1077, 1080, 1083, 1086, 1089, 1091, 1095, 1101, 1106, 704 1108, 1112, 1115, 1119, 1121, 1124, 1126, 1127, 1129, 1133, 705 1137, 1143, 1148, 1151, 1153, 1157, 1163, 1167, 1172, 1181, 706 1185, 1190, 1202, 1204, 1207, 1209, 1211, 1215, 1219, 1222, 707 1226, 1228, 1229, 1230, 1231, 1232, 1236, 1238, 1239, 1240, 708 1241, 1245, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 709 1255, 1256, 1259, 1264, 1275, 1278, 1282, 1289, 1299, 1305, 710 1311, 1317, 1319, 1325, 1327, 1333, 1335, 1337, 1339, 1341, 711 1345, 1347, 1348, 1349, 1350, 1351, 1352, 1355, 1361, 1363, 712 1365, 1369, 1374, 1379, 1385, 1395, 1401, 1403, 1405, 1412, 713 1415, 1417, 1419, 1423, 1425, 1428, 1432, 1434, 1437, 1444, 714 1450, 1452, 1454, 1458, 1466, 1469, 1471, 1473, 1477, 1482, 715 1491, 1496, 1499, 1506, 1508, 1510, 1514, 1517, 1526, 1533, 716 1535, 1539, 1552, 1554, 1560, 1566, 1570, 1572, 1576, 1579, 717 1581, 1585, 1588, 1590, 1592, 1596, 1599, 1601, 1603, 1607, 718 1610, 1612, 1614, 1618, 1624, 1626, 1630, 1637, 1639, 1641, 719 1643, 1647, 1655, 1658, 1660, 1665, 1669, 1671, 1678, 1686, 720 1703, 1705, 1707, 1711, 1714, 1719, 1721, 1724, 1726, 1728, 721 1730, 1731, 1732, 1733, 1737, 1739, 1741, 1746, 1748, 1750, 722 1752, 1754, 1758, 1761, 1766, 1768, 1773, 1774, 1775, 1776, 723 1777, 1779, 1781, 1783, 1785, 1787, 1791, 1793, 1796, 1802, 724 1807, 1811, 1814, 1816, 1818, 1822, 1824, 1826, 1828, 1832, 725 1835, 1839, 1845, 1847, 1855, 1882, 1884, 1888, 1893, 1900, 726 1904, 1907, 1909, 1920, 1931, 1936, 1945, 1947, 1951, 1954, 727 1956, 1961, 1966, 1971, 1978, 1980, 1981, 1982, 1985, 1990, 728 1995, 1997, 1998, 2000, 2002, 2003, 2005, 2009, 2012, 2016, 729 2019, 2023, 2025, 2027, 2029, 2030, 2032, 2036, 2045, 2047, 730 2049, 2062, 2064, 2070, 2072, 2074, 2078, 2080, 2085, 2090, 731 2095, 2097, 2099, 2103, 2105, 2110, 2115, 2117, 2121, 2123, 732 2128, 2133, 2138, 2140, 2142, 2146, 2148, 2153, 2158, 2163, 733 2168, 2170, 2172, 2174, 2176, 2178, 2182, 2184, 2189, 2194, 734 2196, 2200, 2202, 2207, 2211, 2213, 2218, 2222, 2224, 2229, 735 2233, 2235, 2240, 2244, 2246, 2251, 2255, 2257, 2262, 2268, 736 2270, 2274, 2276, 2279, 2282, 2290, 2292, 2293, 2296, 2298, 737 2301, 2305 738}; 739#endif 740 741 742#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) 743 744static const char * const yytname[] = { "$","error","$undefined.","PLUS_TK", 745"MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK", 746"OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK", 747"LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK", 748"REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK", 749"XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK", 750"FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK", 751"ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK", 752"BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK", 753"INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK", 754"FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK", 755"FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK", 756"INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK", 757"REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK", 758"CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK", 759"CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK", 760"goal","literal","type","primitive_type","reference_type","class_or_interface_type", 761"class_type","interface_type","array_type","name","simple_name","qualified_name", 762"identifier","compilation_unit","import_declarations","type_declarations","package_declaration", 763"import_declaration","single_type_import_declaration","type_import_on_demand_declaration", 764"type_declaration","modifiers","class_declaration","@1","@2","super","interfaces", 765"interface_type_list","class_body","class_body_declarations","class_body_declaration", 766"class_member_declaration","field_declaration","variable_declarators","variable_declarator", 767"variable_declarator_id","variable_initializer","method_declaration","@3","method_header", 768"method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list", 769"method_body","static_initializer","static","constructor_declaration","@4","constructor_header", 770"constructor_declarator","constructor_body","constructor_block_end","explicit_constructor_invocation", 771"this_or_super","interface_declaration","@5","@6","@7","@8","extends_interfaces", 772"interface_body","interface_member_declarations","interface_member_declaration", 773"constant_declaration","abstract_method_declaration","array_initializer","variable_initializers", 774"block","block_begin","block_end","block_statements","block_statement","local_variable_declaration_statement", 775"local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement", 776"empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement", 777"statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi", 778"switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups", 779"switch_block_statement_group","switch_labels","switch_label","while_expression", 780"while_statement","while_statement_nsi","do_statement_begin","do_statement", 781"for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update", 782"statement_expression_list","break_statement","continue_statement","return_statement", 783"throw_statement","synchronized_statement","synchronized","try_statement","catches", 784"catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array", 785"class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression", 786"dim_exprs","dim_expr","dims","field_access","method_invocation","array_access", 787"postfix_expression","post_increment_expression","post_decrement_expression", 788"unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus", 789"cast_expression","multiplicative_expression","additive_expression","shift_expression", 790"relational_expression","equality_expression","and_expression","exclusive_or_expression", 791"inclusive_or_expression","conditional_and_expression","conditional_or_expression", 792"conditional_expression","assignment_expression","assignment","left_hand_side", 793"assignment_operator","expression","constant_expression", NULL 794}; 795#endif 796 797static const short yyr1[] = { 0, 798 110, 111, 111, 111, 111, 111, 111, 112, 112, 113, 799 113, 113, 114, 114, 115, 116, 117, 118, 118, 118, 800 118, 118, 119, 119, 120, 121, 122, 123, 123, 123, 801 123, 123, 123, 123, 123, 124, 124, 125, 125, 126, 802 126, 126, 127, 127, 128, 128, 128, 129, 129, 129, 803 130, 130, 130, 130, 131, 131, 133, 132, 134, 132, 804 132, 132, 132, 132, 135, 135, 135, 135, 136, 136, 805 136, 137, 137, 137, 138, 138, 139, 139, 140, 140, 806 140, 140, 141, 141, 141, 141, 141, 142, 142, 143, 807 143, 143, 144, 144, 144, 144, 145, 145, 145, 145, 808 145, 146, 146, 148, 147, 147, 149, 149, 149, 149, 809 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 810 151, 151, 151, 152, 152, 152, 152, 153, 153, 153, 811 154, 154, 154, 155, 155, 155, 156, 156, 157, 159, 812 158, 160, 160, 161, 161, 162, 162, 162, 162, 163, 813 163, 164, 164, 164, 164, 165, 165, 167, 166, 168, 814 166, 169, 166, 170, 166, 166, 166, 171, 171, 171, 815 171, 172, 172, 173, 173, 174, 174, 174, 174, 175, 816 176, 176, 177, 177, 177, 178, 178, 178, 179, 179, 817 180, 181, 182, 182, 183, 183, 183, 184, 185, 185, 818 186, 186, 186, 186, 186, 186, 187, 187, 187, 187, 819 187, 188, 188, 188, 188, 188, 188, 188, 188, 188, 820 188, 188, 189, 190, 191, 191, 192, 193, 193, 193, 821 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 822 194, 194, 194, 194, 194, 194, 194, 195, 195, 195, 823 195, 196, 197, 199, 198, 200, 200, 200, 200, 201, 824 201, 201, 201, 202, 202, 203, 204, 204, 205, 205, 825 205, 205, 205, 206, 207, 207, 207, 207, 208, 209, 826 210, 211, 211, 211, 211, 211, 212, 212, 213, 213, 827 213, 214, 215, 215, 215, 215, 216, 216, 217, 217, 828 217, 218, 218, 218, 218, 219, 219, 219, 219, 220, 829 220, 220, 220, 221, 221, 221, 222, 222, 222, 222, 830 222, 223, 224, 224, 224, 224, 225, 225, 226, 227, 831 227, 227, 227, 228, 228, 229, 229, 230, 230, 230, 832 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 833 230, 230, 231, 231, 231, 231, 231, 231, 231, 231, 834 231, 231, 231, 231, 231, 231, 232, 232, 233, 233, 835 233, 234, 234, 234, 234, 234, 234, 234, 234, 235, 836 235, 236, 236, 236, 237, 237, 237, 238, 238, 238, 837 239, 239, 239, 239, 239, 239, 239, 239, 240, 240, 838 240, 240, 240, 240, 241, 241, 241, 241, 242, 243, 839 244, 244, 244, 244, 244, 244, 244, 245, 245, 246, 840 246, 247, 247, 247, 247, 247, 247, 248, 248, 248, 841 248, 248, 248, 248, 248, 248, 249, 249, 249, 249, 842 249, 249, 249, 250, 250, 250, 250, 250, 251, 251, 843 251, 251, 251, 251, 251, 252, 252, 252, 252, 252, 844 252, 252, 252, 252, 252, 252, 253, 253, 253, 253, 845 253, 254, 254, 254, 255, 255, 255, 256, 256, 256, 846 257, 257, 257, 258, 258, 258, 259, 259, 259, 259, 847 259, 260, 260, 261, 261, 262, 262, 262, 263, 263, 848 264, 265 849}; 850 851static const short yyr2[] = { 0, 852 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 853 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 854 3, 3, 1, 1, 1, 3, 1, 0, 1, 1, 855 1, 2, 2, 2, 3, 1, 2, 1, 2, 3, 856 2, 3, 1, 1, 3, 2, 3, 5, 4, 5, 857 1, 1, 1, 1, 1, 2, 0, 7, 0, 6, 858 3, 2, 3, 4, 0, 2, 3, 2, 0, 2, 859 2, 1, 3, 3, 2, 3, 1, 2, 1, 1, 860 1, 1, 1, 2, 1, 1, 1, 3, 4, 1, 861 3, 3, 1, 3, 3, 4, 1, 3, 2, 3, 862 3, 1, 1, 0, 3, 2, 3, 3, 4, 4, 863 2, 3, 2, 3, 2, 3, 4, 3, 3, 3, 864 1, 3, 3, 2, 3, 2, 3, 0, 2, 2, 865 1, 3, 3, 1, 2, 1, 2, 3, 1, 0, 866 3, 2, 3, 3, 4, 2, 3, 3, 4, 1, 867 2, 4, 5, 7, 6, 1, 1, 0, 4, 0, 868 5, 0, 5, 0, 6, 3, 4, 2, 3, 2, 869 3, 2, 3, 1, 2, 1, 1, 1, 1, 1, 870 2, 2, 2, 3, 4, 1, 3, 3, 2, 3, 871 1, 1, 1, 2, 1, 1, 1, 2, 2, 3, 872 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 873 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 874 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 875 2, 3, 4, 4, 5, 4, 5, 6, 7, 6, 876 1, 1, 1, 1, 1, 1, 1, 5, 2, 3, 877 4, 7, 7, 0, 3, 4, 2, 3, 5, 2, 878 3, 3, 4, 1, 2, 2, 1, 2, 3, 2, 879 2, 3, 2, 4, 2, 2, 3, 4, 2, 1, 880 7, 7, 6, 3, 5, 4, 7, 6, 2, 2, 881 3, 2, 0, 1, 1, 2, 0, 1, 1, 3, 882 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 883 3, 2, 3, 3, 2, 3, 5, 5, 2, 4, 884 3, 1, 3, 3, 4, 2, 1, 2, 2, 4, 885 2, 3, 4, 2, 2, 1, 1, 1, 1, 3, 886 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 887 3, 3, 5, 4, 6, 5, 4, 5, 5, 6, 888 3, 3, 4, 5, 2, 3, 3, 3, 1, 3, 889 3, 3, 3, 4, 4, 4, 4, 3, 3, 1, 890 2, 3, 3, 2, 2, 3, 3, 3, 3, 2, 891 3, 4, 5, 6, 5, 6, 4, 4, 4, 4, 892 3, 4, 3, 4, 1, 1, 1, 1, 2, 2, 893 1, 1, 2, 2, 1, 2, 2, 2, 2, 2, 894 2, 1, 2, 2, 1, 2, 2, 5, 4, 4, 895 5, 4, 2, 5, 4, 5, 1, 3, 3, 3, 896 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 897 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 898 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 899 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 900 1, 3, 3, 1, 3, 3, 1, 5, 4, 3, 901 5, 1, 1, 3, 3, 1, 1, 1, 1, 1, 902 1, 1 903}; 904 905static const short yydefact[] = { 0, 906 54, 55, 0, 0, 0, 0, 53, 1, 0, 0, 907 0, 36, 43, 44, 38, 0, 51, 52, 46, 27, 908 0, 23, 24, 25, 0, 62, 0, 41, 0, 0, 909 37, 39, 0, 0, 56, 0, 0, 47, 45, 0, 910 166, 0, 0, 162, 63, 0, 69, 42, 40, 0, 911 0, 0, 61, 0, 49, 0, 26, 170, 17, 168, 912 15, 0, 159, 0, 0, 68, 16, 0, 0, 59, 913 167, 0, 164, 64, 69, 50, 48, 12, 0, 10, 914 11, 172, 0, 8, 9, 13, 14, 15, 0, 178, 915 180, 0, 179, 0, 174, 176, 177, 171, 169, 163, 916 67, 71, 72, 70, 0, 161, 0, 57, 113, 0, 917 128, 111, 0, 0, 90, 93, 128, 0, 0, 0, 918 115, 0, 0, 182, 181, 173, 175, 0, 0, 60, 919 165, 0, 0, 0, 0, 108, 99, 88, 0, 0, 920 0, 0, 107, 21, 18, 22, 20, 19, 114, 128, 921 112, 0, 128, 74, 73, 55, 191, 75, 23, 0, 922 86, 0, 77, 79, 83, 85, 0, 80, 0, 81, 923 140, 128, 87, 82, 0, 58, 119, 116, 0, 0, 924 0, 121, 130, 131, 129, 120, 118, 92, 0, 91, 925 95, 0, 0, 0, 0, 0, 0, 0, 339, 0, 926 0, 0, 0, 6, 5, 2, 3, 4, 7, 338, 927 0, 406, 0, 103, 405, 336, 341, 0, 337, 342, 928 343, 344, 422, 407, 408, 437, 411, 412, 415, 425, 929 444, 449, 456, 467, 472, 475, 478, 481, 484, 487, 930 492, 501, 493, 0, 102, 100, 98, 101, 110, 89, 931 109, 189, 0, 128, 76, 78, 84, 106, 0, 137, 932 0, 142, 0, 55, 0, 0, 280, 0, 0, 0, 933 0, 0, 0, 0, 0, 339, 0, 223, 0, 8, 934 406, 0, 0, 197, 0, 212, 0, 193, 195, 0, 935 196, 201, 213, 0, 202, 214, 0, 203, 204, 215, 936 254, 0, 205, 0, 216, 206, 293, 0, 217, 218, 937 219, 221, 220, 0, 222, 247, 246, 0, 244, 245, 938 242, 243, 241, 126, 124, 0, 117, 0, 0, 416, 939 406, 342, 344, 413, 417, 414, 421, 420, 419, 418, 940 0, 390, 0, 0, 0, 16, 0, 426, 423, 427, 941 424, 433, 0, 406, 0, 183, 186, 0, 0, 0, 942 0, 0, 96, 0, 0, 365, 0, 410, 409, 0, 943 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 944 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 945 499, 500, 0, 144, 0, 143, 136, 105, 134, 138, 946 191, 141, 0, 230, 231, 229, 249, 0, 315, 0, 947 304, 302, 0, 312, 310, 0, 276, 0, 257, 0, 948 326, 0, 290, 0, 308, 306, 0, 0, 199, 0, 949 0, 226, 224, 0, 0, 192, 190, 194, 198, 322, 950 406, 225, 228, 0, 275, 0, 406, 0, 295, 299, 951 292, 0, 0, 319, 0, 127, 125, 123, 122, 133, 952 132, 352, 347, 0, 389, 379, 378, 361, 0, 372, 953 380, 0, 373, 0, 362, 0, 0, 0, 0, 0, 954 0, 349, 340, 184, 0, 351, 346, 391, 0, 369, 955 401, 0, 350, 345, 367, 348, 368, 388, 403, 0, 956 366, 0, 441, 438, 442, 439, 443, 440, 447, 445, 957 448, 446, 453, 450, 454, 451, 455, 452, 463, 458, 958 465, 460, 462, 457, 464, 459, 466, 0, 461, 470, 959 468, 471, 469, 474, 473, 477, 476, 480, 479, 483, 960 482, 486, 485, 490, 0, 0, 495, 494, 145, 135, 961 406, 146, 0, 0, 150, 0, 250, 0, 316, 314, 962 305, 303, 313, 311, 277, 0, 258, 0, 0, 0, 963 323, 327, 0, 324, 291, 309, 307, 340, 0, 200, 964 232, 0, 0, 0, 255, 0, 296, 0, 284, 0, 965 0, 321, 0, 397, 398, 0, 384, 385, 0, 381, 966 374, 0, 377, 375, 376, 363, 354, 0, 435, 429, 967 432, 0, 0, 430, 188, 185, 187, 392, 0, 402, 968 399, 0, 404, 400, 357, 0, 489, 0, 0, 147, 969 0, 0, 151, 148, 251, 0, 278, 274, 0, 331, 970 0, 335, 334, 328, 325, 329, 236, 0, 233, 234, 971 0, 0, 0, 260, 0, 264, 0, 267, 0, 301, 972 300, 286, 0, 298, 0, 320, 0, 395, 0, 383, 973 382, 387, 386, 356, 364, 353, 434, 428, 436, 431, 974 371, 370, 393, 0, 358, 359, 491, 488, 0, 149, 975 0, 0, 0, 248, 0, 201, 0, 208, 209, 0, 976 210, 211, 0, 259, 332, 0, 237, 0, 0, 235, 977 273, 270, 271, 502, 0, 262, 265, 0, 261, 0, 978 268, 0, 0, 285, 0, 318, 317, 396, 355, 394, 979 360, 0, 152, 0, 0, 0, 227, 279, 0, 333, 980 330, 240, 238, 0, 272, 269, 263, 0, 283, 0, 981 0, 0, 153, 0, 252, 0, 0, 239, 281, 282, 982 155, 0, 0, 0, 0, 154, 0, 0, 0, 0, 983 288, 0, 253, 287, 0, 0, 0 984}; 985 986static const short yydefgoto[] = { 775, 987 210, 279, 211, 85, 86, 68, 60, 87, 212, 22, 988 23, 24, 8, 9, 10, 11, 12, 13, 14, 15, 989 283, 284, 132, 105, 47, 70, 104, 130, 162, 163, 990 164, 91, 114, 115, 116, 213, 166, 259, 92, 111, 991 181, 182, 136, 185, 398, 168, 169, 170, 261, 171, 992 172, 402, 552, 553, 285, 18, 43, 72, 65, 107, 993 44, 63, 94, 95, 96, 97, 214, 358, 286, 175, 994 555, 720, 288, 289, 290, 291, 695, 292, 293, 294, 995 295, 698, 296, 297, 298, 299, 699, 300, 444, 301, 996 585, 655, 656, 657, 658, 302, 303, 701, 304, 305, 997 306, 702, 307, 308, 451, 663, 664, 309, 310, 311, 998 312, 313, 314, 315, 571, 572, 573, 574, 215, 216, 999 217, 218, 489, 219, 470, 471, 472, 220, 221, 222, 1000 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 1001 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 1002 243, 244, 393, 490, 715 1003}; 1004 1005static const short yypact[] = { 507, 1006-32768,-32768, 15, -30, 18, 244,-32768,-32768, 414, 443, 1007 556,-32768,-32768,-32768,-32768, 714,-32768,-32768,-32768,-32768, 1008 23,-32768,-32768,-32768, 359,-32768, 340,-32768, 49, 601, 1009-32768,-32768, 585, 603,-32768, -30, 417,-32768,-32768, 92, 1010-32768, 489, -24, 107,-32768, 529, 295,-32768,-32768, -30, 1011 710, 452,-32768, 344,-32768, 40,-32768,-32768,-32768,-32768, 1012 192, 1047,-32768, 530, -24,-32768,-32768, 388, 534,-32768, 1013-32768, -24, 107,-32768, 295,-32768,-32768,-32768, 540,-32768, 1014-32768,-32768, 548, 258,-32768,-32768, 307, 442, 736,-32768, 1015-32768, 77,-32768, 1638,-32768,-32768,-32768,-32768,-32768,-32768, 1016-32768,-32768,-32768, 312, 406,-32768, -24,-32768,-32768, 379, 1017 -18,-32768, 426, 331,-32768, 693, -18, 120, 210, 429, 1018-32768, 564, 587,-32768,-32768,-32768,-32768, 593, 951,-32768, 1019-32768, 406, 607, 617, 214,-32768,-32768,-32768, 618, 1077, 1020 219, 531,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -18, 1021-32768, 361, -18,-32768,-32768, 460, 471,-32768, 494, 736, 1022-32768, 1204,-32768,-32768, 500,-32768, 180,-32768, 535,-32768, 1023-32768, 591,-32768,-32768, 1759,-32768,-32768,-32768, 620, 728, 1024 377,-32768,-32768,-32768, 613,-32768,-32768,-32768, 157,-32768, 1025-32768, 2663, 2728, 2779, 2844, 655, 32, 707,-32768, 2895, 1026 2960, 3011, 5025,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1027 673, 881, 56,-32768, 678, 746,-32768, 640,-32768, 671, 1028-32768, 715, 866,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1029 899, 921, 1006, 838, 920, 654, 814, 820, 847, 263, 1030-32768,-32768,-32768, 850,-32768,-32768,-32768,-32768,-32768,-32768, 1031-32768,-32768, 963, 591,-32768,-32768,-32768,-32768, 484, 769, 1032 775,-32768, -1, 306, 353, 3076,-32768, 232, 1357, 35, 1033 392, 419, 228, 424, 234, 779, 5324,-32768, -30, 538, 1034 974, 265, 872,-32768, 784,-32768, 1691,-32768,-32768, 789, 1035-32768,-32768,-32768, 1827,-32768,-32768, 797,-32768,-32768,-32768, 1036-32768, 1827,-32768, 1827,-32768,-32768, 5375, 802,-32768,-32768, 1037-32768,-32768,-32768, 427,-32768, 737, 806, 866, 902, 916, 1038-32768,-32768,-32768,-32768, 891, 642,-32768, 592, 660,-32768, 1039 189,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1040 409,-32768, 666, 964, 793, 793, 428,-32768,-32768,-32768, 1041-32768,-32768, 777, 1121, 66,-32768,-32768, 622, 432, 5092, 1042 3127, 729,-32768, -28, 3192,-32768, 435,-32768,-32768, 3243, 1043 3308, 3359, 3424, 3475, 3540, 3591, 3656, 3707, 3772, 3823, 1044 3888, 864, 3939, 4004, 4055, 4120, 4171, 4236, 4287, 2032, 1045-32768,-32768, 4352,-32768, 605,-32768,-32768,-32768, 810,-32768, 1046-32768,-32768, 1691,-32768,-32768,-32768,-32768, 4403,-32768, 95, 1047-32768,-32768, 126,-32768,-32768, 174,-32768, 4468,-32768, 4519, 1048-32768, 785,-32768, 4933,-32768,-32768, 182, 269, 815, 2083, 1049 604,-32768,-32768, -30, 2148,-32768,-32768,-32768,-32768,-32768, 1050 1158,-32768,-32768, 823,-32768, 861, 1018, 728,-32768,-32768, 1051-32768, 86, 2199,-32768, 4584,-32768, 891,-32768,-32768,-32768, 1052-32768,-32768,-32768, 565, 836,-32768,-32768,-32768, 2264, 793, 1053-32768, 590, 793, 590,-32768, 2315, 4635, 223, -43, 2380, 1054 191,-32768, 894,-32768, 1967,-32768,-32768,-32768, 649,-32768, 1055-32768, 237,-32768,-32768,-32768,-32768,-32768, 839,-32768, 239, 1056-32768, 5143,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 899, 1057-32768, 899,-32768, 921,-32768, 921,-32768, 921,-32768, 1006, 1058-32768, 1006,-32768, 1006,-32768, 1006,-32768, 258,-32768,-32768, 1059 838,-32768, 838,-32768, 920,-32768, 654,-32768, 814,-32768, 1060 820,-32768, 847,-32768, 933, 857,-32768,-32768,-32768,-32768, 1061 1254,-32768, 1691, 859, 856, 1691,-32768, 314,-32768,-32768, 1062-32768,-32768,-32768,-32768,-32768, 348,-32768, 870, 461, 229, 1063 785,-32768, 535,-32768,-32768,-32768,-32768,-32768, 467, 815, 1064-32768, 967, 14, 444,-32768, 878,-32768, 5067,-32768, 4958, 1065 876, 887, 892,-32768,-32768, 5208,-32768,-32768, 241,-32768, 1066 895, 299,-32768, 895,-32768,-32768, 406, 17,-32768,-32768, 1067-32768, 4700, 487,-32768,-32768,-32768,-32768,-32768, 4751,-32768, 1068-32768, 5259,-32768,-32768, 406, 704,-32768, 4816, 662,-32768, 1069 1691, 2431,-32768,-32768,-32768, 1893,-32768,-32768, 343,-32768, 1070 835,-32768,-32768,-32768,-32768,-32768,-32768, 2496,-32768,-32768, 1071 999, 91, 4867,-32768, 674,-32768, 1467,-32768, 5324,-32768, 1072-32768,-32768, 928, 923, 5000,-32768, 410,-32768, 723,-32768, 1073-32768,-32768,-32768,-32768,-32768, 406,-32768,-32768,-32768,-32768, 1074-32768,-32768,-32768, 731,-32768, 406,-32768,-32768, 477,-32768, 1075 243, 108, 485,-32768, 978, 979, 1893,-32768,-32768, 1893, 1076-32768,-32768, 942,-32768, 948, 950,-32768, 1053, 128,-32768, 1077-32768,-32768,-32768,-32768, 328,-32768,-32768, 1540,-32768, 1608, 1078-32768, 961, 1827,-32768, 970,-32768,-32768,-32768,-32768,-32768, 1079-32768, 2547,-32768, 262, 4403, 1827,-32768,-32768, 2612,-32768, 1080-32768,-32768,-32768, 1071,-32768,-32768,-32768, 980,-32768, 1827, 1081 296, 202,-32768, 358,-32768, 4958, 983,-32768,-32768,-32768, 1082-32768, 302, 1893, 990, 5000,-32768, 1021, 1893, 992, 1893, 1083-32768, 1893,-32768,-32768, 1087, 1089,-32768 1084}; 1085 1086static const short yypgoto[] = {-32768, 1087-32768, -57, -60, 711, -16, -123, 568,-32768, -3, 552, 1088-32768, 130,-32768, 1085, 791,-32768, 22,-32768,-32768, 778, 1089 12, 154,-32768,-32768, 1044, 1030,-32768, -128,-32768, 945, 1090-32768, 382, -106, 973, -165, -193,-32768,-32768, 469, -58, 1091 865, -327, -40,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1092 957,-32768, 142,-32768, 718, -10,-32768,-32768,-32768,-32768, 1093 1072, 584,-32768, 1031,-32768,-32768, 372,-32768, -122, 867, 1094 843, -166, -279,-32768, 819, -234, 197, -551,-32768, -529, 1095-32768,-32768,-32768, -301,-32768,-32768,-32768,-32768,-32768,-32768, 1096-32768,-32768, 476, 486, -619, -496,-32768,-32768,-32768,-32768, 1097-32768,-32768,-32768, -436,-32768, -603, 832,-32768,-32768,-32768, 1098-32768,-32768,-32768,-32768,-32768, 569,-32768, 573,-32768,-32768, 1099 119,-32768, -386,-32768, 799, 362, -326, 858, 163, 1120, 1100 320, 437, 438, -112, 560, 636, -470,-32768, 632, 724, 1101 651, 625, 761, 765, 760, 764, 776,-32768, 526, 771, 1102 717,-32768,-32768, 29,-32768 1103}; 1104 1105 1106#define YYLAST 5484 1107 1108 1109static const short yytable[] = { 21, 1110 459, 84, 29, 176, 83, 450, 174, 438, 287, 357, 1111 184, 16, 614, 325, 650, 19, 152, 675, 26, 474, 1112 16, 16, 16, 38, 117, 59, 479, 481, 84, 67, 1113 31, 123, 342, 84, 134, 342, 83, 721, 61, 174, 1114 76, 16, 61, 497, 16, 16, 260, 59, 583, 48, 1115 612, 93, 59, 602, 31, 20, 363, 20, 88, 442, 1116 61, 725, 16, 150, 153, 61, 482, 445, 84, 446, 1117 62, 83, 84, 89, 347, 179, 143, 124, 135, 334, 1118 336, 338, 340, 93, 696, 88, 587, 349, 351, 608, 1119 88, 711, 55, 404, 405, 559, 56, 406, 721, 84, 1120 20, 84, 123, 20, 83, 89, 697, 651, 650, 249, 1121 676, 59, 251, 619, 280, 626, 619, 67, 173, 84, 1122 144, 39, 326, 40, 61, 88, 561, -157, 743, 88, 1123 61, 262, 343, 25, 27, 343, 399, 345, 77, 700, 1124 160, 353, 680, 601, 180, 696, 604, 49, 696, 50, 1125 422, 173, 764, 17, -94, -94, 88, 137, 88, 483, 1126 457, 769, 17, 17, 17, 52, 54, 697, 245, 57, 1127 697, 281, 429, 160, 563, 125, 88, 20, 712, 57, 1128 258, 346, 576, 17, -294, 588, 17, 17, 331, 331, 1129 331, 331, 84, 560, 61, 179, 331, 331, 354, 703, 1130 700, 734, 743, 700, 17, 461, 64, 619, 110, 669, 1131 146, 696, 113, 396, 186, 90, 696, 145, 696, 246, 1132 696, 744, 84, 611, 562, 434, 280, 619, 421, 642, 1133 355, 245, 411, 697, 425, 684, 556, 620, 697, 623, 1134 697, 670, 697, 649, 28, 692, 280, 90, -97, 88, 1135 -97, 110, 113, -97, -97, -97, -97, 504, 506, 508, 1136 703, 709, 710, 703, 180, 432, 700, 84, 189, 482, 1137 179, 700, 564, 700, -104, 700, 438, 389, -104, 88, 1138 577, 360, 161, 281, 613, 361, 661, 602, 450, 362, 1139 441, 617, 50, 316, 410, 762, 742, 416, 441, 672, 1140 441, 619, 758, 447, 282, 428, -322, 147, 189, -25, 1141 -25, 187, 67, 706, 635, 161, 247, 20, 448, 20, 1142 598, 528, 157, 157, 88, 61, 703, 580, 745, 20, 1143 412, 703, 426, 703, 621, 703, 624, 317, 671, 180, 1144 45, 733, 280, 704, 74, 752, 69, 367, 637, 390, 1145 -25, 438, 433, 407, 118, -25, -25, -25, 635, 41, 1146 753, -25, 578, 450, 610, -25, 331, 331, 331, 331, 1147 331, 331, 331, 331, 331, 331, 331, 331, 88, 331, 1148 331, 331, 331, 331, 331, 331, 631, 84, 101, 492, 1149 434, -65, 417, 500, 761, -65, 673, 413, -322, 551, 1150 766, 694, 46, 119, 427, 316, 46, 636, 189, 462, 1151 726, 128, 316, -30, 1, 746, 282, 53, 546, 419, 1152 316, 42, 316, 282, 423, 316, 137, 454, 475, 138, 1153 139, 282, 486, 282, -65, 501, 558, -256, -65, -66, 1154 438, 638, -31, 1, 88, 408, 566, 643, 568, 317, 1155 646, 763, 71, -158, 450, 189, 317, 2, 492, 250, 1156 139, 640, 442, 450, 317, 445, 317, 647, 3, 317, 1157 327, 133, 465, 331, 4, 463, 328, 647, 674, 331, 1158 5, 591, -66, 593, 418, 407, 2, 679, 749, 58, 1159 652, 57, 280, 498, 318, 280, 685, 599, 487, 678, 1160 129, 755, 20, 4, 157, 653, -28, 1, 492, 5, 1161 165, 420, 7, 245, 42, 760, 424, -97, 133, 455, 1162 476, 316, -97, -97, -97, -97, 148, 502, 694, 66, 1163 98, 248, 282, 749, 102, 755, 78, 760, 120, 654, 1164 109, 7, 50, 165, 727, 196, -160, 729, 112, 281, 1165 2, 197, 281, 641, -139, -29, 1, 731, 198, 648, 1166 57, 3, 199, 189, 149, 317, 252, 4, 80, 732, 1167 280, 81, 20, 5, 20, 200, 201, 735, 157, 202, 1168 84, 6, 397, 179, -32, 1, 253, 151, 204, 205, 1169 206, 207, 458, 154, 208, 209, 280, 167, 257, 2, 1170 -34, 1, -33, 1, 493, 7, 318, 177, 331, 331, 1171 3, 319, 320, 318, 20, 20, 4, 183, 188, 20, 1172 324, 318, 5, 318, 331, 20, 318, 281, 2, 157, 1173 167, 99, 441, 20, 118, 2, 103, 88, 359, 3, 1174 366, 78, 456, 134, 2, 4, 2, 682, 100, 20, 1175 2, 5, 180, 281, 7, 106, 78, 280, 594, 280, 1176 460, 4, 493, 4, 385, 595, 464, 5, 579, 5, 1177 494, 316, 20, 80, 316, 495, 81, 20, 20, 496, 1178 159, 714, 282, 7, 203, 282, 602, 722, 80, 20, 1179 131, 81, 20, 441, 630, 155, 441, 634, 549, 7, 1180 178, 7, 20, 20, 328, 20, 316, 344, 316, -35, 1181 1, 159, 329, 159, 281, 317, 281, 484, 317, 441, 1182 652, 485, 318, 319, 320, 20, 689, 20, 494, 493, 1183 319, 320, 441, 495, 321, 653, 121, 496, 319, 320, 1184 319, 320, 618, 319, 320, 20, 441, 20, 619, 316, 1185 317, 20, 317, 2, 316, 341, 78, 35, 57, 441, 1186 282, -497, -497, 754, 441, 282, 441, 757, 441, 716, 1187 4, 35, 690, 359, 36, 316, 5, 78, 364, 35, 1188 37, -341, -341, 316, 140, 78, 282, 32, 80, 141, 1189 142, 81, 20, 317, 122, 494, 36, 686, 317, 30, 1190 495, 34, 37, 619, 496, -498, -498, 32, 7, 80, 1191 322, 32, 81, 20, 20, 316, 728, 80, 316, 317, 1192 81, 20, 619, 51, 730, 386, 282, 317, 32, 282, 1193 619, 600, 387, -341, 600, 705, 316, -341, 316, 319, 1194 320, 316, 365, 603, 569, 605, 321, 282, 570, 282, 1195 -343, -343, 282, 321, 316, 378, 379, 380, 381, 317, 1196 388, 321, 317, 321, 527, 282, 321, 400, 316, 401, 1197 477, -156, 318, 478, 316, 318, 435, 359, 2, 282, 1198 317, 316, 317, 316, 78, 317, 316, 439, 316, 469, 1199 316, 323, 282, 737, 382, 443, 738, 282, 317, 282, 1200 453, 282, -343, 370, 371, 372, -343, 318, 550, 318, 1201 368, 369, 317, 78, 139, 35, 80, 584, 317, 81, 1202 20, 78, 322, 373, 374, 317, 586, 317, 596, 322, 1203 317, 622, 317, 627, 317, 383, 384, 322, 37, 322, 1204 391, 392, 322, 78, 628, 80, -407, -407, 81, 20, 1205 318, 632, 196, 80, 633, 318, 81, 20, 197, 767, 1206 -408, -408, 321, 639, 771, 198, 773, 649, 774, 199, 1207 659, -496, -496, 360, 665, 80, 318, 361, 81, 20, 1208 666, 362, 200, 201, 318, 667, 202, 141, 142, 319, 1209 320, 602, 319, 320, 156, 204, 205, 206, 207, 710, 1210 78, 208, 209, 323, 510, 512, 2, 531, 533, 79, 1211 323, 4, 78, 375, 376, 377, 318, 5, 323, 318, 1212 323, 723, 588, 323, 319, 320, 319, 320, 520, 522, 1213 524, 526, 80, 736, -207, 81, 20, 318, 322, 318, 1214 739, 740, 318, 741, 80, 157, 158, 81, 20, 332, 1215 332, 332, 332, 742, 748, 318, 394, 332, 332, -15, 1216 466, 467, 468, 750, -496, -496, 360, 319, 320, 318, 1217 430, 758, 319, 320, 431, 318, 770, 191, 759, 192, 1218 193, 765, 318, 768, 318, 772, 776, 318, 777, 318, 1219 2, 318, 529, 319, 320, 33, 78, 75, 514, 516, 1220 518, 319, 320, -15, 108, 79, 256, 4, -496, -496, 1221 360, 190, 321, 5, 430, 321, 254, 395, 362, 323, 1222 554, 194, 195, 73, 127, 449, 78, 403, 80, 437, 1223 717, 81, 20, 319, 320, 196, 319, 320, 452, 644, 1224 718, 197, 82, 645, 473, 535, 539, 321, 198, 321, 1225 537, 541, 199, 688, 319, 320, 319, 320, 80, 319, 1226 320, 81, 20, 548, 543, 200, 201, 0, 0, 202, 1227 0, 203, 319, 320, 0, 0, 0, 0, 204, 205, 1228 206, 207, 0, 0, 208, 209, 319, 320, 322, 0, 1229 321, 322, 319, 320, 0, 321, 0, 0, 0, 319, 1230 320, 319, 320, 0, 319, 320, 319, 320, 319, 320, 1231 0, -496, -496, 360, 0, 0, 321, 480, 0, 0, 1232 0, 362, 0, 322, 321, 322, 0, 332, 332, 332, 1233 332, 332, 332, 332, 332, 332, 332, 332, 332, 0, 1234 332, 332, 332, 332, 332, 332, 332, 156, -496, -496, 1235 360, 0, 0, 78, 361, 0, 321, 0, 431, 321, 1236 0, 0, 79, 0, 4, 0, 322, 0, 0, 323, 1237 5, 322, 323, 0, 0, 0, 0, 321, 0, 321, 1238 0, 0, 321, 0, 0, 80, 0, 0, 81, 20, 1239 0, 0, 322, 0, 0, 321, 0, 0, 157, 255, 1240 322, 0, 0, 0, 323, 0, 323, 0, 0, 321, 1241 0, 333, 333, 333, 333, 321, 0, 0, 0, 333, 1242 333, 0, 321, 0, 321, 0, 0, 321, 0, 321, 1243 0, 321, 322, 0, 332, 322, 0, 0, 0, -15, 1244 332, 0, 0, 0, -496, -496, 360, 323, 0, 0, 1245 430, 0, 323, 322, 629, 322, 0, 414, 322, 192, 1246 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1247 0, 322, 0, 323, 0, 0, 0, 0, 0, 0, 1248 0, 323, 0, 0, 0, 322, 0, 0, 0, 0, 1249 0, 322, 0, 0, 0, 0, 0, 0, 322, 0, 1250 322, 194, 195, 322, 0, 322, 78, 322, 0, 0, 1251 0, 0, 0, 323, 0, 196, 323, 0, 0, 0, 1252 0, 197, 0, 0, 0, 0, 0, 0, 198, 0, 1253 0, 0, 199, 0, 323, 0, 323, 0, 80, 323, 1254 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, 1255 0, 0, 323, 0, 0, 415, 0, 0, 204, 205, 1256 206, 207, 0, 0, 208, 209, 323, 263, 0, 332, 1257 332, 0, 323, 0, 0, 0, 0, 0, 0, 323, 1258 0, 323, 0, 0, 323, 332, 323, 0, 323, 333, 1259 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 1260 333, 0, 333, 333, 333, 333, 333, 333, 333, 0, 1261 264, 194, 195, 652, 265, 266, 78, 267, 0, 0, 1262 268, 0, 0, 0, 269, 196, 0, 0, 653, 0, 1263 0, 270, 271, 5, 272, 0, 273, 274, 198, 275, 1264 263, 0, 276, 0, 0, 0, 0, 0, 80, 0, 1265 0, 81, 20, 0, 0, 0, 0, 0, 0, 277, 1266 0, 157, 719, 0, 0, 278, 0, 0, 204, 205, 1267 206, 207, 0, 0, 208, 209, 0, 0, 0, 0, 1268 0, 0, 0, 264, 194, 195, 652, 265, 266, 78, 1269 267, 0, 0, 268, 0, 0, 333, 269, 196, 0, 1270 0, 653, 333, 0, 270, 271, 5, 272, 263, 273, 1271 274, 198, 275, 0, 0, 276, 0, 0, 0, 0, 1272 0, 80, 0, 0, 81, 20, 0, 0, 0, 0, 1273 0, 0, 277, 0, 157, 747, 0, 0, 278, 0, 1274 0, 204, 205, 206, 207, 0, 0, 208, 209, 0, 1275 0, 264, 194, 195, -266, 265, 266, 78, 267, 0, 1276 0, 268, 0, 0, 0, 269, 196, 0, 0, -266, 1277 0, 0, 270, 271, 5, 272, 0, 273, 274, 198, 1278 275, 2, 0, 276, 0, 0, 0, 78, 0, 80, 1279 0, 263, 81, 20, 0, 0, 79, 0, 4, 0, 1280 277, 0, 157, -266, 5, 0, 278, 0, 0, 204, 1281 205, 206, 207, 0, 0, 208, 209, 0, 0, 80, 1282 0, 0, 81, 20, 0, 0, 0, 0, 0, 0, 1283 0, 333, 333, 126, 264, 194, 195, 0, 265, 266, 1284 78, 267, 0, 0, 268, 0, 0, 333, 269, 196, 1285 0, 0, 0, 0, 0, 270, 271, 5, 272, 263, 1286 273, 274, 198, 275, 0, 0, 276, 0, 0, 0, 1287 0, 0, 80, 0, 0, 81, 20, 0, 0, 0, 1288 0, 0, 0, 277, 0, 157, 436, 0, 0, 278, 1289 0, 0, 204, 205, 206, 207, 0, 0, 208, 209, 1290 0, 0, 264, 194, 195, 0, 265, 266, 78, 267, 1291 0, 0, 268, 0, 0, 0, 269, 196, 0, 0, 1292 0, 0, 0, 270, 271, 5, 272, 263, 273, 274, 1293 198, 275, 0, 0, 276, 0, 0, 0, 0, 0, 1294 80, 0, 0, 81, 20, 0, 0, 0, 0, 0, 1295 0, 277, 0, 157, 0, 0, 0, 278, 0, 0, 1296 204, 205, 206, 207, 0, 0, 208, 209, 0, 0, 1297 440, 194, 195, 0, 265, 266, 78, 267, 0, 0, 1298 268, 0, 0, 0, 269, 196, 0, 0, 0, 0, 1299 0, 270, 271, 263, 272, 0, 273, 274, 198, 275, 1300 0, 0, 276, 0, 0, 0, 0, 0, 80, 0, 1301 0, 81, 20, 0, 0, 0, 0, 0, 0, 277, 1302 0, 157, 0, 0, 0, 278, 0, 0, 204, 205, 1303 206, 207, 0, 0, 208, 209, 440, 194, 195, 0, 1304 693, 266, 78, 267, 0, 0, 268, 0, 0, 0, 1305 269, 196, 0, 0, 0, 0, 0, 270, 271, 0, 1306 272, 0, 273, 274, 198, 275, 0, 615, 276, 192, 1307 193, 0, 0, 0, 80, 0, 0, 81, 20, 0, 1308 0, 0, 0, 0, 0, 277, 0, 157, 0, 0, 1309 0, 278, 0, 0, 204, 205, 206, 207, 0, 0, 1310 208, 209, 0, 0, 0, 0, 0, 0, 0, 0, 1311 0, 194, 195, 0, 0, 0, 78, 0, 0, 0, 1312 0, 0, 0, 0, 0, 196, 0, 0, 0, 0, 1313 0, 197, 544, 0, 192, 193, 0, 0, 198, 0, 1314 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, 1315 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, 1316 0, 203, 616, 0, 0, 0, 0, 0, 204, 205, 1317 206, 207, 0, 0, 208, 209, 194, 195, 0, 0, 1318 0, 78, 0, 491, 0, 192, 193, 0, 0, 0, 1319 196, 0, 0, 0, 0, 0, 197, 0, 0, 0, 1320 0, 0, 0, 198, 0, 0, 0, 199, 0, 0, 1321 0, 0, 0, 80, 0, 0, 81, 20, 0, 545, 1322 200, 201, 0, 0, 202, 0, 0, 194, 195, 0, 1323 0, 0, 78, 204, 205, 206, 207, 0, 0, 208, 1324 209, 196, 0, 0, 0, 0, 0, 197, 581, 0, 1325 192, 193, 0, 0, 198, 0, 0, 0, 199, 0, 1326 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, 1327 0, 200, 201, 0, 0, 202, 0, 0, 0, 0, 1328 148, 0, 0, 0, 204, 205, 206, 207, 0, 0, 1329 208, 209, 194, 195, 0, 0, 0, 78, 0, 589, 1330 0, 192, 193, 0, 0, 0, 196, 0, 0, 0, 1331 0, 0, 197, 0, 0, 0, 0, 0, 0, 198, 1332 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, 1333 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, 1334 202, 582, 0, 194, 195, 0, 0, 0, 78, 204, 1335 205, 206, 207, 0, 0, 208, 209, 196, 0, 0, 1336 0, 0, 0, 197, 597, 0, 192, 193, 0, 0, 1337 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, 1338 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, 1339 0, 202, 0, 0, 0, 0, 0, 590, 0, 0, 1340 204, 205, 206, 207, 0, 0, 208, 209, 194, 195, 1341 0, 0, 0, 78, 0, 606, 0, 192, 193, 0, 1342 0, 0, 196, 0, 0, 0, 0, 0, 197, 0, 1343 0, 0, 0, 0, 0, 198, 0, 0, 0, 199, 1344 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, 1345 0, 0, 200, 201, 0, 0, 202, 0, 0, 194, 1346 195, 598, 0, 0, 78, 204, 205, 206, 207, 0, 1347 0, 208, 209, 196, 0, 0, 0, 0, 0, 197, 1348 491, 0, 192, 193, 0, 0, 198, 0, 0, 0, 1349 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, 1350 20, 0, 0, 200, 201, 0, 0, 202, 607, 0, 1351 0, 0, 0, 0, 0, 0, 204, 205, 206, 207, 1352 0, 0, 208, 209, 194, 195, 0, 0, 0, 78, 1353 0, 581, 0, 192, 193, 0, 0, 0, 196, 0, 1354 0, 0, 0, 0, 197, 0, 0, 0, 0, 0, 1355 0, 198, 0, 0, 0, 199, 0, 0, 0, 0, 1356 0, 80, 0, 0, 81, 20, 0, 0, 200, 201, 1357 0, 0, 202, 0, 0, 194, 195, 598, 0, 0, 1358 78, 204, 205, 206, 207, 0, 0, 208, 209, 196, 1359 0, 0, 0, 0, 0, 197, 707, 0, 192, 193, 1360 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, 1361 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, 1362 201, 0, 0, 202, 691, 0, 0, 0, 0, 0, 1363 0, 0, 204, 205, 206, 207, 0, 0, 208, 209, 1364 194, 195, 0, 0, 0, 78, 0, 707, 0, 192, 1365 193, 0, 0, 0, 196, 0, 0, 0, 0, 0, 1366 197, 0, 0, 0, 0, 0, 0, 198, 0, 0, 1367 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, 1368 81, 20, 0, 0, 200, 201, 0, 0, 202, 708, 1369 0, 194, 195, 0, 0, 0, 78, 204, 205, 206, 1370 207, 0, 0, 208, 209, 196, 0, 0, 0, 0, 1371 0, 197, 589, 0, 192, 193, 0, 0, 198, 0, 1372 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, 1373 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, 1374 751, 0, 0, 0, 0, 0, 0, 0, 204, 205, 1375 206, 207, 0, 0, 208, 209, 194, 195, 0, 0, 1376 0, 78, 0, 330, 0, 192, 193, 0, 0, 0, 1377 196, 0, 0, 0, 0, 0, 197, 0, 0, 0, 1378 0, 0, 0, 198, 0, 0, 0, 199, 0, 0, 1379 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, 1380 200, 201, 0, 0, 202, 0, 0, 194, 195, 0, 1381 756, 0, 78, 204, 205, 206, 207, 0, 0, 208, 1382 209, 196, 0, 0, 0, 0, 0, 197, 335, 0, 1383 192, 193, 0, 0, 198, 0, 0, 0, 199, 0, 1384 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, 1385 0, 200, 201, 0, 0, 202, 0, 0, 0, 0, 1386 0, 0, 0, 0, 204, 205, 206, 207, 0, 0, 1387 208, 209, 194, 195, 0, 0, 0, 78, 0, 337, 1388 0, 192, 193, 0, 0, 0, 196, 0, 0, 0, 1389 0, 0, 197, 0, 0, 0, 0, 0, 0, 198, 1390 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, 1391 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, 1392 202, 0, 0, 194, 195, 0, 0, 0, 78, 204, 1393 205, 206, 207, 0, 0, 208, 209, 196, 0, 0, 1394 0, 0, 0, 197, 339, 0, 192, 193, 0, 0, 1395 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, 1396 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, 1397 0, 202, 0, 0, 0, 0, 0, 0, 0, 0, 1398 204, 205, 206, 207, 0, 0, 208, 209, 194, 195, 1399 0, 0, 0, 78, 0, 348, 0, 192, 193, 0, 1400 0, 0, 196, 0, 0, 0, 0, 0, 197, 0, 1401 0, 0, 0, 0, 0, 198, 0, 0, 0, 199, 1402 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, 1403 0, 0, 200, 201, 0, 0, 202, 0, 0, 194, 1404 195, 0, 0, 0, 78, 204, 205, 206, 207, 0, 1405 0, 208, 209, 196, 0, 0, 0, 0, 0, 197, 1406 350, 0, 192, 193, 0, 0, 198, 0, 0, 0, 1407 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, 1408 20, 0, 0, 200, 201, 0, 0, 202, 0, 0, 1409 0, 0, 0, 0, 0, 0, 204, 205, 206, 207, 1410 0, 0, 208, 209, 194, 195, 0, 0, 0, 78, 1411 0, 352, 0, 192, 193, 0, 0, 0, 196, 0, 1412 0, 0, 0, 0, 197, 0, 0, 0, 0, 0, 1413 0, 198, 0, 0, 0, 199, 0, 0, 0, 0, 1414 0, 80, 0, 0, 81, 20, 0, 0, 200, 201, 1415 0, 0, 202, 0, 0, 194, 195, 0, 0, 0, 1416 78, 204, 205, 206, 207, 0, 0, 208, 209, 196, 1417 0, 0, 0, 0, 0, 197, 409, 0, 192, 193, 1418 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, 1419 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, 1420 201, 0, 0, 202, 0, 0, 0, 0, 0, 0, 1421 0, 0, 204, 205, 206, 207, 0, 0, 208, 209, 1422 194, 195, 0, 0, 0, 78, 0, 491, 0, 192, 1423 193, 0, 0, 0, 196, 0, 0, 0, 0, 0, 1424 197, 0, 0, 0, 0, 0, 0, 198, 0, 0, 1425 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, 1426 81, 20, 0, 0, 200, 201, 0, 0, 202, 0, 1427 0, 194, 195, 0, 0, 0, 78, 204, 205, 206, 1428 207, 0, 0, 208, 209, 196, 0, 0, 0, 0, 1429 0, 197, 499, 0, 192, 193, 0, 0, 198, 0, 1430 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, 1431 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, 1432 0, 0, 0, 0, 0, 0, 0, 0, 204, 205, 1433 206, 207, 0, 0, 208, 209, 194, 195, 0, 0, 1434 0, 78, 0, 503, 0, 192, 193, 0, 0, 0, 1435 196, 0, 0, 0, 0, 0, 197, 0, 0, 0, 1436 0, 0, 0, 198, 0, 0, 0, 199, 0, 0, 1437 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, 1438 200, 201, 0, 0, 202, 0, 0, 194, 195, 0, 1439 0, 0, 78, 204, 205, 206, 207, 0, 0, 208, 1440 209, 196, 0, 0, 0, 0, 0, 197, 505, 0, 1441 192, 193, 0, 0, 198, 0, 0, 0, 199, 0, 1442 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, 1443 0, 200, 201, 0, 0, 202, 0, 0, 0, 0, 1444 0, 0, 0, 0, 204, 205, 206, 207, 0, 0, 1445 208, 209, 194, 195, 0, 0, 0, 78, 0, 507, 1446 0, 192, 193, 0, 0, 0, 196, 0, 0, 0, 1447 0, 0, 197, 0, 0, 0, 0, 0, 0, 198, 1448 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, 1449 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, 1450 202, 0, 0, 194, 195, 0, 0, 0, 78, 204, 1451 205, 206, 207, 0, 0, 208, 209, 196, 0, 0, 1452 0, 0, 0, 197, 509, 0, 192, 193, 0, 0, 1453 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, 1454 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, 1455 0, 202, 0, 0, 0, 0, 0, 0, 0, 0, 1456 204, 205, 206, 207, 0, 0, 208, 209, 194, 195, 1457 0, 0, 0, 78, 0, 511, 0, 192, 193, 0, 1458 0, 0, 196, 0, 0, 0, 0, 0, 197, 0, 1459 0, 0, 0, 0, 0, 198, 0, 0, 0, 199, 1460 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, 1461 0, 0, 200, 201, 0, 0, 202, 0, 0, 194, 1462 195, 0, 0, 0, 78, 204, 205, 206, 207, 0, 1463 0, 208, 209, 196, 0, 0, 0, 0, 0, 197, 1464 513, 0, 192, 193, 0, 0, 198, 0, 0, 0, 1465 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, 1466 20, 0, 0, 200, 201, 0, 0, 202, 0, 0, 1467 0, 0, 0, 0, 0, 0, 204, 205, 206, 207, 1468 0, 0, 208, 209, 194, 195, 0, 0, 0, 78, 1469 0, 515, 0, 192, 193, 0, 0, 0, 196, 0, 1470 0, 0, 0, 0, 197, 0, 0, 0, 0, 0, 1471 0, 198, 0, 0, 0, 199, 0, 0, 0, 0, 1472 0, 80, 0, 0, 81, 20, 0, 0, 200, 201, 1473 0, 0, 202, 0, 0, 194, 195, 0, 0, 0, 1474 78, 204, 205, 206, 207, 0, 0, 208, 209, 196, 1475 0, 0, 0, 0, 0, 197, 517, 0, 192, 193, 1476 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, 1477 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, 1478 201, 0, 0, 202, 0, 0, 0, 0, 0, 0, 1479 0, 0, 204, 205, 206, 207, 0, 0, 208, 209, 1480 194, 195, 0, 0, 0, 78, 0, 519, 0, 192, 1481 193, 0, 0, 0, 196, 0, 0, 0, 0, 0, 1482 197, 0, 0, 0, 0, 0, 0, 198, 0, 0, 1483 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, 1484 81, 20, 0, 0, 200, 201, 0, 0, 202, 0, 1485 0, 194, 195, 0, 0, 0, 78, 204, 205, 206, 1486 207, 0, 0, 208, 209, 196, 0, 0, 0, 0, 1487 0, 197, 521, 0, 192, 193, 0, 0, 198, 0, 1488 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, 1489 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, 1490 0, 0, 0, 0, 0, 0, 0, 0, 204, 205, 1491 206, 207, 0, 0, 208, 209, 194, 195, 0, 0, 1492 0, 78, 0, 523, 0, 192, 193, 0, 0, 0, 1493 196, 0, 0, 0, 0, 0, 197, 0, 0, 0, 1494 0, 0, 0, 198, 0, 0, 0, 199, 0, 0, 1495 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, 1496 200, 201, 0, 0, 202, 0, 0, 194, 195, 0, 1497 0, 0, 78, 204, 205, 206, 207, 0, 0, 208, 1498 209, 196, 0, 0, 0, 0, 0, 197, 525, 0, 1499 192, 193, 0, 0, 198, 0, 0, 0, 199, 0, 1500 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, 1501 0, 200, 201, 0, 0, 202, 0, 0, 0, 0, 1502 0, 0, 0, 0, 204, 205, 206, 207, 0, 0, 1503 208, 209, 194, 195, 0, 0, 0, 78, 0, 530, 1504 0, 192, 193, 0, 0, 0, 196, 0, 0, 0, 1505 0, 0, 197, 0, 0, 0, 0, 0, 0, 198, 1506 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, 1507 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, 1508 202, 0, 0, 194, 195, 0, 0, 0, 78, 204, 1509 205, 206, 207, 0, 0, 208, 209, 196, 0, 0, 1510 0, 0, 0, 197, 532, 0, 192, 193, 0, 0, 1511 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, 1512 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, 1513 0, 202, 0, 0, 0, 0, 0, 0, 0, 0, 1514 204, 205, 206, 207, 0, 0, 208, 209, 194, 195, 1515 0, 0, 0, 78, 0, 534, 0, 192, 193, 0, 1516 0, 0, 196, 0, 0, 0, 0, 0, 197, 0, 1517 0, 0, 0, 0, 0, 198, 0, 0, 0, 199, 1518 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, 1519 0, 0, 200, 201, 0, 0, 202, 0, 0, 194, 1520 195, 0, 0, 0, 78, 204, 205, 206, 207, 0, 1521 0, 208, 209, 196, 0, 0, 0, 0, 0, 197, 1522 536, 0, 192, 193, 0, 0, 198, 0, 0, 0, 1523 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, 1524 20, 0, 0, 200, 201, 0, 0, 202, 0, 0, 1525 0, 0, 0, 0, 0, 0, 204, 205, 206, 207, 1526 0, 0, 208, 209, 194, 195, 0, 0, 0, 78, 1527 0, 538, 0, 192, 193, 0, 0, 0, 196, 0, 1528 0, 0, 0, 0, 197, 0, 0, 0, 0, 0, 1529 0, 198, 0, 0, 0, 199, 0, 0, 0, 0, 1530 0, 80, 0, 0, 81, 20, 0, 0, 200, 201, 1531 0, 0, 202, 0, 0, 194, 195, 0, 0, 0, 1532 78, 204, 205, 206, 207, 0, 0, 208, 209, 196, 1533 0, 0, 0, 0, 0, 197, 540, 0, 192, 193, 1534 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, 1535 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, 1536 201, 0, 0, 202, 0, 0, 0, 0, 0, 0, 1537 0, 0, 204, 205, 206, 207, 0, 0, 208, 209, 1538 194, 195, 0, 0, 0, 78, 0, 542, 0, 192, 1539 193, 0, 0, 0, 196, 0, 0, 0, 0, 0, 1540 197, 0, 0, 0, 0, 0, 0, 198, 0, 0, 1541 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, 1542 81, 20, 0, 0, 200, 201, 0, 0, 202, 0, 1543 0, 194, 195, 0, 0, 0, 78, 204, 205, 206, 1544 207, 0, 0, 208, 209, 196, 0, 0, 0, 0, 1545 0, 197, 547, 0, 192, 193, 0, 0, 198, 0, 1546 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, 1547 0, 81, 20, 0, 0, 200, 201, 0, 0, 202, 1548 0, 0, 0, 0, 0, 0, 0, 0, 204, 205, 1549 206, 207, 0, 0, 208, 209, 194, 195, 0, 0, 1550 0, 78, 0, 557, 0, 192, 193, 0, 0, 0, 1551 196, 0, 0, 0, 0, 0, 197, 0, 0, 0, 1552 0, 0, 0, 198, 0, 0, 0, 199, 0, 0, 1553 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, 1554 200, 201, 0, 0, 202, 0, 0, 194, 195, 0, 1555 0, 0, 78, 204, 205, 206, 207, 0, 0, 208, 1556 209, 196, 0, 0, 0, 0, 0, 197, 565, 0, 1557 192, 193, 0, 0, 198, 0, 0, 0, 199, 0, 1558 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, 1559 0, 200, 201, 0, 0, 202, 0, 0, 0, 0, 1560 0, 0, 0, 0, 204, 205, 206, 207, 0, 0, 1561 208, 209, 194, 195, 0, 0, 0, 78, 0, 567, 1562 0, 192, 193, 0, 0, 0, 196, 0, 0, 0, 1563 0, 0, 197, 0, 0, 0, 0, 0, 0, 198, 1564 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, 1565 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, 1566 202, 0, 0, 194, 195, 0, 0, 0, 78, 204, 1567 205, 206, 207, 0, 0, 208, 209, 196, 0, 0, 1568 0, 0, 0, 197, 592, 0, 192, 193, 0, 0, 1569 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, 1570 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, 1571 0, 202, 0, 0, 0, 0, 0, 0, 0, 0, 1572 204, 205, 206, 207, 0, 0, 208, 209, 194, 195, 1573 0, 0, 0, 78, 0, 609, 0, 192, 193, 0, 1574 0, 0, 196, 0, 0, 0, 0, 0, 197, 0, 1575 0, 0, 0, 0, 0, 198, 0, 0, 0, 199, 1576 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, 1577 0, 0, 200, 201, 0, 0, 202, 0, 0, 194, 1578 195, 0, 0, 0, 78, 204, 205, 206, 207, 0, 1579 0, 208, 209, 196, 0, 0, 0, 0, 0, 197, 1580 677, 0, 192, 193, 0, 0, 198, 0, 0, 0, 1581 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, 1582 20, 0, 0, 200, 201, 0, 0, 202, 0, 0, 1583 0, 0, 0, 0, 0, 0, 204, 205, 206, 207, 1584 0, 0, 208, 209, 194, 195, 0, 0, 0, 78, 1585 0, 681, 0, 192, 193, 0, 0, 0, 196, 0, 1586 0, 0, 0, 0, 197, 0, 0, 0, 0, 0, 1587 0, 198, 0, 0, 0, 199, 0, 0, 0, 0, 1588 0, 80, 0, 0, 81, 20, 0, 0, 200, 201, 1589 0, 0, 202, 0, 0, 194, 195, 0, 0, 0, 1590 78, 204, 205, 206, 207, 0, 0, 208, 209, 196, 1591 0, 0, 0, 0, 0, 197, 687, 0, 192, 193, 1592 0, 0, 198, 0, 0, 0, 199, 0, 0, 0, 1593 0, 0, 80, 0, 0, 81, 20, 0, 0, 200, 1594 201, 0, 0, 202, 0, 0, 0, 0, 0, 0, 1595 0, 0, 204, 205, 206, 207, 0, 0, 208, 209, 1596 194, 195, 0, 0, 0, 78, 0, 713, 0, 192, 1597 193, 0, 0, 0, 196, 0, 0, 0, 0, 0, 1598 197, 0, 0, 0, 0, 0, 0, 198, 0, 0, 1599 0, 199, 0, 0, 0, 0, 0, 80, 0, 0, 1600 81, 20, 0, 0, 200, 201, 0, 0, 202, 0, 1601 0, 194, 195, 0, 0, 0, 78, 204, 205, 206, 1602 207, 0, 0, 208, 209, 196, 0, 0, 0, 0, 1603 0, 197, 0, 575, 0, 0, 0, 0, 198, 0, 1604 0, 0, 199, 0, 0, 0, 0, 0, 80, 0, 1605 0, 81, 20, 0, 0, 200, 201, 0, 662, 202, 1606 0, 0, 0, 0, 0, 0, 0, 0, 204, 205, 1607 206, 207, 0, 0, 208, 209, -289, -289, -289, 0, 1608 0, 0, -289, 0, 0, 0, 0, 0, 0, 0, 1609 0, -289, 0, 0, 0, 0, 0, -289, 0, 0, 1610 724, 0, 194, 195, -289, 0, 0, 78, -289, 0, 1611 0, 0, 0, 0, -289, 0, 196, -289, -289, 0, 1612 0, 0, 197, 0, 0, -289, 0, 192, 193, 198, 1613 0, -289, 0, 199, -289, -289, -289, -289, 0, 80, 1614 -289, -289, 81, 20, 194, 195, 0, 0, 0, 78, 1615 277, -297, 0, 0, 0, 0, 0, 0, 196, 204, 1616 205, 206, 207, 0, 197, 208, 209, 660, 0, 194, 1617 195, 198, 0, 0, 78, 199, 0, 0, 0, 0, 1618 0, 80, 0, 196, 81, 20, 0, 0, 0, 197, 1619 0, 0, 277, -297, 192, 193, 198, 0, 0, 0, 1620 199, 204, 205, 206, 207, 0, 80, 208, 209, 81, 1621 20, 194, 195, 200, 201, 0, 78, 202, 0, 203, 1622 356, 0, 0, 0, 0, 196, 204, 205, 206, 207, 1623 0, 197, 208, 209, 0, 0, 194, 195, 198, 0, 1624 0, 78, 199, 0, 0, 192, 193, 0, 80, 0, 1625 196, 81, 20, 0, 0, 0, 197, 0, 0, 277, 1626 0, 0, 0, 198, 0, 0, 0, 199, 204, 205, 1627 206, 207, 0, 80, 208, 209, 81, 20, 0, 0, 1628 200, 201, 0, 0, 202, 488, 0, 194, 195, 0, 1629 0, 0, 78, 204, 205, 206, 207, 0, 0, 208, 1630 209, 196, 0, 0, 0, 0, 0, 197, 0, 0, 1631 192, 193, 0, 0, 198, 0, 0, 0, 199, 0, 1632 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, 1633 0, 200, 201, 0, 0, 202, 625, 0, 0, 0, 1634 0, 0, 0, 0, 204, 205, 206, 207, 0, 0, 1635 208, 209, 194, 195, 0, 0, 0, 78, 0, 0, 1636 0, 192, 193, 0, 0, 0, 196, 0, 0, 0, 1637 0, 0, 197, 0, 0, 0, 0, 0, 0, 198, 1638 0, 0, 0, 199, 0, 0, 0, 0, 0, 80, 1639 0, 0, 81, 20, 0, 0, 200, 201, 0, 0, 1640 202, 668, 0, 194, 195, 0, 0, 0, 78, 204, 1641 205, 206, 207, 0, 0, 208, 209, 196, 0, 0, 1642 0, 0, 0, 197, 0, 0, 192, 193, 0, 0, 1643 198, 0, 0, 0, 199, 0, 0, 0, 0, 0, 1644 80, 0, 0, 81, 20, 0, 0, 200, 201, 0, 1645 0, 202, 683, 0, 0, 0, 0, 0, 0, 0, 1646 204, 205, 206, 207, 0, 0, 208, 209, 194, 195, 1647 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 1648 0, 0, 196, 0, 0, 0, 0, 0, 197, 0, 1649 0, 0, 0, 0, 0, 198, 0, 0, 0, 199, 1650 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, 1651 0, 0, 200, 201, 0, 0, 202, 0, 2, 194, 1652 195, 0, 0, 0, 78, 204, 205, 206, 207, 0, 1653 0, 208, 209, 196, 0, 0, 0, 0, 0, 197, 1654 0, 0, 0, 0, 0, 0, 198, 0, 0, 0, 1655 199, 0, 0, 0, 0, 0, 80, 0, 0, 81, 1656 20, 0, 0, 0, 0, 0, 0, 277, 0, 0, 1657 0, 0, 0, 0, 0, 0, 204, 205, 206, 207, 1658 0, 0, 208, 209 1659}; 1660 1661static const short yycheck[] = { 3, 1662 328, 62, 6, 132, 62, 307, 129, 287, 175, 203, 1663 134, 0, 483, 179, 1, 1, 123, 1, 1, 346, 1664 9, 10, 11, 1, 83, 42, 353, 354, 89, 46, 1665 9, 89, 1, 94, 53, 1, 94, 657, 42, 162, 1666 1, 30, 46, 72, 33, 34, 169, 64, 435, 1, 1667 94, 62, 69, 97, 33, 86, 1, 86, 62, 294, 1668 64, 665, 51, 122, 123, 69, 1, 302, 129, 304, 1669 95, 129, 133, 62, 198, 133, 117, 1, 97, 192, 1670 193, 194, 195, 94, 636, 89, 1, 200, 201, 476, 1671 94, 1, 1, 95, 96, 1, 5, 99, 718, 160, 1672 86, 162, 160, 86, 162, 94, 636, 94, 1, 150, 1673 94, 128, 153, 100, 175, 502, 100, 134, 129, 180, 1674 1, 99, 180, 101, 128, 129, 1, 93, 1, 133, 1675 134, 172, 101, 4, 5, 101, 259, 198, 99, 636, 1676 129, 202, 613, 470, 133, 697, 473, 99, 700, 101, 1677 273, 162, 756, 0, 99, 100, 160, 1, 162, 94, 1678 326, 765, 9, 10, 11, 36, 37, 697, 140, 40, 1679 700, 175, 279, 162, 1, 99, 180, 86, 88, 50, 1680 1, 198, 1, 30, 99, 100, 33, 34, 192, 193, 1681 194, 195, 253, 99, 198, 253, 200, 201, 202, 636, 1682 697, 94, 1, 700, 51, 329, 100, 100, 79, 596, 1683 1, 763, 83, 254, 1, 62, 768, 98, 770, 1, 1684 772, 94, 283, 1, 99, 283, 287, 100, 1, 1, 1685 202, 203, 1, 763, 1, 622, 403, 1, 768, 1, 1686 770, 1, 772, 1, 1, 632, 307, 94, 92, 253, 1687 94, 122, 123, 97, 98, 99, 100, 370, 371, 372, 1688 697, 648, 1, 700, 253, 1, 763, 328, 139, 1, 1689 328, 768, 99, 770, 95, 772, 556, 15, 99, 283, 1690 99, 93, 129, 287, 94, 97, 588, 97, 590, 101, 1691 294, 485, 101, 175, 266, 94, 1, 269, 302, 1, 1692 304, 100, 1, 307, 175, 277, 1, 98, 179, 45, 1693 46, 98, 329, 641, 1, 162, 98, 86, 307, 86, 1694 98, 382, 95, 95, 328, 329, 763, 434, 1, 86, 1695 99, 768, 99, 770, 98, 772, 98, 175, 98, 328, 1696 1, 99, 403, 1, 1, 732, 52, 218, 1, 87, 1697 86, 631, 88, 1, 97, 91, 92, 93, 1, 1, 1698 99, 97, 94, 665, 477, 101, 370, 371, 372, 373, 1699 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 1700 384, 385, 386, 387, 388, 389, 553, 448, 1, 361, 1701 448, 52, 1, 365, 99, 52, 98, 268, 93, 403, 1702 99, 636, 63, 97, 275, 287, 63, 94, 279, 1, 1703 1, 100, 294, 0, 1, 88, 287, 1, 390, 1, 1704 302, 63, 304, 294, 1, 307, 1, 1, 1, 99, 1705 100, 302, 1, 304, 95, 1, 408, 95, 95, 52, 1706 720, 94, 0, 1, 448, 93, 418, 570, 420, 287, 1707 573, 94, 1, 95, 756, 326, 294, 44, 430, 99, 1708 100, 1, 697, 765, 302, 700, 304, 1, 55, 307, 1709 94, 93, 343, 477, 61, 67, 100, 1, 607, 483, 1710 67, 453, 95, 455, 93, 1, 44, 1, 723, 1, 1711 47, 362, 553, 364, 175, 556, 625, 469, 67, 612, 1712 95, 736, 86, 61, 95, 62, 0, 1, 480, 67, 1713 129, 93, 99, 485, 63, 750, 93, 92, 93, 93, 1714 93, 403, 97, 98, 99, 100, 98, 93, 763, 1, 1715 1, 1, 403, 768, 1, 770, 50, 772, 97, 96, 1716 1, 99, 101, 162, 667, 59, 95, 676, 1, 553, 1717 44, 65, 556, 93, 95, 0, 1, 686, 72, 93, 1718 431, 55, 76, 434, 1, 403, 96, 61, 82, 93, 1719 631, 85, 86, 67, 86, 89, 90, 93, 95, 93, 1720 641, 75, 99, 641, 0, 1, 93, 1, 102, 103, 1721 104, 105, 1, 1, 108, 109, 657, 129, 99, 44, 1722 0, 1, 0, 1, 1, 99, 287, 1, 612, 613, 1723 55, 175, 175, 294, 86, 86, 61, 1, 1, 86, 1724 1, 302, 67, 304, 628, 86, 307, 631, 44, 95, 1725 162, 64, 636, 86, 97, 44, 69, 641, 101, 55, 1726 1, 50, 1, 53, 44, 61, 44, 619, 65, 86, 1727 44, 67, 641, 657, 99, 72, 50, 718, 94, 720, 1728 1, 61, 1, 61, 11, 101, 1, 67, 65, 67, 1729 67, 553, 86, 82, 556, 72, 85, 86, 86, 76, 1730 129, 653, 553, 99, 95, 556, 97, 659, 82, 86, 1731 107, 85, 86, 697, 553, 128, 700, 556, 94, 99, 1732 94, 99, 86, 86, 100, 86, 588, 1, 590, 0, 1733 1, 160, 100, 162, 718, 553, 720, 96, 556, 723, 1734 47, 100, 403, 287, 287, 86, 65, 86, 67, 1, 1735 294, 294, 736, 72, 175, 62, 1, 76, 302, 302, 1736 304, 304, 94, 307, 307, 86, 750, 86, 100, 631, 1737 588, 86, 590, 44, 636, 101, 50, 44, 629, 763, 1738 631, 91, 92, 735, 768, 636, 770, 739, 772, 96, 1739 61, 44, 631, 101, 61, 657, 67, 50, 101, 44, 1740 67, 45, 46, 665, 92, 50, 657, 10, 82, 97, 1741 98, 85, 86, 631, 59, 67, 61, 94, 636, 9, 1742 72, 11, 67, 100, 76, 91, 92, 30, 99, 82, 1743 175, 34, 85, 86, 86, 697, 94, 82, 700, 657, 1744 85, 86, 100, 33, 94, 12, 697, 665, 51, 700, 1745 100, 470, 13, 97, 473, 1, 718, 101, 720, 403, 1746 403, 723, 97, 472, 60, 474, 287, 718, 64, 720, 1747 45, 46, 723, 294, 736, 18, 19, 20, 21, 697, 1748 14, 302, 700, 304, 1, 736, 307, 99, 750, 95, 1749 94, 93, 553, 97, 756, 556, 93, 101, 44, 750, 1750 718, 763, 720, 765, 50, 723, 768, 99, 770, 97, 1751 772, 175, 763, 697, 57, 99, 700, 768, 736, 770, 1752 99, 772, 97, 5, 6, 7, 101, 588, 99, 590, 1753 45, 46, 750, 50, 100, 44, 82, 95, 756, 85, 1754 86, 50, 287, 3, 4, 763, 66, 765, 93, 294, 1755 768, 93, 770, 1, 772, 16, 17, 302, 67, 304, 1756 91, 92, 307, 50, 88, 82, 45, 46, 85, 86, 1757 631, 93, 59, 82, 99, 636, 85, 86, 65, 763, 1758 45, 46, 403, 94, 768, 72, 770, 1, 772, 76, 1759 93, 91, 92, 93, 99, 82, 657, 97, 85, 86, 1760 94, 101, 89, 90, 665, 94, 93, 97, 98, 553, 1761 553, 97, 556, 556, 44, 102, 103, 104, 105, 1, 1762 50, 108, 109, 287, 373, 374, 44, 383, 384, 59, 1763 294, 61, 50, 8, 9, 10, 697, 67, 302, 700, 1764 304, 94, 100, 307, 588, 588, 590, 590, 378, 379, 1765 380, 381, 82, 56, 56, 85, 86, 718, 403, 720, 1766 99, 94, 723, 94, 82, 95, 96, 85, 86, 192, 1767 193, 194, 195, 1, 94, 736, 94, 200, 201, 86, 1768 97, 98, 99, 94, 91, 92, 93, 631, 631, 750, 1769 97, 1, 636, 636, 101, 756, 56, 1, 99, 3, 1770 4, 99, 763, 94, 765, 94, 0, 768, 0, 770, 1771 44, 772, 382, 657, 657, 11, 50, 54, 375, 376, 1772 377, 665, 665, 86, 75, 59, 162, 61, 91, 92, 1773 93, 139, 553, 67, 97, 556, 160, 253, 101, 403, 1774 403, 45, 46, 52, 94, 307, 50, 261, 82, 287, 1775 655, 85, 86, 697, 697, 59, 700, 700, 307, 571, 1776 655, 65, 96, 571, 346, 385, 387, 588, 72, 590, 1777 386, 388, 76, 628, 718, 718, 720, 720, 82, 723, 1778 723, 85, 86, 393, 389, 89, 90, -1, -1, 93, 1779 -1, 95, 736, 736, -1, -1, -1, -1, 102, 103, 1780 104, 105, -1, -1, 108, 109, 750, 750, 553, -1, 1781 631, 556, 756, 756, -1, 636, -1, -1, -1, 763, 1782 763, 765, 765, -1, 768, 768, 770, 770, 772, 772, 1783 -1, 91, 92, 93, -1, -1, 657, 97, -1, -1, 1784 -1, 101, -1, 588, 665, 590, -1, 370, 371, 372, 1785 373, 374, 375, 376, 377, 378, 379, 380, 381, -1, 1786 383, 384, 385, 386, 387, 388, 389, 44, 91, 92, 1787 93, -1, -1, 50, 97, -1, 697, -1, 101, 700, 1788 -1, -1, 59, -1, 61, -1, 631, -1, -1, 553, 1789 67, 636, 556, -1, -1, -1, -1, 718, -1, 720, 1790 -1, -1, 723, -1, -1, 82, -1, -1, 85, 86, 1791 -1, -1, 657, -1, -1, 736, -1, -1, 95, 96, 1792 665, -1, -1, -1, 588, -1, 590, -1, -1, 750, 1793 -1, 192, 193, 194, 195, 756, -1, -1, -1, 200, 1794 201, -1, 763, -1, 765, -1, -1, 768, -1, 770, 1795 -1, 772, 697, -1, 477, 700, -1, -1, -1, 86, 1796 483, -1, -1, -1, 91, 92, 93, 631, -1, -1, 1797 97, -1, 636, 718, 101, 720, -1, 1, 723, 3, 1798 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1799 -1, 736, -1, 657, -1, -1, -1, -1, -1, -1, 1800 -1, 665, -1, -1, -1, 750, -1, -1, -1, -1, 1801 -1, 756, -1, -1, -1, -1, -1, -1, 763, -1, 1802 765, 45, 46, 768, -1, 770, 50, 772, -1, -1, 1803 -1, -1, -1, 697, -1, 59, 700, -1, -1, -1, 1804 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1, 1805 -1, -1, 76, -1, 718, -1, 720, -1, 82, 723, 1806 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, 1807 -1, -1, 736, -1, -1, 99, -1, -1, 102, 103, 1808 104, 105, -1, -1, 108, 109, 750, 1, -1, 612, 1809 613, -1, 756, -1, -1, -1, -1, -1, -1, 763, 1810 -1, 765, -1, -1, 768, 628, 770, -1, 772, 370, 1811 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 1812 381, -1, 383, 384, 385, 386, 387, 388, 389, -1, 1813 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, 1814 54, -1, -1, -1, 58, 59, -1, -1, 62, -1, 1815 -1, 65, 66, 67, 68, -1, 70, 71, 72, 73, 1816 1, -1, 76, -1, -1, -1, -1, -1, 82, -1, 1817 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93, 1818 -1, 95, 96, -1, -1, 99, -1, -1, 102, 103, 1819 104, 105, -1, -1, 108, 109, -1, -1, -1, -1, 1820 -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 1821 51, -1, -1, 54, -1, -1, 477, 58, 59, -1, 1822 -1, 62, 483, -1, 65, 66, 67, 68, 1, 70, 1823 71, 72, 73, -1, -1, 76, -1, -1, -1, -1, 1824 -1, 82, -1, -1, 85, 86, -1, -1, -1, -1, 1825 -1, -1, 93, -1, 95, 96, -1, -1, 99, -1, 1826 -1, 102, 103, 104, 105, -1, -1, 108, 109, -1, 1827 -1, 44, 45, 46, 47, 48, 49, 50, 51, -1, 1828 -1, 54, -1, -1, -1, 58, 59, -1, -1, 62, 1829 -1, -1, 65, 66, 67, 68, -1, 70, 71, 72, 1830 73, 44, -1, 76, -1, -1, -1, 50, -1, 82, 1831 -1, 1, 85, 86, -1, -1, 59, -1, 61, -1, 1832 93, -1, 95, 96, 67, -1, 99, -1, -1, 102, 1833 103, 104, 105, -1, -1, 108, 109, -1, -1, 82, 1834 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1, 1835 -1, 612, 613, 96, 44, 45, 46, -1, 48, 49, 1836 50, 51, -1, -1, 54, -1, -1, 628, 58, 59, 1837 -1, -1, -1, -1, -1, 65, 66, 67, 68, 1, 1838 70, 71, 72, 73, -1, -1, 76, -1, -1, -1, 1839 -1, -1, 82, -1, -1, 85, 86, -1, -1, -1, 1840 -1, -1, -1, 93, -1, 95, 96, -1, -1, 99, 1841 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, 1842 -1, -1, 44, 45, 46, -1, 48, 49, 50, 51, 1843 -1, -1, 54, -1, -1, -1, 58, 59, -1, -1, 1844 -1, -1, -1, 65, 66, 67, 68, 1, 70, 71, 1845 72, 73, -1, -1, 76, -1, -1, -1, -1, -1, 1846 82, -1, -1, 85, 86, -1, -1, -1, -1, -1, 1847 -1, 93, -1, 95, -1, -1, -1, 99, -1, -1, 1848 102, 103, 104, 105, -1, -1, 108, 109, -1, -1, 1849 44, 45, 46, -1, 48, 49, 50, 51, -1, -1, 1850 54, -1, -1, -1, 58, 59, -1, -1, -1, -1, 1851 -1, 65, 66, 1, 68, -1, 70, 71, 72, 73, 1852 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, 1853 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93, 1854 -1, 95, -1, -1, -1, 99, -1, -1, 102, 103, 1855 104, 105, -1, -1, 108, 109, 44, 45, 46, -1, 1856 48, 49, 50, 51, -1, -1, 54, -1, -1, -1, 1857 58, 59, -1, -1, -1, -1, -1, 65, 66, -1, 1858 68, -1, 70, 71, 72, 73, -1, 1, 76, 3, 1859 4, -1, -1, -1, 82, -1, -1, 85, 86, -1, 1860 -1, -1, -1, -1, -1, 93, -1, 95, -1, -1, 1861 -1, 99, -1, -1, 102, 103, 104, 105, -1, -1, 1862 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, 1863 -1, 45, 46, -1, -1, -1, 50, -1, -1, -1, 1864 -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, 1865 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1, 1866 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, 1867 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, 1868 -1, 95, 96, -1, -1, -1, -1, -1, 102, 103, 1869 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, 1870 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1, 1871 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, 1872 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, 1873 -1, -1, -1, 82, -1, -1, 85, 86, -1, 88, 1874 89, 90, -1, -1, 93, -1, -1, 45, 46, -1, 1875 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, 1876 109, 59, -1, -1, -1, -1, -1, 65, 1, -1, 1877 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, 1878 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, 1879 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1, 1880 98, -1, -1, -1, 102, 103, 104, 105, -1, -1, 1881 108, 109, 45, 46, -1, -1, -1, 50, -1, 1, 1882 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, 1883 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, 1884 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, 1885 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, 1886 93, 94, -1, 45, 46, -1, -1, -1, 50, 102, 1887 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, 1888 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1, 1889 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, 1890 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, 1891 -1, 93, -1, -1, -1, -1, -1, 99, -1, -1, 1892 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, 1893 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1, 1894 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, 1895 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, 1896 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, 1897 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, 1898 46, 98, -1, -1, 50, 102, 103, 104, 105, -1, 1899 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, 1900 1, -1, 3, 4, -1, -1, 72, -1, -1, -1, 1901 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, 1902 86, -1, -1, 89, 90, -1, -1, 93, 94, -1, 1903 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, 1904 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, 1905 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1, 1906 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, 1907 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, 1908 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, 1909 -1, -1, 93, -1, -1, 45, 46, 98, -1, -1, 1910 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, 1911 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4, 1912 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, 1913 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, 1914 90, -1, -1, 93, 94, -1, -1, -1, -1, -1, 1915 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, 1916 45, 46, -1, -1, -1, 50, -1, 1, -1, 3, 1917 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, 1918 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, 1919 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, 1920 85, 86, -1, -1, 89, 90, -1, -1, 93, 94, 1921 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104, 1922 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, 1923 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1, 1924 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, 1925 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, 1926 94, -1, -1, -1, -1, -1, -1, -1, 102, 103, 1927 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, 1928 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1, 1929 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, 1930 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, 1931 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, 1932 89, 90, -1, -1, 93, -1, -1, 45, 46, -1, 1933 99, -1, 50, 102, 103, 104, 105, -1, -1, 108, 1934 109, 59, -1, -1, -1, -1, -1, 65, 1, -1, 1935 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, 1936 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, 1937 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1, 1938 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, 1939 108, 109, 45, 46, -1, -1, -1, 50, -1, 1, 1940 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, 1941 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, 1942 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, 1943 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, 1944 93, -1, -1, 45, 46, -1, -1, -1, 50, 102, 1945 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, 1946 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1, 1947 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, 1948 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, 1949 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, 1950 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, 1951 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1, 1952 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, 1953 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, 1954 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, 1955 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, 1956 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, 1957 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, 1958 1, -1, 3, 4, -1, -1, 72, -1, -1, -1, 1959 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, 1960 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, 1961 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, 1962 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, 1963 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1, 1964 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, 1965 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, 1966 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, 1967 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1, 1968 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, 1969 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4, 1970 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, 1971 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, 1972 90, -1, -1, 93, -1, -1, -1, -1, -1, -1, 1973 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, 1974 45, 46, -1, -1, -1, 50, -1, 1, -1, 3, 1975 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, 1976 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, 1977 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, 1978 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, 1979 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104, 1980 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, 1981 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1, 1982 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, 1983 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, 1984 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103, 1985 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, 1986 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1, 1987 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, 1988 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, 1989 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, 1990 89, 90, -1, -1, 93, -1, -1, 45, 46, -1, 1991 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, 1992 109, 59, -1, -1, -1, -1, -1, 65, 1, -1, 1993 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, 1994 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, 1995 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1, 1996 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, 1997 108, 109, 45, 46, -1, -1, -1, 50, -1, 1, 1998 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, 1999 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, 2000 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, 2001 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, 2002 93, -1, -1, 45, 46, -1, -1, -1, 50, 102, 2003 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, 2004 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1, 2005 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, 2006 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, 2007 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, 2008 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, 2009 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1, 2010 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, 2011 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, 2012 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, 2013 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, 2014 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, 2015 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, 2016 1, -1, 3, 4, -1, -1, 72, -1, -1, -1, 2017 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, 2018 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, 2019 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, 2020 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, 2021 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1, 2022 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, 2023 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, 2024 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, 2025 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1, 2026 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, 2027 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4, 2028 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, 2029 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, 2030 90, -1, -1, 93, -1, -1, -1, -1, -1, -1, 2031 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, 2032 45, 46, -1, -1, -1, 50, -1, 1, -1, 3, 2033 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, 2034 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, 2035 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, 2036 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, 2037 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104, 2038 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, 2039 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1, 2040 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, 2041 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, 2042 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103, 2043 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, 2044 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1, 2045 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, 2046 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, 2047 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, 2048 89, 90, -1, -1, 93, -1, -1, 45, 46, -1, 2049 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, 2050 109, 59, -1, -1, -1, -1, -1, 65, 1, -1, 2051 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, 2052 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, 2053 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1, 2054 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, 2055 108, 109, 45, 46, -1, -1, -1, 50, -1, 1, 2056 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, 2057 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, 2058 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, 2059 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, 2060 93, -1, -1, 45, 46, -1, -1, -1, 50, 102, 2061 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, 2062 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1, 2063 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, 2064 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, 2065 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, 2066 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, 2067 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1, 2068 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, 2069 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, 2070 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, 2071 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, 2072 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, 2073 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, 2074 1, -1, 3, 4, -1, -1, 72, -1, -1, -1, 2075 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, 2076 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, 2077 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, 2078 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, 2079 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1, 2080 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, 2081 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, 2082 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, 2083 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1, 2084 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, 2085 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4, 2086 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, 2087 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, 2088 90, -1, -1, 93, -1, -1, -1, -1, -1, -1, 2089 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, 2090 45, 46, -1, -1, -1, 50, -1, 1, -1, 3, 2091 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, 2092 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, 2093 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, 2094 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, 2095 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104, 2096 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, 2097 -1, 65, 1, -1, 3, 4, -1, -1, 72, -1, 2098 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, 2099 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, 2100 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103, 2101 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, 2102 -1, 50, -1, 1, -1, 3, 4, -1, -1, -1, 2103 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, 2104 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, 2105 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, 2106 89, 90, -1, -1, 93, -1, -1, 45, 46, -1, 2107 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, 2108 109, 59, -1, -1, -1, -1, -1, 65, 1, -1, 2109 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, 2110 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, 2111 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1, 2112 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, 2113 108, 109, 45, 46, -1, -1, -1, 50, -1, 1, 2114 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, 2115 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, 2116 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, 2117 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, 2118 93, -1, -1, 45, 46, -1, -1, -1, 50, 102, 2119 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, 2120 -1, -1, -1, 65, 1, -1, 3, 4, -1, -1, 2121 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, 2122 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, 2123 -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, 2124 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, 2125 -1, -1, -1, 50, -1, 1, -1, 3, 4, -1, 2126 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, 2127 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, 2128 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, 2129 -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, 2130 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, 2131 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, 2132 1, -1, 3, 4, -1, -1, 72, -1, -1, -1, 2133 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, 2134 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, 2135 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, 2136 -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, 2137 -1, 1, -1, 3, 4, -1, -1, -1, 59, -1, 2138 -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, 2139 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, 2140 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, 2141 -1, -1, 93, -1, -1, 45, 46, -1, -1, -1, 2142 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, 2143 -1, -1, -1, -1, -1, 65, 1, -1, 3, 4, 2144 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, 2145 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, 2146 90, -1, -1, 93, -1, -1, -1, -1, -1, -1, 2147 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, 2148 45, 46, -1, -1, -1, 50, -1, 1, -1, 3, 2149 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, 2150 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, 2151 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, 2152 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, 2153 -1, 45, 46, -1, -1, -1, 50, 102, 103, 104, 2154 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, 2155 -1, 65, -1, 1, -1, -1, -1, -1, 72, -1, 2156 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, 2157 -1, 85, 86, -1, -1, 89, 90, -1, 1, 93, 2158 -1, -1, -1, -1, -1, -1, -1, -1, 102, 103, 2159 104, 105, -1, -1, 108, 109, 44, 45, 46, -1, 2160 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, 2161 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1, 2162 1, -1, 45, 46, 72, -1, -1, 50, 76, -1, 2163 -1, -1, -1, -1, 82, -1, 59, 85, 86, -1, 2164 -1, -1, 65, -1, -1, 93, -1, 3, 4, 72, 2165 -1, 99, -1, 76, 102, 103, 104, 105, -1, 82, 2166 108, 109, 85, 86, 45, 46, -1, -1, -1, 50, 2167 93, 94, -1, -1, -1, -1, -1, -1, 59, 102, 2168 103, 104, 105, -1, 65, 108, 109, 1, -1, 45, 2169 46, 72, -1, -1, 50, 76, -1, -1, -1, -1, 2170 -1, 82, -1, 59, 85, 86, -1, -1, -1, 65, 2171 -1, -1, 93, 94, 3, 4, 72, -1, -1, -1, 2172 76, 102, 103, 104, 105, -1, 82, 108, 109, 85, 2173 86, 45, 46, 89, 90, -1, 50, 93, -1, 95, 2174 96, -1, -1, -1, -1, 59, 102, 103, 104, 105, 2175 -1, 65, 108, 109, -1, -1, 45, 46, 72, -1, 2176 -1, 50, 76, -1, -1, 3, 4, -1, 82, -1, 2177 59, 85, 86, -1, -1, -1, 65, -1, -1, 93, 2178 -1, -1, -1, 72, -1, -1, -1, 76, 102, 103, 2179 104, 105, -1, 82, 108, 109, 85, 86, -1, -1, 2180 89, 90, -1, -1, 93, 94, -1, 45, 46, -1, 2181 -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, 2182 109, 59, -1, -1, -1, -1, -1, 65, -1, -1, 2183 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, 2184 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, 2185 -1, 89, 90, -1, -1, 93, 94, -1, -1, -1, 2186 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, 2187 108, 109, 45, 46, -1, -1, -1, 50, -1, -1, 2188 -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, 2189 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, 2190 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, 2191 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, 2192 93, 94, -1, 45, 46, -1, -1, -1, 50, 102, 2193 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, 2194 -1, -1, -1, 65, -1, -1, 3, 4, -1, -1, 2195 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, 2196 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, 2197 -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, 2198 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, 2199 -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, 2200 -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, 2201 -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, 2202 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, 2203 -1, -1, 89, 90, -1, -1, 93, -1, 44, 45, 2204 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, 2205 -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, 2206 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, 2207 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, 2208 86, -1, -1, -1, -1, -1, -1, 93, -1, -1, 2209 -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, 2210 -1, -1, 108, 109 2211}; 2212#define YYPURE 1 2213 2214/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 2215#line 3 "/usr/lib/bison.simple" 2216/* This file comes from bison-1.27. */ 2217 2218/* Skeleton output parser for bison, 2219 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. 2220 2221 This program is free software; you can redistribute it and/or modify 2222 it under the terms of the GNU General Public License as published by 2223 the Free Software Foundation; either version 2, or (at your option) 2224 any later version. 2225 2226 This program is distributed in the hope that it will be useful, 2227 but WITHOUT ANY WARRANTY; without even the implied warranty of 2228 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2229 GNU General Public License for more details. 2230 2231 You should have received a copy of the GNU General Public License 2232 along with this program; if not, write to the Free Software 2233 Foundation, Inc., 59 Temple Place - Suite 330, 2234 Boston, MA 02111-1307, USA. */ 2235 2236/* As a special exception, when this file is copied by Bison into a 2237 Bison output file, you may use that output file without restriction. 2238 This special exception was added by the Free Software Foundation 2239 in version 1.24 of Bison. */ 2240 2241/* This is the parser code that is written into each bison parser 2242 when the %semantic_parser declaration is not specified in the grammar. 2243 It was written by Richard Stallman by simplifying the hairy parser 2244 used when %semantic_parser is specified. */ 2245 2246#ifndef YYSTACK_USE_ALLOCA 2247#ifdef alloca 2248#define YYSTACK_USE_ALLOCA 2249#else /* alloca not defined */ 2250#ifdef __GNUC__ 2251#define YYSTACK_USE_ALLOCA 2252#define alloca __builtin_alloca 2253#else /* not GNU C. */ 2254#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) 2255#define YYSTACK_USE_ALLOCA 2256#include <alloca.h> 2257#else /* not sparc */ 2258/* We think this test detects Watcom and Microsoft C. */ 2259/* This used to test MSDOS, but that is a bad idea 2260 since that symbol is in the user namespace. */ 2261#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) 2262#if 0 /* No need for malloc.h, which pollutes the namespace; 2263 instead, just don't use alloca. */ 2264#include <malloc.h> 2265#endif 2266#else /* not MSDOS, or __TURBOC__ */ 2267#if defined(_AIX) 2268/* I don't know what this was needed for, but it pollutes the namespace. 2269 So I turned it off. rms, 2 May 1997. */ 2270/* #include <malloc.h> */ 2271 #pragma alloca 2272#define YYSTACK_USE_ALLOCA 2273#else /* not MSDOS, or __TURBOC__, or _AIX */ 2274#if 0 2275#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, 2276 and on HPUX 10. Eventually we can turn this on. */ 2277#define YYSTACK_USE_ALLOCA 2278#define alloca __builtin_alloca 2279#endif /* __hpux */ 2280#endif 2281#endif /* not _AIX */ 2282#endif /* not MSDOS, or __TURBOC__ */ 2283#endif /* not sparc */ 2284#endif /* not GNU C */ 2285#endif /* alloca not defined */ 2286#endif /* YYSTACK_USE_ALLOCA not defined */ 2287 2288#ifdef YYSTACK_USE_ALLOCA 2289#define YYSTACK_ALLOC alloca 2290#else 2291#define YYSTACK_ALLOC malloc 2292#endif 2293 2294/* Note: there must be only one dollar sign in this file. 2295 It is replaced by the list of actions, each action 2296 as one case of the switch. */ 2297 2298#define yyerrok (yyerrstatus = 0) 2299#define yyclearin (yychar = YYEMPTY) 2300#define YYEMPTY -2 2301#define YYEOF 0 2302#define YYACCEPT goto yyacceptlab 2303#define YYABORT goto yyabortlab 2304#define YYERROR goto yyerrlab1 2305/* Like YYERROR except do call yyerror. 2306 This remains here temporarily to ease the 2307 transition to the new meaning of YYERROR, for GCC. 2308 Once GCC version 2 has supplanted version 1, this can go. */ 2309#define YYFAIL goto yyerrlab 2310#define YYRECOVERING() (!!yyerrstatus) 2311#define YYBACKUP(token, value) \ 2312do \ 2313 if (yychar == YYEMPTY && yylen == 1) \ 2314 { yychar = (token), yylval = (value); \ 2315 yychar1 = YYTRANSLATE (yychar); \ 2316 YYPOPSTACK; \ 2317 goto yybackup; \ 2318 } \ 2319 else \ 2320 { yyerror ("syntax error: cannot back up"); YYERROR; } \ 2321while (0) 2322 2323#define YYTERROR 1 2324#define YYERRCODE 256 2325 2326#ifndef YYPURE 2327#define YYLEX yylex() 2328#endif 2329 2330#ifdef YYPURE 2331#ifdef YYLSP_NEEDED 2332#ifdef YYLEX_PARAM 2333#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) 2334#else 2335#define YYLEX yylex(&yylval, &yylloc) 2336#endif 2337#else /* not YYLSP_NEEDED */ 2338#ifdef YYLEX_PARAM 2339#define YYLEX yylex(&yylval, YYLEX_PARAM) 2340#else 2341#define YYLEX yylex(&yylval) 2342#endif 2343#endif /* not YYLSP_NEEDED */ 2344#endif 2345 2346/* If nonreentrant, generate the variables here */ 2347 2348#ifndef YYPURE 2349 2350int yychar; /* the lookahead symbol */ 2351YYSTYPE yylval; /* the semantic value of the */ 2352 /* lookahead symbol */ 2353 2354#ifdef YYLSP_NEEDED 2355YYLTYPE yylloc; /* location data for the lookahead */ 2356 /* symbol */ 2357#endif 2358 2359int yynerrs; /* number of parse errors so far */ 2360#endif /* not YYPURE */ 2361 2362#if YYDEBUG != 0 2363int yydebug; /* nonzero means print parse trace */ 2364/* Since this is uninitialized, it does not stop multiple parsers 2365 from coexisting. */ 2366#endif 2367 2368/* YYINITDEPTH indicates the initial size of the parser's stacks */ 2369 2370#ifndef YYINITDEPTH 2371#define YYINITDEPTH 200 2372#endif 2373 2374/* YYMAXDEPTH is the maximum size the stacks can grow to 2375 (effective only if the built-in stack extension method is used). */ 2376 2377#if YYMAXDEPTH == 0 2378#undef YYMAXDEPTH 2379#endif 2380 2381#ifndef YYMAXDEPTH 2382#define YYMAXDEPTH 10000 2383#endif 2384 2385/* Define __yy_memcpy. Note that the size argument 2386 should be passed with type unsigned int, because that is what the non-GCC 2387 definitions require. With GCC, __builtin_memcpy takes an arg 2388 of type size_t, but it can handle unsigned int. */ 2389 2390#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ 2391#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) 2392#else /* not GNU C or C++ */ 2393#ifndef __cplusplus 2394 2395/* This is the most reliable way to avoid incompatibilities 2396 in available built-in functions on various systems. */ 2397static void 2398__yy_memcpy (to, from, count) 2399 char *to; 2400 char *from; 2401 unsigned int count; 2402{ 2403 register char *f = from; 2404 register char *t = to; 2405 register int i = count; 2406 2407 while (i-- > 0) 2408 *t++ = *f++; 2409} 2410 2411#else /* __cplusplus */ 2412 2413/* This is the most reliable way to avoid incompatibilities 2414 in available built-in functions on various systems. */ 2415static void 2416__yy_memcpy (char *to, char *from, unsigned int count) 2417{ 2418 register char *t = to; 2419 register char *f = from; 2420 register int i = count; 2421 2422 while (i-- > 0) 2423 *t++ = *f++; 2424} 2425 2426#endif 2427#endif 2428 2429#line 216 "/usr/lib/bison.simple" 2430 2431/* The user can define YYPARSE_PARAM as the name of an argument to be passed 2432 into yyparse. The argument should have type void *. 2433 It should actually point to an object. 2434 Grammar actions can access the variable by casting it 2435 to the proper pointer type. */ 2436 2437#ifdef YYPARSE_PARAM 2438#ifdef __cplusplus 2439#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 2440#define YYPARSE_PARAM_DECL 2441#else /* not __cplusplus */ 2442#define YYPARSE_PARAM_ARG YYPARSE_PARAM 2443#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 2444#endif /* not __cplusplus */ 2445#else /* not YYPARSE_PARAM */ 2446#define YYPARSE_PARAM_ARG 2447#define YYPARSE_PARAM_DECL 2448#endif /* not YYPARSE_PARAM */ 2449 2450/* Prevent warning if -Wstrict-prototypes. */ 2451#ifdef __GNUC__ 2452#ifdef YYPARSE_PARAM 2453int yyparse (void *); 2454#else 2455int yyparse (void); 2456#endif 2457#endif 2458 2459int 2460yyparse(YYPARSE_PARAM_ARG) 2461 YYPARSE_PARAM_DECL 2462{ 2463 register int yystate; 2464 register int yyn; 2465 register short *yyssp; 2466 register YYSTYPE *yyvsp; 2467 int yyerrstatus; /* number of tokens to shift before error messages enabled */ 2468 int yychar1 = 0; /* lookahead token as an internal (translated) token number */ 2469 2470 short yyssa[YYINITDEPTH]; /* the state stack */ 2471 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ 2472 2473 short *yyss = yyssa; /* refer to the stacks thru separate pointers */ 2474 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ 2475 2476#ifdef YYLSP_NEEDED 2477 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ 2478 YYLTYPE *yyls = yylsa; 2479 YYLTYPE *yylsp; 2480 2481#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 2482#else 2483#define YYPOPSTACK (yyvsp--, yyssp--) 2484#endif 2485 2486 int yystacksize = YYINITDEPTH; 2487 int yyfree_stacks = 0; 2488 2489#ifdef YYPURE 2490 int yychar; 2491 YYSTYPE yylval; 2492 int yynerrs; 2493#ifdef YYLSP_NEEDED 2494 YYLTYPE yylloc; 2495#endif 2496#endif 2497 2498 YYSTYPE yyval; /* the variable used to return */ 2499 /* semantic values from the action */ 2500 /* routines */ 2501 2502 int yylen; 2503 2504#if YYDEBUG != 0 2505 if (yydebug) 2506 fprintf(stderr, "Starting parse\n"); 2507#endif 2508 2509 yystate = 0; 2510 yyerrstatus = 0; 2511 yynerrs = 0; 2512 yychar = YYEMPTY; /* Cause a token to be read. */ 2513 2514 /* Initialize stack pointers. 2515 Waste one element of value and location stack 2516 so that they stay on the same level as the state stack. 2517 The wasted elements are never initialized. */ 2518 2519 yyssp = yyss - 1; 2520 yyvsp = yyvs; 2521#ifdef YYLSP_NEEDED 2522 yylsp = yyls; 2523#endif 2524 2525/* Push a new state, which is found in yystate . */ 2526/* In all cases, when you get here, the value and location stacks 2527 have just been pushed. so pushing a state here evens the stacks. */ 2528yynewstate: 2529 2530 *++yyssp = yystate; 2531 2532 if (yyssp >= yyss + yystacksize - 1) 2533 { 2534 /* Give user a chance to reallocate the stack */ 2535 /* Use copies of these so that the &'s don't force the real ones into memory. */ 2536 YYSTYPE *yyvs1 = yyvs; 2537 short *yyss1 = yyss; 2538#ifdef YYLSP_NEEDED 2539 YYLTYPE *yyls1 = yyls; 2540#endif 2541 2542 /* Get the current used size of the three stacks, in elements. */ 2543 int size = yyssp - yyss + 1; 2544 2545#ifdef yyoverflow 2546 /* Each stack pointer address is followed by the size of 2547 the data in use in that stack, in bytes. */ 2548#ifdef YYLSP_NEEDED 2549 /* This used to be a conditional around just the two extra args, 2550 but that might be undefined if yyoverflow is a macro. */ 2551 yyoverflow("parser stack overflow", 2552 &yyss1, size * sizeof (*yyssp), 2553 &yyvs1, size * sizeof (*yyvsp), 2554 &yyls1, size * sizeof (*yylsp), 2555 &yystacksize); 2556#else 2557 yyoverflow("parser stack overflow", 2558 &yyss1, size * sizeof (*yyssp), 2559 &yyvs1, size * sizeof (*yyvsp), 2560 &yystacksize); 2561#endif 2562 2563 yyss = yyss1; yyvs = yyvs1; 2564#ifdef YYLSP_NEEDED 2565 yyls = yyls1; 2566#endif 2567#else /* no yyoverflow */ 2568 /* Extend the stack our own way. */ 2569 if (yystacksize >= YYMAXDEPTH) 2570 { 2571 yyerror("parser stack overflow"); 2572 if (yyfree_stacks) 2573 { 2574 free (yyss); 2575 free (yyvs); 2576#ifdef YYLSP_NEEDED 2577 free (yyls); 2578#endif 2579 } 2580 return 2; 2581 } 2582 yystacksize *= 2; 2583 if (yystacksize > YYMAXDEPTH) 2584 yystacksize = YYMAXDEPTH; 2585#ifndef YYSTACK_USE_ALLOCA 2586 yyfree_stacks = 1; 2587#endif 2588 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); 2589 __yy_memcpy ((char *)yyss, (char *)yyss1, 2590 size * (unsigned int) sizeof (*yyssp)); 2591 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); 2592 __yy_memcpy ((char *)yyvs, (char *)yyvs1, 2593 size * (unsigned int) sizeof (*yyvsp)); 2594#ifdef YYLSP_NEEDED 2595 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); 2596 __yy_memcpy ((char *)yyls, (char *)yyls1, 2597 size * (unsigned int) sizeof (*yylsp)); 2598#endif 2599#endif /* no yyoverflow */ 2600 2601 yyssp = yyss + size - 1; 2602 yyvsp = yyvs + size - 1; 2603#ifdef YYLSP_NEEDED 2604 yylsp = yyls + size - 1; 2605#endif 2606 2607#if YYDEBUG != 0 2608 if (yydebug) 2609 fprintf(stderr, "Stack size increased to %d\n", yystacksize); 2610#endif 2611 2612 if (yyssp >= yyss + yystacksize - 1) 2613 YYABORT; 2614 } 2615 2616#if YYDEBUG != 0 2617 if (yydebug) 2618 fprintf(stderr, "Entering state %d\n", yystate); 2619#endif 2620 2621 goto yybackup; 2622 yybackup: 2623 2624/* Do appropriate processing given the current state. */ 2625/* Read a lookahead token if we need one and don't already have one. */ 2626/* yyresume: */ 2627 2628 /* First try to decide what to do without reference to lookahead token. */ 2629 2630 yyn = yypact[yystate]; 2631 if (yyn == YYFLAG) 2632 goto yydefault; 2633 2634 /* Not known => get a lookahead token if don't already have one. */ 2635 2636 /* yychar is either YYEMPTY or YYEOF 2637 or a valid token in external form. */ 2638 2639 if (yychar == YYEMPTY) 2640 { 2641#if YYDEBUG != 0 2642 if (yydebug) 2643 fprintf(stderr, "Reading a token: "); 2644#endif 2645 yychar = YYLEX; 2646 } 2647 2648 /* Convert token to internal form (in yychar1) for indexing tables with */ 2649 2650 if (yychar <= 0) /* This means end of input. */ 2651 { 2652 yychar1 = 0; 2653 yychar = YYEOF; /* Don't call YYLEX any more */ 2654 2655#if YYDEBUG != 0 2656 if (yydebug) 2657 fprintf(stderr, "Now at end of input.\n"); 2658#endif 2659 } 2660 else 2661 { 2662 yychar1 = YYTRANSLATE(yychar); 2663 2664#if YYDEBUG != 0 2665 if (yydebug) 2666 { 2667 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); 2668 /* Give the individual parser a way to print the precise meaning 2669 of a token, for further debugging info. */ 2670#ifdef YYPRINT 2671 YYPRINT (stderr, yychar, yylval); 2672#endif 2673 fprintf (stderr, ")\n"); 2674 } 2675#endif 2676 } 2677 2678 yyn += yychar1; 2679 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) 2680 goto yydefault; 2681 2682 yyn = yytable[yyn]; 2683 2684 /* yyn is what to do for this token type in this state. 2685 Negative => reduce, -yyn is rule number. 2686 Positive => shift, yyn is new state. 2687 New state is final state => don't bother to shift, 2688 just return success. 2689 0, or most negative number => error. */ 2690 2691 if (yyn < 0) 2692 { 2693 if (yyn == YYFLAG) 2694 goto yyerrlab; 2695 yyn = -yyn; 2696 goto yyreduce; 2697 } 2698 else if (yyn == 0) 2699 goto yyerrlab; 2700 2701 if (yyn == YYFINAL) 2702 YYACCEPT; 2703 2704 /* Shift the lookahead token. */ 2705 2706#if YYDEBUG != 0 2707 if (yydebug) 2708 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); 2709#endif 2710 2711 /* Discard the token being shifted unless it is eof. */ 2712 if (yychar != YYEOF) 2713 yychar = YYEMPTY; 2714 2715 *++yyvsp = yylval; 2716#ifdef YYLSP_NEEDED 2717 *++yylsp = yylloc; 2718#endif 2719 2720 /* count tokens shifted since error; after three, turn off error status. */ 2721 if (yyerrstatus) yyerrstatus--; 2722 2723 yystate = yyn; 2724 goto yynewstate; 2725 2726/* Do the default action for the current state. */ 2727yydefault: 2728 2729 yyn = yydefact[yystate]; 2730 if (yyn == 0) 2731 goto yyerrlab; 2732 2733/* Do a reduction. yyn is the number of a rule to reduce with. */ 2734yyreduce: 2735 yylen = yyr2[yyn]; 2736 if (yylen > 0) 2737 yyval = yyvsp[1-yylen]; /* implement default value of the action */ 2738 2739#if YYDEBUG != 0 2740 if (yydebug) 2741 { 2742 int i; 2743 2744 fprintf (stderr, "Reducing via rule %d (line %d), ", 2745 yyn, yyrline[yyn]); 2746 2747 /* Print the symbols being reduced, and their result. */ 2748 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) 2749 fprintf (stderr, "%s ", yytname[yyrhs[i]]); 2750 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); 2751 } 2752#endif 2753 2754 2755 switch (yyn) { 2756 2757case 1: 2758#line 460 "./parse.y" 2759{; 2760 break;} 2761case 18: 2762#line 504 "./parse.y" 2763{ 2764 yyval.node = build_java_array_type (yyvsp[-2].node, -1); 2765 CLASS_LOADED_P (yyval.node) = 1; 2766 ; 2767 break;} 2768case 19: 2769#line 509 "./parse.y" 2770{ yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; 2771 break;} 2772case 20: 2773#line 511 "./parse.y" 2774{ yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; 2775 break;} 2776case 21: 2777#line 513 "./parse.y" 2778{RULE ("']' expected"); RECOVER;; 2779 break;} 2780case 22: 2781#line 515 "./parse.y" 2782{RULE ("']' expected"); RECOVER;; 2783 break;} 2784case 26: 2785#line 530 "./parse.y" 2786{ yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ; 2787 break;} 2788case 28: 2789#line 539 "./parse.y" 2790{yyval.node = NULL;; 2791 break;} 2792case 36: 2793#line 551 "./parse.y" 2794{ 2795 yyval.node = NULL; 2796 ; 2797 break;} 2798case 37: 2799#line 555 "./parse.y" 2800{ 2801 yyval.node = NULL; 2802 ; 2803 break;} 2804case 40: 2805#line 567 "./parse.y" 2806{ ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); ; 2807 break;} 2808case 41: 2809#line 569 "./parse.y" 2810{yyerror ("Missing name"); RECOVER;; 2811 break;} 2812case 42: 2813#line 571 "./parse.y" 2814{yyerror ("';' expected"); RECOVER;; 2815 break;} 2816case 45: 2817#line 581 "./parse.y" 2818{ 2819 tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name; 2820 int i = IDENTIFIER_LENGTH (name)-1; 2821 char *last = &IDENTIFIER_POINTER (name)[i]; 2822 while (last != IDENTIFIER_POINTER (name)) 2823 { 2824 if (last [0] == '.') 2825 break; 2826 last--; 2827 } 2828 last_name = get_identifier (++last); 2829 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name)) 2830 { 2831 tree err = find_name_in_single_imports (last_name); 2832 if (err && err != name) 2833 parse_error_context 2834 (yyvsp[-1].node, "Ambiguous class: `%s' and `%s'", 2835 IDENTIFIER_POINTER (name), 2836 IDENTIFIER_POINTER (err)); 2837 else 2838 REGISTER_IMPORT (yyvsp[-1].node, last_name) 2839 } 2840 else 2841 REGISTER_IMPORT (yyvsp[-1].node, last_name); 2842 ; 2843 break;} 2844case 46: 2845#line 607 "./parse.y" 2846{yyerror ("Missing name"); RECOVER;; 2847 break;} 2848case 47: 2849#line 609 "./parse.y" 2850{yyerror ("';' expected"); RECOVER;; 2851 break;} 2852case 48: 2853#line 614 "./parse.y" 2854{ 2855 tree name = EXPR_WFL_NODE (yyvsp[-3].node); 2856 /* Don't import java.lang.* twice. */ 2857 if (name != java_lang_id) 2858 { 2859 tree node = build_tree_list (yyvsp[-3].node, NULL_TREE); 2860 read_import_dir (yyvsp[-3].node); 2861 TREE_CHAIN (node) = ctxp->import_demand_list; 2862 ctxp->import_demand_list = node; 2863 } 2864 ; 2865 break;} 2866case 49: 2867#line 626 "./parse.y" 2868{yyerror ("'*' expected"); RECOVER;; 2869 break;} 2870case 50: 2871#line 628 "./parse.y" 2872{yyerror ("';' expected"); RECOVER;; 2873 break;} 2874case 51: 2875#line 633 "./parse.y" 2876{ 2877 maybe_generate_finit (); 2878 maybe_generate_clinit (); 2879 yyval.node = yyvsp[0].node; 2880 ; 2881 break;} 2882case 52: 2883#line 639 "./parse.y" 2884{ 2885 maybe_generate_clinit (); 2886 yyval.node = yyvsp[0].node; 2887 ; 2888 break;} 2889case 53: 2890#line 644 "./parse.y" 2891{ yyval.node = NULL; ; 2892 break;} 2893case 54: 2894#line 646 "./parse.y" 2895{ 2896 YYERROR_NOW; 2897 yyerror ("Class or interface declaration expected"); 2898 ; 2899 break;} 2900case 55: 2901#line 657 "./parse.y" 2902{ 2903 yyval.value = (1 << yyvsp[0].value); 2904 ; 2905 break;} 2906case 56: 2907#line 661 "./parse.y" 2908{ 2909 int acc = (1 << yyvsp[0].value); 2910 if (yyval.value & acc) 2911 parse_error_context 2912 (ctxp->modifier_ctx [yyvsp[0].value], "Modifier `%s' declared twice", 2913 java_accstring_lookup (acc)); 2914 else 2915 { 2916 yyval.value |= acc; 2917 } 2918 ; 2919 break;} 2920case 57: 2921#line 677 "./parse.y" 2922{ create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; 2923 break;} 2924case 58: 2925#line 679 "./parse.y" 2926{ 2927 yyval.node = yyvsp[0].node; 2928 ; 2929 break;} 2930case 59: 2931#line 683 "./parse.y" 2932{ create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; 2933 break;} 2934case 60: 2935#line 685 "./parse.y" 2936{ 2937 yyval.node = yyvsp[0].node; 2938 ; 2939 break;} 2940case 61: 2941#line 689 "./parse.y" 2942{yyerror ("Missing class name"); RECOVER;; 2943 break;} 2944case 62: 2945#line 691 "./parse.y" 2946{yyerror ("Missing class name"); RECOVER;; 2947 break;} 2948case 63: 2949#line 693 "./parse.y" 2950{ 2951 if (!ctxp->class_err) yyerror ("'{' expected"); 2952 DRECOVER(class1); 2953 ; 2954 break;} 2955case 64: 2956#line 698 "./parse.y" 2957{if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;; 2958 break;} 2959case 65: 2960#line 702 "./parse.y" 2961{ yyval.node = NULL; ; 2962 break;} 2963case 66: 2964#line 704 "./parse.y" 2965{ yyval.node = yyvsp[0].node; ; 2966 break;} 2967case 67: 2968#line 706 "./parse.y" 2969{yyerror ("'{' expected"); ctxp->class_err=1;; 2970 break;} 2971case 68: 2972#line 708 "./parse.y" 2973{yyerror ("Missing super class name"); ctxp->class_err=1;; 2974 break;} 2975case 69: 2976#line 712 "./parse.y" 2977{ yyval.node = NULL_TREE; ; 2978 break;} 2979case 70: 2980#line 714 "./parse.y" 2981{ yyval.node = yyvsp[0].node; ; 2982 break;} 2983case 71: 2984#line 716 "./parse.y" 2985{ 2986 ctxp->class_err=1; 2987 yyerror ("Missing interface name"); 2988 ; 2989 break;} 2990case 72: 2991#line 724 "./parse.y" 2992{ 2993 ctxp->interface_number = 1; 2994 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); 2995 ; 2996 break;} 2997case 73: 2998#line 729 "./parse.y" 2999{ 3000 ctxp->interface_number++; 3001 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE)); 3002 ; 3003 break;} 3004case 74: 3005#line 734 "./parse.y" 3006{yyerror ("Missing interface name"); RECOVER;; 3007 break;} 3008case 75: 3009#line 739 "./parse.y" 3010{ 3011 /* Store the location of the `}' when doing xrefs */ 3012 if (flag_emit_xref) 3013 DECL_END_SOURCE_LINE (ctxp->current_parsed_class) = 3014 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1); 3015 yyval.node = ctxp->current_parsed_class; 3016 ; 3017 break;} 3018case 76: 3019#line 747 "./parse.y" 3020{ 3021 /* Store the location of the `}' when doing xrefs */ 3022 if (flag_emit_xref) 3023 DECL_END_SOURCE_LINE (ctxp->current_parsed_class) = 3024 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1); 3025 yyval.node = ctxp->current_parsed_class; 3026 ; 3027 break;} 3028case 82: 3029#line 766 "./parse.y" 3030{ yyval.node = parse_jdk1_1_error ("instance initializer"); ; 3031 break;} 3032case 84: 3033#line 772 "./parse.y" 3034{ yyval.node = yyvsp[-1].node; ; 3035 break;} 3036case 86: 3037#line 775 "./parse.y" 3038{ yyval.node = parse_jdk1_1_error ("inner classe declaration"); ; 3039 break;} 3040case 87: 3041#line 777 "./parse.y" 3042{ yyval.node = parse_jdk1_1_error ("inner interface declaration"); ; 3043 break;} 3044case 88: 3045#line 783 "./parse.y" 3046{ register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ; 3047 break;} 3048case 89: 3049#line 785 "./parse.y" 3050{ 3051 check_modifiers 3052 ("Illegal modifier `%s' for field declaration", 3053 yyvsp[-3].value, FIELD_MODIFIERS); 3054 check_modifiers_consistency (yyvsp[-3].value); 3055 register_fields (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node); 3056 ; 3057 break;} 3058case 91: 3059#line 798 "./parse.y" 3060{ yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ; 3061 break;} 3062case 92: 3063#line 800 "./parse.y" 3064{yyerror ("Missing term"); RECOVER;; 3065 break;} 3066case 93: 3067#line 805 "./parse.y" 3068{ yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ; 3069 break;} 3070case 94: 3071#line 807 "./parse.y" 3072{ 3073 if (java_error_count) 3074 yyvsp[0].node = NULL_TREE; 3075 yyval.node = build_tree_list 3076 (yyvsp[-2].node, build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node)); 3077 ; 3078 break;} 3079case 95: 3080#line 814 "./parse.y" 3081{ 3082 yyerror ("Missing variable initializer"); 3083 yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE); 3084 RECOVER; 3085 ; 3086 break;} 3087case 96: 3088#line 820 "./parse.y" 3089{ 3090 yyerror ("';' expected"); 3091 yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE); 3092 RECOVER; 3093 ; 3094 break;} 3095case 98: 3096#line 830 "./parse.y" 3097{ yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; 3098 break;} 3099case 99: 3100#line 832 "./parse.y" 3101{yyerror ("Invalid declaration"); DRECOVER(vdi);; 3102 break;} 3103case 100: 3104#line 834 "./parse.y" 3105{yyerror ("']' expected"); DRECOVER(vdi);; 3106 break;} 3107case 101: 3108#line 836 "./parse.y" 3109{yyerror ("Unbalanced ']'"); DRECOVER(vdi);; 3110 break;} 3111case 104: 3112#line 847 "./parse.y" 3113{ 3114 current_function_decl = yyvsp[0].node; 3115 source_start_java_method (current_function_decl); 3116 ; 3117 break;} 3118case 105: 3119#line 852 "./parse.y" 3120{ finish_method_declaration (yyvsp[0].node); ; 3121 break;} 3122case 106: 3123#line 854 "./parse.y" 3124{YYNOT_TWICE yyerror ("'{' expected"); RECOVER;; 3125 break;} 3126case 107: 3127#line 859 "./parse.y" 3128{ yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; 3129 break;} 3130case 108: 3131#line 861 "./parse.y" 3132{ yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ; 3133 break;} 3134case 109: 3135#line 863 "./parse.y" 3136{ yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; 3137 break;} 3138case 110: 3139#line 865 "./parse.y" 3140{ yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ; 3141 break;} 3142case 111: 3143#line 867 "./parse.y" 3144{RECOVER;; 3145 break;} 3146case 112: 3147#line 869 "./parse.y" 3148{RECOVER;; 3149 break;} 3150case 113: 3151#line 871 "./parse.y" 3152{yyerror ("Identifier expected"); RECOVER;; 3153 break;} 3154case 114: 3155#line 873 "./parse.y" 3156{yyerror ("Identifier expected"); RECOVER;; 3157 break;} 3158case 115: 3159#line 875 "./parse.y" 3160{ 3161 yyerror ("Invalid method declaration, return type required"); 3162 RECOVER; 3163 ; 3164 break;} 3165case 116: 3166#line 883 "./parse.y" 3167{ yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ; 3168 break;} 3169case 117: 3170#line 885 "./parse.y" 3171{ yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ; 3172 break;} 3173case 118: 3174#line 887 "./parse.y" 3175{ 3176 EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location; 3177 TREE_PURPOSE (yyvsp[-2].node) = 3178 build_unresolved_array_type (TREE_PURPOSE (yyvsp[-2].node)); 3179 parse_warning_context 3180 (wfl_operator, 3181 "Discouraged form of returned type specification"); 3182 ; 3183 break;} 3184case 119: 3185#line 896 "./parse.y" 3186{yyerror ("')' expected"); DRECOVER(method_declarator);; 3187 break;} 3188case 120: 3189#line 898 "./parse.y" 3190{yyerror ("']' expected"); RECOVER;; 3191 break;} 3192case 121: 3193#line 903 "./parse.y" 3194{ 3195 ctxp->formal_parameter_number = 1; 3196 ; 3197 break;} 3198case 122: 3199#line 907 "./parse.y" 3200{ 3201 ctxp->formal_parameter_number += 1; 3202 yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); 3203 ; 3204 break;} 3205case 123: 3206#line 912 "./parse.y" 3207{yyerror ("Missing formal parameter term"); RECOVER;; 3208 break;} 3209case 124: 3210#line 917 "./parse.y" 3211{ 3212 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node); 3213 ; 3214 break;} 3215case 125: 3216#line 921 "./parse.y" 3217{ 3218 parse_jdk1_1_error ("final parameters"); 3219 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node); 3220 ; 3221 break;} 3222case 126: 3223#line 926 "./parse.y" 3224{yyerror ("Missing identifier"); RECOVER;; 3225 break;} 3226case 127: 3227#line 928 "./parse.y" 3228{ 3229 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value)); 3230 yyerror ("Missing identifier"); RECOVER; 3231 ; 3232 break;} 3233case 128: 3234#line 935 "./parse.y" 3235{ yyval.node = NULL_TREE; ; 3236 break;} 3237case 129: 3238#line 937 "./parse.y" 3239{ yyval.node = yyvsp[0].node; ; 3240 break;} 3241case 130: 3242#line 939 "./parse.y" 3243{yyerror ("Missing class type term"); RECOVER;; 3244 break;} 3245case 131: 3246#line 944 "./parse.y" 3247{ yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ; 3248 break;} 3249case 132: 3250#line 946 "./parse.y" 3251{ yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ; 3252 break;} 3253case 133: 3254#line 948 "./parse.y" 3255{yyerror ("Missing class type term"); RECOVER;; 3256 break;} 3257case 136: 3258#line 955 "./parse.y" 3259{ yyval.node = NULL_TREE; ; 3260 break;} 3261case 137: 3262#line 961 "./parse.y" 3263{ 3264 TREE_CHAIN (yyvsp[0].node) = ctxp->static_initialized; 3265 ctxp->static_initialized = yyvsp[0].node; 3266 ; 3267 break;} 3268case 138: 3269#line 966 "./parse.y" 3270{ 3271 TREE_CHAIN (yyvsp[-1].node) = ctxp->static_initialized; 3272 ctxp->static_initialized = yyvsp[-1].node; 3273 ; 3274 break;} 3275case 139: 3276#line 974 "./parse.y" 3277{ 3278 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value)); 3279 ; 3280 break;} 3281case 140: 3282#line 982 "./parse.y" 3283{ 3284 current_function_decl = yyvsp[0].node; 3285 source_start_java_method (current_function_decl); 3286 ; 3287 break;} 3288case 141: 3289#line 987 "./parse.y" 3290{ finish_method_declaration (yyvsp[0].node); ; 3291 break;} 3292case 142: 3293#line 992 "./parse.y" 3294{ yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ; 3295 break;} 3296case 143: 3297#line 994 "./parse.y" 3298{ yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ; 3299 break;} 3300case 144: 3301#line 999 "./parse.y" 3302{ yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ; 3303 break;} 3304case 145: 3305#line 1001 "./parse.y" 3306{ yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ; 3307 break;} 3308case 146: 3309#line 1009 "./parse.y" 3310{ 3311 BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node; 3312 yyval.node = yyvsp[0].node; 3313 ; 3314 break;} 3315case 147: 3316#line 1014 "./parse.y" 3317{ yyval.node = yyvsp[0].node; ; 3318 break;} 3319case 148: 3320#line 1016 "./parse.y" 3321{ yyval.node = yyvsp[0].node; ; 3322 break;} 3323case 149: 3324#line 1018 "./parse.y" 3325{ yyval.node = yyvsp[0].node; ; 3326 break;} 3327case 152: 3328#line 1028 "./parse.y" 3329{ 3330 yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE); 3331 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node); 3332 yyval.node = java_method_add_stmt (current_function_decl, yyval.node); 3333 ; 3334 break;} 3335case 153: 3336#line 1034 "./parse.y" 3337{ 3338 yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node); 3339 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node); 3340 yyval.node = java_method_add_stmt (current_function_decl, yyval.node); 3341 ; 3342 break;} 3343case 154: 3344#line 1042 "./parse.y" 3345{yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ; 3346 break;} 3347case 155: 3348#line 1044 "./parse.y" 3349{yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ; 3350 break;} 3351case 156: 3352#line 1049 "./parse.y" 3353{ 3354 tree wfl = build_wfl_node (this_identifier_node); 3355 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location; 3356 yyval.node = wfl; 3357 ; 3358 break;} 3359case 157: 3360#line 1055 "./parse.y" 3361{ 3362 tree wfl = build_wfl_node (super_identifier_node); 3363 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location; 3364 yyval.node = wfl; 3365 ; 3366 break;} 3367case 158: 3368#line 1066 "./parse.y" 3369{ create_interface (0, yyvsp[0].node, NULL_TREE); ; 3370 break;} 3371case 159: 3372#line 1068 "./parse.y" 3373{ 3374 yyval.node = yyvsp[0].node; 3375 ; 3376 break;} 3377case 160: 3378#line 1072 "./parse.y" 3379{ create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ; 3380 break;} 3381case 161: 3382#line 1074 "./parse.y" 3383{ 3384 yyval.node = yyvsp[0].node; 3385 ; 3386 break;} 3387case 162: 3388#line 1078 "./parse.y" 3389{ create_interface (0, yyvsp[-1].node, yyvsp[0].node); ; 3390 break;} 3391case 163: 3392#line 1080 "./parse.y" 3393{ 3394 yyval.node = yyvsp[0].node; 3395 ; 3396 break;} 3397case 164: 3398#line 1084 "./parse.y" 3399{ create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ; 3400 break;} 3401case 165: 3402#line 1086 "./parse.y" 3403{ 3404 yyval.node = yyvsp[0].node; 3405 ; 3406 break;} 3407case 166: 3408#line 1090 "./parse.y" 3409{yyerror ("'{' expected"); RECOVER;; 3410 break;} 3411case 167: 3412#line 1092 "./parse.y" 3413{yyerror ("'{' expected"); RECOVER;; 3414 break;} 3415case 168: 3416#line 1097 "./parse.y" 3417{ 3418 ctxp->interface_number = 1; 3419 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); 3420 ; 3421 break;} 3422case 169: 3423#line 1102 "./parse.y" 3424{ 3425 ctxp->interface_number++; 3426 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE)); 3427 ; 3428 break;} 3429case 170: 3430#line 1107 "./parse.y" 3431{yyerror ("Invalid interface type"); RECOVER;; 3432 break;} 3433case 171: 3434#line 1109 "./parse.y" 3435{yyerror ("Missing term"); RECOVER;; 3436 break;} 3437case 172: 3438#line 1114 "./parse.y" 3439{ yyval.node = NULL_TREE; ; 3440 break;} 3441case 173: 3442#line 1116 "./parse.y" 3443{ yyval.node = NULL_TREE; ; 3444 break;} 3445case 178: 3446#line 1128 "./parse.y" 3447{ yyval.node = parse_jdk1_1_error ("inner class declaration"); ; 3448 break;} 3449case 179: 3450#line 1130 "./parse.y" 3451{ yyval.node = parse_jdk1_1_error ("inner interface declaration"); ; 3452 break;} 3453case 181: 3454#line 1139 "./parse.y" 3455{ 3456 check_abstract_method_header (yyvsp[-1].node); 3457 current_function_decl = NULL_TREE; /* FIXME ? */ 3458 ; 3459 break;} 3460case 182: 3461#line 1144 "./parse.y" 3462{yyerror ("';' expected"); RECOVER;; 3463 break;} 3464case 183: 3465#line 1150 "./parse.y" 3466{ yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ; 3467 break;} 3468case 184: 3469#line 1152 "./parse.y" 3470{ yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ; 3471 break;} 3472case 185: 3473#line 1154 "./parse.y" 3474{ yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ; 3475 break;} 3476case 186: 3477#line 1159 "./parse.y" 3478{ 3479 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), 3480 yyvsp[0].node, NULL_TREE); 3481 ; 3482 break;} 3483case 187: 3484#line 1164 "./parse.y" 3485{ 3486 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node); 3487 ; 3488 break;} 3489case 188: 3490#line 1168 "./parse.y" 3491{yyerror ("Missing term"); RECOVER;; 3492 break;} 3493case 189: 3494#line 1174 "./parse.y" 3495{ 3496 /* Store the location of the `}' when doing xrefs */ 3497 if (current_function_decl && flag_emit_xref) 3498 DECL_END_SOURCE_LINE (current_function_decl) = 3499 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1); 3500 yyval.node = empty_stmt_node; 3501 ; 3502 break;} 3503case 190: 3504#line 1182 "./parse.y" 3505{ yyval.node = yyvsp[0].node; ; 3506 break;} 3507case 191: 3508#line 1187 "./parse.y" 3509{ enter_block (); ; 3510 break;} 3511case 192: 3512#line 1192 "./parse.y" 3513{ 3514 maybe_absorb_scoping_blocks (); 3515 /* Store the location of the `}' when doing xrefs */ 3516 if (current_function_decl && flag_emit_xref) 3517 DECL_END_SOURCE_LINE (current_function_decl) = 3518 EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1); 3519 yyval.node = exit_block (); 3520 ; 3521 break;} 3522case 196: 3523#line 1210 "./parse.y" 3524{ java_method_add_stmt (current_function_decl, yyvsp[0].node); ; 3525 break;} 3526case 197: 3527#line 1212 "./parse.y" 3528{ parse_jdk1_1_error ("inner class declaration"); ; 3529 break;} 3530case 199: 3531#line 1221 "./parse.y" 3532{ declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ; 3533 break;} 3534case 200: 3535#line 1223 "./parse.y" 3536{ declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ; 3537 break;} 3538case 206: 3539#line 1233 "./parse.y" 3540{ yyval.node = exit_block (); ; 3541 break;} 3542case 211: 3543#line 1242 "./parse.y" 3544{ yyval.node = exit_block (); ; 3545 break;} 3546case 223: 3547#line 1261 "./parse.y" 3548{ yyval.node = empty_stmt_node; ; 3549 break;} 3550case 224: 3551#line 1266 "./parse.y" 3552{ 3553 yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node), 3554 EXPR_WFL_NODE (yyvsp[-1].node)); 3555 pushlevel (2); 3556 push_labeled_block (yyval.node); 3557 PUSH_LABELED_BLOCK (yyval.node); 3558 ; 3559 break;} 3560case 225: 3561#line 1277 "./parse.y" 3562{ yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ; 3563 break;} 3564case 226: 3565#line 1279 "./parse.y" 3566{yyerror ("':' expected"); RECOVER;; 3567 break;} 3568case 227: 3569#line 1284 "./parse.y" 3570{ yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ; 3571 break;} 3572case 228: 3573#line 1291 "./parse.y" 3574{ 3575 /* We have a statement. Generate a WFL around it so 3576 we can debug it */ 3577 yyval.node = build_expr_wfl (yyvsp[-1].node, input_filename, lineno, 0); 3578 /* We know we have a statement, so set the debug 3579 info to be eventually generate here. */ 3580 yyval.node = JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval.node); 3581 ; 3582 break;} 3583case 229: 3584#line 1300 "./parse.y" 3585{ 3586 if (ctxp->prevent_ese != lineno) 3587 yyerror ("Invalid expression statement"); 3588 DRECOVER (expr_stmt); 3589 ; 3590 break;} 3591case 230: 3592#line 1306 "./parse.y" 3593{ 3594 if (ctxp->prevent_ese != lineno) 3595 yyerror ("Invalid expression statement"); 3596 DRECOVER (expr_stmt); 3597 ; 3598 break;} 3599case 231: 3600#line 1312 "./parse.y" 3601{ 3602 if (ctxp->prevent_ese != lineno) 3603 yyerror ("Invalid expression statement"); 3604 DRECOVER (expr_stmt); 3605 ; 3606 break;} 3607case 232: 3608#line 1318 "./parse.y" 3609{yyerror ("')' expected"); RECOVER;; 3610 break;} 3611case 233: 3612#line 1320 "./parse.y" 3613{ 3614 yyerror ("Constructor invocation must be first " 3615 "thing in a constructor"); 3616 RECOVER; 3617 ; 3618 break;} 3619case 234: 3620#line 1326 "./parse.y" 3621{yyerror ("')' expected"); RECOVER;; 3622 break;} 3623case 235: 3624#line 1328 "./parse.y" 3625{ 3626 yyerror ("Constructor invocation must be first " 3627 "thing in a constructor"); 3628 RECOVER; 3629 ; 3630 break;} 3631case 236: 3632#line 1334 "./parse.y" 3633{yyerror ("'(' expected"); RECOVER;; 3634 break;} 3635case 237: 3636#line 1336 "./parse.y" 3637{yyerror ("')' expected"); RECOVER;; 3638 break;} 3639case 238: 3640#line 1338 "./parse.y" 3641{yyerror ("')' expected"); RECOVER;; 3642 break;} 3643case 239: 3644#line 1340 "./parse.y" 3645{yyerror ("';' expected"); RECOVER;; 3646 break;} 3647case 240: 3648#line 1342 "./parse.y" 3649{yyerror ("';' expected"); RECOVER;; 3650 break;} 3651case 248: 3652#line 1357 "./parse.y" 3653{ 3654 yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node, 3655 yyvsp[0].node, NULL_TREE); 3656 ; 3657 break;} 3658case 249: 3659#line 1362 "./parse.y" 3660{yyerror ("'(' expected"); RECOVER;; 3661 break;} 3662case 250: 3663#line 1364 "./parse.y" 3664{yyerror ("Missing term"); RECOVER;; 3665 break;} 3666case 251: 3667#line 1366 "./parse.y" 3668{yyerror ("')' expected"); RECOVER;; 3669 break;} 3670case 252: 3671#line 1371 "./parse.y" 3672{ yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; 3673 break;} 3674case 253: 3675#line 1376 "./parse.y" 3676{ yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; 3677 break;} 3678case 254: 3679#line 1381 "./parse.y" 3680{ 3681 enter_block (); 3682 ; 3683 break;} 3684case 255: 3685#line 1385 "./parse.y" 3686{ 3687 /* Make into "proper list" of COMPOUND_EXPRs. 3688 I.e. make the last statment also have its own 3689 COMPOUND_EXPR. */ 3690 maybe_absorb_scoping_blocks (); 3691 TREE_OPERAND (yyvsp[-2].node, 1) = exit_block (); 3692 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-2].node), yyvsp[-2].node); 3693 ; 3694 break;} 3695case 256: 3696#line 1397 "./parse.y" 3697{ 3698 yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE); 3699 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location; 3700 ; 3701 break;} 3702case 257: 3703#line 1402 "./parse.y" 3704{yyerror ("'(' expected"); RECOVER;; 3705 break;} 3706case 258: 3707#line 1404 "./parse.y" 3708{yyerror ("Missing term or ')'"); DRECOVER(switch_statement);; 3709 break;} 3710case 259: 3711#line 1406 "./parse.y" 3712{yyerror ("'{' expected"); RECOVER;; 3713 break;} 3714case 260: 3715#line 1414 "./parse.y" 3716{ yyval.node = NULL_TREE; ; 3717 break;} 3718case 261: 3719#line 1416 "./parse.y" 3720{ yyval.node = NULL_TREE; ; 3721 break;} 3722case 262: 3723#line 1418 "./parse.y" 3724{ yyval.node = NULL_TREE; ; 3725 break;} 3726case 263: 3727#line 1420 "./parse.y" 3728{ yyval.node = NULL_TREE; ; 3729 break;} 3730case 269: 3731#line 1439 "./parse.y" 3732{ 3733 tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node); 3734 EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location; 3735 java_method_add_stmt (current_function_decl, lab); 3736 ; 3737 break;} 3738case 270: 3739#line 1445 "./parse.y" 3740{ 3741 tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE); 3742 EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location; 3743 java_method_add_stmt (current_function_decl, lab); 3744 ; 3745 break;} 3746case 271: 3747#line 1451 "./parse.y" 3748{yyerror ("Missing or invalid constant expression"); RECOVER;; 3749 break;} 3750case 272: 3751#line 1453 "./parse.y" 3752{yyerror ("':' expected"); RECOVER;; 3753 break;} 3754case 273: 3755#line 1455 "./parse.y" 3756{yyerror ("':' expected"); RECOVER;; 3757 break;} 3758case 274: 3759#line 1460 "./parse.y" 3760{ 3761 tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0); 3762 yyval.node = build_new_loop (body); 3763 ; 3764 break;} 3765case 275: 3766#line 1468 "./parse.y" 3767{ yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ; 3768 break;} 3769case 276: 3770#line 1470 "./parse.y" 3771{YYERROR_NOW; yyerror ("'(' expected"); RECOVER;; 3772 break;} 3773case 277: 3774#line 1472 "./parse.y" 3775{yyerror ("Missing term and ')' expected"); RECOVER;; 3776 break;} 3777case 278: 3778#line 1474 "./parse.y" 3779{yyerror ("')' expected"); RECOVER;; 3780 break;} 3781case 279: 3782#line 1479 "./parse.y" 3783{ yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ; 3784 break;} 3785case 280: 3786#line 1484 "./parse.y" 3787{ 3788 tree body = build_loop_body (0, NULL_TREE, 1); 3789 yyval.node = build_new_loop (body); 3790 ; 3791 break;} 3792case 281: 3793#line 1493 "./parse.y" 3794{ yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ; 3795 break;} 3796case 282: 3797#line 1498 "./parse.y" 3798{ yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; 3799 break;} 3800case 283: 3801#line 1500 "./parse.y" 3802{ 3803 yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); 3804 /* We have not condition, so we get rid of the EXIT_EXPR */ 3805 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) = 3806 empty_stmt_node; 3807 ; 3808 break;} 3809case 284: 3810#line 1507 "./parse.y" 3811{yyerror ("Invalid control expression"); RECOVER;; 3812 break;} 3813case 285: 3814#line 1509 "./parse.y" 3815{yyerror ("Invalid update expression"); RECOVER;; 3816 break;} 3817case 286: 3818#line 1511 "./parse.y" 3819{yyerror ("Invalid update expression"); RECOVER;; 3820 break;} 3821case 287: 3822#line 1516 "./parse.y" 3823{ yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);; 3824 break;} 3825case 288: 3826#line 1518 "./parse.y" 3827{ 3828 yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); 3829 /* We have not condition, so we get rid of the EXIT_EXPR */ 3830 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) = 3831 empty_stmt_node; 3832 ; 3833 break;} 3834case 289: 3835#line 1528 "./parse.y" 3836{ 3837 /* This scope defined for local variable that may be 3838 defined within the scope of the for loop */ 3839 enter_block (); 3840 ; 3841 break;} 3842case 290: 3843#line 1534 "./parse.y" 3844{yyerror ("'(' expected"); DRECOVER(for_1);; 3845 break;} 3846case 291: 3847#line 1536 "./parse.y" 3848{yyerror ("Invalid init statement"); RECOVER;; 3849 break;} 3850case 292: 3851#line 1541 "./parse.y" 3852{ 3853 /* We now declare the loop body. The loop is 3854 declared as a for loop. */ 3855 tree body = build_loop_body (0, NULL_TREE, 0); 3856 yyval.node = build_new_loop (body); 3857 IS_FOR_LOOP_P (yyval.node) = 1; 3858 /* The loop is added to the current block the for 3859 statement is defined within */ 3860 java_method_add_stmt (current_function_decl, yyval.node); 3861 ; 3862 break;} 3863case 293: 3864#line 1553 "./parse.y" 3865{ yyval.node = empty_stmt_node; ; 3866 break;} 3867case 294: 3868#line 1555 "./parse.y" 3869{ 3870 /* Init statement recorded within the previously 3871 defined block scope */ 3872 yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node); 3873 ; 3874 break;} 3875case 295: 3876#line 1561 "./parse.y" 3877{ 3878 /* Local variable are recorded within the previously 3879 defined block scope */ 3880 yyval.node = NULL_TREE; 3881 ; 3882 break;} 3883case 296: 3884#line 1567 "./parse.y" 3885{yyerror ("';' expected"); DRECOVER(for_init_1);; 3886 break;} 3887case 297: 3888#line 1571 "./parse.y" 3889{yyval.node = empty_stmt_node;; 3890 break;} 3891case 298: 3892#line 1573 "./parse.y" 3893{ yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ; 3894 break;} 3895case 299: 3896#line 1578 "./parse.y" 3897{ yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ; 3898 break;} 3899case 300: 3900#line 1580 "./parse.y" 3901{ yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ; 3902 break;} 3903case 301: 3904#line 1582 "./parse.y" 3905{yyerror ("Missing term"); RECOVER;; 3906 break;} 3907case 302: 3908#line 1587 "./parse.y" 3909{ yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ; 3910 break;} 3911case 303: 3912#line 1589 "./parse.y" 3913{ yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ; 3914 break;} 3915case 304: 3916#line 1591 "./parse.y" 3917{yyerror ("Missing term"); RECOVER;; 3918 break;} 3919case 305: 3920#line 1593 "./parse.y" 3921{yyerror ("';' expected"); RECOVER;; 3922 break;} 3923case 306: 3924#line 1598 "./parse.y" 3925{ yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ; 3926 break;} 3927case 307: 3928#line 1600 "./parse.y" 3929{ yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ; 3930 break;} 3931case 308: 3932#line 1602 "./parse.y" 3933{yyerror ("Missing term"); RECOVER;; 3934 break;} 3935case 309: 3936#line 1604 "./parse.y" 3937{yyerror ("';' expected"); RECOVER;; 3938 break;} 3939case 310: 3940#line 1609 "./parse.y" 3941{ yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ; 3942 break;} 3943case 311: 3944#line 1611 "./parse.y" 3945{ yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ; 3946 break;} 3947case 312: 3948#line 1613 "./parse.y" 3949{yyerror ("Missing term"); RECOVER;; 3950 break;} 3951case 313: 3952#line 1615 "./parse.y" 3953{yyerror ("';' expected"); RECOVER;; 3954 break;} 3955case 314: 3956#line 1620 "./parse.y" 3957{ 3958 yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node); 3959 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location; 3960 ; 3961 break;} 3962case 315: 3963#line 1625 "./parse.y" 3964{yyerror ("Missing term"); RECOVER;; 3965 break;} 3966case 316: 3967#line 1627 "./parse.y" 3968{yyerror ("';' expected"); RECOVER;; 3969 break;} 3970case 317: 3971#line 1632 "./parse.y" 3972{ 3973 yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); 3974 EXPR_WFL_LINECOL (yyval.node) = 3975 EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK)); 3976 ; 3977 break;} 3978case 318: 3979#line 1638 "./parse.y" 3980{yyerror ("'{' expected"); RECOVER;; 3981 break;} 3982case 319: 3983#line 1640 "./parse.y" 3984{yyerror ("'(' expected"); RECOVER;; 3985 break;} 3986case 320: 3987#line 1642 "./parse.y" 3988{yyerror ("Missing term"); RECOVER;; 3989 break;} 3990case 321: 3991#line 1644 "./parse.y" 3992{yyerror ("Missing term"); RECOVER;; 3993 break;} 3994case 322: 3995#line 1649 "./parse.y" 3996{ 3997 if ((1 << yyvsp[0].value) != ACC_SYNCHRONIZED) 3998 fatal ("synchronized was '%d' - yyparse", (1 << yyvsp[0].value)); 3999 ; 4000 break;} 4001case 323: 4002#line 1657 "./parse.y" 4003{ yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ; 4004 break;} 4005case 324: 4006#line 1659 "./parse.y" 4007{ yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ; 4008 break;} 4009case 325: 4010#line 1661 "./parse.y" 4011{ yyval.node = build_try_finally_statement 4012 (yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location, 4013 yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node); 4014 ; 4015 break;} 4016case 326: 4017#line 1666 "./parse.y" 4018{yyerror ("'{' expected"); DRECOVER (try_statement);; 4019 break;} 4020case 328: 4021#line 1672 "./parse.y" 4022{ 4023 TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node; 4024 yyval.node = yyvsp[0].node; 4025 ; 4026 break;} 4027case 329: 4028#line 1680 "./parse.y" 4029{ 4030 java_method_add_stmt (current_function_decl, yyvsp[0].node); 4031 exit_block (); 4032 yyval.node = yyvsp[-1].node; 4033 ; 4034 break;} 4035case 330: 4036#line 1688 "./parse.y" 4037{ 4038 /* We add a block to define a scope for 4039 formal_parameter (CCBP). The formal parameter is 4040 declared initialized by the appropriate function 4041 call */ 4042 tree ccpb = enter_block (); 4043 tree init = build_assignment (ASSIGN_TK, yyvsp[-2].operator.location, 4044 TREE_PURPOSE (yyvsp[-1].node), 4045 soft_exceptioninfo_call_node); 4046 declare_local_variables (0, TREE_VALUE (yyvsp[-1].node), 4047 build_tree_list (TREE_PURPOSE (yyvsp[-1].node), 4048 init)); 4049 yyval.node = build1 (CATCH_EXPR, NULL_TREE, ccpb); 4050 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location; 4051 ; 4052 break;} 4053case 331: 4054#line 1704 "./parse.y" 4055{yyerror ("'(' expected"); RECOVER;; 4056 break;} 4057case 332: 4058#line 1706 "./parse.y" 4059{yyerror ("Missing term or ')' expected"); DRECOVER (2);; 4060 break;} 4061case 333: 4062#line 1708 "./parse.y" 4063{yyerror ("')' expected"); DRECOVER (1);; 4064 break;} 4065case 334: 4066#line 1713 "./parse.y" 4067{ yyval.node = yyvsp[0].node; ; 4068 break;} 4069case 335: 4070#line 1715 "./parse.y" 4071{yyerror ("'{' expected"); RECOVER; ; 4072 break;} 4073case 339: 4074#line 1727 "./parse.y" 4075{ yyval.node = build_this (yyvsp[0].operator.location); ; 4076 break;} 4077case 340: 4078#line 1729 "./parse.y" 4079{yyval.node = yyvsp[-1].node;; 4080 break;} 4081case 345: 4082#line 1738 "./parse.y" 4083{ yyval.node = parse_jdk1_1_error ("named class literals"); ; 4084 break;} 4085case 346: 4086#line 1740 "./parse.y" 4087{ yyval.node = build_class_ref (yyvsp[-2].node); ; 4088 break;} 4089case 347: 4090#line 1742 "./parse.y" 4091{ yyval.node = build_class_ref (void_type_node); ; 4092 break;} 4093case 348: 4094#line 1747 "./parse.y" 4095{ yyval.node = parse_jdk1_1_error ("class literals"); ; 4096 break;} 4097case 349: 4098#line 1749 "./parse.y" 4099{yyerror ("')' expected"); RECOVER;; 4100 break;} 4101case 350: 4102#line 1751 "./parse.y" 4103{yyerror ("'class' or 'this' expected" ); RECOVER;; 4104 break;} 4105case 351: 4106#line 1753 "./parse.y" 4107{yyerror ("'class' expected" ); RECOVER;; 4108 break;} 4109case 352: 4110#line 1755 "./parse.y" 4111{yyerror ("'class' expected" ); RECOVER;; 4112 break;} 4113case 353: 4114#line 1760 "./parse.y" 4115{ yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ; 4116 break;} 4117case 354: 4118#line 1762 "./parse.y" 4119{ yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ; 4120 break;} 4121case 355: 4122#line 1767 "./parse.y" 4123{ yyval.node = parse_jdk1_1_error ("inner class instance creation"); ; 4124 break;} 4125case 356: 4126#line 1769 "./parse.y" 4127{ yyval.node = parse_jdk1_1_error ("inner class instance creation"); ; 4128 break;} 4129case 361: 4130#line 1778 "./parse.y" 4131{yyerror ("'(' expected"); DRECOVER(new_1);; 4132 break;} 4133case 362: 4134#line 1780 "./parse.y" 4135{yyerror ("'(' expected"); RECOVER;; 4136 break;} 4137case 363: 4138#line 1782 "./parse.y" 4139{yyerror ("')' or term expected"); RECOVER;; 4140 break;} 4141case 364: 4142#line 1784 "./parse.y" 4143{yyerror ("')' expected"); RECOVER;; 4144 break;} 4145case 365: 4146#line 1786 "./parse.y" 4147{YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;; 4148 break;} 4149case 366: 4150#line 1788 "./parse.y" 4151{yyerror ("'(' expected"); RECOVER;; 4152 break;} 4153case 369: 4154#line 1798 "./parse.y" 4155{ 4156 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE); 4157 ctxp->formal_parameter_number = 1; 4158 ; 4159 break;} 4160case 370: 4161#line 1803 "./parse.y" 4162{ 4163 ctxp->formal_parameter_number += 1; 4164 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node); 4165 ; 4166 break;} 4167case 371: 4168#line 1808 "./parse.y" 4169{yyerror ("Missing term"); RECOVER;; 4170 break;} 4171case 372: 4172#line 1813 "./parse.y" 4173{ yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ; 4174 break;} 4175case 373: 4176#line 1815 "./parse.y" 4177{ yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ; 4178 break;} 4179case 374: 4180#line 1817 "./parse.y" 4181{ yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));; 4182 break;} 4183case 375: 4184#line 1819 "./parse.y" 4185{ yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));; 4186 break;} 4187case 376: 4188#line 1823 "./parse.y" 4189{ yyval.node = parse_jdk1_1_error ("anonymous array"); ; 4190 break;} 4191case 377: 4192#line 1825 "./parse.y" 4193{ yyval.node = parse_jdk1_1_error ("anonymous array"); ; 4194 break;} 4195case 378: 4196#line 1827 "./parse.y" 4197{yyerror ("'[' expected"); DRECOVER ("]");; 4198 break;} 4199case 379: 4200#line 1829 "./parse.y" 4201{yyerror ("']' expected"); RECOVER;; 4202 break;} 4203case 380: 4204#line 1834 "./parse.y" 4205{ yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ; 4206 break;} 4207case 381: 4208#line 1836 "./parse.y" 4209{ yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ; 4210 break;} 4211case 382: 4212#line 1841 "./parse.y" 4213{ 4214 EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location; 4215 yyval.node = yyvsp[-1].node; 4216 ; 4217 break;} 4218case 383: 4219#line 1846 "./parse.y" 4220{yyerror ("']' expected"); RECOVER;; 4221 break;} 4222case 384: 4223#line 1848 "./parse.y" 4224{ 4225 yyerror ("Missing term"); 4226 yyerror ("']' expected"); 4227 RECOVER; 4228 ; 4229 break;} 4230case 385: 4231#line 1857 "./parse.y" 4232{ 4233 int allocate = 0; 4234 /* If not initialized, allocate memory for the osb 4235 numbers stack */ 4236 if (!ctxp->osb_limit) 4237 { 4238 allocate = ctxp->osb_limit = 32; 4239 ctxp->osb_depth = -1; 4240 } 4241 /* If capacity overflown, reallocate a bigger chuck */ 4242 else if (ctxp->osb_depth+1 == ctxp->osb_limit) 4243 allocate = ctxp->osb_limit << 1; 4244 4245 if (allocate) 4246 { 4247 allocate *= sizeof (int); 4248 if (ctxp->osb_number) 4249 ctxp->osb_number = (int *)xrealloc (ctxp->osb_number, 4250 allocate); 4251 else 4252 ctxp->osb_number = (int *)xmalloc (allocate); 4253 } 4254 ctxp->osb_depth++; 4255 CURRENT_OSB (ctxp) = 1; 4256 ; 4257 break;} 4258case 386: 4259#line 1883 "./parse.y" 4260{ CURRENT_OSB (ctxp)++; ; 4261 break;} 4262case 387: 4263#line 1885 "./parse.y" 4264{ yyerror ("']' expected"); RECOVER;; 4265 break;} 4266case 388: 4267#line 1890 "./parse.y" 4268{ yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ; 4269 break;} 4270case 389: 4271#line 1894 "./parse.y" 4272{ 4273 tree super_wfl = 4274 build_wfl_node (super_identifier_node); 4275 EXPR_WFL_LINECOL (super_wfl) = yyvsp[-2].operator.location; 4276 yyval.node = make_qualified_name (super_wfl, yyvsp[0].node, yyvsp[-1].operator.location); 4277 ; 4278 break;} 4279case 390: 4280#line 1901 "./parse.y" 4281{yyerror ("Field expected"); DRECOVER (super_field_acces);; 4282 break;} 4283case 391: 4284#line 1906 "./parse.y" 4285{ yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ; 4286 break;} 4287case 392: 4288#line 1908 "./parse.y" 4289{ yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ; 4290 break;} 4291case 393: 4292#line 1910 "./parse.y" 4293{ 4294 if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR) 4295 yyval.node = build_this_super_qualified_invocation 4296 (1, yyvsp[-2].node, NULL_TREE, 0, yyvsp[-3].operator.location); 4297 else 4298 { 4299 tree invok = build_method_invocation (yyvsp[-2].node, NULL_TREE); 4300 yyval.node = make_qualified_primary (yyvsp[-4].node, invok, yyvsp[-3].operator.location); 4301 } 4302 ; 4303 break;} 4304case 394: 4305#line 1921 "./parse.y" 4306{ 4307 if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR) 4308 yyval.node = build_this_super_qualified_invocation 4309 (1, yyvsp[-3].node, yyvsp[-1].node, 0, yyvsp[-4].operator.location); 4310 else 4311 { 4312 tree invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); 4313 yyval.node = make_qualified_primary (yyvsp[-5].node, invok, yyvsp[-4].operator.location); 4314 } 4315 ; 4316 break;} 4317case 395: 4318#line 1932 "./parse.y" 4319{ 4320 yyval.node = build_this_super_qualified_invocation 4321 (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location); 4322 ; 4323 break;} 4324case 396: 4325#line 1937 "./parse.y" 4326{ 4327 yyval.node = build_this_super_qualified_invocation 4328 (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location); 4329 ; 4330 break;} 4331case 397: 4332#line 1946 "./parse.y" 4333{ yyerror ("'(' expected"); DRECOVER (method_invocation); ; 4334 break;} 4335case 398: 4336#line 1948 "./parse.y" 4337{ yyerror ("'(' expected"); DRECOVER (method_invocation); ; 4338 break;} 4339case 399: 4340#line 1953 "./parse.y" 4341{ yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ; 4342 break;} 4343case 400: 4344#line 1955 "./parse.y" 4345{ yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ; 4346 break;} 4347case 401: 4348#line 1957 "./parse.y" 4349{ 4350 yyerror ("Missing term and ']' expected"); 4351 DRECOVER(array_access); 4352 ; 4353 break;} 4354case 402: 4355#line 1962 "./parse.y" 4356{ 4357 yyerror ("']' expected"); 4358 DRECOVER(array_access); 4359 ; 4360 break;} 4361case 403: 4362#line 1967 "./parse.y" 4363{ 4364 yyerror ("Missing term and ']' expected"); 4365 DRECOVER(array_access); 4366 ; 4367 break;} 4368case 404: 4369#line 1972 "./parse.y" 4370{ 4371 yyerror ("']' expected"); 4372 DRECOVER(array_access); 4373 ; 4374 break;} 4375case 409: 4376#line 1987 "./parse.y" 4377{ yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ; 4378 break;} 4379case 410: 4380#line 1992 "./parse.y" 4381{ yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ; 4382 break;} 4383case 413: 4384#line 1999 "./parse.y" 4385{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; 4386 break;} 4387case 414: 4388#line 2001 "./parse.y" 4389{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; 4390 break;} 4391case 416: 4392#line 2004 "./parse.y" 4393{yyerror ("Missing term"); RECOVER; 4394 break;} 4395case 417: 4396#line 2006 "./parse.y" 4397{yyerror ("Missing term"); RECOVER; 4398 break;} 4399case 418: 4400#line 2011 "./parse.y" 4401{yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ; 4402 break;} 4403case 419: 4404#line 2013 "./parse.y" 4405{yyerror ("Missing term"); RECOVER; 4406 break;} 4407case 420: 4408#line 2018 "./parse.y" 4409{yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ; 4410 break;} 4411case 421: 4412#line 2020 "./parse.y" 4413{yyerror ("Missing term"); RECOVER; 4414 break;} 4415case 423: 4416#line 2026 "./parse.y" 4417{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; 4418 break;} 4419case 424: 4420#line 2028 "./parse.y" 4421{yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; 4422 break;} 4423case 426: 4424#line 2031 "./parse.y" 4425{yyerror ("Missing term"); RECOVER; 4426 break;} 4427case 427: 4428#line 2033 "./parse.y" 4429{yyerror ("Missing term"); RECOVER; 4430 break;} 4431case 428: 4432#line 2038 "./parse.y" 4433{ 4434 tree type = yyvsp[-3].node; 4435 while (CURRENT_OSB (ctxp)--) 4436 type = build_java_array_type (type, -1); 4437 ctxp->osb_depth--; 4438 yyval.node = build_cast (yyvsp[-4].operator.location, type, yyvsp[0].node); 4439 ; 4440 break;} 4441case 429: 4442#line 2046 "./parse.y" 4443{ yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ; 4444 break;} 4445case 430: 4446#line 2048 "./parse.y" 4447{ yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ; 4448 break;} 4449case 431: 4450#line 2050 "./parse.y" 4451{ 4452 char *ptr; 4453 while (CURRENT_OSB (ctxp)--) 4454 obstack_1grow (&temporary_obstack, '['); 4455 ctxp->osb_depth--; 4456 obstack_grow0 (&temporary_obstack, 4457 IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp[-3].node)), 4458 IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp[-3].node))); 4459 ptr = obstack_finish (&temporary_obstack); 4460 EXPR_WFL_NODE (yyvsp[-3].node) = get_identifier (ptr); 4461 yyval.node = build_cast (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[0].node); 4462 ; 4463 break;} 4464case 432: 4465#line 2063 "./parse.y" 4466{yyerror ("']' expected, invalid type expression");; 4467 break;} 4468case 433: 4469#line 2065 "./parse.y" 4470{ 4471 if (ctxp->prevent_ese != lineno) 4472 yyerror ("Invalid type expression"); RECOVER; 4473 RECOVER; 4474 ; 4475 break;} 4476case 434: 4477#line 2071 "./parse.y" 4478{yyerror ("Missing term"); RECOVER;; 4479 break;} 4480case 435: 4481#line 2073 "./parse.y" 4482{yyerror ("Missing term"); RECOVER;; 4483 break;} 4484case 436: 4485#line 2075 "./parse.y" 4486{yyerror ("Missing term"); RECOVER;; 4487 break;} 4488case 438: 4489#line 2081 "./parse.y" 4490{ 4491 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), 4492 yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); 4493 ; 4494 break;} 4495case 439: 4496#line 2086 "./parse.y" 4497{ 4498 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4499 yyvsp[-2].node, yyvsp[0].node); 4500 ; 4501 break;} 4502case 440: 4503#line 2091 "./parse.y" 4504{ 4505 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4506 yyvsp[-2].node, yyvsp[0].node); 4507 ; 4508 break;} 4509case 441: 4510#line 2096 "./parse.y" 4511{yyerror ("Missing term"); RECOVER;; 4512 break;} 4513case 442: 4514#line 2098 "./parse.y" 4515{yyerror ("Missing term"); RECOVER;; 4516 break;} 4517case 443: 4518#line 2100 "./parse.y" 4519{yyerror ("Missing term"); RECOVER;; 4520 break;} 4521case 445: 4522#line 2106 "./parse.y" 4523{ 4524 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4525 yyvsp[-2].node, yyvsp[0].node); 4526 ; 4527 break;} 4528case 446: 4529#line 2111 "./parse.y" 4530{ 4531 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4532 yyvsp[-2].node, yyvsp[0].node); 4533 ; 4534 break;} 4535case 447: 4536#line 2116 "./parse.y" 4537{yyerror ("Missing term"); RECOVER;; 4538 break;} 4539case 448: 4540#line 2118 "./parse.y" 4541{yyerror ("Missing term"); RECOVER;; 4542 break;} 4543case 450: 4544#line 2124 "./parse.y" 4545{ 4546 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4547 yyvsp[-2].node, yyvsp[0].node); 4548 ; 4549 break;} 4550case 451: 4551#line 2129 "./parse.y" 4552{ 4553 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4554 yyvsp[-2].node, yyvsp[0].node); 4555 ; 4556 break;} 4557case 452: 4558#line 2134 "./parse.y" 4559{ 4560 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4561 yyvsp[-2].node, yyvsp[0].node); 4562 ; 4563 break;} 4564case 453: 4565#line 2139 "./parse.y" 4566{yyerror ("Missing term"); RECOVER;; 4567 break;} 4568case 454: 4569#line 2141 "./parse.y" 4570{yyerror ("Missing term"); RECOVER;; 4571 break;} 4572case 455: 4573#line 2143 "./parse.y" 4574{yyerror ("Missing term"); RECOVER;; 4575 break;} 4576case 457: 4577#line 2149 "./parse.y" 4578{ 4579 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4580 yyvsp[-2].node, yyvsp[0].node); 4581 ; 4582 break;} 4583case 458: 4584#line 2154 "./parse.y" 4585{ 4586 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4587 yyvsp[-2].node, yyvsp[0].node); 4588 ; 4589 break;} 4590case 459: 4591#line 2159 "./parse.y" 4592{ 4593 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4594 yyvsp[-2].node, yyvsp[0].node); 4595 ; 4596 break;} 4597case 460: 4598#line 2164 "./parse.y" 4599{ 4600 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4601 yyvsp[-2].node, yyvsp[0].node); 4602 ; 4603 break;} 4604case 461: 4605#line 2169 "./parse.y" 4606{ yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ; 4607 break;} 4608case 462: 4609#line 2171 "./parse.y" 4610{yyerror ("Missing term"); RECOVER;; 4611 break;} 4612case 463: 4613#line 2173 "./parse.y" 4614{yyerror ("Missing term"); RECOVER;; 4615 break;} 4616case 464: 4617#line 2175 "./parse.y" 4618{yyerror ("Missing term"); RECOVER;; 4619 break;} 4620case 465: 4621#line 2177 "./parse.y" 4622{yyerror ("Missing term"); RECOVER;; 4623 break;} 4624case 466: 4625#line 2179 "./parse.y" 4626{yyerror ("Invalid reference type"); RECOVER;; 4627 break;} 4628case 468: 4629#line 2185 "./parse.y" 4630{ 4631 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4632 yyvsp[-2].node, yyvsp[0].node); 4633 ; 4634 break;} 4635case 469: 4636#line 2190 "./parse.y" 4637{ 4638 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4639 yyvsp[-2].node, yyvsp[0].node); 4640 ; 4641 break;} 4642case 470: 4643#line 2195 "./parse.y" 4644{yyerror ("Missing term"); RECOVER;; 4645 break;} 4646case 471: 4647#line 2197 "./parse.y" 4648{yyerror ("Missing term"); RECOVER;; 4649 break;} 4650case 473: 4651#line 2203 "./parse.y" 4652{ 4653 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4654 yyvsp[-2].node, yyvsp[0].node); 4655 ; 4656 break;} 4657case 474: 4658#line 2208 "./parse.y" 4659{yyerror ("Missing term"); RECOVER;; 4660 break;} 4661case 476: 4662#line 2214 "./parse.y" 4663{ 4664 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4665 yyvsp[-2].node, yyvsp[0].node); 4666 ; 4667 break;} 4668case 477: 4669#line 2219 "./parse.y" 4670{yyerror ("Missing term"); RECOVER;; 4671 break;} 4672case 479: 4673#line 2225 "./parse.y" 4674{ 4675 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4676 yyvsp[-2].node, yyvsp[0].node); 4677 ; 4678 break;} 4679case 480: 4680#line 2230 "./parse.y" 4681{yyerror ("Missing term"); RECOVER;; 4682 break;} 4683case 482: 4684#line 2236 "./parse.y" 4685{ 4686 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4687 yyvsp[-2].node, yyvsp[0].node); 4688 ; 4689 break;} 4690case 483: 4691#line 2241 "./parse.y" 4692{yyerror ("Missing term"); RECOVER;; 4693 break;} 4694case 485: 4695#line 2247 "./parse.y" 4696{ 4697 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, 4698 yyvsp[-2].node, yyvsp[0].node); 4699 ; 4700 break;} 4701case 486: 4702#line 2252 "./parse.y" 4703{yyerror ("Missing term"); RECOVER;; 4704 break;} 4705case 488: 4706#line 2258 "./parse.y" 4707{ 4708 yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); 4709 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location; 4710 ; 4711 break;} 4712case 489: 4713#line 2263 "./parse.y" 4714{ 4715 YYERROR_NOW; 4716 yyerror ("Missing term"); 4717 DRECOVER (1); 4718 ; 4719 break;} 4720case 490: 4721#line 2269 "./parse.y" 4722{yyerror ("Missing term"); DRECOVER (2);; 4723 break;} 4724case 491: 4725#line 2271 "./parse.y" 4726{yyerror ("Missing term"); DRECOVER (3);; 4727 break;} 4728case 494: 4729#line 2281 "./parse.y" 4730{ yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ; 4731 break;} 4732case 495: 4733#line 2283 "./parse.y" 4734{ 4735 if (ctxp->prevent_ese != lineno) 4736 yyerror ("Missing term"); 4737 DRECOVER (assign); 4738 ; 4739 break;} 4740} 4741 /* the action file gets copied in in place of this dollarsign */ 4742#line 542 "/usr/lib/bison.simple" 4743 4744 yyvsp -= yylen; 4745 yyssp -= yylen; 4746#ifdef YYLSP_NEEDED 4747 yylsp -= yylen; 4748#endif 4749 4750#if YYDEBUG != 0 4751 if (yydebug) 4752 { 4753 short *ssp1 = yyss - 1; 4754 fprintf (stderr, "state stack now"); 4755 while (ssp1 != yyssp) 4756 fprintf (stderr, " %d", *++ssp1); 4757 fprintf (stderr, "\n"); 4758 } 4759#endif 4760 4761 *++yyvsp = yyval; 4762 4763#ifdef YYLSP_NEEDED 4764 yylsp++; 4765 if (yylen == 0) 4766 { 4767 yylsp->first_line = yylloc.first_line; 4768 yylsp->first_column = yylloc.first_column; 4769 yylsp->last_line = (yylsp-1)->last_line; 4770 yylsp->last_column = (yylsp-1)->last_column; 4771 yylsp->text = 0; 4772 } 4773 else 4774 { 4775 yylsp->last_line = (yylsp+yylen-1)->last_line; 4776 yylsp->last_column = (yylsp+yylen-1)->last_column; 4777 } 4778#endif 4779 4780 /* Now "shift" the result of the reduction. 4781 Determine what state that goes to, 4782 based on the state we popped back to 4783 and the rule number reduced by. */ 4784 4785 yyn = yyr1[yyn]; 4786 4787 yystate = yypgoto[yyn - YYNTBASE] + *yyssp; 4788 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) 4789 yystate = yytable[yystate]; 4790 else 4791 yystate = yydefgoto[yyn - YYNTBASE]; 4792 4793 goto yynewstate; 4794 4795yyerrlab: /* here on detecting error */ 4796 4797 if (! yyerrstatus) 4798 /* If not already recovering from an error, report this error. */ 4799 { 4800 ++yynerrs; 4801 4802#ifdef YYERROR_VERBOSE 4803 yyn = yypact[yystate]; 4804 4805 if (yyn > YYFLAG && yyn < YYLAST) 4806 { 4807 int size = 0; 4808 char *msg; 4809 int x, count; 4810 4811 count = 0; 4812 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ 4813 for (x = (yyn < 0 ? -yyn : 0); 4814 x < (sizeof(yytname) / sizeof(char *)); x++) 4815 if (yycheck[x + yyn] == x) 4816 size += strlen(yytname[x]) + 15, count++; 4817 msg = (char *) malloc(size + 15); 4818 if (msg != 0) 4819 { 4820 strcpy(msg, "parse error"); 4821 4822 if (count < 5) 4823 { 4824 count = 0; 4825 for (x = (yyn < 0 ? -yyn : 0); 4826 x < (sizeof(yytname) / sizeof(char *)); x++) 4827 if (yycheck[x + yyn] == x) 4828 { 4829 strcat(msg, count == 0 ? ", expecting `" : " or `"); 4830 strcat(msg, yytname[x]); 4831 strcat(msg, "'"); 4832 count++; 4833 } 4834 } 4835 yyerror(msg); 4836 free(msg); 4837 } 4838 else 4839 yyerror ("parse error; also virtual memory exceeded"); 4840 } 4841 else 4842#endif /* YYERROR_VERBOSE */ 4843 yyerror("parse error"); 4844 } 4845 4846 goto yyerrlab1; 4847yyerrlab1: /* here on error raised explicitly by an action */ 4848 4849 if (yyerrstatus == 3) 4850 { 4851 /* if just tried and failed to reuse lookahead token after an error, discard it. */ 4852 4853 /* return failure if at end of input */ 4854 if (yychar == YYEOF) 4855 YYABORT; 4856 4857#if YYDEBUG != 0 4858 if (yydebug) 4859 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); 4860#endif 4861 4862 yychar = YYEMPTY; 4863 } 4864 4865 /* Else will try to reuse lookahead token 4866 after shifting the error token. */ 4867 4868 yyerrstatus = 3; /* Each real token shifted decrements this */ 4869 4870 goto yyerrhandle; 4871 4872yyerrdefault: /* current state does not do anything special for the error token. */ 4873 4874#if 0 4875 /* This is wrong; only states that explicitly want error tokens 4876 should shift them. */ 4877 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ 4878 if (yyn) goto yydefault; 4879#endif 4880 4881yyerrpop: /* pop the current state because it cannot handle the error token */ 4882 4883 if (yyssp == yyss) YYABORT; 4884 yyvsp--; 4885 yystate = *--yyssp; 4886#ifdef YYLSP_NEEDED 4887 yylsp--; 4888#endif 4889 4890#if YYDEBUG != 0 4891 if (yydebug) 4892 { 4893 short *ssp1 = yyss - 1; 4894 fprintf (stderr, "Error: state stack now"); 4895 while (ssp1 != yyssp) 4896 fprintf (stderr, " %d", *++ssp1); 4897 fprintf (stderr, "\n"); 4898 } 4899#endif 4900 4901yyerrhandle: 4902 4903 yyn = yypact[yystate]; 4904 if (yyn == YYFLAG) 4905 goto yyerrdefault; 4906 4907 yyn += YYTERROR; 4908 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) 4909 goto yyerrdefault; 4910 4911 yyn = yytable[yyn]; 4912 if (yyn < 0) 4913 { 4914 if (yyn == YYFLAG) 4915 goto yyerrpop; 4916 yyn = -yyn; 4917 goto yyreduce; 4918 } 4919 else if (yyn == 0) 4920 goto yyerrpop; 4921 4922 if (yyn == YYFINAL) 4923 YYACCEPT; 4924 4925#if YYDEBUG != 0 4926 if (yydebug) 4927 fprintf(stderr, "Shifting error token, "); 4928#endif 4929 4930 *++yyvsp = yylval; 4931#ifdef YYLSP_NEEDED 4932 *++yylsp = yylloc; 4933#endif 4934 4935 yystate = yyn; 4936 goto yynewstate; 4937 4938 yyacceptlab: 4939 /* YYACCEPT comes here. */ 4940 if (yyfree_stacks) 4941 { 4942 free (yyss); 4943 free (yyvs); 4944#ifdef YYLSP_NEEDED 4945 free (yyls); 4946#endif 4947 } 4948 return 0; 4949 4950 yyabortlab: 4951 /* YYABORT comes here. */ 4952 if (yyfree_stacks) 4953 { 4954 free (yyss); 4955 free (yyvs); 4956#ifdef YYLSP_NEEDED 4957 free (yyls); 4958#endif 4959 } 4960 return 1; 4961} 4962#line 2309 "./parse.y" 4963 4964 4965 4966/* Flag for the error report routine to issue the error the first time 4967 it's called (overriding the default behavior which is to drop the 4968 first invocation and honor the second one, taking advantage of a 4969 richer context. */ 4970static int force_error = 0; 4971 4972/* Create a new parser context and make it the current one. */ 4973 4974void 4975java_push_parser_context () 4976{ 4977 struct parser_ctxt *new = 4978 (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt)); 4979 4980 bzero ((PTR) new, sizeof (struct parser_ctxt)); 4981 new->next = ctxp; 4982 ctxp = new; 4983 if (ctxp->next) 4984 { 4985 ctxp->incomplete_class = ctxp->next->incomplete_class; 4986 ctxp->gclass_list = ctxp->next->gclass_list; 4987 } 4988} 4989 4990/* If the first file of a file list was a class file, no context 4991 exists for a source file to be parsed. This boolean remembers that 4992 java_parser_context_save_global might have created a dummy one, so 4993 that java_parser_context_restore_global can pop it. */ 4994static int extra_ctxp_pushed_p = 0; 4995 4996void 4997java_parser_context_save_global () 4998{ 4999 if (!ctxp) 5000 { 5001 java_push_parser_context (); 5002 extra_ctxp_pushed_p = 1; 5003 } 5004 ctxp->finput = finput; 5005 ctxp->lineno = lineno; 5006 ctxp->current_class = current_class; 5007 ctxp->filename = input_filename; 5008 ctxp->current_function_decl = current_function_decl; 5009} 5010 5011void 5012java_parser_context_restore_global () 5013{ 5014 finput = ctxp->finput; 5015 lineno = ctxp->lineno; 5016 current_class = ctxp->current_class; 5017 input_filename = ctxp->filename; 5018 current_function_decl = ctxp->current_function_decl; 5019 if (!ctxp->next && extra_ctxp_pushed_p) 5020 { 5021 java_pop_parser_context (0); 5022 extra_ctxp_pushed_p = 0; 5023 } 5024} 5025 5026void 5027java_pop_parser_context (generate) 5028 int generate; 5029{ 5030 tree current; 5031 struct parser_ctxt *toFree, *next; 5032 5033 if (!ctxp) 5034 return; 5035 5036 toFree = ctxp; 5037 next = ctxp->next; 5038 if (next) 5039 { 5040 next->incomplete_class = ctxp->incomplete_class; 5041 next->gclass_list = ctxp->gclass_list; 5042 lineno = ctxp->lineno; 5043 finput = ctxp->finput; 5044 current_class = ctxp->current_class; 5045 } 5046 5047 /* Set the single import class file flag to 0 for the current list 5048 of imported things */ 5049 for (current = ctxp->import_list; current; current = TREE_CHAIN (current)) 5050 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 0; 5051 5052 /* And restore those of the previous context */ 5053 if ((ctxp = next)) /* Assignment is really meant here */ 5054 for (current = ctxp->import_list; current; current = TREE_CHAIN (current)) 5055 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1; 5056 5057 if (generate) 5058 { 5059 toFree->next = ctxp_for_generation; 5060 ctxp_for_generation = toFree; 5061 } 5062 else 5063 free (toFree); 5064} 5065 5066/* Reporting JDK1.1 features not implemented */ 5067 5068static tree 5069parse_jdk1_1_error (msg) 5070 char *msg; 5071{ 5072 sorry (": `%s' JDK1.1(TM) feature", msg); 5073 java_error_count++; 5074 return empty_stmt_node; 5075} 5076 5077static int do_warning = 0; 5078 5079void 5080yyerror (msg) 5081 char *msg; 5082{ 5083 static java_lc elc; 5084 static int prev_lineno; 5085 static char *prev_msg; 5086 5087 int save_lineno; 5088 char *remainder, *code_from_source; 5089 extern struct obstack temporary_obstack; 5090 5091 if (!force_error && prev_lineno == lineno) 5092 return; 5093 5094 /* Save current error location but report latter, when the context is 5095 richer. */ 5096 if (ctxp->java_error_flag == 0) 5097 { 5098 ctxp->java_error_flag = 1; 5099 elc = ctxp->elc; 5100 /* Do something to use the previous line if we're reaching the 5101 end of the file... */ 5102#ifdef VERBOSE_SKELETON 5103 printf ("* Error detected (%s)\n", (msg ? msg : "(null)")); 5104#endif 5105 return; 5106 } 5107 5108 /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */ 5109 if (!force_error && msg == prev_msg && prev_lineno == elc.line) 5110 return; 5111 5112 ctxp->java_error_flag = 0; 5113 if (do_warning) 5114 java_warning_count++; 5115 else 5116 java_error_count++; 5117 5118 if (elc.col == 0 && msg[1] == ';') 5119 { 5120 elc.col = ctxp->p_line->char_col-1; 5121 elc.line = ctxp->p_line->lineno; 5122 } 5123 5124 save_lineno = lineno; 5125 prev_lineno = lineno = elc.line; 5126 prev_msg = msg; 5127 5128 code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col); 5129 obstack_grow0 (&temporary_obstack, 5130 code_from_source, strlen (code_from_source)); 5131 remainder = obstack_finish (&temporary_obstack); 5132 if (do_warning) 5133 warning ("%s.\n%s", msg, remainder); 5134 else 5135 error ("%s.\n%s", msg, remainder); 5136 5137 /* This allow us to cheaply avoid an extra 'Invalid expression 5138 statement' error report when errors have been already reported on 5139 the same line. This occurs when we report an error but don't have 5140 a synchronization point other than ';', which 5141 expression_statement is the only one to take care of. */ 5142 ctxp->prevent_ese = lineno = save_lineno; 5143} 5144 5145static void 5146issue_warning_error_from_context (cl, msg, ap) 5147 tree cl; 5148 const char *msg; 5149 va_list ap; 5150{ 5151 char *saved, *saved_input_filename; 5152 char buffer [4096]; 5153 vsprintf (buffer, msg, ap); 5154 force_error = 1; 5155 5156 ctxp->elc.line = EXPR_WFL_LINENO (cl); 5157 ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 : 5158 (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl))); 5159 5160 /* We have a CL, that's a good reason for using it if it contains data */ 5161 saved = ctxp->filename; 5162 if (TREE_CODE (cl) == EXPR_WITH_FILE_LOCATION && EXPR_WFL_FILENAME_NODE (cl)) 5163 ctxp->filename = EXPR_WFL_FILENAME (cl); 5164 saved_input_filename = input_filename; 5165 input_filename = ctxp->filename; 5166 java_error (NULL); 5167 java_error (buffer); 5168 ctxp->filename = saved; 5169 input_filename = saved_input_filename; 5170 force_error = 0; 5171} 5172 5173/* Issue an error message at a current source line CL */ 5174 5175void 5176parse_error_context VPROTO ((tree cl, const char *msg, ...)) 5177{ 5178#ifndef ANSI_PROTOTYPES 5179 tree cl; 5180 const char *msg; 5181#endif 5182 va_list ap; 5183 5184 VA_START (ap, msg); 5185#ifndef ANSI_PROTOTYPES 5186 cl = va_arg (ap, tree); 5187 msg = va_arg (ap, const char *); 5188#endif 5189 issue_warning_error_from_context (cl, msg, ap); 5190 va_end (ap); 5191} 5192 5193/* Issue a warning at a current source line CL */ 5194 5195static void 5196parse_warning_context VPROTO ((tree cl, const char *msg, ...)) 5197{ 5198#ifndef ANSI_PROTOTYPES 5199 tree cl; 5200 const char *msg; 5201#endif 5202 va_list ap; 5203 5204 VA_START (ap, msg); 5205#ifndef ANSI_PROTOTYPES 5206 cl = va_arg (ap, tree); 5207 msg = va_arg (ap, const char *); 5208#endif 5209 5210 force_error = do_warning = 1; 5211 issue_warning_error_from_context (cl, msg, ap); 5212 do_warning = force_error = 0; 5213 va_end (ap); 5214} 5215 5216static tree 5217find_expr_with_wfl (node) 5218 tree node; 5219{ 5220 while (node) 5221 { 5222 char code; 5223 tree to_return; 5224 5225 switch (TREE_CODE (node)) 5226 { 5227 case BLOCK: 5228 node = BLOCK_EXPR_BODY (node); 5229 continue; 5230 5231 case COMPOUND_EXPR: 5232 to_return = find_expr_with_wfl (TREE_OPERAND (node, 0)); 5233 if (to_return) 5234 return to_return; 5235 node = TREE_OPERAND (node, 1); 5236 continue; 5237 5238 case LOOP_EXPR: 5239 node = TREE_OPERAND (node, 0); 5240 continue; 5241 5242 case LABELED_BLOCK_EXPR: 5243 node = TREE_OPERAND (node, 1); 5244 continue; 5245 5246 default: 5247 code = TREE_CODE_CLASS (TREE_CODE (node)); 5248 if (((code == '1') || (code == '2') || (code == 'e')) 5249 && EXPR_WFL_LINECOL (node)) 5250 return node; 5251 return NULL_TREE; 5252 } 5253 } 5254 return NULL_TREE; 5255} 5256 5257/* Issue a missing return statement error. Uses METHOD to figure the 5258 last line of the method the error occurs in. */ 5259 5260static void 5261missing_return_error (method) 5262 tree method; 5263{ 5264 EXPR_WFL_SET_LINECOL (wfl_operator, DECL_SOURCE_LINE_LAST (method), -2); 5265 parse_error_context (wfl_operator, "Missing return statement"); 5266} 5267 5268/* Issue an unreachable statement error. From NODE, find the next 5269 statement to report appropriately. */ 5270static void 5271unreachable_stmt_error (node) 5272 tree node; 5273{ 5274 /* Browse node to find the next expression node that has a WFL. Use 5275 the location to report the error */ 5276 if (TREE_CODE (node) == COMPOUND_EXPR) 5277 node = find_expr_with_wfl (TREE_OPERAND (node, 1)); 5278 else 5279 node = find_expr_with_wfl (node); 5280 5281 if (node) 5282 { 5283 EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2); 5284 parse_error_context (wfl_operator, "Unreachable statement"); 5285 } 5286 else 5287 fatal ("Can't get valid statement - unreachable_stmt_error"); 5288} 5289 5290int 5291java_report_errors () 5292{ 5293 if (java_error_count) 5294 fprintf (stderr, "%d error%s", 5295 java_error_count, (java_error_count == 1 ? "" : "s")); 5296 if (java_warning_count) 5297 fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""), 5298 java_warning_count, (java_warning_count == 1 ? "" : "s")); 5299 if (java_error_count || java_warning_count) 5300 putc ('\n', stderr); 5301 return java_error_count; 5302} 5303 5304static char * 5305java_accstring_lookup (flags) 5306 int flags; 5307{ 5308 static char buffer [80]; 5309#define COPY_RETURN(S) {strcpy (buffer, S); return buffer;} 5310 5311 /* Access modifier looked-up first for easier report on forbidden 5312 access. */ 5313 if (flags & ACC_PUBLIC) COPY_RETURN ("public"); 5314 if (flags & ACC_PRIVATE) COPY_RETURN ("private"); 5315 if (flags & ACC_PROTECTED) COPY_RETURN ("protected"); 5316 if (flags & ACC_STATIC) COPY_RETURN ("static"); 5317 if (flags & ACC_FINAL) COPY_RETURN ("final"); 5318 if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized"); 5319 if (flags & ACC_VOLATILE) COPY_RETURN ("volatile"); 5320 if (flags & ACC_TRANSIENT) COPY_RETURN ("transient"); 5321 if (flags & ACC_NATIVE) COPY_RETURN ("native"); 5322 if (flags & ACC_INTERFACE) COPY_RETURN ("interface"); 5323 if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract"); 5324 5325 buffer [0] = '\0'; 5326 return buffer; 5327#undef COPY_RETURN 5328} 5329 5330/* Issuing error messages upon redefinition of classes, interfaces or 5331 variables. */ 5332 5333static void 5334classitf_redefinition_error (context, id, decl, cl) 5335 char *context; 5336 tree id, decl, cl; 5337{ 5338 parse_error_context (cl, "%s `%s' already defined in %s:%d", 5339 context, IDENTIFIER_POINTER (id), 5340 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); 5341 /* Here we should point out where its redefined. It's a unicode. FIXME */ 5342} 5343 5344static void 5345variable_redefinition_error (context, name, type, line) 5346 tree context, name, type; 5347 int line; 5348{ 5349 char *type_name; 5350 5351 /* Figure a proper name for type. We might haven't resolved it */ 5352 if (TREE_CODE (type) == POINTER_TYPE && !TREE_TYPE (type)) 5353 type_name = IDENTIFIER_POINTER (TYPE_NAME (type)); 5354 else 5355 type_name = lang_printable_name (type, 0); 5356 5357 parse_error_context (context, 5358 "Variable `%s' is already defined in this method and " 5359 "was declared `%s %s' at line %d", 5360 IDENTIFIER_POINTER (name), 5361 type_name, IDENTIFIER_POINTER (name), line); 5362} 5363 5364static tree 5365build_array_from_name (type, type_wfl, name, ret_name) 5366 tree type, type_wfl, name, *ret_name; 5367{ 5368 int more_dims = 0; 5369 char *string; 5370 5371 /* Eventually get more dims */ 5372 string = IDENTIFIER_POINTER (name); 5373 while (string [more_dims] == '[') 5374 more_dims++; 5375 5376 /* If we have, then craft a new type for this variable */ 5377 if (more_dims) 5378 { 5379 name = get_identifier (&string [more_dims]); 5380 5381 /* If we have a pointer, use its type */ 5382 if (TREE_CODE (type) == POINTER_TYPE) 5383 type = TREE_TYPE (type); 5384 5385 /* Building the first dimension of a primitive type uses this 5386 function */ 5387 if (JPRIMITIVE_TYPE_P (type)) 5388 { 5389 type = build_java_array_type (type, -1); 5390 CLASS_LOADED_P (type) = 1; 5391 more_dims--; 5392 } 5393 /* Otherwise, if we have a WFL for this type, use it (the type 5394 is already an array on an unresolved type, and we just keep 5395 on adding dimensions) */ 5396 else if (type_wfl) 5397 type = type_wfl; 5398 5399 /* Add all the dimensions */ 5400 while (more_dims--) 5401 type = build_unresolved_array_type (type); 5402 5403 /* The type may have been incomplete in the first place */ 5404 if (type_wfl) 5405 type = obtain_incomplete_type (type); 5406 } 5407 5408 *ret_name = name; 5409 return type; 5410} 5411 5412/* Build something that the type identifier resolver will identify as 5413 being an array to an unresolved type. TYPE_WFL is a WFL on a 5414 identifier. */ 5415 5416static tree 5417build_unresolved_array_type (type_or_wfl) 5418 tree type_or_wfl; 5419{ 5420 char *ptr; 5421 5422 /* TYPE_OR_WFL might be an array on a resolved type. In this case, 5423 just create a array type */ 5424 if (TREE_CODE (type_or_wfl) == RECORD_TYPE) 5425 { 5426 tree type = build_java_array_type (type_or_wfl, -1); 5427 CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl); 5428 return type; 5429 } 5430 5431 obstack_1grow (&temporary_obstack, '['); 5432 obstack_grow0 (&temporary_obstack, 5433 IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)), 5434 IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl))); 5435 ptr = obstack_finish (&temporary_obstack); 5436 return build_expr_wfl (get_identifier (ptr), 5437 EXPR_WFL_FILENAME (type_or_wfl), 5438 EXPR_WFL_LINENO (type_or_wfl), 5439 EXPR_WFL_COLNO (type_or_wfl)); 5440} 5441 5442/* Check modifiers. If one doesn't fit, retrieve it in its declaration line 5443 and point it out. */ 5444 5445static void 5446check_modifiers (message, value, mask) 5447 char *message; 5448 int value; 5449 int mask; 5450{ 5451 /* Should point out the one that don't fit. ASCII/unicode, 5452 going backward. FIXME */ 5453 if (value & ~mask) 5454 { 5455 int i, remainder = value & ~mask; 5456 for (i = 0; i <= 10; i++) 5457 if ((1 << i) & remainder) 5458 parse_error_context (ctxp->modifier_ctx [i], message, 5459 java_accstring_lookup (1 << i)); 5460 } 5461} 5462 5463static void 5464parser_add_interface (class_decl, interface_decl, wfl) 5465 tree class_decl, interface_decl, wfl; 5466{ 5467 if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl))) 5468 parse_error_context (wfl, "Interface `%s' repeated", 5469 IDENTIFIER_POINTER (DECL_NAME (interface_decl))); 5470} 5471 5472/* Bulk of common class/interface checks. Return 1 if an error was 5473 encountered. TAG is 0 for a class, 1 for an interface. */ 5474 5475static int 5476check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl) 5477 int is_interface, flags; 5478 tree raw_name, qualified_name, decl, cl; 5479{ 5480 tree node; 5481 5482 if (!quiet_flag) 5483 fprintf (stderr, " %s %s", (is_interface ? "interface" : "class"), 5484 IDENTIFIER_POINTER (qualified_name)); 5485 5486 /* Scope of an interface/class type name: 5487 - Can't be imported by a single type import 5488 - Can't already exists in the package */ 5489 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name) 5490 && (node = find_name_in_single_imports (raw_name))) 5491 { 5492 parse_error_context 5493 (cl, "%s name `%s' clashes with imported type `%s'", 5494 (is_interface ? "Interface" : "Class"), 5495 IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node)); 5496 return 1; 5497 } 5498 if (decl && CLASS_COMPLETE_P (decl)) 5499 { 5500 classitf_redefinition_error ((is_interface ? "Interface" : "Class"), 5501 qualified_name, decl, cl); 5502 return 1; 5503 } 5504 5505 /* If public, file name should match class/interface name */ 5506 if (flags & ACC_PUBLIC) 5507 { 5508 char *f; 5509 5510 /* Contains OS dependent assumption on path separator. FIXME */ 5511 for (f = &input_filename [strlen (input_filename)]; 5512 f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR; 5513 f--) 5514 ; 5515 if (f[0] == '/' || f[0] == DIR_SEPARATOR) 5516 f++; 5517 if (strncmp (IDENTIFIER_POINTER (raw_name), 5518 f , IDENTIFIER_LENGTH (raw_name)) || 5519 f [IDENTIFIER_LENGTH (raw_name)] != '.') 5520 parse_error_context (cl, "Public %s `%s' must be defined in a file " 5521 "called `%s.java'", 5522 (is_interface ? "interface" : "class"), 5523 IDENTIFIER_POINTER (qualified_name), 5524 IDENTIFIER_POINTER (raw_name)); 5525 } 5526 5527 check_modifiers ((is_interface ? 5528 "Illegal modifier `%s' for interface declaration" : 5529 "Illegal modifier `%s' for class declaration"), flags, 5530 (is_interface ? INTERFACE_MODIFIERS : CLASS_MODIFIERS)); 5531 return 0; 5532} 5533 5534/* If DECL is NULL, create and push a new DECL, record the current 5535 line CL and do other maintenance things. */ 5536 5537static tree 5538maybe_create_class_interface_decl (decl, qualified_name, cl) 5539 tree decl, qualified_name, cl; 5540{ 5541 if (!decl) 5542 decl = push_class (make_class (), qualified_name); 5543 5544 /* Take care of the file and line business */ 5545 DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl); 5546 /* If we're emiting xrefs, store the line/col number information */ 5547 if (flag_emit_xref) 5548 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (cl); 5549 else 5550 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl); 5551 CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1; 5552 CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl)) = 5553 IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl)); 5554 5555 ctxp->current_parsed_class = decl; 5556 5557 /* Link the declaration to the already seen ones */ 5558 TREE_CHAIN (decl) = ctxp->class_list; 5559 ctxp->class_list = decl; 5560 5561 /* Create a new nodes in the global lists */ 5562 ctxp->gclass_list = tree_cons (NULL_TREE, decl, ctxp->gclass_list); 5563 all_class_list = tree_cons (NULL_TREE, decl, all_class_list); 5564 5565 /* Install a new dependency list element */ 5566 create_jdep_list (ctxp); 5567 5568 SOURCE_FRONTEND_DEBUG (("Defining class/interface %s", 5569 IDENTIFIER_POINTER (qualified_name))); 5570 return decl; 5571} 5572 5573static void 5574add_superinterfaces (decl, interface_list) 5575 tree decl, interface_list; 5576{ 5577 tree node; 5578 /* Superinterface(s): if present and defined, parser_check_super_interface () 5579 takes care of ensuring that: 5580 - This is an accessible interface type, 5581 - Circularity detection. 5582 parser_add_interface is then called. If present but not defined, 5583 the check operation is delayed until the super interface gets 5584 defined. */ 5585 for (node = interface_list; node; node = TREE_CHAIN (node)) 5586 { 5587 tree current = TREE_PURPOSE (node); 5588 tree idecl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current)); 5589 if (idecl && CLASS_LOADED_P (TREE_TYPE (idecl))) 5590 { 5591 if (!parser_check_super_interface (idecl, decl, current)) 5592 parser_add_interface (decl, idecl, current); 5593 } 5594 else 5595 register_incomplete_type (JDEP_INTERFACE, 5596 current, decl, NULL_TREE); 5597 } 5598} 5599 5600/* Create an interface in pass1 and return its decl. Return the 5601 interface's decl in pass 2. */ 5602 5603static tree 5604create_interface (flags, id, super) 5605 int flags; 5606 tree id, super; 5607{ 5608 tree raw_name = EXPR_WFL_NODE (id); 5609 tree q_name = parser_qualified_classname (id); 5610 tree decl = IDENTIFIER_CLASS_VALUE (q_name); 5611 5612 EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */ 5613 5614 /* Basic checks: scope, redefinition, modifiers */ 5615 if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id)) 5616 return NULL_TREE; 5617 5618 /* Interface modifiers check 5619 - public/abstract allowed (already done at that point) 5620 - abstract is obsolete (comes first, it's a warning, or should be) 5621 - Can't use twice the same (checked in the modifier rule) */ 5622 if ((flags & ACC_ABSTRACT) && flag_redundant) 5623 parse_warning_context 5624 (MODIFIER_WFL (ABSTRACT_TK), 5625 "Redundant use of `abstract' modifier. Interface `%s' is implicitely " 5626 "abstract", IDENTIFIER_POINTER (raw_name)); 5627 5628 /* Create a new decl if DECL is NULL, otherwise fix it */ 5629 decl = maybe_create_class_interface_decl (decl, q_name, id); 5630 5631 /* Set super info and mark the class a complete */ 5632 set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl), 5633 object_type_node, ctxp->interface_number); 5634 ctxp->interface_number = 0; 5635 CLASS_COMPLETE_P (decl) = 1; 5636 add_superinterfaces (decl, super); 5637 5638 return decl; 5639} 5640 5641/* Create an class in pass1 and return its decl. Return class 5642 interface's decl in pass 2. */ 5643 5644static tree 5645create_class (flags, id, super, interfaces) 5646 int flags; 5647 tree id, super, interfaces; 5648{ 5649 tree raw_name = EXPR_WFL_NODE (id); 5650 tree class_id, decl; 5651 tree super_decl_type; 5652 5653 class_id = parser_qualified_classname (id); 5654 decl = IDENTIFIER_CLASS_VALUE (class_id); 5655 ctxp->current_parsed_class_un = EXPR_WFL_NODE (id); 5656 EXPR_WFL_NODE (id) = class_id; 5657 5658 /* Basic check: scope, redefinition, modifiers */ 5659 if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id)) 5660 return NULL_TREE; 5661 5662 /* Class modifier check: 5663 - Allowed modifier (already done at that point) 5664 - abstract AND final forbidden 5665 - Public classes defined in the correct file */ 5666 if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL)) 5667 parse_error_context (id, "Class `%s' can't be declared both abstract " 5668 "and final", IDENTIFIER_POINTER (raw_name)); 5669 5670 /* Create a new decl if DECL is NULL, otherwise fix it */ 5671 decl = maybe_create_class_interface_decl (decl, class_id, id); 5672 5673 /* If SUPER exists, use it, otherwise use Object */ 5674 if (super) 5675 { 5676 /* Can't extend java.lang.Object */ 5677 if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node) 5678 { 5679 parse_error_context (id, "Can't extend `java.lang.Object'"); 5680 return NULL_TREE; 5681 } 5682 5683 super_decl_type = 5684 register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE); 5685 } 5686 else if (TREE_TYPE (decl) != object_type_node) 5687 super_decl_type = object_type_node; 5688 /* We're defining java.lang.Object */ 5689 else 5690 super_decl_type = NULL_TREE; 5691 5692 /* Set super info and mark the class a complete */ 5693 set_super_info (flags, TREE_TYPE (decl), super_decl_type, 5694 ctxp->interface_number); 5695 ctxp->interface_number = 0; 5696 CLASS_COMPLETE_P (decl) = 1; 5697 add_superinterfaces (decl, interfaces); 5698 5699 /* If doing xref, store the location at which the inherited class 5700 (if any) was seen. */ 5701 if (flag_emit_xref && super) 5702 DECL_INHERITED_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (super); 5703 5704 /* Eventually sets the @deprecated tag flag */ 5705 CHECK_DEPRECATED (decl); 5706 5707 return decl; 5708} 5709 5710/* Can't use lookup_field () since we don't want to load the class and 5711 can't set the CLASS_LOADED_P flag */ 5712 5713static tree 5714find_field (class, name) 5715 tree class; 5716 tree name; 5717{ 5718 tree decl; 5719 for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl)) 5720 { 5721 if (DECL_NAME (decl) == name) 5722 return decl; 5723 } 5724 return NULL_TREE; 5725} 5726 5727/* Wrap around lookup_field that doesn't potentially upset the value 5728 of CLASS */ 5729 5730static tree 5731lookup_field_wrapper (class, name) 5732 tree class, name; 5733{ 5734 tree type = class; 5735 tree decl; 5736 java_parser_context_save_global (); 5737 decl = lookup_field (&type, name); 5738 java_parser_context_restore_global (); 5739 return decl == error_mark_node ? NULL : decl; 5740} 5741 5742/* Find duplicate field within the same class declarations and report 5743 the error. Returns 1 if a duplicated field was found, 0 5744 otherwise. */ 5745 5746static int 5747duplicate_declaration_error_p (new_field_name, new_type, cl) 5748 tree new_field_name, new_type, cl; 5749{ 5750 /* This might be modified to work with method decl as well */ 5751 tree decl = find_field (TREE_TYPE (ctxp->current_parsed_class), 5752 new_field_name); 5753 if (decl) 5754 { 5755 char *t1 = strdup (purify_type_name 5756 ((TREE_CODE (new_type) == POINTER_TYPE 5757 && TREE_TYPE (new_type) == NULL_TREE) ? 5758 IDENTIFIER_POINTER (TYPE_NAME (new_type)) : 5759 lang_printable_name (new_type, 1))); 5760 /* The type may not have been completed by the time we report 5761 the error */ 5762 char *t2 = strdup (purify_type_name 5763 ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE 5764 && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ? 5765 IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) : 5766 lang_printable_name (TREE_TYPE (decl), 1))); 5767 parse_error_context 5768 (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)", 5769 t1, IDENTIFIER_POINTER (new_field_name), 5770 t2, IDENTIFIER_POINTER (DECL_NAME (decl)), 5771 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); 5772 free (t1); 5773 free (t2); 5774 return 1; 5775 } 5776 return 0; 5777} 5778 5779/* Field registration routine. If TYPE doesn't exist, field 5780 declarations are linked to the undefined TYPE dependency list, to 5781 be later resolved in java_complete_class () */ 5782 5783static void 5784register_fields (flags, type, variable_list) 5785 int flags; 5786 tree type, variable_list; 5787{ 5788 tree current, saved_type; 5789 tree class_type = TREE_TYPE (ctxp->current_parsed_class); 5790 int saved_lineno = lineno; 5791 int must_chain = 0; 5792 tree wfl = NULL_TREE; 5793 5794 /* If we're adding fields to interfaces, those fields are public, 5795 static, final */ 5796 if (CLASS_INTERFACE (TYPE_NAME (class_type))) 5797 { 5798 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), 5799 flags, ACC_PUBLIC, 5800 "%s", "interface field(s)"); 5801 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK), 5802 flags, ACC_STATIC, 5803 "%s", "interface field(s)"); 5804 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK), 5805 flags, ACC_FINAL, "%s", "interface field(s)"); 5806 check_modifiers ("Illegal interface member modifier `%s'", flags, 5807 INTERFACE_FIELD_MODIFIERS); 5808 flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL); 5809 } 5810 5811 /* Obtain a suitable type for resolution, if necessary */ 5812 SET_TYPE_FOR_RESOLUTION (type, wfl, must_chain); 5813 5814 /* If TYPE is fully resolved and we don't have a reference, make one */ 5815 PROMOTE_RECORD_IF_COMPLETE (type, must_chain); 5816 5817 for (current = variable_list, saved_type = type; current; 5818 current = TREE_CHAIN (current), type = saved_type) 5819 { 5820 tree real_type; 5821 tree field_decl; 5822 tree cl = TREE_PURPOSE (current); 5823 tree init = TREE_VALUE (current); 5824 tree current_name = EXPR_WFL_NODE (cl); 5825 5826 /* Process NAME, as it may specify extra dimension(s) for it */ 5827 type = build_array_from_name (type, wfl, current_name, ¤t_name); 5828 5829 /* Type adjustment. We may have just readjusted TYPE because 5830 the variable specified more dimensions. Make sure we have 5831 a reference if we can and don't have one already. Also 5832 change the name if we have an init. */ 5833 if (type != saved_type) 5834 { 5835 PROMOTE_RECORD_IF_COMPLETE (type, must_chain); 5836 if (init) 5837 EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = current_name; 5838 } 5839 5840 real_type = GET_REAL_TYPE (type); 5841 /* Check for redeclarations */ 5842 if (duplicate_declaration_error_p (current_name, real_type, cl)) 5843 continue; 5844 5845 /* Set lineno to the line the field was found and create a 5846 declaration for it. Eventually sets the @deprecated tag flag. */ 5847 if (flag_emit_xref) 5848 lineno = EXPR_WFL_LINECOL (cl); 5849 else 5850 lineno = EXPR_WFL_LINENO (cl); 5851 field_decl = add_field (class_type, current_name, real_type, flags); 5852 CHECK_DEPRECATED (field_decl); 5853 5854 /* Check if we must chain. */ 5855 if (must_chain) 5856 register_incomplete_type (JDEP_FIELD, wfl, field_decl, type); 5857 5858 /* If we have an initialization value tied to the field */ 5859 if (init) 5860 { 5861 /* The field is declared static */ 5862 if (flags & ACC_STATIC) 5863 { 5864 /* We include the field and its initialization part into 5865 a list used to generate <clinit>. After <clinit> is 5866 walked, field initializations will be processed and 5867 fields initialized with known constants will be taken 5868 out of <clinit> and have their DECL_INITIAL set 5869 appropriately. */ 5870 TREE_CHAIN (init) = ctxp->static_initialized; 5871 ctxp->static_initialized = init; 5872 if (TREE_OPERAND (init, 1) 5873 && TREE_CODE (TREE_OPERAND (init, 1)) == NEW_ARRAY_INIT) 5874 TREE_STATIC (TREE_OPERAND (init, 1)) = 1; 5875 } 5876 /* A non-static field declared with an immediate initialization is 5877 to be initialized in <init>, if any. This field is remembered 5878 to be processed at the time of the generation of <init>. */ 5879 else 5880 { 5881 TREE_CHAIN (init) = ctxp->non_static_initialized; 5882 ctxp->non_static_initialized = init; 5883 } 5884 MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1; 5885 DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1); 5886 } 5887 } 5888 lineno = saved_lineno; 5889} 5890 5891/* Generate the method $finit$ that initializes fields initialized 5892 upon declaration. */ 5893 5894static void 5895maybe_generate_finit () 5896{ 5897 tree mdecl, current; 5898 5899 if (!ctxp->non_static_initialized || java_error_count) 5900 return; 5901 5902 mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class), 5903 ACC_PRIVATE, void_type_node, 5904 finit_identifier_node, end_params_node); 5905 start_artificial_method_body (mdecl); 5906 5907 ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized); 5908 for (current = ctxp->non_static_initialized; current; 5909 current = TREE_CHAIN (current)) 5910 java_method_add_stmt (mdecl, 5911 build_debugable_stmt (EXPR_WFL_LINECOL (current), 5912 current)); 5913 5914 end_artificial_method_body (mdecl); 5915 CLASS_HAS_FINIT_P (TREE_TYPE (ctxp->current_parsed_class)) = 1; 5916 ctxp->non_static_initialized = NULL_TREE; 5917} 5918 5919/* Check whether it is necessary to generate a <clinit> for the class 5920 we just parsed. */ 5921 5922static void 5923maybe_generate_clinit () 5924{ 5925 tree mdecl, c; 5926 5927 if (!ctxp->static_initialized || java_error_count) 5928 return; 5929 5930 mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class), 5931 ACC_STATIC, void_type_node, 5932 clinit_identifier_node, end_params_node); 5933 start_artificial_method_body (mdecl); 5934 5935 /* Keep initialization in order to enforce 8.5 */ 5936 ctxp->static_initialized = nreverse (ctxp->static_initialized); 5937 5938 /* We process the list of assignment we produced as the result of 5939 the declaration of initialized static field and add them as 5940 statement to the <clinit> method. */ 5941 for (c = ctxp->static_initialized; c; c = TREE_CHAIN (c)) 5942 { 5943 /* We build the assignment expression that will initialize the 5944 field to its value. There are strict rules on static 5945 initializers (8.5). FIXME */ 5946 java_method_add_stmt (mdecl, 5947 build_debugable_stmt (EXPR_WFL_LINECOL (c), c)); 5948 } 5949 5950 end_artificial_method_body (mdecl); 5951 ctxp->static_initialized = NULL_TREE; 5952} 5953 5954/* Shared accros method_declarator and method_header to remember the 5955 patch stage that was reached during the declaration of the method. 5956 A method DECL is built differently is there is no patch 5957 (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN) 5958 pending on the currently defined method. */ 5959 5960static int patch_stage; 5961 5962/* Check the method declaration and add the method to its current 5963 class. If the argument list is known to contain incomplete types, 5964 the method is partially added and the registration will be resume 5965 once the method arguments resolved. If TYPE is NULL, we're dealing 5966 with a constructor. */ 5967 5968static tree 5969method_header (flags, type, mdecl, throws) 5970 int flags; 5971 tree type, mdecl, throws; 5972{ 5973 tree meth = TREE_VALUE (mdecl); 5974 tree id = TREE_PURPOSE (mdecl); 5975 tree this_class = TREE_TYPE (ctxp->current_parsed_class); 5976 tree type_wfl = NULL_TREE; 5977 tree meth_name = NULL_TREE, current, orig_arg; 5978 int saved_lineno; 5979 int constructor_ok = 0, must_chain; 5980 5981 check_modifiers_consistency (flags); 5982 5983 /* There are some forbidden modifiers for an abstract method and its 5984 class must be abstract as well. */ 5985 if (type && (flags & ACC_ABSTRACT)) 5986 { 5987 ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private"); 5988 ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static"); 5989 ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final"); 5990 ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native"); 5991 ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized"); 5992 if (!CLASS_ABSTRACT (TYPE_NAME (this_class)) 5993 && !CLASS_INTERFACE (TYPE_NAME (this_class))) 5994 parse_error_context 5995 (id, "Class `%s' must be declared abstract to define abstract " 5996 "method `%s'", 5997 IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)), 5998 IDENTIFIER_POINTER (EXPR_WFL_NODE (id))); 5999 } 6000 /* Things to be checked when declaring a constructor */ 6001 if (!type) 6002 { 6003 int ec = java_error_count; 6004 /* 8.6: Constructor declarations: we might be trying to define a 6005 method without specifying a return type. */ 6006 if (EXPR_WFL_NODE (id) != ctxp->current_parsed_class_un) 6007 parse_error_context 6008 (id, "Invalid method declaration, return type required"); 6009 /* 8.6.3: Constructor modifiers */ 6010 else 6011 { 6012 JCONSTRUCTOR_CHECK (flags, ACC_ABSTRACT, id, "abstract"); 6013 JCONSTRUCTOR_CHECK (flags, ACC_STATIC, id, "static"); 6014 JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final"); 6015 JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native"); 6016 JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized"); 6017 } 6018 /* If we found error here, we don't consider it's OK to tread 6019 the method definition as a constructor, for the rest of this 6020 function */ 6021 if (ec == java_error_count) 6022 constructor_ok = 1; 6023 } 6024 6025 /* Method declared within the scope of an interface are implicitly 6026 abstract and public. Conflicts with other erroneously provided 6027 modifiers are checked right after. */ 6028 6029 if (CLASS_INTERFACE (TYPE_NAME (this_class))) 6030 { 6031 /* If FLAGS isn't set because of a modifier, turn the 6032 corresponding modifier WFL to NULL so we issue a warning on 6033 the obsolete use of the modifier */ 6034 if (!(flags & ACC_PUBLIC)) 6035 MODIFIER_WFL (PUBLIC_TK) = NULL; 6036 if (!(flags & ACC_ABSTRACT)) 6037 MODIFIER_WFL (ABSTRACT_TK) = NULL; 6038 flags |= ACC_PUBLIC; 6039 flags |= ACC_ABSTRACT; 6040 } 6041 6042 /* Modifiers context reset moved up, so abstract method declaration 6043 modifiers can be later checked. */ 6044 6045 /* Set constructor returned type to void and method name to <init>, 6046 unless we found an error identifier the constructor (in which 6047 case we retain the original name) */ 6048 if (!type) 6049 { 6050 type = void_type_node; 6051 if (constructor_ok) 6052 meth_name = init_identifier_node; 6053 } 6054 else 6055 meth_name = EXPR_WFL_NODE (id); 6056 6057 /* Do the returned type resolution and registration if necessary */ 6058 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain); 6059 6060 if (meth_name) 6061 type = build_array_from_name (type, type_wfl, meth_name, &meth_name); 6062 EXPR_WFL_NODE (id) = meth_name; 6063 PROMOTE_RECORD_IF_COMPLETE (type, must_chain); 6064 6065 if (must_chain) 6066 { 6067 patch_stage = JDEP_METHOD_RETURN; 6068 register_incomplete_type (patch_stage, type_wfl, id, type); 6069 TREE_TYPE (meth) = GET_REAL_TYPE (type); 6070 } 6071 else 6072 TREE_TYPE (meth) = type; 6073 6074 saved_lineno = lineno; 6075 /* When defining an abstract or interface method, the curly 6076 bracket at level 1 doesn't exist because there is no function 6077 body */ 6078 lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 : 6079 EXPR_WFL_LINENO (id)); 6080 6081 /* Remember the original argument list */ 6082 orig_arg = TYPE_ARG_TYPES (meth); 6083 6084 if (patch_stage) /* includes ret type and/or all args */ 6085 { 6086 jdep *jdep; 6087 meth = add_method_1 (this_class, flags, meth_name, meth); 6088 /* Patch for the return type */ 6089 if (patch_stage == JDEP_METHOD_RETURN) 6090 { 6091 jdep = CLASSD_LAST (ctxp->classd_list); 6092 JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth)); 6093 } 6094 /* This is the stop JDEP. METH allows the function's signature 6095 to be computed. */ 6096 register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE); 6097 } 6098 else 6099 meth = add_method (this_class, flags, meth_name, 6100 build_java_signature (meth)); 6101 6102 /* Fix the method argument list so we have the argument name 6103 information */ 6104 fix_method_argument_names (orig_arg, meth); 6105 6106 /* Register the parameter number and re-install the current line 6107 number */ 6108 DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1; 6109 lineno = saved_lineno; 6110 6111 /* Register exception specified by the `throws' keyword for 6112 resolution and set the method decl appropriate field to the list. 6113 Note: the grammar ensures that what we get here are class 6114 types. */ 6115 if (throws) 6116 { 6117 throws = nreverse (throws); 6118 for (current = throws; current; current = TREE_CHAIN (current)) 6119 { 6120 register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current), 6121 NULL_TREE, NULL_TREE); 6122 JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) = 6123 &TREE_VALUE (current); 6124 } 6125 DECL_FUNCTION_THROWS (meth) = throws; 6126 } 6127 6128 /* We set the DECL_NAME to ID so we can track the location where 6129 the function was declared. This allow us to report 6130 redefinition error accurately. When method are verified, 6131 DECL_NAME is reinstalled properly (using the content of the 6132 WFL node ID) (see check_method_redefinition). We don't do that 6133 when Object is being defined. Constructor <init> names will be 6134 reinstalled the same way. */ 6135 if (TREE_TYPE (ctxp->current_parsed_class) != object_type_node) 6136 DECL_NAME (meth) = id; 6137 6138 /* Set the flag if we correctly processed a constructor */ 6139 if (constructor_ok) 6140 DECL_CONSTRUCTOR_P (meth) = 1; 6141 6142 /* Eventually set the @deprecated tag flag */ 6143 CHECK_DEPRECATED (meth); 6144 6145 /* If doing xref, store column and line number information instead 6146 of the line number only. */ 6147 if (flag_emit_xref) 6148 DECL_SOURCE_LINE (meth) = EXPR_WFL_LINECOL (id); 6149 6150 return meth; 6151} 6152 6153static void 6154fix_method_argument_names (orig_arg, meth) 6155 tree orig_arg, meth; 6156{ 6157 tree arg = TYPE_ARG_TYPES (TREE_TYPE (meth)); 6158 if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE) 6159 { 6160 TREE_PURPOSE (arg) = this_identifier_node; 6161 arg = TREE_CHAIN (arg); 6162 } 6163 while (orig_arg != end_params_node) 6164 { 6165 TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg); 6166 orig_arg = TREE_CHAIN (orig_arg); 6167 arg = TREE_CHAIN (arg); 6168 } 6169} 6170 6171/* Complete the method declaration with METHOD_BODY. */ 6172 6173static void 6174finish_method_declaration (method_body) 6175 tree method_body; 6176{ 6177 int flags = get_access_flags_from_decl (current_function_decl); 6178 6179 /* 8.4.5 Method Body */ 6180 if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body) 6181 { 6182 tree wfl = DECL_NAME (current_function_decl); 6183 parse_error_context (wfl, 6184 "%s method `%s' can't have a body defined", 6185 (METHOD_NATIVE (current_function_decl) ? 6186 "Native" : "Abstract"), 6187 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); 6188 method_body = NULL_TREE; 6189 } 6190 else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body) 6191 { 6192 tree wfl = DECL_NAME (current_function_decl); 6193 parse_error_context (wfl, 6194 "Non native and non abstract method `%s' must " 6195 "have a body defined", 6196 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); 6197 method_body = NULL_TREE; 6198 } 6199 6200 if (flag_emit_class_files && method_body 6201 && TREE_CODE (method_body) == NOP_EXPR 6202 && TREE_TYPE (current_function_decl) 6203 && TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node) 6204 method_body = build1 (RETURN_EXPR, void_type_node, NULL); 6205 6206 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body; 6207 maybe_absorb_scoping_blocks (); 6208 /* Exit function's body */ 6209 exit_block (); 6210 /* Merge last line of the function with first line, directly in the 6211 function decl. It will be used to emit correct debug info. */ 6212 if (!flag_emit_xref) 6213 DECL_SOURCE_LINE_MERGE (current_function_decl, ctxp->last_ccb_indent1); 6214 /* So we don't have an irrelevant function declaration context for 6215 the next static block we'll see. */ 6216 current_function_decl = NULL_TREE; 6217} 6218 6219/* Build a an error message for constructor circularity errors. */ 6220 6221static char * 6222constructor_circularity_msg (from, to) 6223 tree from, to; 6224{ 6225 static char string [4096]; 6226 char *t = strdup (lang_printable_name (from, 0)); 6227 sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0)); 6228 free (t); 6229 return string; 6230} 6231 6232/* Verify a circular call to METH. Return 1 if an error is found, 0 6233 otherwise. */ 6234 6235static int 6236verify_constructor_circularity (meth, current) 6237 tree meth, current; 6238{ 6239 static tree list = NULL_TREE; 6240 tree c; 6241 for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c)) 6242 { 6243 if (TREE_VALUE (c) == meth) 6244 { 6245 char *t; 6246 if (list) 6247 { 6248 tree liste; 6249 list = nreverse (list); 6250 for (liste = list; liste; liste = TREE_CHAIN (liste)) 6251 { 6252 parse_error_context 6253 (TREE_PURPOSE (TREE_PURPOSE (liste)), 6254 constructor_circularity_msg 6255 (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste)))); 6256 java_error_count--; 6257 } 6258 } 6259 t = strdup (lang_printable_name (meth, 0)); 6260 parse_error_context (TREE_PURPOSE (c), 6261 "%s: recursive invocation of constructor `%s'", 6262 constructor_circularity_msg (current, meth), t); 6263 free (t); 6264 list = NULL_TREE; 6265 return 1; 6266 } 6267 } 6268 for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c)) 6269 { 6270 list = tree_cons (c, current, list); 6271 if (verify_constructor_circularity (meth, TREE_VALUE (c))) 6272 return 1; 6273 list = TREE_CHAIN (list); 6274 } 6275 return 0; 6276} 6277 6278/* Check modifiers that can be declared but exclusively */ 6279 6280static void 6281check_modifiers_consistency (flags) 6282 int flags; 6283{ 6284 int acc_count = 0; 6285 tree cl = NULL_TREE; 6286 6287 THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl); 6288 THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl); 6289 THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl); 6290 if (acc_count > 1) 6291 parse_error_context 6292 (cl, "Inconsistent member declaration. At most one of `public', " 6293 "`private', or `protected' may be specified"); 6294} 6295 6296/* Check the methode header METH for abstract specifics features */ 6297 6298static void 6299check_abstract_method_header (meth) 6300 tree meth; 6301{ 6302 int flags = get_access_flags_from_decl (meth); 6303 /* DECL_NAME might still be a WFL node */ 6304 tree name = GET_METHOD_NAME (meth); 6305 6306 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK), flags, 6307 ACC_ABSTRACT, "abstract method `%s'", 6308 IDENTIFIER_POINTER (name)); 6309 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), flags, 6310 ACC_PUBLIC, "abstract method `%s'", 6311 IDENTIFIER_POINTER (name)); 6312 6313 check_modifiers ("Illegal modifier `%s' for interface method", 6314 flags, INTERFACE_METHOD_MODIFIERS); 6315} 6316 6317/* Create a FUNCTION_TYPE node and start augmenting it with the 6318 declared function arguments. Arguments type that can't be resolved 6319 are left as they are, but the returned node is marked as containing 6320 incomplete types. */ 6321 6322static tree 6323method_declarator (id, list) 6324 tree id, list; 6325{ 6326 tree arg_types = NULL_TREE, current, node; 6327 tree meth = make_node (FUNCTION_TYPE); 6328 jdep *jdep; 6329 6330 patch_stage = JDEP_NO_PATCH; 6331 6332 for (current = list; current; current = TREE_CHAIN (current)) 6333 { 6334 int must_chain = 0; 6335 tree wfl_name = TREE_PURPOSE (current); 6336 tree type = TREE_VALUE (current); 6337 tree name = EXPR_WFL_NODE (wfl_name); 6338 tree already, arg_node; 6339 tree type_wfl = NULL_TREE; 6340 tree real_type; 6341 6342 /* Obtain a suitable type for resolution, if necessary */ 6343 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain); 6344 6345 /* Process NAME, as it may specify extra dimension(s) for it */ 6346 type = build_array_from_name (type, type_wfl, name, &name); 6347 EXPR_WFL_NODE (wfl_name) = name; 6348 6349 real_type = GET_REAL_TYPE (type); 6350 if (TREE_CODE (real_type) == RECORD_TYPE) 6351 { 6352 real_type = promote_type (real_type); 6353 if (TREE_CODE (type) == TREE_LIST) 6354 TREE_PURPOSE (type) = real_type; 6355 } 6356 6357 /* Check redefinition */ 6358 for (already = arg_types; already; already = TREE_CHAIN (already)) 6359 if (TREE_PURPOSE (already) == name) 6360 { 6361 parse_error_context 6362 (wfl_name, "Variable `%s' is used more than once in the " 6363 "argument list of method `%s'", IDENTIFIER_POINTER (name), 6364 IDENTIFIER_POINTER (EXPR_WFL_NODE (id))); 6365 break; 6366 } 6367 6368 /* If we've an incomplete argument type, we know there is a location 6369 to patch when the type get resolved, later. */ 6370 jdep = NULL; 6371 if (must_chain) 6372 { 6373 patch_stage = JDEP_METHOD; 6374 type = register_incomplete_type (patch_stage, 6375 type_wfl, wfl_name, type); 6376 jdep = CLASSD_LAST (ctxp->classd_list); 6377 JDEP_MISC (jdep) = id; 6378 } 6379 6380 /* The argument node: a name and a (possibly) incomplete type */ 6381 arg_node = build_tree_list (name, real_type); 6382 if (jdep) 6383 JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node); 6384 TREE_CHAIN (arg_node) = arg_types; 6385 arg_types = arg_node; 6386 } 6387 TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node); 6388 node = build_tree_list (id, meth); 6389 return node; 6390} 6391 6392static int 6393unresolved_type_p (wfl, returned) 6394 tree wfl; 6395 tree *returned; 6396 6397{ 6398 if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION) 6399 { 6400 tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl)); 6401 if (returned) 6402 *returned = (decl ? TREE_TYPE (decl) : NULL_TREE); 6403 return 1; 6404 } 6405 if (returned) 6406 *returned = wfl; 6407 return 0; 6408} 6409 6410/* From NAME, build a qualified identifier node using the 6411 qualification from the current package definition. */ 6412 6413static tree 6414parser_qualified_classname (name) 6415 tree name; 6416{ 6417 if (ctxp->package) 6418 return merge_qualified_name (ctxp->package, EXPR_WFL_NODE (name)); 6419 else 6420 return EXPR_WFL_NODE (name); 6421} 6422 6423/* Called once the type a interface extends is resolved. Returns 0 if 6424 everything is OK. */ 6425 6426static int 6427parser_check_super_interface (super_decl, this_decl, this_wfl) 6428 tree super_decl, this_decl, this_wfl; 6429{ 6430 tree super_type = TREE_TYPE (super_decl); 6431 6432 /* Has to be an interface */ 6433 if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl)))) 6434 { 6435 parse_error_context 6436 (this_wfl, "Can't use %s `%s' to implement/extend %s `%s'", 6437 (TYPE_ARRAY_P (super_type) ? "array" : "class"), 6438 IDENTIFIER_POINTER (DECL_NAME (super_decl)), 6439 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ? 6440 "interface" : "class"), 6441 IDENTIFIER_POINTER (DECL_NAME (this_decl))); 6442 return 1; 6443 } 6444 6445 /* Check scope: same package OK, other package: OK if public */ 6446 if (check_pkg_class_access (DECL_NAME (super_decl), lookup_cl (this_decl))) 6447 return 1; 6448 6449 SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s", 6450 IDENTIFIER_POINTER (DECL_NAME (this_decl)), 6451 IDENTIFIER_POINTER (DECL_NAME (super_decl)))); 6452 return 0; 6453} 6454 6455/* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns 6456 0 if everthing is OK. */ 6457 6458static int 6459parser_check_super (super_decl, this_decl, wfl) 6460 tree super_decl, this_decl, wfl; 6461{ 6462 tree super_type = TREE_TYPE (super_decl); 6463 6464 /* SUPER should be a CLASS (neither an array nor an interface) */ 6465 if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type))) 6466 { 6467 parse_error_context 6468 (wfl, "Class `%s' can't subclass %s `%s'", 6469 IDENTIFIER_POINTER (DECL_NAME (this_decl)), 6470 (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"), 6471 IDENTIFIER_POINTER (DECL_NAME (super_decl))); 6472 return 1; 6473 } 6474 6475 if (CLASS_FINAL (TYPE_NAME (super_type))) 6476 { 6477 parse_error_context (wfl, "Can't subclass final classes: %s", 6478 IDENTIFIER_POINTER (DECL_NAME (super_decl))); 6479 return 1; 6480 } 6481 6482 /* Check scope: same package OK, other package: OK if public */ 6483 if (check_pkg_class_access (DECL_NAME (super_decl), wfl)) 6484 return 1; 6485 6486 SOURCE_FRONTEND_DEBUG (("Completing class %s with %s", 6487 IDENTIFIER_POINTER (DECL_NAME (this_decl)), 6488 IDENTIFIER_POINTER (DECL_NAME (super_decl)))); 6489 return 0; 6490} 6491 6492/* Create a new dependency list and link it (in a LIFO manner) to the 6493 CTXP list of type dependency list. */ 6494 6495static void 6496create_jdep_list (ctxp) 6497 struct parser_ctxt *ctxp; 6498{ 6499 jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist)); 6500 new->first = new->last = NULL; 6501 new->next = ctxp->classd_list; 6502 ctxp->classd_list = new; 6503} 6504 6505static jdeplist * 6506reverse_jdep_list (ctxp) 6507 struct parser_ctxt *ctxp; 6508{ 6509 register jdeplist *prev = NULL, *current, *next; 6510 for (current = ctxp->classd_list; current; current = next) 6511 { 6512 next = current->next; 6513 current->next = prev; 6514 prev = current; 6515 } 6516 return prev; 6517} 6518 6519/* Create a fake pointer based on the ID stored in 6520 TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be 6521 registered again. */ 6522 6523static tree 6524obtain_incomplete_type (type_name) 6525 tree type_name; 6526{ 6527 tree ptr, name; 6528 6529 if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION) 6530 name = EXPR_WFL_NODE (type_name); 6531 else if (INCOMPLETE_TYPE_P (type_name)) 6532 name = TYPE_NAME (type_name); 6533 else 6534 fatal ("invalid type name - obtain_incomplete_type"); 6535 6536 for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr)) 6537 if (TYPE_NAME (ptr) == name) 6538 break; 6539 6540 if (!ptr) 6541 { 6542 push_obstacks (&permanent_obstack, &permanent_obstack); 6543 BUILD_PTR_FROM_NAME (ptr, name); 6544 layout_type (ptr); 6545 pop_obstacks (); 6546 TREE_CHAIN (ptr) = ctxp->incomplete_class; 6547 ctxp->incomplete_class = ptr; 6548 } 6549 6550 return ptr; 6551} 6552 6553/* Register a incomplete type whose name is WFL. Reuse PTR if PTR is 6554 non NULL instead of computing a new fake type based on WFL. The new 6555 dependency is inserted in the current type dependency list, in FIFO 6556 manner. */ 6557 6558static tree 6559register_incomplete_type (kind, wfl, decl, ptr) 6560 int kind; 6561 tree wfl, decl, ptr; 6562{ 6563 jdep *new = (jdep *)xmalloc (sizeof (jdep)); 6564 6565 if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */ 6566 ptr = obtain_incomplete_type (wfl); 6567 6568 JDEP_KIND (new) = kind; 6569 JDEP_DECL (new) = decl; 6570 JDEP_SOLV (new) = ptr; 6571 JDEP_WFL (new) = wfl; 6572 JDEP_CHAIN (new) = NULL; 6573 JDEP_MISC (new) = NULL_TREE; 6574 JDEP_GET_PATCH (new) = (tree *)NULL; 6575 6576 JDEP_INSERT (ctxp->classd_list, new); 6577 6578 return ptr; 6579} 6580 6581void 6582java_check_circular_reference () 6583{ 6584 tree current; 6585 for (current = ctxp->class_list; current; current = TREE_CHAIN (current)) 6586 { 6587 tree type = TREE_TYPE (current); 6588 if (CLASS_INTERFACE (TYPE_NAME (type))) 6589 { 6590 /* Check all interfaces this class extends */ 6591 tree basetype_vec = TYPE_BINFO_BASETYPES (type); 6592 int n, i; 6593 6594 if (!basetype_vec) 6595 return; 6596 n = TREE_VEC_LENGTH (basetype_vec); 6597 for (i = 0; i < n; i++) 6598 { 6599 tree vec_elt = TREE_VEC_ELT (basetype_vec, i); 6600 if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node 6601 && interface_of_p (type, BINFO_TYPE (vec_elt))) 6602 parse_error_context (lookup_cl (current), 6603 "Cyclic interface inheritance"); 6604 } 6605 } 6606 else 6607 if (inherits_from_p (CLASSTYPE_SUPER (type), type)) 6608 parse_error_context (lookup_cl (current), 6609 "Cyclic class inheritance"); 6610 } 6611} 6612 6613/* safe_layout_class just makes sure that we can load a class without 6614 disrupting the current_class, input_file, lineno, etc, information 6615 about the class processed currently. */ 6616 6617void 6618safe_layout_class (class) 6619 tree class; 6620{ 6621 tree save_current_class = current_class; 6622 char *save_input_filename = input_filename; 6623 int save_lineno = lineno; 6624 6625 push_obstacks (&permanent_obstack, &permanent_obstack); 6626 6627 layout_class (class); 6628 pop_obstacks (); 6629 6630 current_class = save_current_class; 6631 input_filename = save_input_filename; 6632 lineno = save_lineno; 6633 CLASS_LOADED_P (class) = 1; 6634} 6635 6636static tree 6637jdep_resolve_class (dep) 6638 jdep *dep; 6639{ 6640 tree decl; 6641 6642 if (JDEP_RESOLVED_P (dep)) 6643 decl = JDEP_RESOLVED_DECL (dep); 6644 else 6645 { 6646 decl = resolve_class (JDEP_TO_RESOLVE (dep), 6647 JDEP_DECL (dep), JDEP_WFL (dep)); 6648 JDEP_RESOLVED (dep, decl); 6649 } 6650 6651 if (!decl) 6652 complete_class_report_errors (dep); 6653 6654 return decl; 6655} 6656 6657/* Complete unsatisfied class declaration and their dependencies */ 6658 6659void 6660java_complete_class () 6661{ 6662 tree cclass; 6663 jdeplist *cclassd; 6664 int error_found; 6665 tree type; 6666 6667 push_obstacks (&permanent_obstack, &permanent_obstack); 6668 6669 /* Process imports and reverse the import on demand list */ 6670 process_imports (); 6671 if (ctxp->import_demand_list) 6672 ctxp->import_demand_list = nreverse (ctxp->import_demand_list); 6673 6674 /* Rever things so we have the right order */ 6675 ctxp->class_list = nreverse (ctxp->class_list); 6676 ctxp->classd_list = reverse_jdep_list (ctxp); 6677 6678 for (cclassd = ctxp->classd_list, cclass = ctxp->class_list; 6679 cclass && cclassd; 6680 cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd)) 6681 { 6682 jdep *dep; 6683 for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep)) 6684 { 6685 tree decl; 6686 if (!(decl = jdep_resolve_class (dep))) 6687 continue; 6688 6689 /* Now it's time to patch */ 6690 switch (JDEP_KIND (dep)) 6691 { 6692 case JDEP_SUPER: 6693 /* Simply patch super */ 6694 if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep))) 6695 continue; 6696 BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO 6697 (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl); 6698 break; 6699 6700 case JDEP_FIELD: 6701 { 6702 /* We do part of the job done in add_field */ 6703 tree field_decl = JDEP_DECL (dep); 6704 tree field_type = TREE_TYPE (decl); 6705 push_obstacks (&permanent_obstack, &permanent_obstack); 6706 if (TREE_CODE (field_type) == RECORD_TYPE) 6707 field_type = promote_type (field_type); 6708 pop_obstacks (); 6709 TREE_TYPE (field_decl) = field_type; 6710 DECL_ALIGN (field_decl) = 0; 6711 layout_decl (field_decl, 0); 6712 SOURCE_FRONTEND_DEBUG 6713 (("Completed field/var decl `%s' with `%s'", 6714 IDENTIFIER_POINTER (DECL_NAME (field_decl)), 6715 IDENTIFIER_POINTER (DECL_NAME (decl)))); 6716 break; 6717 } 6718 case JDEP_METHOD: /* We start patching a method */ 6719 case JDEP_METHOD_RETURN: 6720 error_found = 0; 6721 while (1) 6722 { 6723 if (decl) 6724 { 6725 type = TREE_TYPE(decl); 6726 if (TREE_CODE (type) == RECORD_TYPE) 6727 type = promote_type (type); 6728 JDEP_APPLY_PATCH (dep, type); 6729 SOURCE_FRONTEND_DEBUG 6730 (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ? 6731 "Completing fct `%s' with ret type `%s'": 6732 "Completing arg `%s' with type `%s'"), 6733 IDENTIFIER_POINTER (EXPR_WFL_NODE 6734 (JDEP_DECL_WFL (dep))), 6735 IDENTIFIER_POINTER (DECL_NAME (decl)))); 6736 } 6737 else 6738 error_found = 1; 6739 dep = JDEP_CHAIN (dep); 6740 if (JDEP_KIND (dep) == JDEP_METHOD_END) 6741 break; 6742 else 6743 decl = jdep_resolve_class (dep); 6744 } 6745 if (!error_found) 6746 { 6747 tree mdecl = JDEP_DECL (dep), signature; 6748 push_obstacks (&permanent_obstack, &permanent_obstack); 6749 /* Recompute and reset the signature */ 6750 signature = build_java_signature (TREE_TYPE (mdecl)); 6751 set_java_signature (TREE_TYPE (mdecl), signature); 6752 pop_obstacks (); 6753 } 6754 else 6755 continue; 6756 break; 6757 6758 case JDEP_INTERFACE: 6759 if (parser_check_super_interface (decl, JDEP_DECL (dep), 6760 JDEP_WFL (dep))) 6761 continue; 6762 parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep)); 6763 break; 6764 6765 case JDEP_PARM: 6766 case JDEP_VARIABLE: 6767 type = TREE_TYPE(decl); 6768 if (TREE_CODE (type) == RECORD_TYPE) 6769 type = promote_type (type); 6770 JDEP_APPLY_PATCH (dep, type); 6771 break; 6772 6773 case JDEP_TYPE: 6774 JDEP_APPLY_PATCH (dep, TREE_TYPE (decl)); 6775 SOURCE_FRONTEND_DEBUG 6776 (("Completing a random type dependency on a '%s' node", 6777 tree_code_name [TREE_CODE (JDEP_DECL (dep))])); 6778 break; 6779 6780 case JDEP_EXCEPTION: 6781 JDEP_APPLY_PATCH (dep, TREE_TYPE (decl)); 6782 SOURCE_FRONTEND_DEBUG 6783 (("Completing `%s' `throws' argument node", 6784 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))))); 6785 break; 6786 6787 default: 6788 fatal ("Can't handle patch code %d - java_complete_class", 6789 JDEP_KIND (dep)); 6790 } 6791 } 6792 } 6793 pop_obstacks (); 6794 return; 6795} 6796 6797/* Resolve class CLASS_TYPE. Handle the case of trying to resolve an 6798 array. */ 6799 6800static tree 6801resolve_class (class_type, decl, cl) 6802 tree class_type, decl, cl; 6803{ 6804 char *name = IDENTIFIER_POINTER (TYPE_NAME (class_type)); 6805 char *base = name; 6806 tree resolved_type = TREE_TYPE (class_type); 6807 tree resolved_type_decl; 6808 6809 if (resolved_type != NULL_TREE) 6810 { 6811 tree resolved_type_decl = TYPE_NAME (resolved_type); 6812 if (resolved_type_decl == NULL_TREE 6813 || TREE_CODE (resolved_type_decl) == IDENTIFIER_NODE) 6814 { 6815 resolved_type_decl = build_decl (TYPE_DECL, 6816 TYPE_NAME (class_type), 6817 resolved_type); 6818 } 6819 return resolved_type_decl; 6820 } 6821 6822 /* 1- Check to see if we have an array. If true, find what we really 6823 want to resolve */ 6824 while (name[0] == '[') 6825 name++; 6826 if (base != name) 6827 TYPE_NAME (class_type) = get_identifier (name); 6828 6829 /* 2- Resolve the bare type */ 6830 if (!(resolved_type_decl = do_resolve_class (class_type, decl, cl))) 6831 return NULL_TREE; 6832 resolved_type = TREE_TYPE (resolved_type_decl); 6833 6834 /* 3- If we have and array, reconstruct the array down to its nesting */ 6835 if (base != name) 6836 { 6837 while (base != name) 6838 { 6839 if (TREE_CODE (resolved_type) == RECORD_TYPE) 6840 resolved_type = promote_type (resolved_type); 6841 resolved_type = build_java_array_type (resolved_type, -1); 6842 CLASS_LOADED_P (resolved_type) = 1; 6843 name--; 6844 } 6845 /* Build a fake decl for this, since this is what is expected to 6846 be returned. */ 6847 resolved_type_decl = 6848 build_decl (TYPE_DECL, TYPE_NAME (resolved_type), resolved_type); 6849 /* Figure how those two things are important for error report. FIXME */ 6850 DECL_SOURCE_LINE (resolved_type_decl) = 0; 6851 DECL_SOURCE_FILE (resolved_type_decl) = input_filename; 6852 TYPE_NAME (class_type) = TYPE_NAME (resolved_type); 6853 } 6854 TREE_TYPE (class_type) = resolved_type; 6855 return resolved_type_decl; 6856} 6857 6858/* Effectively perform the resolution of class CLASS_TYPE. DECL or CL 6859 are used to report error messages. */ 6860 6861tree 6862do_resolve_class (class_type, decl, cl) 6863 tree class_type; 6864 tree decl; 6865 tree cl; 6866{ 6867 tree new_class_decl; 6868 tree original_name = NULL_TREE; 6869 6870 /* Do not try to replace TYPE_NAME (class_type) by a variable, since 6871 its is changed by find_in_imports{_on_demand} */ 6872 6873 /* 1- Check for the type in single imports */ 6874 if (find_in_imports (class_type)) 6875 return NULL_TREE; 6876 6877 /* 2- And check for the type in the current compilation unit. If it fails, 6878 try with a name qualified with the package name if appropriate. */ 6879 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) 6880 { 6881 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && 6882 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl))) 6883 load_class (TYPE_NAME (class_type), 0); 6884 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); 6885 } 6886 6887 original_name = TYPE_NAME (class_type); 6888 if (!QUALIFIED_P (TYPE_NAME (class_type)) && ctxp->package) 6889 TYPE_NAME (class_type) = merge_qualified_name (ctxp->package, 6890 TYPE_NAME (class_type)); 6891#if 1 6892 if (!(new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) 6893 load_class (TYPE_NAME (class_type), 0); 6894 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) 6895 { 6896 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && 6897 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl))) 6898 load_class (TYPE_NAME (class_type), 0); 6899 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); 6900 } 6901#else 6902 new_name = TYPE_NAME (class_type); 6903 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_name)) != NULL_TREE) 6904 { 6905 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && 6906 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl))) 6907 load_class (new_name, 0); 6908 return IDENTIFIER_CLASS_VALUE (new_name); 6909 } 6910 else 6911 { 6912 tree class = read_class (new_name); 6913 if (class != NULL_TREE) 6914 { 6915 tree decl = IDENTIFIER_CLASS_VALUE (new_name); 6916 if (decl == NULL_TREE) 6917 decl = push_class (class, new_name); 6918 return decl; 6919 } 6920 } 6921#endif 6922 TYPE_NAME (class_type) = original_name; 6923 6924 /* 3- Check an other compilation unit that bears the name of type */ 6925 load_class (TYPE_NAME (class_type), 0); 6926 if (check_pkg_class_access (TYPE_NAME (class_type), 6927 (cl ? cl : lookup_cl (decl)))) 6928 return NULL_TREE; 6929 6930 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) 6931 return new_class_decl; 6932 6933 /* 4- Check the import on demands. Don't allow bar.baz to be 6934 imported from foo.* */ 6935 if (!QUALIFIED_P (TYPE_NAME (class_type))) 6936 if (find_in_imports_on_demand (class_type)) 6937 return NULL_TREE; 6938 6939 /* 5- Last call for a resolution */ 6940 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); 6941} 6942 6943/* Resolve NAME and lay it out (if not done and if not the current 6944 parsed class). Return a decl node. This function is meant to be 6945 called when type resolution is necessary during the walk pass. */ 6946 6947static tree 6948resolve_and_layout (something, cl) 6949 tree something; 6950 tree cl; 6951{ 6952 tree decl; 6953 6954 /* Don't do that on the current class */ 6955 if (something == current_class) 6956 return TYPE_NAME (current_class); 6957 6958 /* Don't do anything for void and other primitive types */ 6959 if (JPRIMITIVE_TYPE_P (something) || something == void_type_node) 6960 return NULL_TREE; 6961 6962 /* Pointer types can be reall pointer types or fake pointers. When 6963 finding a real pointer, recheck for primitive types */ 6964 if (TREE_CODE (something) == POINTER_TYPE) 6965 { 6966 if (TREE_TYPE (something)) 6967 { 6968 something = TREE_TYPE (something); 6969 if (JPRIMITIVE_TYPE_P (something) || something == void_type_node) 6970 return NULL_TREE; 6971 } 6972 else 6973 something = TYPE_NAME (something); 6974 } 6975 6976 /* Don't do anything for arrays of primitive types */ 6977 if (TREE_CODE (something) == RECORD_TYPE && TYPE_ARRAY_P (something) 6978 && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something))) 6979 return NULL_TREE; 6980 6981 /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL 6982 or a real TYPE */ 6983 if (TREE_CODE (something) != IDENTIFIER_NODE) 6984 something = (TREE_CODE (TYPE_NAME (something)) == TYPE_DECL ? 6985 DECL_NAME (TYPE_NAME (something)) : TYPE_NAME (something)); 6986 6987 if (!(decl = resolve_no_layout (something, cl))) 6988 return NULL_TREE; 6989 6990 /* Resolve and layout if necessary */ 6991 layout_class_methods (TREE_TYPE (decl)); 6992 if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl))) 6993 CHECK_METHODS (decl); 6994 if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl))) 6995 safe_layout_class (TREE_TYPE (decl)); 6996 6997 return decl; 6998} 6999 7000/* Resolve a class, returns its decl but doesn't perform any 7001 layout. The current parsing context is saved and restored */ 7002 7003static tree 7004resolve_no_layout (name, cl) 7005 tree name, cl; 7006{ 7007 tree ptr, decl; 7008 BUILD_PTR_FROM_NAME (ptr, name); 7009 java_parser_context_save_global (); 7010 decl = resolve_class (ptr, NULL_TREE, cl); 7011 java_parser_context_restore_global (); 7012 7013 return decl; 7014} 7015 7016/* Called when reporting errors. Skip leader '[' in a complex array 7017 type description that failed to be resolved. */ 7018 7019static char * 7020purify_type_name (name) 7021 char *name; 7022{ 7023 while (*name && *name == '[') 7024 name++; 7025 return name; 7026} 7027 7028/* The type CURRENT refers to can't be found. We print error messages. */ 7029 7030static void 7031complete_class_report_errors (dep) 7032 jdep *dep; 7033{ 7034 char *name; 7035 7036 if (!JDEP_WFL (dep)) 7037 return; 7038 7039 name = IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))); 7040 switch (JDEP_KIND (dep)) 7041 { 7042 case JDEP_SUPER: 7043 parse_error_context 7044 (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found", 7045 purify_type_name (name), 7046 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); 7047 break; 7048 case JDEP_FIELD: 7049 parse_error_context 7050 (JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'", 7051 purify_type_name (name), 7052 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); 7053 break; 7054 case JDEP_METHOD: /* Covers arguments */ 7055 parse_error_context 7056 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the " 7057 "argument `%s' of method `%s'", 7058 purify_type_name (name), 7059 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))), 7060 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep)))); 7061 break; 7062 case JDEP_METHOD_RETURN: /* Covers return type */ 7063 parse_error_context 7064 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the " 7065 "return type of method `%s'", 7066 purify_type_name (name), 7067 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep)))); 7068 break; 7069 case JDEP_INTERFACE: 7070 parse_error_context 7071 (JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found", 7072 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))), 7073 (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")), 7074 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); 7075 break; 7076 case JDEP_VARIABLE: 7077 parse_error_context 7078 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the " 7079 "local variable `%s'", 7080 purify_type_name (IDENTIFIER_POINTER 7081 (EXPR_WFL_NODE (JDEP_WFL (dep)))), 7082 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); 7083 break; 7084 case JDEP_EXCEPTION: /* As specified by `throws' */ 7085 parse_error_context 7086 (JDEP_WFL (dep), "Class `%s' not found in `throws'", 7087 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))); 7088 break; 7089 default: 7090 /* Fix for -Wall. Just break doing nothing. The error will be 7091 caught later */ 7092 break; 7093 } 7094} 7095 7096/* Check uninitialized final. */ 7097 7098void 7099java_check_final () 7100{ 7101} 7102 7103/* Return a static string containing the DECL prototype string. If 7104 DECL is a constructor, use the class name instead of the form 7105 <init> */ 7106 7107static char * 7108get_printable_method_name (decl) 7109 tree decl; 7110{ 7111 char *to_return; 7112 tree name = NULL_TREE; 7113 7114 if (DECL_CONSTRUCTOR_P (decl)) 7115 { 7116 name = DECL_NAME (decl); 7117 DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))); 7118 } 7119 7120 to_return = lang_printable_name (decl, 0); 7121 if (DECL_CONSTRUCTOR_P (decl)) 7122 DECL_NAME (decl) = name; 7123 7124 return to_return; 7125} 7126 7127/* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method 7128 nevertheless needs to be verfied, 1 otherwise. */ 7129 7130static int 7131reset_method_name (method) 7132 tree method; 7133{ 7134 if (!IS_CLINIT (method) && DECL_NAME (method) != finit_identifier_node) 7135 { 7136 /* NAME is just the plain name when Object is being defined */ 7137 if (DECL_CONTEXT (method) != object_type_node) 7138 DECL_NAME (method) = (DECL_CONSTRUCTOR_P (method) ? 7139 init_identifier_node : GET_METHOD_NAME (method)); 7140 return 0; 7141 } 7142 else 7143 return 1; 7144} 7145 7146/* Return the name of METHOD_DECL, when DECL_NAME is a WFL */ 7147 7148tree 7149java_get_real_method_name (method_decl) 7150 tree method_decl; 7151{ 7152 tree method_name = DECL_NAME (method_decl); 7153 if (DECL_CONSTRUCTOR_P (method_decl)) 7154 return init_identifier_node; 7155 7156 /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P 7157 and still can be a constructor. FIXME */ 7158 7159 /* Don't confuse method only bearing the name of their class as 7160 constructors */ 7161 else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl)) 7162 && ctxp 7163 && ctxp->current_parsed_class_un == EXPR_WFL_NODE (method_name) 7164 && get_access_flags_from_decl (method_decl) <= ACC_PROTECTED 7165 && TREE_TYPE (TREE_TYPE (method_decl)) == void_type_node) 7166 return init_identifier_node; 7167 else 7168 return EXPR_WFL_NODE (method_name); 7169} 7170 7171/* Track method being redefined inside the same class. As a side 7172 effect, set DECL_NAME to an IDENTIFIER (prior entering this 7173 function it's a FWL, so we can track errors more accurately */ 7174 7175static int 7176check_method_redefinition (class, method) 7177 tree class, method; 7178{ 7179 tree redef, name; 7180 tree cl = DECL_NAME (method); 7181 tree sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method)); 7182 /* decl name of artificial <clinit> and $finit$ doesn't need to be 7183 fixed and checked */ 7184 7185 /* Reset the method name before running the check. If it returns 1, 7186 the method doesn't need to be verified with respect to method 7187 redeclaration and we return 0 */ 7188 if (reset_method_name (method)) 7189 return 0; 7190 7191 name = DECL_NAME (method); 7192 for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef)) 7193 { 7194 if (redef == method) 7195 break; 7196 if (DECL_NAME (redef) == name 7197 && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef))) 7198 { 7199 parse_error_context 7200 (cl, "Duplicate %s declaration `%s'", 7201 (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"), 7202 get_printable_method_name (redef)); 7203 return 1; 7204 } 7205 } 7206 return 0; 7207} 7208 7209/* Check all the methods of CLASS. Methods are first completed then 7210 checked according to regular method existance rules. 7211 If no constructor were encountered, then build its declaration. */ 7212 7213static void 7214java_check_regular_methods (class_decl) 7215 tree class_decl; 7216{ 7217 int saw_constructor = 0; 7218 tree method; 7219 tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl)); 7220 tree super_class = CLASSTYPE_SUPER (class); 7221 tree saved_found_wfl = NULL_TREE, found = NULL_TREE; 7222 tree mthrows; 7223 7224 /* It is not necessary to check methods defined in java.lang.Object */ 7225 if (class == object_type_node) 7226 return; 7227 7228 if (!TYPE_NVIRTUALS (class)) 7229 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class)); 7230 7231 /* Should take interfaces into account. FIXME */ 7232 for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method)) 7233 { 7234 tree sig; 7235 tree method_wfl = DECL_NAME (method); 7236 int aflags; 7237 7238 /* If we previously found something and its name was saved, 7239 reinstall it now */ 7240 if (found && saved_found_wfl) 7241 { 7242 DECL_NAME (found) = saved_found_wfl; 7243 saved_found_wfl = NULL_TREE; 7244 } 7245 7246 /* Check for redefinitions */ 7247 if (check_method_redefinition (class, method)) 7248 continue; 7249 7250 /* If we see one constructor a mark so we don't generate the 7251 default one. Also skip other verifications: constructors 7252 can't be inherited hence hiden or overriden */ 7253 if (DECL_CONSTRUCTOR_P (method)) 7254 { 7255 saw_constructor = 1; 7256 continue; 7257 } 7258 7259 /* We verify things thrown by the method. They must inherits from 7260 java.lang.Throwable */ 7261 for (mthrows = DECL_FUNCTION_THROWS (method); 7262 mthrows; mthrows = TREE_CHAIN (mthrows)) 7263 { 7264 if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node)) 7265 parse_error_context 7266 (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be " 7267 "a subclass of class `java.lang.Throwable'", 7268 IDENTIFIER_POINTER 7269 (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows))))); 7270 } 7271 7272 sig = build_java_argument_signature (TREE_TYPE (method)); 7273 found = lookup_argument_method (super_class, DECL_NAME (method), sig); 7274 7275 /* Nothing overrides or it's a private method. */ 7276 if (!found) 7277 continue; 7278 if (METHOD_PRIVATE (found)) 7279 { 7280 found = NULL_TREE; 7281 continue; 7282 } 7283 7284 /* If found wasn't verified, it's DECL_NAME won't be set properly. 7285 We set it temporarily for the sake of the error report. */ 7286 saved_found_wfl = DECL_NAME (found); 7287 reset_method_name (found); 7288 7289 /* Can't override a method with the same name and different return 7290 types. */ 7291 if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method))) 7292 { 7293 char *t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 7294 0)); 7295 parse_error_context 7296 (method_wfl, 7297 "Method `%s' was defined with return type `%s' in class `%s'", 7298 lang_printable_name (found, 0), t, 7299 IDENTIFIER_POINTER 7300 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); 7301 free (t); 7302 } 7303 7304 aflags = get_access_flags_from_decl (found); 7305 /* If the method has default, access in an other package, then 7306 issue a warning that the current method doesn't override the 7307 one that was found elsewhere. Do not issue this warning when 7308 the match was found in java.lang.Object. */ 7309 if (DECL_CONTEXT (found) != object_type_node 7310 && ((aflags & 0x7) == 0) 7311 && !class_in_current_package (DECL_CONTEXT (found)) 7312 && DECL_NAME (found) != clinit_identifier_node 7313 && flag_not_overriding) 7314 { 7315 parse_warning_context 7316 (method_wfl, "Method `%s' in class `%s' does not " 7317 "override the corresponding method in class `%s', which is " 7318 "private to a different package", 7319 lang_printable_name (found, 0), 7320 IDENTIFIER_POINTER (DECL_NAME (class_decl)), 7321 IDENTIFIER_POINTER (DECL_NAME 7322 (TYPE_NAME (DECL_CONTEXT (found))))); 7323 continue; 7324 } 7325 7326 /* Can't override final. Can't override static. */ 7327 if (METHOD_FINAL (found) || METHOD_STATIC (found)) 7328 { 7329 /* Static *can* override static */ 7330 if (METHOD_STATIC (found) && METHOD_STATIC (method)) 7331 continue; 7332 parse_error_context 7333 (method_wfl, 7334 "%s methods can't be overriden. Method `%s' is %s in class `%s'", 7335 (METHOD_FINAL (found) ? "Final" : "Static"), 7336 lang_printable_name (found, 0), 7337 (METHOD_FINAL (found) ? "final" : "static"), 7338 IDENTIFIER_POINTER 7339 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); 7340 continue; 7341 } 7342 7343 /* Static method can't override instance method. */ 7344 if (METHOD_STATIC (method)) 7345 { 7346 parse_error_context 7347 (method_wfl, 7348 "Instance methods can't be overriden by a static method. Method " 7349 "`%s' is an instance method in class `%s'", 7350 lang_printable_name (found, 0), 7351 IDENTIFIER_POINTER 7352 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); 7353 continue; 7354 } 7355 7356 /* - Overriding/hiding public must be public 7357 - Overriding/hiding protected must be protected or public 7358 - If the overriden or hidden method has default (package) 7359 access, then the overriding or hiding method must not be 7360 private; otherwise, a compile-time error occurs */ 7361 if ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method)) 7362 || (METHOD_PROTECTED (found) 7363 && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method))) 7364 || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC)) 7365 && METHOD_PRIVATE (method))) 7366 { 7367 parse_error_context 7368 (method_wfl, 7369 "Methods can't be overridden to be more private. Method `%s' is " 7370 "not %s in class `%s'", lang_printable_name (method, 0), 7371 (METHOD_PUBLIC (method) ? "public" : 7372 (METHOD_PRIVATE (method) ? "private" : "protected")), 7373 IDENTIFIER_POINTER (DECL_NAME 7374 (TYPE_NAME (DECL_CONTEXT (found))))); 7375 continue; 7376 } 7377 7378 /* Overriding methods must have compatible `throws' clauses on checked 7379 exceptions, if any */ 7380 check_throws_clauses (method, method_wfl, found); 7381 7382 /* Inheriting multiple methods with the same signature. FIXME */ 7383 } 7384 7385 /* Don't forget eventual pending found and saved_found_wfl. Take 7386 into account that we might have exited because we saw an 7387 aritifical method as the last entry. */ 7388 7389 if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl) 7390 DECL_NAME (found) = saved_found_wfl; 7391 7392 if (!TYPE_NVIRTUALS (class)) 7393 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class)); 7394 7395 if (!saw_constructor) 7396 { 7397 /* No constructor seen, we craft one, at line 0. Since this 7398 operation takes place after we laid methods out 7399 (layout_class_methods), we prepare the its DECL 7400 appropriately. */ 7401 int flags; 7402 tree decl; 7403 7404 /* If the class is declared PUBLIC, the default constructor is 7405 PUBLIC otherwise it has default access implied by no access 7406 modifiers. */ 7407 flags = (get_access_flags_from_decl (class_decl) & ACC_PUBLIC ? 7408 ACC_PUBLIC : 0); 7409 decl = create_artificial_method (class, flags, void_type_node, 7410 init_identifier_node, end_params_node); 7411 DECL_CONSTRUCTOR_P (decl) = 1; 7412 layout_class_method (TREE_TYPE (class_decl), NULL_TREE, decl, NULL_TREE); 7413 } 7414} 7415 7416/* Return a non zero value if the `throws' clause of METHOD (if any) 7417 is incompatible with the `throws' clause of FOUND (if any). */ 7418 7419static void 7420check_throws_clauses (method, method_wfl, found) 7421 tree method, method_wfl, found; 7422{ 7423 tree mthrows, fthrows; 7424 7425 /* Can't check these things with class loaded from bytecode. FIXME */ 7426 if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found))) 7427 return; 7428 7429 for (mthrows = DECL_FUNCTION_THROWS (method); 7430 mthrows; mthrows = TREE_CHAIN (mthrows)) 7431 { 7432 /* We don't verify unchecked expressions */ 7433 if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows))) 7434 continue; 7435 /* Checked expression must be compatible */ 7436 for (fthrows = DECL_FUNCTION_THROWS (found); 7437 fthrows; fthrows = TREE_CHAIN (fthrows)) 7438 if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows))) 7439 break; 7440 if (!fthrows) 7441 { 7442 parse_error_context 7443 (method_wfl, "Invalid checked exception class `%s' in " 7444 "`throws' clause. The exception must be a subclass of an " 7445 "exception thrown by `%s' from class `%s'", 7446 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))), 7447 lang_printable_name (found, 0), 7448 IDENTIFIER_POINTER 7449 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); 7450 } 7451 } 7452} 7453 7454/* Check abstract method of interface INTERFACE */ 7455 7456static void 7457java_check_abstract_methods (interface_decl) 7458 tree interface_decl; 7459{ 7460 int i, n; 7461 tree method, basetype_vec, found; 7462 tree interface = TREE_TYPE (interface_decl); 7463 7464 for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method)) 7465 { 7466 tree method_wfl = DECL_NAME (method); 7467 7468 /* 2- Check for double definition inside the defining interface */ 7469 if (check_method_redefinition (interface, method)) 7470 continue; 7471 7472 /* 3- Overriding is OK as far as we preserve the return type and 7473 the thrown exceptions (FIXME) */ 7474 found = lookup_java_interface_method2 (interface, method); 7475 if (found) 7476 { 7477 char *t; 7478 tree saved_found_wfl = DECL_NAME (found); 7479 reset_method_name (found); 7480 t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0)); 7481 parse_error_context 7482 (method_wfl, 7483 "Method `%s' was defined with return type `%s' in class `%s'", 7484 lang_printable_name (found, 0), t, 7485 IDENTIFIER_POINTER 7486 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); 7487 free (t); 7488 continue; 7489 7490 DECL_NAME (found) = saved_found_wfl; 7491 } 7492 } 7493 7494 /* 4- Inherited methods can't differ by their returned types */ 7495 if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface))) 7496 return; 7497 n = TREE_VEC_LENGTH (basetype_vec); 7498 for (i = 0; i < n; i++) 7499 { 7500 tree sub_interface_method, sub_interface; 7501 tree vec_elt = TREE_VEC_ELT (basetype_vec, i); 7502 if (!vec_elt) 7503 continue; 7504 sub_interface = BINFO_TYPE (vec_elt); 7505 for (sub_interface_method = TYPE_METHODS (sub_interface); 7506 sub_interface_method; 7507 sub_interface_method = TREE_CHAIN (sub_interface_method)) 7508 { 7509 found = lookup_java_interface_method2 (interface, 7510 sub_interface_method); 7511 if (found && (found != sub_interface_method)) 7512 { 7513 tree saved_found_wfl = DECL_NAME (found); 7514 reset_method_name (found); 7515 parse_error_context 7516 (lookup_cl (sub_interface_method), 7517 "Interface `%s' inherits method `%s' from interface `%s'. " 7518 "This method is redefined with a different return type in " 7519 "interface `%s'", 7520 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))), 7521 lang_printable_name (found, 0), 7522 IDENTIFIER_POINTER 7523 (DECL_NAME (TYPE_NAME 7524 (DECL_CONTEXT (sub_interface_method)))), 7525 IDENTIFIER_POINTER 7526 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); 7527 DECL_NAME (found) = saved_found_wfl; 7528 } 7529 } 7530 } 7531} 7532 7533/* Lookup methods in interfaces using their name and partial 7534 signature. Return a matching method only if their types differ. */ 7535 7536static tree 7537lookup_java_interface_method2 (class, method_decl) 7538 tree class, method_decl; 7539{ 7540 int i, n; 7541 tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return; 7542 7543 if (!basetype_vec) 7544 return NULL_TREE; 7545 7546 n = TREE_VEC_LENGTH (basetype_vec); 7547 for (i = 0; i < n; i++) 7548 { 7549 tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return; 7550 if ((BINFO_TYPE (vec_elt) != object_type_node) 7551 && (to_return = 7552 lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1))) 7553 return to_return; 7554 } 7555 for (i = 0; i < n; i++) 7556 { 7557 to_return = lookup_java_interface_method2 7558 (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl); 7559 if (to_return) 7560 return to_return; 7561 } 7562 7563 return NULL_TREE; 7564} 7565 7566/* Lookup method using their name and partial signature. Return a 7567 matching method only if their types differ. */ 7568 7569static tree 7570lookup_java_method2 (clas, method_decl, do_interface) 7571 tree clas, method_decl; 7572 int do_interface; 7573{ 7574 tree method, method_signature, method_name, method_type, name; 7575 7576 method_signature = build_java_argument_signature (TREE_TYPE (method_decl)); 7577 name = DECL_NAME (method_decl); 7578 method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ? 7579 EXPR_WFL_NODE (name) : name); 7580 method_type = TREE_TYPE (TREE_TYPE (method_decl)); 7581 7582 while (clas != NULL_TREE) 7583 { 7584 for (method = TYPE_METHODS (clas); 7585 method != NULL_TREE; method = TREE_CHAIN (method)) 7586 { 7587 tree method_sig = build_java_argument_signature (TREE_TYPE (method)); 7588 tree name = DECL_NAME (method); 7589 if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ? 7590 EXPR_WFL_NODE (name) : name) == method_name 7591 && method_sig == method_signature 7592 && TREE_TYPE (TREE_TYPE (method)) != method_type) 7593 return method; 7594 } 7595 clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas)); 7596 } 7597 return NULL_TREE; 7598} 7599 7600/* Return the line that matches DECL line number. Used during error 7601 report */ 7602 7603static tree 7604lookup_cl (decl) 7605 tree decl; 7606{ 7607 static tree cl = NULL_TREE; 7608 7609 if (!decl) 7610 return NULL_TREE; 7611 7612 if (cl == NULL_TREE) 7613 cl = build_expr_wfl (NULL_TREE, NULL, 0, 0); 7614 7615 EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl)); 7616 EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1); 7617 7618 return cl; 7619} 7620 7621/* Look for a simple name in the single-type import list */ 7622 7623static tree 7624find_name_in_single_imports (name) 7625 tree name; 7626{ 7627 tree node; 7628 7629 for (node = ctxp->import_list; node; node = TREE_CHAIN (node)) 7630 if (TREE_VALUE (node) == name) 7631 return (EXPR_WFL_NODE (TREE_PURPOSE (node))); 7632 7633 return NULL_TREE; 7634} 7635 7636/* Process all single-type import. */ 7637 7638static int 7639process_imports () 7640{ 7641 tree import; 7642 int error_found; 7643 7644 for (import = ctxp->import_list; import; import = TREE_CHAIN (import)) 7645 { 7646 tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import)); 7647 7648 /* Don't load twice something already defined. */ 7649 if (IDENTIFIER_CLASS_VALUE (to_be_found)) 7650 continue; 7651 QUALIFIED_P (to_be_found) = 1; 7652 load_class (to_be_found, 0); 7653 error_found = 7654 check_pkg_class_access (to_be_found, TREE_PURPOSE (import)); 7655 if (!IDENTIFIER_CLASS_VALUE (to_be_found)) 7656 { 7657 parse_error_context (TREE_PURPOSE (import), 7658 "Class or interface `%s' not found in import", 7659 IDENTIFIER_POINTER (to_be_found)); 7660 return 1; 7661 } 7662 if (error_found) 7663 return 1; 7664 } 7665 return 0; 7666} 7667 7668/* Possibly find a class imported by a single-type import statement. Return 7669 1 if an error occured, 0 otherwise. */ 7670 7671static int 7672find_in_imports (class_type) 7673 tree class_type; 7674{ 7675 tree import; 7676 7677 for (import = ctxp->import_list; import; import = TREE_CHAIN (import)) 7678 if (TREE_VALUE (import) == TYPE_NAME (class_type)) 7679 { 7680 TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import)); 7681 QUALIFIED_P (TYPE_NAME (class_type)) = 1; 7682 } 7683 return 0; 7684} 7685 7686static int 7687note_possible_classname (name, len) 7688 char *name; 7689 int len; 7690{ 7691 tree node; 7692 if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0) 7693 len = len - 5; 7694 else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0) 7695 len = len - 6; 7696 else 7697 return 0; 7698 node = ident_subst (name, len, "", '/', '.', ""); 7699 IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */ 7700 QUALIFIED_P (node) = strchr (name, '/') ? 1 : 0; 7701 return 1; 7702} 7703 7704/* Read a import directory, gathering potential match for further type 7705 references. Indifferently reads a filesystem or a ZIP archive 7706 directory. */ 7707 7708static void 7709read_import_dir (wfl) 7710 tree wfl; 7711{ 7712 tree package_id = EXPR_WFL_NODE (wfl); 7713 char *package_name = IDENTIFIER_POINTER (package_id); 7714 int package_length = IDENTIFIER_LENGTH (package_id); 7715 DIR *dirp = NULL; 7716 JCF *saved_jcf = current_jcf; 7717 7718 int found = 0; 7719 int k; 7720 void *entry; 7721 struct buffer filename[1]; 7722 7723 7724 if (IS_AN_IMPORT_ON_DEMAND_P (package_id)) 7725 return; 7726 IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1; 7727 7728 BUFFER_INIT (filename); 7729 buffer_grow (filename, package_length + 100); 7730 7731 for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry)) 7732 { 7733 char *entry_name = jcf_path_name (entry); 7734 int entry_length = strlen (entry_name); 7735 if (jcf_path_is_zipfile (entry)) 7736 { 7737 ZipFile *zipf; 7738 buffer_grow (filename, entry_length); 7739 memcpy (filename->data, entry_name, entry_length - 1); 7740 filename->data[entry_length-1] = '\0'; 7741 zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry)); 7742 if (zipf == NULL) 7743 error ("malformed .zip archive in CLASSPATH: %s", entry_name); 7744 else 7745 { 7746 ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory; 7747 BUFFER_RESET (filename); 7748 for (k = 0; k < package_length; k++) 7749 { 7750 char ch = package_name[k]; 7751 *filename->ptr++ = ch == '.' ? '/' : ch; 7752 } 7753 *filename->ptr++ = '/'; 7754 7755 for (k = 0; k < zipf->count; k++, zipd = ZIPDIR_NEXT (zipd)) 7756 { 7757 char *current_entry = ZIPDIR_FILENAME (zipd); 7758 int current_entry_len = zipd->filename_length; 7759 7760 if (current_entry_len >= BUFFER_LENGTH (filename) 7761 && strncmp (filename->data, current_entry, 7762 BUFFER_LENGTH (filename)) != 0) 7763 continue; 7764 found |= note_possible_classname (current_entry, 7765 current_entry_len); 7766 } 7767 } 7768 } 7769 else 7770 { 7771 BUFFER_RESET (filename); 7772 buffer_grow (filename, entry_length + package_length + 4); 7773 strcpy (filename->data, entry_name); 7774 filename->ptr = filename->data + entry_length; 7775 for (k = 0; k < package_length; k++) 7776 { 7777 char ch = package_name[k]; 7778 *filename->ptr++ = ch == '.' ? '/' : ch; 7779 } 7780 *filename->ptr = '\0'; 7781 7782 dirp = opendir (filename->data); 7783 if (dirp == NULL) 7784 continue; 7785 *filename->ptr++ = '/'; 7786 for (;;) 7787 { 7788 int len; 7789 char *d_name; 7790 struct dirent *direntp = readdir (dirp); 7791 if (!direntp) 7792 break; 7793 d_name = direntp->d_name; 7794 len = strlen (direntp->d_name); 7795 buffer_grow (filename, len+1); 7796 strcpy (filename->ptr, d_name); 7797 found |= note_possible_classname (filename->data + entry_length, 7798 package_length+len+1); 7799 } 7800 if (dirp) 7801 closedir (dirp); 7802 } 7803 } 7804 7805 free (filename->data); 7806 7807 /* Here we should have a unified way of retrieving an entry, to be 7808 indexed. */ 7809 if (!found) 7810 { 7811 static int first = 1; 7812 if (first) 7813 { 7814 char buffer [256]; 7815 sprintf (buffer, "Can't find default package `%s'. Check " 7816 "the CLASSPATH environment variable and the access to the " 7817 "archives.", package_name); 7818 error (buffer); 7819 java_error_count++; 7820 first = 0; 7821 } 7822 else 7823 parse_error_context (wfl, "Package `%s' not found in import", 7824 package_name); 7825 current_jcf = saved_jcf; 7826 return; 7827 } 7828 current_jcf = saved_jcf; 7829} 7830 7831/* Possibly find a type in the import on demands specified 7832 types. Returns 1 if an error occured, 0 otherwise. Run throught the 7833 entire list, to detected potential double definitions. */ 7834 7835static int 7836find_in_imports_on_demand (class_type) 7837 tree class_type; 7838{ 7839 tree node, import, node_to_use = NULL_TREE; 7840 int seen_once = -1; 7841 tree cl = NULL_TREE; 7842 7843 for (import = ctxp->import_demand_list; import; import = TREE_CHAIN (import)) 7844 { 7845 char *id_name; 7846 obstack_grow (&temporary_obstack, 7847 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))), 7848 IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import)))); 7849 obstack_1grow (&temporary_obstack, '.'); 7850 obstack_grow0 (&temporary_obstack, 7851 IDENTIFIER_POINTER (TYPE_NAME (class_type)), 7852 IDENTIFIER_LENGTH (TYPE_NAME (class_type))); 7853 id_name = obstack_finish (&temporary_obstack); 7854 7855 node = maybe_get_identifier (id_name); 7856 if (node && IS_A_CLASSFILE_NAME (node)) 7857 { 7858 if (seen_once < 0) 7859 { 7860 cl = TREE_PURPOSE (import); 7861 seen_once = 1; 7862 node_to_use = node; 7863 } 7864 else 7865 { 7866 seen_once++; 7867 parse_error_context 7868 (import, "Type `%s' also potentially defined in package `%s'", 7869 IDENTIFIER_POINTER (TYPE_NAME (class_type)), 7870 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import)))); 7871 } 7872 } 7873 } 7874 7875 if (seen_once == 1) 7876 { 7877 /* Setup lineno so that it refers to the line of the import (in 7878 case we parse a class file and encounter errors */ 7879 tree decl; 7880 int saved_lineno = lineno; 7881 lineno = EXPR_WFL_LINENO (cl); 7882 TYPE_NAME (class_type) = node_to_use; 7883 QUALIFIED_P (TYPE_NAME (class_type)) = 1; 7884 decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); 7885 /* If there is no DECL set for the class or if the class isn't 7886 loaded and not seen in source yet, the load */ 7887 if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl)) 7888 && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))) 7889 load_class (node_to_use, 0); 7890 lineno = saved_lineno; 7891 return check_pkg_class_access (TYPE_NAME (class_type), cl); 7892 } 7893 else 7894 return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */ 7895} 7896 7897static tree 7898resolve_package (pkg, next) 7899 tree pkg, *next; 7900{ 7901 tree current; 7902 tree type_name = NULL_TREE; 7903 char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg)); 7904 7905 /* The trick is to determine when the package name stops and were 7906 the name of something contained in the package starts. Then we 7907 return a fully qualified name of what we want to get. */ 7908 7909 /* Do a quick search on well known package names */ 7910 if (!strncmp (name, "java.lang.reflect", 17)) 7911 { 7912 *next = 7913 TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg)))); 7914 type_name = lookup_package_type (name, 17); 7915 } 7916 else if (!strncmp (name, "java.lang", 9)) 7917 { 7918 *next = TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg))); 7919 type_name = lookup_package_type (name, 9); 7920 } 7921 7922 /* If we found something here, return */ 7923 if (type_name) 7924 return type_name; 7925 7926 *next = EXPR_WFL_QUALIFICATION (pkg); 7927 7928 /* Try the current package. */ 7929 if (ctxp->package && !strncmp (name, IDENTIFIER_POINTER (ctxp->package), 7930 IDENTIFIER_LENGTH (ctxp->package))) 7931 { 7932 type_name = 7933 lookup_package_type_and_set_next (name, 7934 IDENTIFIER_LENGTH (ctxp->package), 7935 next ); 7936 if (type_name) 7937 return type_name; 7938 } 7939 7940 /* Search in imported package */ 7941 for (current = ctxp->import_list; current; current = TREE_CHAIN (current)) 7942 { 7943 tree current_pkg_name = EXPR_WFL_NODE (TREE_PURPOSE (current)); 7944 int len = IDENTIFIER_LENGTH (current_pkg_name); 7945 if (!strncmp (name, IDENTIFIER_POINTER (current_pkg_name), len)) 7946 { 7947 tree left, dummy; 7948 7949 breakdown_qualified (&left, &dummy, current_pkg_name); 7950 len = IDENTIFIER_LENGTH (left); 7951 type_name = lookup_package_type_and_set_next (name, len, next); 7952 if (type_name) 7953 break; 7954 } 7955 } 7956 7957 return type_name; 7958} 7959 7960static tree 7961lookup_package_type_and_set_next (name, len, next) 7962 char *name; 7963 int len; 7964 tree *next; 7965{ 7966 char *ptr; 7967 tree type_name = lookup_package_type (name, len); 7968 7969 if (!type_name) 7970 return NULL; 7971 7972 ptr = IDENTIFIER_POINTER (type_name); 7973 while (ptr && (ptr = strchr (ptr, '.'))) 7974 { 7975 *next = TREE_CHAIN (*next); 7976 ptr++; 7977 } 7978 return type_name; 7979} 7980 7981static tree 7982lookup_package_type (name, from) 7983 char *name; 7984 int from; 7985{ 7986 char subname [128]; 7987 char *sub = &name[from+1]; 7988 while (*sub != '.' && *sub) 7989 sub++; 7990 strncpy (subname, name, sub-name); 7991 subname [sub-name] = '\0'; 7992 return get_identifier (subname); 7993} 7994 7995/* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no 7996 access violations were found, 1 otherwise. */ 7997 7998static int 7999check_pkg_class_access (class_name, cl) 8000 tree class_name; 8001 tree cl; 8002{ 8003 tree type; 8004 8005 if (!QUALIFIED_P (class_name) || !IDENTIFIER_CLASS_VALUE (class_name)) 8006 return 0; 8007 8008 if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name)))) 8009 return 0; 8010 8011 if (!CLASS_PUBLIC (TYPE_NAME (type))) 8012 { 8013 /* Access to a private class within the same package is 8014 allowed. */ 8015 tree l, r; 8016 breakdown_qualified (&l, &r, class_name); 8017 if (l == ctxp->package) 8018 return 0; 8019 8020 parse_error_context 8021 (cl, "Can't access %s `%s'. Only public classes and interfaces in " 8022 "other packages can be accessed", 8023 (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"), 8024 IDENTIFIER_POINTER (class_name)); 8025 return 1; 8026 } 8027 return 0; 8028} 8029 8030/* Local variable declaration. */ 8031 8032static void 8033declare_local_variables (modifier, type, vlist) 8034 int modifier; 8035 tree type; 8036 tree vlist; 8037{ 8038 tree decl, current, saved_type; 8039 tree type_wfl = NULL_TREE; 8040 int must_chain = 0; 8041 8042 /* Push a new block if statements were seen between the last time we 8043 pushed a block and now. Keep a cound of block to close */ 8044 if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl))) 8045 { 8046 tree body = GET_CURRENT_BLOCK (current_function_decl); 8047 tree b = enter_block (); 8048 BLOCK_EXPR_ORIGIN (b) = body; 8049 } 8050 8051 if (modifier) 8052 { 8053 int i; 8054 for (i = 0; i <= 10; i++) if (1 << i & modifier) break; 8055 if (modifier == ACC_FINAL) 8056 { 8057 if (flag_static_local_jdk1_1) 8058 parse_warning_context (ctxp->modifier_ctx [i], 8059 "Unsupported JDK1.1 `final' local variable " 8060 "(treated as non final)"); 8061 } 8062 else 8063 { 8064 parse_error_context 8065 (ctxp->modifier_ctx [i], 8066 "Only `final' is allowed as a local variables modifier"); 8067 return; 8068 } 8069 } 8070 8071 /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will 8072 hold the TYPE value if a new incomplete has to be created (as 8073 opposed to being found already existing and reused). */ 8074 SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain); 8075 8076 /* If TYPE is fully resolved and we don't have a reference, make one */ 8077 PROMOTE_RECORD_IF_COMPLETE (type, must_chain); 8078 8079 /* Go through all the declared variables */ 8080 for (current = vlist, saved_type = type; current; 8081 current = TREE_CHAIN (current), type = saved_type) 8082 { 8083 tree other, real_type; 8084 tree wfl = TREE_PURPOSE (current); 8085 tree name = EXPR_WFL_NODE (wfl); 8086 tree init = TREE_VALUE (current); 8087 8088 /* Process NAME, as it may specify extra dimension(s) for it */ 8089 type = build_array_from_name (type, type_wfl, name, &name); 8090 8091 /* Variable redefinition check */ 8092 if ((other = lookup_name_in_blocks (name))) 8093 { 8094 variable_redefinition_error (wfl, name, TREE_TYPE (other), 8095 DECL_SOURCE_LINE (other)); 8096 continue; 8097 } 8098 8099 /* Type adjustment. We may have just readjusted TYPE because 8100 the variable specified more dimensions. Make sure we have 8101 a reference if we can and don't have one already. */ 8102 PROMOTE_RECORD_IF_COMPLETE (type, must_chain); 8103 8104 real_type = GET_REAL_TYPE (type); 8105 /* Never layout this decl. This will be done when its scope 8106 will be entered */ 8107 decl = build_decl (VAR_DECL, name, real_type); 8108 BLOCK_CHAIN_DECL (decl); 8109 8110 /* If doing xreferencing, replace the line number with the WFL 8111 compound value */ 8112 if (flag_emit_xref) 8113 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl); 8114 8115 /* Don't try to use an INIT statement when an error was found */ 8116 if (init && java_error_count) 8117 init = NULL_TREE; 8118 8119 /* Add the initialization function to the current function's code */ 8120 if (init) 8121 { 8122 /* Name might have been readjusted */ 8123 EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = name; 8124 MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1; 8125 java_method_add_stmt (current_function_decl, 8126 build_debugable_stmt (EXPR_WFL_LINECOL (init), 8127 init)); 8128 } 8129 8130 /* Setup dependency the type of the decl */ 8131 if (must_chain) 8132 { 8133 jdep *dep; 8134 register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type); 8135 dep = CLASSD_LAST (ctxp->classd_list); 8136 JDEP_GET_PATCH (dep) = &TREE_TYPE (decl); 8137 } 8138 } 8139 SOURCE_FRONTEND_DEBUG (("Defined locals")); 8140} 8141 8142/* Called during parsing. Build decls from argument list. */ 8143 8144static void 8145source_start_java_method (fndecl) 8146 tree fndecl; 8147{ 8148 tree tem; 8149 tree parm_decl; 8150 int i; 8151 8152 current_function_decl = fndecl; 8153 8154 /* New scope for the function */ 8155 enter_block (); 8156 for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0; 8157 tem != end_params_node; tem = TREE_CHAIN (tem), i++) 8158 { 8159 tree type = TREE_VALUE (tem); 8160 tree name = TREE_PURPOSE (tem); 8161 8162 /* If type is incomplete. Create an incomplete decl and ask for 8163 the decl to be patched later */ 8164 if (INCOMPLETE_TYPE_P (type)) 8165 { 8166 jdep *jdep; 8167 tree real_type = GET_REAL_TYPE (type); 8168 parm_decl = build_decl (PARM_DECL, name, real_type); 8169 type = obtain_incomplete_type (type); 8170 register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type); 8171 jdep = CLASSD_LAST (ctxp->classd_list); 8172 JDEP_MISC (jdep) = name; 8173 JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl); 8174 } 8175 else 8176 parm_decl = build_decl (PARM_DECL, name, type); 8177 8178 BLOCK_CHAIN_DECL (parm_decl); 8179 } 8180 tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)); 8181 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) = 8182 nreverse (tem); 8183 DECL_ARG_SLOT_COUNT (current_function_decl) = i; 8184} 8185 8186/* Called during parsing. Creates an artificial method declaration. */ 8187 8188static tree 8189create_artificial_method (class, flags, type, name, args) 8190 tree class; 8191 int flags; 8192 tree type, name, args; 8193{ 8194 int saved_lineno = lineno; 8195 tree mdecl; 8196 8197 lineno = 0; 8198 mdecl = make_node (FUNCTION_TYPE); 8199 TREE_TYPE (mdecl) = type; 8200 TYPE_ARG_TYPES (mdecl) = args; 8201 mdecl = add_method (class, flags, name, build_java_signature (mdecl)); 8202 lineno = saved_lineno; 8203 DECL_ARTIFICIAL (mdecl) = 1; 8204 return mdecl; 8205} 8206 8207/* Starts the body if an artifical method. */ 8208 8209static void 8210start_artificial_method_body (mdecl) 8211 tree mdecl; 8212{ 8213 DECL_SOURCE_LINE (mdecl) = 1; 8214 DECL_SOURCE_LINE_MERGE (mdecl, 1); 8215 source_start_java_method (mdecl); 8216 enter_block (); 8217} 8218 8219static void 8220end_artificial_method_body (mdecl) 8221 tree mdecl; 8222{ 8223 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block (); 8224 exit_block (); 8225} 8226 8227/* Called during expansion. Push decls formerly built from argument 8228 list so they're usable during expansion. */ 8229 8230static void 8231expand_start_java_method (fndecl) 8232 tree fndecl; 8233{ 8234 tree tem, *ptr; 8235 8236 current_function_decl = fndecl; 8237 8238 announce_function (fndecl); 8239 pushlevel (1); /* Push parameters */ 8240 ptr = &DECL_ARGUMENTS (fndecl); 8241 tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)); 8242 while (tem) 8243 { 8244 tree next = TREE_CHAIN (tem); 8245 tree type = TREE_TYPE (tem); 8246#ifdef PROMOTE_PROTOTYPES 8247 if (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node) 8248 && INTEGRAL_TYPE_P (type)) 8249 type = integer_type_node; 8250#endif 8251 DECL_ARG_TYPE (tem) = type; 8252 layout_decl (tem, 0); 8253 pushdecl (tem); 8254 *ptr = tem; 8255 ptr = &TREE_CHAIN (tem); 8256 tem = next; 8257 } 8258 *ptr = NULL_TREE; 8259 pushdecl_force_head (DECL_ARGUMENTS (fndecl)); 8260 lineno = DECL_SOURCE_LINE_FIRST (fndecl); 8261} 8262 8263/* Terminate a function and expand its body. */ 8264 8265static void 8266source_end_java_method () 8267{ 8268 tree fndecl = current_function_decl; 8269 int flag_asynchronous_exceptions = asynchronous_exceptions; 8270 8271 java_parser_context_save_global (); 8272 lineno = ctxp->last_ccb_indent1; 8273 8274 /* Set EH language codes */ 8275 java_set_exception_lang_code (); 8276 8277 /* Turn function bodies with only a NOP expr null, so they don't get 8278 generated at all and we won't get warnings when using the -W 8279 -Wall flags. */ 8280 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) == empty_stmt_node) 8281 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE; 8282 8283 /* Generate function's code */ 8284 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) 8285 && ! flag_emit_class_files 8286 && ! flag_emit_xref) 8287 expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))); 8288 8289 /* pop out of its parameters */ 8290 pushdecl_force_head (DECL_ARGUMENTS (fndecl)); 8291 poplevel (1, 0, 1); 8292 BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl; 8293 8294 /* Generate rtl for function exit. */ 8295 if (! flag_emit_class_files && ! flag_emit_xref) 8296 { 8297 lineno = DECL_SOURCE_LINE_LAST (fndecl); 8298 /* Emit catch-finally clauses */ 8299 emit_handlers (); 8300 expand_function_end (input_filename, lineno, 0); 8301 8302 /* FIXME: If the current method contains any exception handlers, 8303 force asynchronous_exceptions: this is necessary because signal 8304 handlers in libjava may throw exceptions. This is far from being 8305 a perfect solution, but it's better than doing nothing at all.*/ 8306 if (catch_clauses) 8307 asynchronous_exceptions = 1; 8308 8309 /* Run the optimizers and output assembler code for this function. */ 8310 rest_of_compilation (fndecl); 8311 } 8312 8313 current_function_decl = NULL_TREE; 8314 /* permanent_allocation (1); */ 8315 java_parser_context_restore_global (); 8316 asynchronous_exceptions = flag_asynchronous_exceptions; 8317} 8318 8319/* Record EXPR in the current function block. Complements compound 8320 expression second operand if necessary. */ 8321 8322tree 8323java_method_add_stmt (fndecl, expr) 8324 tree fndecl, expr; 8325{ 8326 return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr); 8327} 8328 8329static tree 8330add_stmt_to_block (b, type, stmt) 8331 tree b, type, stmt; 8332{ 8333 tree body = BLOCK_EXPR_BODY (b), c; 8334 8335 if (java_error_count) 8336 return body; 8337 8338 if ((c = add_stmt_to_compound (body, type, stmt)) == body) 8339 return body; 8340 8341 BLOCK_EXPR_BODY (b) = c; 8342 TREE_SIDE_EFFECTS (c) = 1; 8343 return c; 8344} 8345 8346/* Add STMT to EXISTING if possible, otherwise create a new 8347 COMPOUND_EXPR and add STMT to it. */ 8348 8349static tree 8350add_stmt_to_compound (existing, type, stmt) 8351 tree existing, type, stmt; 8352{ 8353 if (existing) 8354 return build (COMPOUND_EXPR, type, existing, stmt); 8355 else 8356 return stmt; 8357} 8358 8359/* Hold THIS for the scope of the current public method decl. */ 8360static tree current_this; 8361 8362void java_layout_seen_class_methods () 8363{ 8364 tree previous_list = all_class_list; 8365 tree end = NULL_TREE; 8366 tree current; 8367 8368 while (1) 8369 { 8370 for (current = previous_list; 8371 current != end; current = TREE_CHAIN (current)) 8372 layout_class_methods (TREE_TYPE (TREE_VALUE (current))); 8373 8374 if (previous_list != all_class_list) 8375 { 8376 end = previous_list; 8377 previous_list = all_class_list; 8378 } 8379 else 8380 break; 8381 } 8382} 8383 8384/* Layout the methods of all classes loaded in one way on an 8385 other. Check methods of source parsed classes. Then reorder the 8386 fields and layout the classes or the type of all source parsed 8387 classes */ 8388 8389void 8390java_layout_classes () 8391{ 8392 tree current; 8393 int save_error_count = java_error_count; 8394 8395 /* Layout the methods of all classes seen so far */ 8396 java_layout_seen_class_methods (); 8397 java_parse_abort_on_error (); 8398 all_class_list = NULL_TREE; 8399 8400 /* Then check the methods of all parsed classes */ 8401 for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current)) 8402 if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current)))) 8403 CHECK_METHODS (TREE_VALUE (current)); 8404 java_parse_abort_on_error (); 8405 8406 for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current)) 8407 { 8408 current_class = TREE_TYPE (TREE_VALUE (current)); 8409 8410 /* Reverse the fields, but leave the dummy field in front. 8411 Fields are already ordered for Object and Class */ 8412 if (TYPE_FIELDS (current_class) && current_class != object_type_node 8413 && current_class != class_type_node) 8414 { 8415 /* If the dummy field is there, reverse the right fields and 8416 just layout the type for proper fields offset */ 8417 if (!DECL_NAME (TYPE_FIELDS (current_class))) 8418 { 8419 tree fields = TYPE_FIELDS (current_class); 8420 TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields)); 8421 TYPE_SIZE (current_class) = NULL_TREE; 8422 layout_type (current_class); 8423 } 8424 /* We don't have a dummy field, we need to layout the class, 8425 after having reversed the fields */ 8426 else 8427 { 8428 TYPE_FIELDS (current_class) = 8429 nreverse (TYPE_FIELDS (current_class)); 8430 TYPE_SIZE (current_class) = NULL_TREE; 8431 layout_class (current_class); 8432 } 8433 } 8434 else 8435 layout_class (current_class); 8436 8437 /* From now on, the class is considered completely loaded */ 8438 CLASS_LOADED_P (current_class) = 1; 8439 8440 /* Error reported by the caller */ 8441 if (java_error_count) 8442 return; 8443 } 8444 8445 /* We might have reloaded classes durign the process of laying out 8446 classes for code generation. We must layout the methods of those 8447 late additions, as constructor checks might use them */ 8448 java_layout_seen_class_methods (); 8449 java_parse_abort_on_error (); 8450} 8451 8452/* Expand all methods in all registered classes. */ 8453 8454void 8455java_complete_expand_methods () 8456{ 8457 tree current; 8458 8459 do_not_fold = flag_emit_xref; 8460 8461 for (current = ctxp->class_list; current; current = TREE_CHAIN (current)) 8462 { 8463 int is_interface; 8464 tree class_type = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current)); 8465 tree decl; 8466 8467 current_class = TREE_TYPE (current); 8468 is_interface = CLASS_INTERFACE (TYPE_NAME (current_class)); 8469 8470 /* Initialize a new constant pool */ 8471 init_outgoing_cpool (); 8472 8473 /* We want <clinit> (if any) to be processed first. */ 8474 decl = tree_last (TYPE_METHODS (class_type)); 8475 if (IS_CLINIT (decl)) 8476 { 8477 tree fbody = DECL_FUNCTION_BODY (decl); 8478 tree list; 8479 if (fbody != NULL_TREE) 8480 { 8481 /* First check if we can ignore empty <clinit> */ 8482 tree block_body = BLOCK_EXPR_BODY (fbody); 8483 8484 current_this = NULL_TREE; 8485 current_function_decl = decl; 8486 if (block_body != NULL_TREE) 8487 { 8488 /* Prevent the use of `this' inside <clinit> */ 8489 ctxp->explicit_constructor_p = 1; 8490 8491 block_body = java_complete_tree (block_body); 8492 ctxp->explicit_constructor_p = 0; 8493 BLOCK_EXPR_BODY (fbody) = block_body; 8494 if (block_body != NULL_TREE 8495 && TREE_CODE (block_body) == BLOCK 8496 && BLOCK_EXPR_BODY (block_body) == empty_stmt_node) 8497 decl = NULL_TREE; 8498 } 8499 } 8500 list = nreverse (TREE_CHAIN (nreverse (TYPE_METHODS (class_type)))); 8501 if (decl != NULL_TREE) 8502 { 8503 TREE_CHAIN (decl) = list; 8504 TYPE_METHODS (class_type) = decl; 8505 } 8506 else 8507 TYPE_METHODS (class_type) = list; 8508 } 8509 8510 for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl)) 8511 { 8512 current_function_decl = decl; 8513 /* Don't generate debug info on line zero when expanding a 8514 generated constructor. */ 8515 if (DECL_CONSTRUCTOR_P (decl) && !DECL_FUNCTION_BODY (decl)) 8516 { 8517 /* If we found errors, it's too dangerous to try to 8518 generate and expand a constructor */ 8519 if (!java_error_count) 8520 { 8521 restore_line_number_status (1); 8522 java_complete_expand_method (decl); 8523 restore_line_number_status (0); 8524 } 8525 } 8526 else if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl)) 8527 continue; 8528 else 8529 java_complete_expand_method (decl); 8530 } 8531 8532 /* Now verify constructor circularity (stop after the first one 8533 we find) */ 8534 if (!is_interface) 8535 for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl)) 8536 if (DECL_CONSTRUCTOR_P (decl) && 8537 verify_constructor_circularity (decl, decl)) 8538 break; 8539 8540 /* Make the class data, register it and run the rest of decl 8541 compilation on it */ 8542 if (!java_error_count) 8543 { 8544 if (flag_emit_class_files) 8545 write_classfile (current_class); 8546 if (flag_emit_xref) 8547 expand_xref (current_class); 8548 else if (! flag_syntax_only) 8549 finish_class (current_class); 8550 } 8551 } 8552} 8553 8554/* Hold a list of catch clauses list. The first element of this list is 8555 the list of the catch clauses of the currently analysed try block. */ 8556static tree currently_caught_type_list; 8557 8558/* Complete and expand a method. */ 8559 8560static void 8561java_complete_expand_method (mdecl) 8562 tree mdecl; 8563{ 8564 /* Fix constructors before expanding them */ 8565 if (DECL_CONSTRUCTOR_P (mdecl)) 8566 fix_constructors (mdecl); 8567 8568 /* Expand functions that have a body */ 8569 if (DECL_FUNCTION_BODY (mdecl)) 8570 { 8571 tree fbody = DECL_FUNCTION_BODY (mdecl); 8572 tree block_body = BLOCK_EXPR_BODY (fbody); 8573 tree exception_copy; 8574 expand_start_java_method (mdecl); 8575 build_result_decl (mdecl); 8576 8577 current_this 8578 = (!METHOD_STATIC (mdecl) ? 8579 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE); 8580 8581 /* Purge the `throws' list of unchecked exceptions. If we're 8582 doing xref, save a copy of the list and re-install it 8583 later. */ 8584 if (flag_emit_xref) 8585 exception_copy = copy_list (DECL_FUNCTION_THROWS (mdecl)); 8586 8587 purge_unchecked_exceptions (mdecl); 8588 8589 /* Install exceptions thrown with `throws' */ 8590 PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl)); 8591 8592 if (block_body != NULL_TREE) 8593 { 8594 block_body = java_complete_tree (block_body); 8595 if (!flag_emit_xref) 8596 check_for_initialization (block_body); 8597 ctxp->explicit_constructor_p = 0; 8598 } 8599 BLOCK_EXPR_BODY (fbody) = block_body; 8600 8601 if ((block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body)) 8602 && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE 8603 && !flag_emit_xref) 8604 missing_return_error (current_function_decl); 8605 8606 complete_start_java_method (mdecl); 8607 8608 /* Don't go any further if we've found error(s) during the 8609 expansion */ 8610 if (!java_error_count) 8611 source_end_java_method (); 8612 else 8613 { 8614 pushdecl_force_head (DECL_ARGUMENTS (mdecl)); 8615 poplevel (1, 0, 1); 8616 } 8617 8618 /* Pop the exceptions and sanity check */ 8619 POP_EXCEPTIONS(); 8620 if (currently_caught_type_list) 8621 fatal ("Exception list non empty - java_complete_expand_method"); 8622 8623 if (flag_emit_xref) 8624 DECL_FUNCTION_THROWS (mdecl) = exception_copy; 8625 } 8626} 8627 8628/* Craft a body for default constructor. Patch existing constructor 8629 bodies with call to super() and field initialization statements if 8630 necessary. */ 8631 8632static void 8633fix_constructors (mdecl) 8634 tree mdecl; 8635{ 8636 tree body = DECL_FUNCTION_BODY (mdecl); 8637 8638 if (!body) 8639 { 8640 /* The constructor body must be crafted by hand. It's the 8641 constructor we defined when we realize we didn't have the 8642 CLASSNAME() constructor */ 8643 8644 tree compound; 8645 8646 /* It is an error for the compiler to generate a default 8647 constructor if the superclass doesn't have a constructor that 8648 takes no argument */ 8649 if (verify_constructor_super ()) 8650 { 8651 tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (current_class)); 8652 char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl)); 8653 parse_error_context (lookup_cl (TYPE_NAME (current_class)), 8654 "No constructor matching `%s()' found in " 8655 "class `%s'", n, n); 8656 } 8657 8658 start_artificial_method_body (mdecl); 8659 8660 /* We don't generate a super constructor invocation if we're 8661 compiling java.lang.Object. build_super_invocation takes care 8662 of that. */ 8663 compound = java_method_add_stmt (mdecl, build_super_invocation ()); 8664 8665 end_artificial_method_body (mdecl); 8666 } 8667 /* Search for an explicit constructor invocation */ 8668 else 8669 { 8670 int found = 0; 8671 tree main_block = BLOCK_EXPR_BODY (body); 8672 tree compound = NULL_TREE; 8673 8674 while (body) 8675 switch (TREE_CODE (body)) 8676 { 8677 case CALL_EXPR: 8678 found = CALL_EXPLICIT_CONSTRUCTOR_P (body); 8679 body = NULL_TREE; 8680 break; 8681 case COMPOUND_EXPR: 8682 case EXPR_WITH_FILE_LOCATION: 8683 body = TREE_OPERAND (body, 0); 8684 break; 8685 case BLOCK: 8686 body = BLOCK_EXPR_BODY (body); 8687 break; 8688 default: 8689 found = 0; 8690 body = NULL_TREE; 8691 } 8692 /* The constructor is missing an invocation of super() */ 8693 if (!found) 8694 compound = add_stmt_to_compound (compound, NULL_TREE, 8695 build_super_invocation ()); 8696 8697 /* Fix the constructor main block if we're adding extra stmts */ 8698 if (compound) 8699 { 8700 compound = add_stmt_to_compound (compound, NULL_TREE, 8701 BLOCK_EXPR_BODY (main_block)); 8702 BLOCK_EXPR_BODY (main_block) = compound; 8703 } 8704 } 8705} 8706 8707/* Browse constructors in the super class, searching for a constructor 8708 that doesn't take any argument. Return 0 if one is found, 1 8709 otherwise. */ 8710 8711static int 8712verify_constructor_super () 8713{ 8714 tree class = CLASSTYPE_SUPER (current_class); 8715 if (!class) 8716 return 0; 8717 8718 if (class) 8719 { 8720 tree mdecl; 8721 for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl)) 8722 { 8723 if (DECL_CONSTRUCTOR_P (mdecl) 8724 && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node) 8725 return 0; 8726 } 8727 } 8728 return 1; 8729} 8730 8731/* Expand finals. */ 8732 8733void 8734java_expand_finals () 8735{ 8736} 8737 8738/* Generate code for all context remembered for code generation. */ 8739 8740void 8741java_expand_classes () 8742{ 8743 int save_error_count = 0; 8744 java_parse_abort_on_error (); 8745 if (!(ctxp = ctxp_for_generation)) 8746 return; 8747 java_layout_classes (); 8748 java_parse_abort_on_error (); 8749 8750 for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next) 8751 { 8752 ctxp = ctxp_for_generation; 8753 lang_init_source (2); /* Error msgs have method prototypes */ 8754 java_complete_expand_methods (); /* Complete and expand method bodies */ 8755 java_parse_abort_on_error (); 8756 java_expand_finals (); /* Expand and check the finals */ 8757 java_parse_abort_on_error (); 8758 java_check_final (); /* Check unitialized final */ 8759 java_parse_abort_on_error (); 8760 } 8761} 8762 8763/* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to 8764 a tree list node containing RIGHT. Fore coming RIGHTs will be 8765 chained to this hook. LOCATION contains the location of the 8766 separating `.' operator. */ 8767 8768static tree 8769make_qualified_primary (primary, right, location) 8770 tree primary, right; 8771 int location; 8772{ 8773 tree wfl; 8774 8775 /* We want to process THIS . xxx symbolicaly, to keep it consistent 8776 with the way we're processing SUPER. A THIS from a primary as a 8777 different form than a SUPER. Turn THIS into something symbolic */ 8778 if (TREE_CODE (primary) == THIS_EXPR) 8779 { 8780 wfl = build_wfl_node (this_identifier_node); 8781 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary); 8782 wfl = make_qualified_name (wfl, right, location); 8783 PRIMARY_P (wfl) = 1; 8784 return wfl; 8785 } 8786 /* Other non WFL node are wrapped around a WFL */ 8787 else if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION) 8788 { 8789 wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0); 8790 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary); 8791 EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (primary, NULL_TREE); 8792 } 8793 else 8794 { 8795 wfl = primary; 8796 if (!EXPR_WFL_QUALIFICATION (primary)) 8797 EXPR_WFL_QUALIFICATION (primary) = 8798 build_tree_list (primary, NULL_TREE); 8799 } 8800 8801 EXPR_WFL_LINECOL (right) = location; 8802 chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE)); 8803 PRIMARY_P (wfl) = 1; 8804 return wfl; 8805} 8806 8807/* Simple merge of two name separated by a `.' */ 8808 8809static tree 8810merge_qualified_name (left, right) 8811 tree left, right; 8812{ 8813 tree node; 8814 obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left), 8815 IDENTIFIER_LENGTH (left)); 8816 obstack_1grow (&temporary_obstack, '.'); 8817 obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right), 8818 IDENTIFIER_LENGTH (right)); 8819 node = get_identifier (obstack_base (&temporary_obstack)); 8820 obstack_free (&temporary_obstack, obstack_base (&temporary_obstack)); 8821 QUALIFIED_P (node) = 1; 8822 return node; 8823} 8824 8825/* Merge the two parts of a qualified name into LEFT. Set the 8826 location information of the resulting node to LOCATION, usually 8827 inherited from the location information of the `.' operator. */ 8828 8829static tree 8830make_qualified_name (left, right, location) 8831 tree left, right; 8832 int location; 8833{ 8834#ifdef USE_COMPONENT_REF 8835 tree node = build (COMPONENT_REF, NULL_TREE, left, right); 8836 EXPR_WFL_LINECOL (node) = location; 8837 return node; 8838#else 8839 tree left_id = EXPR_WFL_NODE (left); 8840 tree right_id = EXPR_WFL_NODE (right); 8841 tree wfl, merge; 8842 8843 merge = merge_qualified_name (left_id, right_id); 8844 8845 /* Left wasn't qualified and is now qualified */ 8846 if (!QUALIFIED_P (left_id)) 8847 { 8848 tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0); 8849 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left); 8850 EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE); 8851 } 8852 8853 wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0); 8854 EXPR_WFL_LINECOL (wfl) = location; 8855 chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE)); 8856 8857 EXPR_WFL_NODE (left) = merge; 8858 return left; 8859#endif 8860} 8861 8862/* Extract the last identifier component of the qualified in WFL. The 8863 last identifier is removed from the linked list */ 8864 8865static tree 8866cut_identifier_in_qualified (wfl) 8867 tree wfl; 8868{ 8869 tree q; 8870 tree previous = NULL_TREE; 8871 for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q)) 8872 if (!TREE_CHAIN (q)) 8873 { 8874 if (!previous) 8875 fatal ("Operating on a non qualified qualified WFL - " 8876 "cut_identifier_in_qualified"); 8877 TREE_CHAIN (previous) = NULL_TREE; 8878 return TREE_PURPOSE (q); 8879 } 8880} 8881 8882/* Resolve the expression name NAME. Return its decl. */ 8883 8884static tree 8885resolve_expression_name (id, orig) 8886 tree id; 8887 tree *orig; 8888{ 8889 tree name = EXPR_WFL_NODE (id); 8890 tree decl; 8891 8892 /* 6.5.5.1: Simple expression names */ 8893 if (!PRIMARY_P (id) && !QUALIFIED_P (name)) 8894 { 8895 /* 15.13.1: NAME can appear within the scope of a local variable 8896 declaration */ 8897 if ((decl = IDENTIFIER_LOCAL_VALUE (name))) 8898 return decl; 8899 8900 /* 15.13.1: NAME can appear within a class declaration */ 8901 else 8902 { 8903 decl = lookup_field_wrapper (current_class, name); 8904 if (decl) 8905 { 8906 int fs = FIELD_STATIC (decl); 8907 /* Instance variable (8.3.1.1) can't appear within 8908 static method, static initializer or initializer for 8909 a static variable. */ 8910 if (!fs && METHOD_STATIC (current_function_decl)) 8911 { 8912 static_ref_err (id, name, current_class); 8913 return error_mark_node; 8914 } 8915 /* Instance variables can't appear as an argument of 8916 an explicit constructor invocation */ 8917 if (!fs && ctxp->explicit_constructor_p) 8918 { 8919 parse_error_context 8920 (id, "Can't reference `%s' before the superclass " 8921 "constructor has been called", IDENTIFIER_POINTER (name)); 8922 return error_mark_node; 8923 } 8924 8925 /* Otherwise build what it takes to access the field */ 8926 decl = build_field_ref ((fs ? NULL_TREE : current_this), 8927 DECL_CONTEXT (decl), name); 8928 if (fs && !flag_emit_class_files && !flag_emit_xref) 8929 decl = build_class_init (DECL_CONTEXT (decl), decl); 8930 /* We may be asked to save the real field access node */ 8931 if (orig) 8932 *orig = decl; 8933 /* And we return what we got */ 8934 return decl; 8935 } 8936 /* Fall down to error report on undefined variable */ 8937 } 8938 } 8939 /* 6.5.5.2 Qualified Expression Names */ 8940 else 8941 { 8942 if (orig) 8943 *orig = NULL_TREE; 8944 qualify_ambiguous_name (id); 8945 /* 15.10.1 Field Access Using a Primary and/or Expression Name */ 8946 /* 15.10.2: Accessing Superclass Members using super */ 8947 return resolve_field_access (id, NULL, NULL); 8948 } 8949 8950 /* We've got an error here */ 8951 parse_error_context (id, "Undefined variable `%s'", 8952 IDENTIFIER_POINTER (name)); 8953 8954 return error_mark_node; 8955} 8956 8957static void 8958static_ref_err (wfl, field_id, class_type) 8959 tree wfl, field_id, class_type; 8960{ 8961 parse_error_context 8962 (wfl, 8963 "Can't make a static reference to nonstatic variable `%s' in class `%s'", 8964 IDENTIFIER_POINTER (field_id), 8965 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type)))); 8966} 8967 8968/* 15.10.1 Field Acess Using a Primary and/or Expression Name. 8969 We return something suitable to generate the field access. We also 8970 return the field decl in FIELD_DECL and its type in FIELD_TYPE. If 8971 recipient's address can be null. */ 8972 8973static tree 8974resolve_field_access (qual_wfl, field_decl, field_type) 8975 tree qual_wfl; 8976 tree *field_decl, *field_type; 8977{ 8978 int is_static = 0; 8979 tree field_ref; 8980 tree decl, where_found, type_found; 8981 8982 if (resolve_qualified_expression_name (qual_wfl, &decl, 8983 &where_found, &type_found)) 8984 return error_mark_node; 8985 8986 /* Resolve the LENGTH field of an array here */ 8987 if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found) 8988 && ! flag_emit_class_files && ! flag_emit_xref) 8989 { 8990 tree length = build_java_array_length_access (where_found); 8991 field_ref = 8992 build_java_arraynull_check (type_found, length, int_type_node); 8993 } 8994 /* We might have been trying to resolve field.method(). In which 8995 case, the resolution is over and decl is the answer */ 8996 else if (JDECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl) 8997 field_ref = decl; 8998 else if (JDECL_P (decl)) 8999 { 9000 int static_final_found = 0; 9001 if (!type_found) 9002 type_found = DECL_CONTEXT (decl); 9003 is_static = JDECL_P (decl) && FIELD_STATIC (decl); 9004 if (FIELD_FINAL (decl) 9005 && JPRIMITIVE_TYPE_P (TREE_TYPE (decl)) 9006 && DECL_LANG_SPECIFIC (decl) 9007 && DECL_INITIAL (decl)) 9008 { 9009 field_ref = DECL_INITIAL (decl); 9010 static_final_found = 1; 9011 } 9012 else 9013 field_ref = build_field_ref ((is_static && !flag_emit_xref? 9014 NULL_TREE : where_found), 9015 type_found, DECL_NAME (decl)); 9016 if (field_ref == error_mark_node) 9017 return error_mark_node; 9018 if (is_static && !static_final_found 9019 && !flag_emit_class_files && !flag_emit_xref) 9020 { 9021 field_ref = build_class_init (type_found, field_ref); 9022 /* If the static field was identified by an expression that 9023 needs to be generated, make the field access a compound 9024 expression whose first part is the evaluation of the 9025 field selector part. */ 9026 if (where_found && TREE_CODE (where_found) != TYPE_DECL 9027 && TREE_CODE (where_found) != RECORD_TYPE) 9028 { 9029 tree type = QUAL_DECL_TYPE (field_ref); 9030 if (TREE_CODE (type) == RECORD_TYPE) 9031 type = build_pointer_type (type); 9032 field_ref = build (COMPOUND_EXPR, type, where_found, field_ref); 9033 } 9034 } 9035 } 9036 else 9037 field_ref = decl; 9038 9039 if (field_decl) 9040 *field_decl = decl; 9041 if (field_type) 9042 *field_type = (QUAL_DECL_TYPE (decl) ? 9043 QUAL_DECL_TYPE (decl) : TREE_TYPE (decl)); 9044 return field_ref; 9045} 9046 9047/* If NODE is an access to f static field, strip out the class 9048 initialization part and return the field decl, otherwise, return 9049 NODE. */ 9050 9051static tree 9052strip_out_static_field_access_decl (node) 9053 tree node; 9054{ 9055 if (TREE_CODE (node) == COMPOUND_EXPR) 9056 { 9057 tree op1 = TREE_OPERAND (node, 1); 9058 if (TREE_CODE (op1) == COMPOUND_EXPR) 9059 { 9060 tree call = TREE_OPERAND (op1, 0); 9061 if (TREE_CODE (call) == CALL_EXPR 9062 && TREE_CODE (TREE_OPERAND (call, 0)) == ADDR_EXPR 9063 && TREE_OPERAND (TREE_OPERAND (call, 0), 0) 9064 == soft_initclass_node) 9065 return TREE_OPERAND (op1, 1); 9066 } 9067 } 9068 return node; 9069} 9070 9071/* 6.5.5.2: Qualified Expression Names */ 9072 9073static int 9074resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) 9075 tree wfl; 9076 tree *found_decl, *type_found, *where_found; 9077{ 9078 int from_type = 0; /* Field search initiated from a type */ 9079 int from_super = 0, from_cast = 0; 9080 int previous_call_static = 0; 9081 int is_static; 9082 tree decl = NULL_TREE, type = NULL_TREE, q; 9083 *type_found = *where_found = NULL_TREE; 9084 9085 for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q)) 9086 { 9087 tree qual_wfl = QUAL_WFL (q); 9088 9089 /* 15.10.1 Field Access Using a Primary */ 9090 switch (TREE_CODE (qual_wfl)) 9091 { 9092 case CALL_EXPR: 9093 case NEW_CLASS_EXPR: 9094 /* If the access to the function call is a non static field, 9095 build the code to access it. */ 9096 if (JDECL_P (decl) && !FIELD_STATIC (decl)) 9097 { 9098 decl = maybe_access_field (decl, *where_found, 9099 DECL_CONTEXT (decl)); 9100 if (decl == error_mark_node) 9101 return 1; 9102 } 9103 /* And code for the function call */ 9104 if (complete_function_arguments (qual_wfl)) 9105 return 1; 9106 if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR) 9107 CALL_USING_SUPER (qual_wfl) = 1; 9108 *where_found = 9109 patch_method_invocation (qual_wfl, decl, type, &is_static, NULL); 9110 if (*where_found == error_mark_node) 9111 return 1; 9112 *type_found = type = QUAL_DECL_TYPE (*where_found); 9113 9114 /* If the previous call was static and this one is too, 9115 build a compound expression to hold the two (because in 9116 that case, previous function calls aren't transported as 9117 forcoming function's argument. */ 9118 if (previous_call_static && is_static) 9119 { 9120 decl = build (COMPOUND_EXPR, type, decl, *where_found); 9121 TREE_SIDE_EFFECTS (decl) = 1; 9122 } 9123 else 9124 { 9125 previous_call_static = is_static; 9126 decl = *where_found; 9127 } 9128 continue; 9129 9130 case NEW_ARRAY_EXPR: 9131 *where_found = decl = java_complete_tree (qual_wfl); 9132 if (decl == error_mark_node) 9133 return 1; 9134 *type_found = type = QUAL_DECL_TYPE (decl); 9135 CLASS_LOADED_P (type) = 1; 9136 continue; 9137 9138 case CONVERT_EXPR: 9139 *where_found = decl = java_complete_tree (qual_wfl); 9140 if (decl == error_mark_node) 9141 return 1; 9142 *type_found = type = QUAL_DECL_TYPE (decl); 9143 from_cast = 1; 9144 continue; 9145 9146 case CONDITIONAL_EXPR: 9147 case STRING_CST: 9148 *where_found = decl = java_complete_tree (qual_wfl); 9149 if (decl == error_mark_node) 9150 return 1; 9151 *type_found = type = QUAL_DECL_TYPE (decl); 9152 continue; 9153 9154 case ARRAY_REF: 9155 /* If the access to the function call is a non static field, 9156 build the code to access it. */ 9157 if (JDECL_P (decl) && !FIELD_STATIC (decl)) 9158 { 9159 decl = maybe_access_field (decl, *where_found, type); 9160 if (decl == error_mark_node) 9161 return 1; 9162 } 9163 /* And code for the array reference expression */ 9164 decl = java_complete_tree (qual_wfl); 9165 if (decl == error_mark_node) 9166 return 1; 9167 type = QUAL_DECL_TYPE (decl); 9168 continue; 9169 9170 default: 9171 /* Fix for -Wall Just go to the next statement. Don't 9172 continue */ 9173 break; 9174 } 9175 9176 /* If we fall here, we weren't processing a (static) function call. */ 9177 previous_call_static = 0; 9178 9179 /* It can be the keyword THIS */ 9180 if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node) 9181 { 9182 if (!current_this) 9183 { 9184 parse_error_context 9185 (wfl, "Keyword `this' used outside allowed context"); 9186 return 1; 9187 } 9188 /* We have to generate code for intermediate acess */ 9189 *where_found = decl = current_this; 9190 *type_found = type = QUAL_DECL_TYPE (decl); 9191 continue; 9192 } 9193 9194 /* 15.10.2 Accessing Superclass Members using SUPER */ 9195 if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node) 9196 { 9197 tree node; 9198 /* Check on the restricted use of SUPER */ 9199 if (METHOD_STATIC (current_function_decl) 9200 || current_class == object_type_node) 9201 { 9202 parse_error_context 9203 (wfl, "Keyword `super' used outside allowed context"); 9204 return 1; 9205 } 9206 /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */ 9207 node = build_cast (EXPR_WFL_LINECOL (qual_wfl), 9208 CLASSTYPE_SUPER (current_class), 9209 build_this (EXPR_WFL_LINECOL (qual_wfl))); 9210 *where_found = decl = java_complete_tree (node); 9211 if (decl == error_mark_node) 9212 return 1; 9213 *type_found = type = QUAL_DECL_TYPE (decl); 9214 from_super = from_type = 1; 9215 continue; 9216 } 9217 9218 /* 15.13.1: Can't search for field name in packages, so we 9219 assume a variable/class name was meant. */ 9220 if (RESOLVE_PACKAGE_NAME_P (qual_wfl)) 9221 { 9222 tree name = resolve_package (wfl, &q); 9223 if (name) 9224 { 9225 *where_found = decl = resolve_no_layout (name, qual_wfl); 9226 /* We wan't to be absolutely that the class is laid 9227 out. We're going to search something inside it. */ 9228 *type_found = type = TREE_TYPE (decl); 9229 layout_class (type); 9230 from_type = 1; 9231 /* Should be a list, really. FIXME */ 9232 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 1; 9233 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 0; 9234 } 9235 else 9236 { 9237 if (from_super || from_cast) 9238 parse_error_context 9239 ((from_cast ? qual_wfl : wfl), 9240 "No variable `%s' defined in class `%s'", 9241 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), 9242 lang_printable_name (type, 0)); 9243 else 9244 parse_error_context 9245 (qual_wfl, "Undefined variable or class name: `%s'", 9246 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl))); 9247 return 1; 9248 } 9249 } 9250 9251 /* We have a type name. It's been already resolved when the 9252 expression was qualified. */ 9253 else if (RESOLVE_TYPE_NAME_P (qual_wfl)) 9254 { 9255 if (!(decl = QUAL_RESOLUTION (q))) 9256 return 1; /* Error reported already */ 9257 9258 if (not_accessible_p (TREE_TYPE (decl), decl, 0)) 9259 { 9260 parse_error_context 9261 (qual_wfl, "Can't access %s field `%s.%s' from `%s'", 9262 java_accstring_lookup (get_access_flags_from_decl (decl)), 9263 GET_TYPE_NAME (type), 9264 IDENTIFIER_POINTER (DECL_NAME (decl)), 9265 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)))); 9266 return 1; 9267 } 9268 check_deprecation (qual_wfl, decl); 9269 9270 type = TREE_TYPE (decl); 9271 from_type = 1; 9272 } 9273 /* We resolve and expression name */ 9274 else 9275 { 9276 tree field_decl; 9277 9278 /* If there exists an early resolution, use it. That occurs 9279 only once and we know that there are more things to 9280 come. Don't do that when processing something after SUPER 9281 (we need more thing to be put in place below */ 9282 if (!from_super && QUAL_RESOLUTION (q)) 9283 { 9284 decl = QUAL_RESOLUTION (q); 9285 if (!type) 9286 { 9287 if (TREE_CODE (decl) == FIELD_DECL && !FIELD_STATIC (decl)) 9288 { 9289 if (current_this) 9290 *where_found = current_this; 9291 else 9292 { 9293 static_ref_err (qual_wfl, DECL_NAME (decl), 9294 current_class); 9295 return 1; 9296 } 9297 } 9298 else 9299 { 9300 *where_found = TREE_TYPE (decl); 9301 if (TREE_CODE (*where_found) == POINTER_TYPE) 9302 *where_found = TREE_TYPE (*where_found); 9303 } 9304 } 9305 } 9306 9307 /* We have to search for a field, knowing the type of its 9308 container. The flag FROM_TYPE indicates that we resolved 9309 the last member of the expression as a type name, which 9310 means that for the resolution of this field, we'll look 9311 for other errors than if it was resolved as a member of 9312 an other field. */ 9313 else 9314 { 9315 int is_static; 9316 tree field_decl_type; /* For layout */ 9317 9318 if (!from_type && !JREFERENCE_TYPE_P (type)) 9319 { 9320 parse_error_context 9321 (qual_wfl, "Attempt to reference field `%s' in `%s %s'", 9322 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), 9323 lang_printable_name (type, 0), 9324 IDENTIFIER_POINTER (DECL_NAME (field_decl))); 9325 return 1; 9326 } 9327 9328 field_decl = lookup_field_wrapper (type, 9329 EXPR_WFL_NODE (qual_wfl)); 9330 if (field_decl == NULL_TREE) 9331 { 9332 parse_error_context 9333 (qual_wfl, "No variable `%s' defined in type `%s'", 9334 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), 9335 GET_TYPE_NAME (type)); 9336 return 1; 9337 } 9338 if (field_decl == error_mark_node) 9339 return 1; 9340 9341 /* Layout the type of field_decl, since we may need 9342 it. Don't do primitive types or loaded classes. The 9343 situation of non primitive arrays may not handled 9344 properly here. FIXME */ 9345 if (TREE_CODE (TREE_TYPE (field_decl)) == POINTER_TYPE) 9346 field_decl_type = TREE_TYPE (TREE_TYPE (field_decl)); 9347 else 9348 field_decl_type = TREE_TYPE (field_decl); 9349 if (!JPRIMITIVE_TYPE_P (field_decl_type) 9350 && !CLASS_LOADED_P (field_decl_type) 9351 && !TYPE_ARRAY_P (field_decl_type)) 9352 resolve_and_layout (field_decl_type, NULL_TREE); 9353 if (TYPE_ARRAY_P (field_decl_type)) 9354 CLASS_LOADED_P (field_decl_type) = 1; 9355 9356 /* Check on accessibility here */ 9357 if (not_accessible_p (type, field_decl, from_super)) 9358 { 9359 parse_error_context 9360 (qual_wfl, 9361 "Can't access %s field `%s.%s' from `%s'", 9362 java_accstring_lookup 9363 (get_access_flags_from_decl (field_decl)), 9364 GET_TYPE_NAME (type), 9365 IDENTIFIER_POINTER (DECL_NAME (field_decl)), 9366 IDENTIFIER_POINTER 9367 (DECL_NAME (TYPE_NAME (current_class)))); 9368 return 1; 9369 } 9370 check_deprecation (qual_wfl, field_decl); 9371 9372 /* There are things to check when fields are accessed 9373 from type. There are no restrictions on a static 9374 declaration of the field when it is accessed from an 9375 interface */ 9376 is_static = FIELD_STATIC (field_decl); 9377 if (!from_super && from_type 9378 && !TYPE_INTERFACE_P (type) && !is_static) 9379 { 9380 static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type); 9381 return 1; 9382 } 9383 from_cast = from_super = 0; 9384 9385 /* If we need to generate something to get a proper 9386 handle on what this field is accessed from, do it 9387 now. */ 9388 if (!is_static) 9389 { 9390 decl = maybe_access_field (decl, *where_found, *type_found); 9391 if (decl == error_mark_node) 9392 return 1; 9393 } 9394 9395 /* We want to keep the location were found it, and the type 9396 we found. */ 9397 *where_found = decl; 9398 *type_found = type; 9399 9400 /* This is the decl found and eventually the next one to 9401 search from */ 9402 decl = field_decl; 9403 } 9404 from_type = 0; 9405 type = QUAL_DECL_TYPE (decl); 9406 } 9407 } 9408 *found_decl = decl; 9409 return 0; 9410} 9411 9412/* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl) 9413 can't be accessed from REFERENCE (a record type). */ 9414 9415int not_accessible_p (reference, member, from_super) 9416 tree reference, member; 9417 int from_super; 9418{ 9419 int access_flag = get_access_flags_from_decl (member); 9420 9421 /* Access always granted for members declared public */ 9422 if (access_flag & ACC_PUBLIC) 9423 return 0; 9424 9425 /* Check access on protected members */ 9426 if (access_flag & ACC_PROTECTED) 9427 { 9428 /* Access granted if it occurs from within the package 9429 containing the class in which the protected member is 9430 declared */ 9431 if (class_in_current_package (DECL_CONTEXT (member))) 9432 return 0; 9433 9434 /* If accessed with the form `super.member', then access is granted */ 9435 if (from_super) 9436 return 0; 9437 9438 /* Otherwise, access is granted if occuring from the class where 9439 member is declared or a subclass of it */ 9440 if (inherits_from_p (reference, current_class)) 9441 return 0; 9442 return 1; 9443 } 9444 9445 /* Check access on private members. Access is granted only if it 9446 occurs from within the class in witch it is declared */ 9447 if (access_flag & ACC_PRIVATE) 9448 return (current_class == DECL_CONTEXT (member) ? 0 : 1); 9449 9450 /* Default access are permitted only when occuring within the 9451 package in which the type (REFERENCE) is declared. In other words, 9452 REFERENCE is defined in the current package */ 9453 if (ctxp->package) 9454 return !class_in_current_package (reference); 9455 9456 /* Otherwise, access is granted */ 9457 return 0; 9458} 9459 9460/* Test deprecated decl access. */ 9461static void 9462check_deprecation (wfl, decl) 9463 tree wfl, decl; 9464{ 9465 char *file = DECL_SOURCE_FILE (decl); 9466 /* Complain if the field is deprecated and the file it was defined 9467 in isn't compiled at the same time the file which contains its 9468 use is */ 9469 if (DECL_DEPRECATED (decl) 9470 && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file))) 9471 { 9472 char the [20]; 9473 switch (TREE_CODE (decl)) 9474 { 9475 case FUNCTION_DECL: 9476 strcpy (the, "method"); 9477 break; 9478 case FIELD_DECL: 9479 strcpy (the, "field"); 9480 break; 9481 case TYPE_DECL: 9482 strcpy (the, "class"); 9483 break; 9484 default: 9485 fatal ("unexpected DECL code - check_deprecation"); 9486 } 9487 parse_warning_context 9488 (wfl, "The %s `%s' in class `%s' has been deprecated", 9489 the, lang_printable_name (decl, 0), 9490 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))))); 9491 } 9492} 9493 9494/* Returns 1 if class was declared in the current package, 0 otherwise */ 9495 9496static int 9497class_in_current_package (class) 9498 tree class; 9499{ 9500 static tree cache = NULL_TREE; 9501 int qualified_flag; 9502 tree left; 9503 9504 if (cache == class) 9505 return 1; 9506 9507 qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class))); 9508 9509 /* If the current package is empty and the name of CLASS is 9510 qualified, class isn't in the current package. If there is a 9511 current package and the name of the CLASS is not qualified, class 9512 isn't in the current package */ 9513 if ((!ctxp->package && qualified_flag) || (ctxp->package && !qualified_flag)) 9514 return 0; 9515 9516 /* If there is not package and the name of CLASS isn't qualified, 9517 they belong to the same unnamed package */ 9518 if (!ctxp->package && !qualified_flag) 9519 return 1; 9520 9521 /* Compare the left part of the name of CLASS with the package name */ 9522 breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class))); 9523 if (ctxp->package == left) 9524 { 9525 cache = class; 9526 return 1; 9527 } 9528 return 0; 9529} 9530 9531/* This function may generate code to access DECL from WHERE. This is 9532 done only if certain conditions meet. */ 9533 9534static tree 9535maybe_access_field (decl, where, type) 9536 tree decl, where, type; 9537{ 9538 if (TREE_CODE (decl) == FIELD_DECL && decl != current_this 9539 && !FIELD_STATIC (decl)) 9540 decl = build_field_ref (where ? where : current_this, 9541 (type ? type : DECL_CONTEXT (decl)), 9542 DECL_NAME (decl)); 9543 return decl; 9544} 9545 9546/* Build a method invocation, by patching PATCH. If non NULL 9547 and according to the situation, PRIMARY and WHERE may be 9548 used. IS_STATIC is set to 1 if the invoked function is static. */ 9549 9550static tree 9551patch_method_invocation (patch, primary, where, is_static, ret_decl) 9552 tree patch, primary, where; 9553 int *is_static; 9554 tree *ret_decl; 9555{ 9556 tree wfl = TREE_OPERAND (patch, 0); 9557 tree args = TREE_OPERAND (patch, 1); 9558 tree name = EXPR_WFL_NODE (wfl); 9559 tree list; 9560 int is_static_flag = 0; 9561 int is_super_init = 0; 9562 tree this_arg = NULL_TREE; 9563 9564 /* Should be overriden if everything goes well. Otherwise, if 9565 something fails, it should keep this value. It stop the 9566 evaluation of a bogus assignment. See java_complete_tree, 9567 MODIFY_EXPR: for the reasons why we sometimes want to keep on 9568 evaluating an assignment */ 9569 TREE_TYPE (patch) = error_mark_node; 9570 9571 /* Since lookup functions are messing with line numbers, save the 9572 context now. */ 9573 java_parser_context_save_global (); 9574 9575 /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */ 9576 9577 /* Resolution of qualified name, excluding constructors */ 9578 if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch)) 9579 { 9580 tree class_decl, identifier, identifier_wfl; 9581 /* Extract the last IDENTIFIER of the qualified 9582 expression. This is a wfl and we will use it's location 9583 data during error report. */ 9584 identifier_wfl = cut_identifier_in_qualified (wfl); 9585 identifier = EXPR_WFL_NODE (identifier_wfl); 9586 9587 /* Given the context, IDENTIFIER is syntactically qualified 9588 as a MethodName. We need to qualify what's before */ 9589 qualify_ambiguous_name (wfl); 9590 9591 /* Package resolution */ 9592 if (RESOLVE_PACKAGE_NAME_P (wfl)) 9593 { 9594 tree next, decl, name = resolve_package (wfl, &next); 9595 9596 if (!name) 9597 { 9598 tree remainder; 9599 breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl)); 9600 parse_error_context (wfl, "Can't search method `%s' in package " 9601 "`%s'",IDENTIFIER_POINTER (identifier), 9602 IDENTIFIER_POINTER (remainder)); 9603 PATCH_METHOD_RETURN_ERROR (); 9604 } 9605 RESOLVE_PACKAGE_NAME_P (wfl) = 0; 9606 if ((decl = resolve_no_layout (name, QUAL_WFL (next)))) 9607 { 9608 QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl)) = decl; 9609 RESOLVE_EXPRESSION_NAME_P (wfl) = 0; 9610 RESOLVE_TYPE_NAME_P (wfl) = 1; 9611 } 9612 else 9613 { 9614 RESOLVE_EXPRESSION_NAME_P (wfl) = 1; 9615 RESOLVE_TYPE_NAME_P (wfl) = 0; 9616 } 9617 } 9618 9619 /* We're resolving a call from a type */ 9620 if (RESOLVE_TYPE_NAME_P (wfl)) 9621 { 9622 tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl)); 9623 tree name = DECL_NAME (decl); 9624 tree type; 9625 9626 class_decl = resolve_and_layout (name, wfl); 9627 if (CLASS_INTERFACE (decl)) 9628 { 9629 parse_error_context 9630 (identifier_wfl, "Can't make static reference to method " 9631 "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier), 9632 IDENTIFIER_POINTER (name)); 9633 PATCH_METHOD_RETURN_ERROR (); 9634 } 9635 /* Look the method up in the type selector. The method ought 9636 to be static. */ 9637 type = TREE_TYPE (class_decl); 9638 list = lookup_method_invoke (0, wfl, type, identifier, args); 9639 if (list && !METHOD_STATIC (list)) 9640 { 9641 char *fct_name = strdup (lang_printable_name (list, 0)); 9642 parse_error_context 9643 (identifier_wfl, 9644 "Can't make static reference to method `%s %s' in class `%s'", 9645 lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0), 9646 fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))); 9647 free (fct_name); 9648 PATCH_METHOD_RETURN_ERROR (); 9649 } 9650 args = nreverse (args); 9651 } 9652 /* We're resolving an expression name */ 9653 else 9654 { 9655 tree field, type; 9656 9657 /* 1- Find the field to which the call applies */ 9658 field = resolve_field_access (wfl, NULL, &type); 9659 if (field == error_mark_node) 9660 PATCH_METHOD_RETURN_ERROR (); 9661 /* field is used in lieu of a primary. It alows us not to 9662 report errors on erroneous use of `this' in 9663 constructors. */ 9664 primary = field; 9665 9666 /* 2- Do the layout of the class where the last field 9667 was found, so we can search it. */ 9668 class_decl = resolve_and_layout (type, NULL_TREE); 9669 if (class_decl != NULL_TREE) 9670 type = TREE_TYPE (class_decl); 9671 9672 /* 3- Retrieve a filtered list of method matches, Refine 9673 if necessary. In any cases, point out errors. */ 9674 list = lookup_method_invoke (0, identifier_wfl, type, 9675 identifier, args); 9676 9677 /* 4- Add the field as an argument */ 9678 args = nreverse (args); 9679 this_arg = field; 9680 } 9681 9682 /* IDENTIFIER_WFL will be used to report any problem further */ 9683 wfl = identifier_wfl; 9684 } 9685 /* Resolution of simple names, names generated after a primary: or 9686 constructors */ 9687 else 9688 { 9689 tree class_to_search; 9690 int lc; /* Looking for Constructor */ 9691 9692 /* We search constructor in their target class */ 9693 if (CALL_CONSTRUCTOR_P (patch)) 9694 { 9695 if (TREE_CODE (patch) == NEW_CLASS_EXPR) 9696 class_to_search = EXPR_WFL_NODE (wfl); 9697 else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) == 9698 this_identifier_node) 9699 class_to_search = NULL_TREE; 9700 else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) == 9701 super_identifier_node) 9702 { 9703 is_super_init = 1; 9704 if (CLASSTYPE_SUPER (current_class)) 9705 class_to_search = 9706 DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class))); 9707 else 9708 { 9709 parse_error_context (wfl, "Can't invoke super constructor " 9710 "on java.lang.Object"); 9711 PATCH_METHOD_RETURN_ERROR (); 9712 } 9713 } 9714 9715 /* Class to search is NULL if we're searching the current one */ 9716 if (class_to_search) 9717 { 9718 class_to_search = resolve_and_layout (class_to_search, 9719 NULL_TREE); 9720 if (!class_to_search) 9721 { 9722 parse_error_context 9723 (wfl, "Class `%s' not found in type declaration", 9724 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); 9725 PATCH_METHOD_RETURN_ERROR (); 9726 } 9727 9728 /* Can't instantiate an abstract class, but we can 9729 invoke it's constructor. It's use within the `new' 9730 context is denied here. */ 9731 if (CLASS_ABSTRACT (class_to_search) 9732 && TREE_CODE (patch) == NEW_CLASS_EXPR) 9733 { 9734 parse_error_context 9735 (wfl, "Class `%s' is an abstract class. It can't be " 9736 "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); 9737 PATCH_METHOD_RETURN_ERROR (); 9738 } 9739 class_to_search = TREE_TYPE (class_to_search); 9740 } 9741 else 9742 class_to_search = current_class; 9743 lc = 1; 9744 } 9745 /* This is a regular search in the local class, unless an 9746 alternate class is specified. */ 9747 else 9748 { 9749 class_to_search = (where ? where : current_class); 9750 lc = 0; 9751 } 9752 9753 /* NAME is a simple identifier or comes from a primary. Search 9754 in the class whose declaration contain the method being 9755 invoked. */ 9756 resolve_and_layout (class_to_search, NULL_TREE); 9757 list = lookup_method_invoke (lc, wfl, class_to_search, name, args); 9758 9759 /* Don't continue if no method were found, as the next statement 9760 can't be executed then. */ 9761 if (!list) 9762 PATCH_METHOD_RETURN_ERROR (); 9763 9764 /* Check for static reference if non static methods */ 9765 if (check_for_static_method_reference (wfl, patch, list, 9766 class_to_search, primary)) 9767 PATCH_METHOD_RETURN_ERROR (); 9768 9769 /* Non static methods are called with the current object extra 9770 argument. If patch a `new TYPE()', the argument is the value 9771 returned by the object allocator. If method is resolved as a 9772 primary, use the primary otherwise use the current THIS. */ 9773 args = nreverse (args); 9774 if (TREE_CODE (patch) != NEW_CLASS_EXPR) 9775 this_arg = primary ? primary : current_this; 9776 } 9777 9778 /* Merge point of all resolution schemes. If we have nothing, this 9779 is an error, already signaled */ 9780 if (!list) 9781 PATCH_METHOD_RETURN_ERROR (); 9782 9783 /* Check accessibility, position the is_static flag, build and 9784 return the call */ 9785 if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0)) 9786 { 9787 char *fct_name = strdup (lang_printable_name (list, 0)); 9788 parse_error_context 9789 (wfl, "Can't access %s method `%s %s.%s' from `%s'", 9790 java_accstring_lookup (get_access_flags_from_decl (list)), 9791 lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0), 9792 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list)))), 9793 fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)))); 9794 free (fct_name); 9795 PATCH_METHOD_RETURN_ERROR (); 9796 } 9797 check_deprecation (wfl, list); 9798 9799 is_static_flag = METHOD_STATIC (list); 9800 if (! METHOD_STATIC (list) && this_arg != NULL_TREE) 9801 args = tree_cons (NULL_TREE, this_arg, args); 9802 9803 /* In the context of an explicit constructor invocation, we can't 9804 invoke any method relying on `this'. Exceptions are: we're 9805 invoking a static function, primary exists and is not the current 9806 this, we're creating a new object. */ 9807 if (ctxp->explicit_constructor_p 9808 && !is_static_flag 9809 && (!primary || primary == current_this) 9810 && (TREE_CODE (patch) != NEW_CLASS_EXPR)) 9811 { 9812 parse_error_context 9813 (wfl, "Can't reference `this' before the superclass constructor has " 9814 "been called"); 9815 PATCH_METHOD_RETURN_ERROR (); 9816 } 9817 java_parser_context_restore_global (); 9818 if (is_static) 9819 *is_static = is_static_flag; 9820 /* Sometimes, we want the decl of the selected method. Such as for 9821 EH checking */ 9822 if (ret_decl) 9823 *ret_decl = list; 9824 patch = patch_invoke (patch, list, args); 9825 if (is_super_init && CLASS_HAS_FINIT_P (current_class)) 9826 { 9827 /* Generate the code used to initialize fields declared with an 9828 initialization statement. For now, it returns a call the the 9829 artificial function $finit$, if required. */ 9830 9831 tree finit_call = 9832 build_method_invocation (build_expr_wfl (finit_identifier_node, 9833 input_filename, 0, 0), 9834 NULL_TREE); 9835 patch = build (COMPOUND_EXPR, void_type_node, patch, 9836 java_complete_tree (finit_call)); 9837 CAN_COMPLETE_NORMALLY (patch) = 1; 9838 } 9839 return patch; 9840} 9841 9842/* Check that we're not trying to do a static reference to a method in 9843 non static method. Return 1 if it's the case, 0 otherwise. */ 9844 9845static int 9846check_for_static_method_reference (wfl, node, method, where, primary) 9847 tree wfl, node, method, where, primary; 9848{ 9849 if (METHOD_STATIC (current_function_decl) 9850 && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node)) 9851 { 9852 char *fct_name = strdup (lang_printable_name (method, 0)); 9853 parse_error_context 9854 (wfl, "Can't make static reference to method `%s %s' in class `%s'", 9855 lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name, 9856 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where)))); 9857 free (fct_name); 9858 return 1; 9859 } 9860 return 0; 9861} 9862 9863/* Patch an invoke expression METHOD and ARGS, based on its invocation 9864 mode. */ 9865 9866static tree 9867patch_invoke (patch, method, args) 9868 tree patch, method, args; 9869{ 9870 tree dtable, func; 9871 tree original_call, t, ta; 9872 9873 /* Last step for args: convert build-in types. If we're dealing with 9874 a new TYPE() type call, the first argument to the constructor 9875 isn't found in the incomming argument list, but delivered by 9876 `new' */ 9877 t = TYPE_ARG_TYPES (TREE_TYPE (method)); 9878 if (TREE_CODE (patch) == NEW_CLASS_EXPR) 9879 t = TREE_CHAIN (t); 9880 for (ta = args; t != end_params_node && ta; 9881 t = TREE_CHAIN (t), ta = TREE_CHAIN (ta)) 9882 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) && 9883 TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t)) 9884 TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta)); 9885 9886 if (flag_emit_class_files || flag_emit_xref) 9887 func = method; 9888 else 9889 { 9890 tree signature = build_java_signature (TREE_TYPE (method)); 9891 switch (invocation_mode (method, CALL_USING_SUPER (patch))) 9892 { 9893 case INVOKE_VIRTUAL: 9894 dtable = invoke_build_dtable (0, args); 9895 func = build_invokevirtual (dtable, method); 9896 break; 9897 9898 case INVOKE_SUPER: 9899 case INVOKE_STATIC: 9900 func = build_known_method_ref (method, TREE_TYPE (method), 9901 DECL_CONTEXT (method), 9902 signature, args); 9903 break; 9904 9905 case INVOKE_INTERFACE: 9906 dtable = invoke_build_dtable (1, args); 9907 func = build_invokeinterface (dtable, DECL_NAME (method), signature); 9908 break; 9909 9910 default: 9911 fatal ("internal error - unknown invocation_mode result"); 9912 } 9913 9914 /* Ensure self_type is initialized, (invokestatic). FIXME */ 9915 func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func); 9916 } 9917 9918 TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method)); 9919 TREE_OPERAND (patch, 0) = func; 9920 TREE_OPERAND (patch, 1) = args; 9921 original_call = patch; 9922 9923 /* We're processing a `new TYPE ()' form. New is called an its 9924 returned value is the first argument to the constructor. We build 9925 a COMPOUND_EXPR and use saved expression so that the overall NEW 9926 expression value is a pointer to a newly created and initialized 9927 class. */ 9928 if (TREE_CODE (original_call) == NEW_CLASS_EXPR) 9929 { 9930 tree class = DECL_CONTEXT (method); 9931 tree c1, saved_new, size, new; 9932 if (flag_emit_class_files || flag_emit_xref) 9933 { 9934 TREE_TYPE (patch) = build_pointer_type (class); 9935 return patch; 9936 } 9937 if (!TYPE_SIZE (class)) 9938 safe_layout_class (class); 9939 size = size_in_bytes (class); 9940 new = build (CALL_EXPR, promote_type (class), 9941 build_address_of (alloc_object_node), 9942 tree_cons (NULL_TREE, build_class_ref (class), 9943 build_tree_list (NULL_TREE, 9944 size_in_bytes (class))), 9945 NULL_TREE); 9946 saved_new = save_expr (new); 9947 c1 = build_tree_list (NULL_TREE, saved_new); 9948 TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1); 9949 TREE_OPERAND (original_call, 1) = c1; 9950 TREE_SET_CODE (original_call, CALL_EXPR); 9951 patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new); 9952 } 9953 return patch; 9954} 9955 9956static int 9957invocation_mode (method, super) 9958 tree method; 9959 int super; 9960{ 9961 int access = get_access_flags_from_decl (method); 9962 9963 if (super) 9964 return INVOKE_SUPER; 9965 9966 if (access & ACC_STATIC || access & ACC_FINAL || access & ACC_PRIVATE) 9967 return INVOKE_STATIC; 9968 9969 if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method)))) 9970 return INVOKE_STATIC; 9971 9972 if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method)))) 9973 return INVOKE_INTERFACE; 9974 9975 if (DECL_CONSTRUCTOR_P (method)) 9976 return INVOKE_STATIC; 9977 9978 return INVOKE_VIRTUAL; 9979} 9980 9981/* Retrieve a refined list of matching methods. It covers the step 9982 15.11.2 (Compile-Time Step 2) */ 9983 9984static tree 9985lookup_method_invoke (lc, cl, class, name, arg_list) 9986 int lc; 9987 tree cl; 9988 tree class, name, arg_list; 9989{ 9990 tree atl = end_params_node; /* Arg Type List */ 9991 tree method, signature, list, node; 9992 char *candidates; /* Used for error report */ 9993 9994 /* Fix the arguments */ 9995 for (node = arg_list; node; node = TREE_CHAIN (node)) 9996 { 9997 tree current_arg = TREE_TYPE (TREE_VALUE (node)); 9998 /* Non primitive type may have to be resolved */ 9999 if (!JPRIMITIVE_TYPE_P (current_arg)) 10000 resolve_and_layout (current_arg, NULL_TREE); 10001 /* And promoted */ 10002 if (TREE_CODE (current_arg) == RECORD_TYPE) 10003 current_arg = promote_type (current_arg); 10004 atl = tree_cons (NULL_TREE, current_arg, atl); 10005 } 10006 10007 /* Find all candidates and then refine the list, searching for the 10008 most specific method. */ 10009 list = find_applicable_accessible_methods_list (lc, class, name, atl); 10010 list = find_most_specific_methods_list (list); 10011 if (list && !TREE_CHAIN (list)) 10012 return TREE_VALUE (list); 10013 10014 /* Issue an error. List candidates if any. Candidates are listed 10015 only if accessible (non accessible methods may end-up here for 10016 the sake of a better error report). */ 10017 candidates = NULL; 10018 if (list) 10019 { 10020 tree current; 10021 obstack_grow (&temporary_obstack, ". Candidates are:\n", 18); 10022 for (current = list; current; current = TREE_CHAIN (current)) 10023 { 10024 tree cm = TREE_VALUE (current); 10025 char string [4096]; 10026 if (!cm || not_accessible_p (class, cm, 0)) 10027 continue; 10028 sprintf 10029 (string, " `%s' in `%s'%s", 10030 get_printable_method_name (cm), 10031 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))), 10032 (TREE_CHAIN (current) ? "\n" : "")); 10033 obstack_grow (&temporary_obstack, string, strlen (string)); 10034 } 10035 obstack_1grow (&temporary_obstack, '\0'); 10036 candidates = obstack_finish (&temporary_obstack); 10037 } 10038 /* Issue the error message */ 10039 method = make_node (FUNCTION_TYPE); 10040 TYPE_ARG_TYPES (method) = atl; 10041 signature = build_java_argument_signature (method); 10042 parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s", 10043 (lc ? "constructor" : "method"), 10044 (lc ? 10045 IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) : 10046 IDENTIFIER_POINTER (name)), 10047 IDENTIFIER_POINTER (signature), 10048 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))), 10049 (candidates ? candidates : "")); 10050 return NULL_TREE; 10051} 10052 10053/* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1 10054 when we're looking for a constructor. */ 10055 10056static tree 10057find_applicable_accessible_methods_list (lc, class, name, arglist) 10058 int lc; 10059 tree class, name, arglist; 10060{ 10061 tree list = NULL_TREE, all_list = NULL_TREE; 10062 10063 /* Search interfaces */ 10064 if (CLASS_INTERFACE (TYPE_NAME (class))) 10065 { 10066 static tree searched_interfaces = NULL_TREE; 10067 static int search_not_done = 0; 10068 int i, n; 10069 tree basetype_vec = TYPE_BINFO_BASETYPES (class); 10070 10071 /* Have we searched this interface already? */ 10072 if (searched_interfaces) 10073 { 10074 tree current; 10075 for (current = searched_interfaces; 10076 current; current = TREE_CHAIN (current)) 10077 if (TREE_VALUE (current) == class) 10078 return NULL; 10079 } 10080 searched_interfaces = tree_cons (NULL_TREE, class, searched_interfaces); 10081 10082 search_applicable_methods_list 10083 (lc, TYPE_METHODS (class), name, arglist, &list, &all_list); 10084 10085 n = TREE_VEC_LENGTH (basetype_vec); 10086 for (i = 0; i < n; i++) 10087 { 10088 tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)); 10089 tree rlist; 10090 10091 /* Skip java.lang.Object (we'll search it once later.) */ 10092 if (t == object_type_node) 10093 continue; 10094 10095 search_not_done++; 10096 rlist = find_applicable_accessible_methods_list (lc, t, name, 10097 arglist); 10098 all_list = chainon (rlist, (list ? list : all_list)); 10099 search_not_done--; 10100 } 10101 10102 /* We're done. Reset the searched interfaces list and finally search 10103 java.lang.Object */ 10104 if (!search_not_done) 10105 { 10106 searched_interfaces = NULL_TREE; 10107 search_applicable_methods_list (lc, TYPE_METHODS (object_type_node), 10108 name, arglist, &list, &all_list); 10109 } 10110 } 10111 /* Search classes */ 10112 else 10113 while (class != NULL_TREE) 10114 { 10115 search_applicable_methods_list 10116 (lc, TYPE_METHODS (class), name, arglist, &list, &all_list); 10117 class = (lc ? NULL_TREE : CLASSTYPE_SUPER (class)); 10118 } 10119 10120 /* Either return the list obtained or all selected (but 10121 inaccessible) methods for better error report. */ 10122 return (!list ? all_list : list); 10123} 10124 10125/* Effectively search for the approriate method in method */ 10126 10127static void 10128search_applicable_methods_list(lc, method, name, arglist, list, all_list) 10129 int lc; 10130 tree method, name, arglist; 10131 tree *list, *all_list; 10132{ 10133 for (; method; method = TREE_CHAIN (method)) 10134 { 10135 /* When dealing with constructor, stop here, otherwise search 10136 other classes */ 10137 if (lc && !DECL_CONSTRUCTOR_P (method)) 10138 continue; 10139 else if (!lc && (DECL_CONSTRUCTOR_P (method) 10140 || (GET_METHOD_NAME (method) != name))) 10141 continue; 10142 10143 if (argument_types_convertible (method, arglist)) 10144 { 10145 /* Retain accessible methods only */ 10146 if (!not_accessible_p (DECL_CONTEXT (current_function_decl), 10147 method, 0)) 10148 *list = tree_cons (NULL_TREE, method, *list); 10149 else 10150 /* Also retain all selected method here */ 10151 *all_list = tree_cons (NULL_TREE, method, *list); 10152 } 10153 } 10154} 10155 10156/* 15.11.2.2 Choose the Most Specific Method */ 10157 10158static tree 10159find_most_specific_methods_list (list) 10160 tree list; 10161{ 10162 int max = 0; 10163 tree current, new_list = NULL_TREE; 10164 for (current = list; current; current = TREE_CHAIN (current)) 10165 { 10166 tree method; 10167 DECL_SPECIFIC_COUNT (TREE_VALUE (current)) = 0; 10168 10169 for (method = list; method; method = TREE_CHAIN (method)) 10170 { 10171 /* Don't test a method against itself */ 10172 if (method == current) 10173 continue; 10174 10175 /* Compare arguments and location where method where declared */ 10176 if (argument_types_convertible (TREE_VALUE (method), 10177 TREE_VALUE (current)) 10178 && valid_method_invocation_conversion_p 10179 (DECL_CONTEXT (TREE_VALUE (method)), 10180 DECL_CONTEXT (TREE_VALUE (current)))) 10181 { 10182 int v = ++DECL_SPECIFIC_COUNT (TREE_VALUE (current)); 10183 max = (v > max ? v : max); 10184 } 10185 } 10186 } 10187 10188 /* Review the list and select the maximally specific methods */ 10189 for (current = list; current; current = TREE_CHAIN (current)) 10190 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max) 10191 new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list); 10192 10193 /* If we can't find one, lower expectations and try to gather multiple 10194 maximally specific methods */ 10195 while (!new_list) 10196 { 10197 while (--max > 0) 10198 { 10199 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max) 10200 new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list); 10201 } 10202 return new_list; 10203 } 10204 10205 return new_list; 10206} 10207 10208/* Make sure that the type of each M2_OR_ARGLIST arguments can be 10209 converted by method invocation conversion (5.3) to the type of the 10210 corresponding parameter of M1. Implementation expects M2_OR_ARGLIST 10211 to change less often than M1. */ 10212 10213static int 10214argument_types_convertible (m1, m2_or_arglist) 10215 tree m1, m2_or_arglist; 10216{ 10217 static tree m2_arg_value = NULL_TREE; 10218 static tree m2_arg_cache = NULL_TREE; 10219 10220 register tree m1_arg, m2_arg; 10221 10222 m1_arg = TYPE_ARG_TYPES (TREE_TYPE (m1)); 10223 if (!METHOD_STATIC (m1)) 10224 m1_arg = TREE_CHAIN (m1_arg); 10225 10226 if (m2_arg_value == m2_or_arglist) 10227 m2_arg = m2_arg_cache; 10228 else 10229 { 10230 /* M2_OR_ARGLIST can be a function DECL or a raw list of 10231 argument types */ 10232 if (m2_or_arglist && TREE_CODE (m2_or_arglist) == FUNCTION_DECL) 10233 { 10234 m2_arg = TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist)); 10235 if (!METHOD_STATIC (m2_or_arglist)) 10236 m2_arg = TREE_CHAIN (m2_arg); 10237 } 10238 else 10239 m2_arg = m2_or_arglist; 10240 10241 m2_arg_value = m2_or_arglist; 10242 m2_arg_cache = m2_arg; 10243 } 10244 10245 while (m1_arg != end_params_node && m2_arg != end_params_node) 10246 { 10247 resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE); 10248 if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg), 10249 TREE_VALUE (m2_arg))) 10250 break; 10251 m1_arg = TREE_CHAIN (m1_arg); 10252 m2_arg = TREE_CHAIN (m2_arg); 10253 } 10254 return m1_arg == end_params_node && m2_arg == end_params_node; 10255} 10256 10257/* Qualification routines */ 10258 10259static void 10260qualify_ambiguous_name (id) 10261 tree id; 10262{ 10263 tree qual, qual_wfl, name, decl, ptr_type, saved_current_class; 10264 int again, super_found = 0, this_found = 0, new_array_found = 0; 10265 int code; 10266 10267 /* We first qualify the first element, then derive qualification of 10268 others based on the first one. If the first element is qualified 10269 by a resolution (field or type), this resolution is stored in the 10270 QUAL_RESOLUTION of the qual element being examined. We need to 10271 save the current_class since the use of SUPER might change the 10272 its value. */ 10273 saved_current_class = current_class; 10274 qual = EXPR_WFL_QUALIFICATION (id); 10275 do { 10276 10277 /* Simple qualified expression feature a qual_wfl that is a 10278 WFL. Expression derived from a primary feature more complicated 10279 things like a CALL_EXPR. Expression from primary need to be 10280 worked out to extract the part on which the qualification will 10281 take place. */ 10282 qual_wfl = QUAL_WFL (qual); 10283 switch (TREE_CODE (qual_wfl)) 10284 { 10285 case CALL_EXPR: 10286 qual_wfl = TREE_OPERAND (qual_wfl, 0); 10287 if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION) 10288 { 10289 qual = EXPR_WFL_QUALIFICATION (qual_wfl); 10290 qual_wfl = QUAL_WFL (qual); 10291 } 10292 break; 10293 case NEW_ARRAY_EXPR: 10294 qual = TREE_CHAIN (qual); 10295 new_array_found = 1; 10296 continue; 10297 case NEW_CLASS_EXPR: 10298 case CONVERT_EXPR: 10299 qual_wfl = TREE_OPERAND (qual_wfl, 0); 10300 break; 10301 case ARRAY_REF: 10302 while (TREE_CODE (qual_wfl) == ARRAY_REF) 10303 qual_wfl = TREE_OPERAND (qual_wfl, 0); 10304 break; 10305 case STRING_CST: 10306 qual = TREE_CHAIN (qual); 10307 qual_wfl = QUAL_WFL (qual); 10308 break; 10309 default: 10310 /* Fix for -Wall. Just break doing nothing */ 10311 break; 10312 } 10313 10314 ptr_type = current_class; 10315 again = 0; 10316 code = TREE_CODE (qual_wfl); 10317 10318 /* Pos evaluation: non WFL leading expression nodes */ 10319 if (code == CONVERT_EXPR 10320 && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION) 10321 name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl)); 10322 10323 else if (code == ARRAY_REF && 10324 TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION) 10325 name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0)); 10326 10327 else if (code == CALL_EXPR && 10328 TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION) 10329 name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0)); 10330 10331 else if (code == STRING_CST || code == CONDITIONAL_EXPR) 10332 { 10333 qual = TREE_CHAIN (qual); 10334 qual_wfl = QUAL_WFL (qual); 10335 again = 1; 10336 } 10337 else 10338 name = EXPR_WFL_NODE (qual_wfl); 10339 10340 /* If we have a THIS (from a primary), we set the context accordingly */ 10341 if (name == this_identifier_node) 10342 { 10343 qual = TREE_CHAIN (qual); 10344 qual_wfl = QUAL_WFL (qual); 10345 if (TREE_CODE (qual_wfl) == CALL_EXPR) 10346 again = 1; 10347 else 10348 name = EXPR_WFL_NODE (qual_wfl); 10349 this_found = 1; 10350 } 10351 /* If we have a SUPER, we set the context accordingly */ 10352 if (name == super_identifier_node) 10353 { 10354 current_class = CLASSTYPE_SUPER (ptr_type); 10355 /* Check that there is such a thing as a super class. If not, 10356 return. The error will be caught later on, during the 10357 resolution */ 10358 if (!current_class) 10359 { 10360 current_class = saved_current_class; 10361 return; 10362 } 10363 qual = TREE_CHAIN (qual); 10364 /* Do one more interation to set things up */ 10365 super_found = again = 1; 10366 } 10367 } while (again); 10368 10369 /* If name appears within the scope of a location variable 10370 declaration or parameter declaration, then it is an expression 10371 name. We don't carry this test out if we're in the context of the 10372 use of SUPER or THIS */ 10373 if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name))) 10374 { 10375 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; 10376 QUAL_RESOLUTION (qual) = decl; 10377 } 10378 10379 /* If within the class/interface NAME was found to be used there 10380 exists a (possibly inherited) field named NAME, then this is an 10381 expression name. If we saw a NEW_ARRAY_EXPR before and want to 10382 address length, it is OK. */ 10383 else if ((decl = lookup_field_wrapper (ptr_type, name)) 10384 || (new_array_found && name == length_identifier_node)) 10385 { 10386 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; 10387 QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl); 10388 } 10389 10390 /* We reclassify NAME as a type name if: 10391 - NAME is a class/interface declared within the compilation 10392 unit containing NAME, 10393 - NAME is imported via a single-type-import declaration, 10394 - NAME is declared in an another compilation unit of the package 10395 of the compilation unit containing NAME, 10396 - NAME is declared by exactly on type-import-on-demand declaration 10397 of the compilation unit containing NAME. */ 10398 else if ((decl = resolve_and_layout (name, NULL_TREE))) 10399 { 10400 RESOLVE_TYPE_NAME_P (qual_wfl) = 1; 10401 QUAL_RESOLUTION (qual) = decl; 10402 } 10403 10404 /* Method call are expression name */ 10405 else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR 10406 || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF 10407 || TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR) 10408 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; 10409 10410 /* Check here that NAME isn't declared by more than one 10411 type-import-on-demand declaration of the compilation unit 10412 containing NAME. FIXME */ 10413 10414 /* Otherwise, NAME is reclassified as a package name */ 10415 else 10416 RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1; 10417 10418 /* Propagate the qualification accross other components of the 10419 qualified name */ 10420 for (qual = TREE_CHAIN (qual); qual; 10421 qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual)) 10422 { 10423 if (RESOLVE_PACKAGE_NAME_P (qual_wfl)) 10424 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1; 10425 else 10426 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1; 10427 } 10428 10429 /* Store the global qualification for the ambiguous part of ID back 10430 into ID fields */ 10431 if (RESOLVE_EXPRESSION_NAME_P (qual_wfl)) 10432 RESOLVE_EXPRESSION_NAME_P (id) = 1; 10433 else if (RESOLVE_TYPE_NAME_P (qual_wfl)) 10434 RESOLVE_TYPE_NAME_P (id) = 1; 10435 else if (RESOLVE_PACKAGE_NAME_P (qual_wfl)) 10436 RESOLVE_PACKAGE_NAME_P (id) = 1; 10437 10438 /* Restore the current class */ 10439 current_class = saved_current_class; 10440} 10441 10442static int 10443breakdown_qualified (left, right, source) 10444 tree *left, *right, source; 10445{ 10446 char *p = IDENTIFIER_POINTER (source), *base; 10447 int l = IDENTIFIER_LENGTH (source); 10448 10449 /* Breakdown NAME into REMAINDER . IDENTIFIER */ 10450 base = p; 10451 p += (l-1); 10452 while (*p != '.' && p != base) 10453 p--; 10454 10455 /* We didn't find a '.'. Return an error */ 10456 if (p == base) 10457 return 1; 10458 10459 *p = '\0'; 10460 if (right) 10461 *right = get_identifier (p+1); 10462 *left = get_identifier (IDENTIFIER_POINTER (source)); 10463 *p = '.'; 10464 10465 return 0; 10466} 10467 10468/* Patch tree nodes in a function body. When a BLOCK is found, push 10469 local variable decls if present. 10470 Same as java_complete_lhs, but does resolve static finals to values. */ 10471 10472static tree 10473java_complete_tree (node) 10474 tree node; 10475{ 10476 node = java_complete_lhs (node); 10477 if (TREE_CODE (node) == VAR_DECL && FIELD_STATIC (node) 10478 && FIELD_FINAL (node) && DECL_INITIAL (node) != NULL_TREE 10479 && !flag_emit_xref) 10480 { 10481 tree value = DECL_INITIAL (node); 10482 DECL_INITIAL (node) = NULL_TREE; 10483 value = fold_constant_for_init (value, node); 10484 DECL_INITIAL (node) = value; 10485 if (value != NULL_TREE) 10486 return value; 10487 } 10488 return node; 10489} 10490 10491static tree 10492java_stabilize_reference (node) 10493 tree node; 10494{ 10495 if (TREE_CODE (node) == COMPOUND_EXPR) 10496 { 10497 tree op0 = TREE_OPERAND (node, 0); 10498 tree op1 = TREE_OPERAND (node, 1); 10499 TREE_OPERAND (node, 0) = save_expr (op0); 10500 TREE_OPERAND (node, 1) = java_stabilize_reference (op1); 10501 return node; 10502 } 10503 else 10504 return stabilize_reference (node); 10505} 10506 10507/* Patch tree nodes in a function body. When a BLOCK is found, push 10508 local variable decls if present. 10509 Same as java_complete_tree, but does not resolve static finals to values. */ 10510 10511static tree 10512java_complete_lhs (node) 10513 tree node; 10514{ 10515 tree nn, cn, wfl_op1, wfl_op2, wfl_op3; 10516 int flag; 10517 10518 /* CONVERT_EXPR always has its type set, even though it needs to be 10519 worked out. */ 10520 if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR) 10521 return node; 10522 10523 /* The switch block implements cases processing container nodes 10524 first. Contained nodes are always written back. Leaves come 10525 next and return a value. */ 10526 switch (TREE_CODE (node)) 10527 { 10528 case BLOCK: 10529 10530 /* 1- Block section. 10531 Set the local values on decl names so we can identify them 10532 faster when they're referenced. At that stage, identifiers 10533 are legal so we don't check for declaration errors. */ 10534 for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn)) 10535 { 10536 DECL_CONTEXT (cn) = current_function_decl; 10537 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn; 10538 } 10539 if (BLOCK_EXPR_BODY (node) == NULL_TREE) 10540 CAN_COMPLETE_NORMALLY (node) = 1; 10541 else 10542 { 10543 tree stmt = BLOCK_EXPR_BODY (node); 10544 tree *ptr; 10545 int error_seen = 0; 10546 if (TREE_CODE (stmt) == COMPOUND_EXPR) 10547 { 10548 /* Re-order from (((A; B); C); ...; Z) to 10549 (A; (B; (C ; (...; Z)))). 10550 This makes it easier to scan the statements left-to-right 10551 without using recursion (which might overflow the stack 10552 if the block has many statements. */ 10553 for (;;) 10554 { 10555 tree left = TREE_OPERAND (stmt, 0); 10556 if (TREE_CODE (left) != COMPOUND_EXPR) 10557 break; 10558 TREE_OPERAND (stmt, 0) = TREE_OPERAND (left, 1); 10559 TREE_OPERAND (left, 1) = stmt; 10560 stmt = left; 10561 } 10562 BLOCK_EXPR_BODY (node) = stmt; 10563 } 10564 10565 /* Now do the actual complete, without deep recursion for 10566 long blocks. */ 10567 ptr = &BLOCK_EXPR_BODY (node); 10568 while (TREE_CODE (*ptr) == COMPOUND_EXPR 10569 && TREE_OPERAND (*ptr, 1) != empty_stmt_node) 10570 { 10571 tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0)); 10572 tree *next = &TREE_OPERAND (*ptr, 1); 10573 TREE_OPERAND (*ptr, 0) = cur; 10574 if (cur == empty_stmt_node) 10575 { 10576 /* Optimization; makes it easier to detect empty bodies. 10577 Most useful for <clinit> with all-constant initializer. */ 10578 *ptr = *next; 10579 continue; 10580 } 10581 if (TREE_CODE (cur) == ERROR_MARK) 10582 error_seen++; 10583 else if (! CAN_COMPLETE_NORMALLY (cur)) 10584 { 10585 wfl_op2 = *next; 10586 for (;;) 10587 { 10588 if (TREE_CODE (wfl_op2) == BLOCK) 10589 wfl_op2 = BLOCK_EXPR_BODY (wfl_op2); 10590 else if (TREE_CODE (wfl_op2) == COMPOUND_EXPR) 10591 wfl_op2 = TREE_OPERAND (wfl_op2, 0); 10592 else 10593 break; 10594 } 10595 if (TREE_CODE (wfl_op2) != CASE_EXPR 10596 && TREE_CODE (wfl_op2) != DEFAULT_EXPR) 10597 unreachable_stmt_error (*ptr); 10598 } 10599 ptr = next; 10600 } 10601 *ptr = java_complete_tree (*ptr); 10602 10603 if (TREE_CODE (*ptr) == ERROR_MARK || error_seen > 0) 10604 return error_mark_node; 10605 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (*ptr); 10606 } 10607 /* Turn local bindings to null */ 10608 for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn)) 10609 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE; 10610 10611 TREE_TYPE (node) = void_type_node; 10612 break; 10613 10614 /* 2- They are expressions but ultimately deal with statements */ 10615 10616 case THROW_EXPR: 10617 wfl_op1 = TREE_OPERAND (node, 0); 10618 COMPLETE_CHECK_OP_0 (node); 10619 /* CAN_COMPLETE_NORMALLY (node) = 0; */ 10620 return patch_throw_statement (node, wfl_op1); 10621 10622 case SYNCHRONIZED_EXPR: 10623 wfl_op1 = TREE_OPERAND (node, 0); 10624 return patch_synchronized_statement (node, wfl_op1); 10625 10626 case TRY_EXPR: 10627 return patch_try_statement (node); 10628 10629 case TRY_FINALLY_EXPR: 10630 COMPLETE_CHECK_OP_0 (node); 10631 COMPLETE_CHECK_OP_1 (node); 10632 CAN_COMPLETE_NORMALLY (node) 10633 = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0)) 10634 && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))); 10635 TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 0)); 10636 return node; 10637 10638 case CLEANUP_POINT_EXPR: 10639 COMPLETE_CHECK_OP_0 (node); 10640 TREE_TYPE (node) = void_type_node; 10641 CAN_COMPLETE_NORMALLY (node) = 10642 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0)); 10643 return node; 10644 10645 case WITH_CLEANUP_EXPR: 10646 COMPLETE_CHECK_OP_0 (node); 10647 COMPLETE_CHECK_OP_2 (node); 10648 CAN_COMPLETE_NORMALLY (node) = 10649 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0)); 10650 TREE_TYPE (node) = void_type_node; 10651 return node; 10652 10653 case LABELED_BLOCK_EXPR: 10654 PUSH_LABELED_BLOCK (node); 10655 if (LABELED_BLOCK_BODY (node)) 10656 COMPLETE_CHECK_OP_1 (node); 10657 TREE_TYPE (node) = void_type_node; 10658 POP_LABELED_BLOCK (); 10659 10660 if (LABELED_BLOCK_BODY (node) == empty_stmt_node) 10661 { 10662 LABELED_BLOCK_BODY (node) = NULL_TREE; 10663 CAN_COMPLETE_NORMALLY (node) = 1; 10664 } 10665 else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node))) 10666 CAN_COMPLETE_NORMALLY (node) = 1; 10667 return node; 10668 10669 case EXIT_BLOCK_EXPR: 10670 /* We don't complete operand 1, because it's the return value of 10671 the EXIT_BLOCK_EXPR which doesn't exist it Java */ 10672 return patch_bc_statement (node); 10673 10674 case CASE_EXPR: 10675 cn = java_complete_tree (TREE_OPERAND (node, 0)); 10676 if (cn == error_mark_node) 10677 return cn; 10678 10679 /* First, the case expression must be constant. Values of final 10680 fields are accepted. */ 10681 cn = fold (cn); 10682 if ((TREE_CODE (cn) == COMPOUND_EXPR || TREE_CODE (cn) == COMPONENT_REF) 10683 && JDECL_P (TREE_OPERAND (cn, 1)) 10684 && FIELD_FINAL (TREE_OPERAND (cn, 1)) 10685 && DECL_INITIAL (TREE_OPERAND (cn, 1))) 10686 cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)), 10687 TREE_OPERAND (cn, 1)); 10688 10689 if (!TREE_CONSTANT (cn) && !flag_emit_xref) 10690 { 10691 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 10692 parse_error_context (node, "Constant expression required"); 10693 return error_mark_node; 10694 } 10695 10696 nn = ctxp->current_loop; 10697 10698 /* It must be assignable to the type of the switch expression. */ 10699 if (!try_builtin_assignconv (NULL_TREE, 10700 TREE_TYPE (TREE_OPERAND (nn, 0)), cn)) 10701 { 10702 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 10703 parse_error_context 10704 (wfl_operator, 10705 "Incompatible type for case. Can't convert `%s' to `int'", 10706 lang_printable_name (TREE_TYPE (cn), 0)); 10707 return error_mark_node; 10708 } 10709 10710 cn = fold (convert (int_type_node, cn)); 10711 10712 /* Multiple instance of a case label bearing the same 10713 value is checked during code generation. The case 10714 expression is allright so far. */ 10715 TREE_OPERAND (node, 0) = cn; 10716 TREE_TYPE (node) = void_type_node; 10717 CAN_COMPLETE_NORMALLY (node) = 1; 10718 TREE_SIDE_EFFECTS (node) = 1; 10719 break; 10720 10721 case DEFAULT_EXPR: 10722 nn = ctxp->current_loop; 10723 /* Only one default label is allowed per switch statement */ 10724 if (SWITCH_HAS_DEFAULT (nn)) 10725 { 10726 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 10727 parse_error_context (wfl_operator, 10728 "Duplicate case label: `default'"); 10729 return error_mark_node; 10730 } 10731 else 10732 SWITCH_HAS_DEFAULT (nn) = 1; 10733 TREE_TYPE (node) = void_type_node; 10734 TREE_SIDE_EFFECTS (node) = 1; 10735 CAN_COMPLETE_NORMALLY (node) = 1; 10736 break; 10737 10738 case SWITCH_EXPR: 10739 case LOOP_EXPR: 10740 PUSH_LOOP (node); 10741 /* Check whether the loop was enclosed in a labeled 10742 statement. If not, create one, insert the loop in it and 10743 return the node */ 10744 nn = patch_loop_statement (node); 10745 10746 /* Anyways, walk the body of the loop */ 10747 if (TREE_CODE (node) == LOOP_EXPR) 10748 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); 10749 /* Switch statement: walk the switch expression and the cases */ 10750 else 10751 node = patch_switch_statement (node); 10752 10753 if (TREE_OPERAND (node, 0) == error_mark_node) 10754 nn = error_mark_node; 10755 else 10756 { 10757 TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node; 10758 /* If we returned something different, that's because we 10759 inserted a label. Pop the label too. */ 10760 if (nn != node) 10761 { 10762 if (CAN_COMPLETE_NORMALLY (node)) 10763 CAN_COMPLETE_NORMALLY (nn) = 1; 10764 POP_LABELED_BLOCK (); 10765 } 10766 } 10767 POP_LOOP (); 10768 return nn; 10769 10770 case EXIT_EXPR: 10771 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); 10772 return patch_exit_expr (node); 10773 10774 case COND_EXPR: 10775 /* Condition */ 10776 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); 10777 if (TREE_OPERAND (node, 0) == error_mark_node) 10778 return error_mark_node; 10779 /* then-else branches */ 10780 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1)); 10781 if (TREE_OPERAND (node, 1) == error_mark_node) 10782 return error_mark_node; 10783 TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2)); 10784 if (TREE_OPERAND (node, 2) == error_mark_node) 10785 return error_mark_node; 10786 return patch_if_else_statement (node); 10787 break; 10788 10789 case CONDITIONAL_EXPR: 10790 /* Condition */ 10791 wfl_op1 = TREE_OPERAND (node, 0); 10792 COMPLETE_CHECK_OP_0 (node); 10793 wfl_op2 = TREE_OPERAND (node, 1); 10794 COMPLETE_CHECK_OP_1 (node); 10795 wfl_op3 = TREE_OPERAND (node, 2); 10796 COMPLETE_CHECK_OP_2 (node); 10797 return patch_conditional_expr (node, wfl_op1, wfl_op2); 10798 10799 /* 3- Expression section */ 10800 case COMPOUND_EXPR: 10801 wfl_op2 = TREE_OPERAND (node, 1); 10802 TREE_OPERAND (node, 0) = nn = 10803 java_complete_tree (TREE_OPERAND (node, 0)); 10804 if (wfl_op2 == empty_stmt_node) 10805 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn); 10806 else 10807 { 10808 if (! CAN_COMPLETE_NORMALLY (nn) && TREE_CODE (nn) != ERROR_MARK) 10809 { 10810 /* An unreachable condition in a do-while statement 10811 is *not* (technically) an unreachable statement. */ 10812 nn = wfl_op2; 10813 if (TREE_CODE (nn) == EXPR_WITH_FILE_LOCATION) 10814 nn = EXPR_WFL_NODE (nn); 10815 if (TREE_CODE (nn) != EXIT_EXPR) 10816 { 10817 SET_WFL_OPERATOR (wfl_operator, node, wfl_op2); 10818 parse_error_context (wfl_operator, "Unreachable statement"); 10819 } 10820 } 10821 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1)); 10822 if (TREE_OPERAND (node, 1) == error_mark_node) 10823 return error_mark_node; 10824 CAN_COMPLETE_NORMALLY (node) 10825 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)); 10826 } 10827 TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1)); 10828 break; 10829 10830 case RETURN_EXPR: 10831 /* CAN_COMPLETE_NORMALLY (node) = 0; */ 10832 return patch_return (node); 10833 10834 case EXPR_WITH_FILE_LOCATION: 10835 if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */ 10836 || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE) 10837 { 10838 tree wfl = node; 10839 node = resolve_expression_name (node, NULL); 10840 if (node == error_mark_node) 10841 return node; 10842 /* Keep line number information somewhere were it doesn't 10843 disrupt the completion process. */ 10844 if (flag_emit_xref && TREE_CODE (node) != CALL_EXPR) 10845 { 10846 EXPR_WFL_NODE (wfl) = TREE_OPERAND (node, 1); 10847 TREE_OPERAND (node, 1) = wfl; 10848 } 10849 CAN_COMPLETE_NORMALLY (node) = 1; 10850 } 10851 else 10852 { 10853 tree body; 10854 int save_lineno = lineno; 10855 lineno = EXPR_WFL_LINENO (node); 10856 body = java_complete_tree (EXPR_WFL_NODE (node)); 10857 lineno = save_lineno; 10858 EXPR_WFL_NODE (node) = body; 10859 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body); 10860 CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body); 10861 if (body == empty_stmt_node) 10862 { 10863 /* Optimization; makes it easier to detect empty bodies. */ 10864 return body; 10865 } 10866 if (body == error_mark_node) 10867 { 10868 /* Its important for the evaluation of assignment that 10869 this mark on the TREE_TYPE is propagated. */ 10870 TREE_TYPE (node) = error_mark_node; 10871 return error_mark_node; 10872 } 10873 else 10874 TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node)); 10875 10876 } 10877 break; 10878 10879 case NEW_ARRAY_EXPR: 10880 /* Patch all the dimensions */ 10881 flag = 0; 10882 for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn)) 10883 { 10884 int location = EXPR_WFL_LINECOL (TREE_VALUE (cn)); 10885 tree dim = java_complete_tree (TREE_VALUE (cn)); 10886 if (dim == error_mark_node) 10887 { 10888 flag = 1; 10889 continue; 10890 } 10891 else 10892 { 10893 TREE_VALUE (cn) = dim; 10894 /* Setup the location of the current dimension, for 10895 later error report. */ 10896 TREE_PURPOSE (cn) = 10897 build_expr_wfl (NULL_TREE, input_filename, 0, 0); 10898 EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location; 10899 } 10900 } 10901 /* They complete the array creation expression, if no errors 10902 were found. */ 10903 CAN_COMPLETE_NORMALLY (node) = 1; 10904 return (flag ? error_mark_node 10905 : force_evaluation_order (patch_newarray (node))); 10906 10907 case NEW_CLASS_EXPR: 10908 case CALL_EXPR: 10909 /* Complete function's argument(s) first */ 10910 if (complete_function_arguments (node)) 10911 return error_mark_node; 10912 else 10913 { 10914 tree decl, wfl = TREE_OPERAND (node, 0); 10915 int in_this = CALL_THIS_CONSTRUCTOR_P (node); 10916 10917 node = patch_method_invocation (node, NULL_TREE, 10918 NULL_TREE, 0, &decl); 10919 if (node == error_mark_node) 10920 return error_mark_node; 10921 10922 check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl); 10923 /* If we call this(...), register signature and positions */ 10924 if (in_this) 10925 DECL_CONSTRUCTOR_CALLS (current_function_decl) = 10926 tree_cons (wfl, decl, 10927 DECL_CONSTRUCTOR_CALLS (current_function_decl)); 10928 CAN_COMPLETE_NORMALLY (node) = 1; 10929 return force_evaluation_order (node); 10930 } 10931 10932 case MODIFY_EXPR: 10933 /* Save potential wfls */ 10934 wfl_op1 = TREE_OPERAND (node, 0); 10935 TREE_OPERAND (node, 0) = nn = java_complete_lhs (wfl_op1); 10936 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node) 10937 && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn) 10938 && DECL_INITIAL (nn) != NULL_TREE) 10939 { 10940 tree value = fold_constant_for_init (nn, nn); 10941 if (value != NULL_TREE) 10942 { 10943 tree type = TREE_TYPE (value); 10944 if (JPRIMITIVE_TYPE_P (type) || type == string_ptr_type_node) 10945 return empty_stmt_node; 10946 } 10947 DECL_INITIAL (nn) = NULL_TREE; 10948 } 10949 wfl_op2 = TREE_OPERAND (node, 1); 10950 10951 if (TREE_OPERAND (node, 0) == error_mark_node) 10952 return error_mark_node; 10953 10954 if (COMPOUND_ASSIGN_P (wfl_op2)) 10955 { 10956 tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0)); 10957 10958 /* Hand stablize the lhs on both places */ 10959 TREE_OPERAND (node, 0) = lvalue; 10960 TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue; 10961 10962 /* Now complete the RHS. We write it back later on. */ 10963 nn = java_complete_tree (TREE_OPERAND (node, 1)); 10964 10965 if ((cn = patch_string (nn))) 10966 nn = cn; 10967 10968 /* The last part of the rewrite for E1 op= E2 is to have 10969 E1 = (T)(E1 op E2), with T being the type of E1. */ 10970 nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2), 10971 TREE_TYPE (lvalue), nn)); 10972 } 10973 10974 /* If we're about to patch a NEW_ARRAY_INIT, we call a special 10975 function to complete this RHS */ 10976 else if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT) 10977 nn = patch_new_array_init (TREE_TYPE (TREE_OPERAND (node, 0)), 10978 TREE_OPERAND (node, 1)); 10979 /* Otherwise we simply complete the RHS */ 10980 else 10981 nn = java_complete_tree (TREE_OPERAND (node, 1)); 10982 10983 if (nn == error_mark_node) 10984 return error_mark_node; 10985 10986 /* Write back the RHS as we evaluated it. */ 10987 TREE_OPERAND (node, 1) = nn; 10988 10989 /* In case we're handling = with a String as a RHS, we need to 10990 produce a String out of the RHS (it might still be a 10991 STRING_CST or a StringBuffer at this stage */ 10992 if ((nn = patch_string (TREE_OPERAND (node, 1)))) 10993 TREE_OPERAND (node, 1) = nn; 10994 node = patch_assignment (node, wfl_op1, wfl_op2); 10995 CAN_COMPLETE_NORMALLY (node) = 1; 10996 return node; 10997 10998 case MULT_EXPR: 10999 case PLUS_EXPR: 11000 case MINUS_EXPR: 11001 case LSHIFT_EXPR: 11002 case RSHIFT_EXPR: 11003 case URSHIFT_EXPR: 11004 case BIT_AND_EXPR: 11005 case BIT_XOR_EXPR: 11006 case BIT_IOR_EXPR: 11007 case TRUNC_MOD_EXPR: 11008 case RDIV_EXPR: 11009 case TRUTH_ANDIF_EXPR: 11010 case TRUTH_ORIF_EXPR: 11011 case EQ_EXPR: 11012 case NE_EXPR: 11013 case GT_EXPR: 11014 case GE_EXPR: 11015 case LT_EXPR: 11016 case LE_EXPR: 11017 /* Operands 0 and 1 are WFL in certain cases only. patch_binop 11018 knows how to handle those cases. */ 11019 wfl_op1 = TREE_OPERAND (node, 0); 11020 wfl_op2 = TREE_OPERAND (node, 1); 11021 11022 CAN_COMPLETE_NORMALLY (node) = 1; 11023 /* Don't complete string nodes if dealing with the PLUS operand. */ 11024 if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op1)) 11025 { 11026 nn = java_complete_tree (wfl_op1); 11027 if (nn == error_mark_node) 11028 return error_mark_node; 11029 if ((cn = patch_string (nn))) 11030 nn = cn; 11031 TREE_OPERAND (node, 0) = nn; 11032 } 11033 if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2)) 11034 { 11035 nn = java_complete_tree (wfl_op2); 11036 if (nn == error_mark_node) 11037 return error_mark_node; 11038 if ((cn = patch_string (nn))) 11039 nn = cn; 11040 TREE_OPERAND (node, 1) = nn; 11041 } 11042 return force_evaluation_order (patch_binop (node, wfl_op1, wfl_op2)); 11043 11044 case INSTANCEOF_EXPR: 11045 wfl_op1 = TREE_OPERAND (node, 0); 11046 COMPLETE_CHECK_OP_0 (node); 11047 if (flag_emit_xref) 11048 { 11049 TREE_TYPE (node) = boolean_type_node; 11050 return node; 11051 } 11052 return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1)); 11053 11054 case UNARY_PLUS_EXPR: 11055 case NEGATE_EXPR: 11056 case TRUTH_NOT_EXPR: 11057 case BIT_NOT_EXPR: 11058 case PREDECREMENT_EXPR: 11059 case PREINCREMENT_EXPR: 11060 case POSTDECREMENT_EXPR: 11061 case POSTINCREMENT_EXPR: 11062 case CONVERT_EXPR: 11063 /* There are cases were wfl_op1 is a WFL. patch_unaryop knows 11064 how to handle those cases. */ 11065 wfl_op1 = TREE_OPERAND (node, 0); 11066 CAN_COMPLETE_NORMALLY (node) = 1; 11067 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1); 11068 if (TREE_OPERAND (node, 0) == error_mark_node) 11069 return error_mark_node; 11070 node = patch_unaryop (node, wfl_op1); 11071 CAN_COMPLETE_NORMALLY (node) = 1; 11072 break; 11073 11074 case ARRAY_REF: 11075 /* There are cases were wfl_op1 is a WFL. patch_array_ref knows 11076 how to handle those cases. */ 11077 wfl_op1 = TREE_OPERAND (node, 0); 11078 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1); 11079 if (TREE_OPERAND (node, 0) == error_mark_node) 11080 return error_mark_node; 11081 if (!flag_emit_class_files && !flag_emit_xref) 11082 TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0)); 11083 /* The same applies to wfl_op2 */ 11084 wfl_op2 = TREE_OPERAND (node, 1); 11085 TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2); 11086 if (TREE_OPERAND (node, 1) == error_mark_node) 11087 return error_mark_node; 11088 if (!flag_emit_class_files && !flag_emit_xref) 11089 TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1)); 11090 return patch_array_ref (node); 11091 11092 case RECORD_TYPE: 11093 return node;; 11094 11095 case COMPONENT_REF: 11096 /* The first step in the re-write of qualified name handling. FIXME. 11097 So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */ 11098 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); 11099 if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE) 11100 { 11101 tree name = TREE_OPERAND (node, 1); 11102 tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name); 11103 if (field == NULL_TREE) 11104 { 11105 error ("missing static field `%s'", IDENTIFIER_POINTER (name)); 11106 return error_mark_node; 11107 } 11108 if (! FIELD_STATIC (field)) 11109 { 11110 error ("not a static field `%s'", IDENTIFIER_POINTER (name)); 11111 return error_mark_node; 11112 } 11113 return field; 11114 } 11115 else 11116 fatal ("unimplemented java_complete_tree for COMPONENT_REF"); 11117 break; 11118 11119 case THIS_EXPR: 11120 /* Can't use THIS in a static environment */ 11121 if (!current_this) 11122 { 11123 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 11124 parse_error_context (wfl_operator, "Keyword `this' used outside " 11125 "allowed context"); 11126 TREE_TYPE (node) = error_mark_node; 11127 return error_mark_node; 11128 } 11129 if (ctxp->explicit_constructor_p) 11130 { 11131 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 11132 parse_error_context 11133 (wfl_operator, "Can't reference `this' or `super' before the " 11134 "superclass constructor has been called"); 11135 TREE_TYPE (node) = error_mark_node; 11136 return error_mark_node; 11137 } 11138 return current_this; 11139 11140 default: 11141 CAN_COMPLETE_NORMALLY (node) = 1; 11142 /* Ok: may be we have a STRING_CST or a crafted `StringBuffer' 11143 and it's time to turn it into the appropriate String object 11144 */ 11145 if ((node = patch_string (node))) 11146 return node; 11147 fatal ("No case for tree code `%s' - java_complete_tree\n", 11148 tree_code_name [TREE_CODE (node)]); 11149 } 11150 return node; 11151} 11152 11153/* Complete function call's argument. Return a non zero value is an 11154 error was found. */ 11155 11156static int 11157complete_function_arguments (node) 11158 tree node; 11159{ 11160 int flag = 0; 11161 tree cn; 11162 11163 ctxp->explicit_constructor_p += (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0); 11164 for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn)) 11165 { 11166 tree wfl = TREE_VALUE (cn), parm, temp; 11167 parm = java_complete_tree (wfl); 11168 if (parm == error_mark_node) 11169 { 11170 flag = 1; 11171 continue; 11172 } 11173 /* If have a string literal that we haven't transformed yet or a 11174 crafted string buffer, as a result of use of the the String 11175 `+' operator. Build `parm.toString()' and expand it. */ 11176 if ((temp = patch_string (parm))) 11177 parm = temp; 11178 /* Inline PRIMTYPE.TYPE read access */ 11179 parm = maybe_build_primttype_type_ref (parm, wfl); 11180 11181 TREE_VALUE (cn) = parm; 11182 } 11183 ctxp->explicit_constructor_p -= (CALL_THIS_CONSTRUCTOR_P (node) ? 1 : 0); 11184 return flag; 11185} 11186 11187/* Sometimes (for loops and variable initialized during their 11188 declaration), we want to wrap a statement around a WFL and turn it 11189 debugable. */ 11190 11191static tree 11192build_debugable_stmt (location, stmt) 11193 int location; 11194 tree stmt; 11195{ 11196 if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION) 11197 { 11198 stmt = build_expr_wfl (stmt, input_filename, 0, 0); 11199 EXPR_WFL_LINECOL (stmt) = location; 11200 } 11201 JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt); 11202 return stmt; 11203} 11204 11205static tree 11206build_expr_block (body, decls) 11207 tree body, decls; 11208{ 11209 tree node = make_node (BLOCK); 11210 BLOCK_EXPR_DECLS (node) = decls; 11211 BLOCK_EXPR_BODY (node) = body; 11212 if (body) 11213 TREE_TYPE (node) = TREE_TYPE (body); 11214 TREE_SIDE_EFFECTS (node) = 1; 11215 return node; 11216} 11217 11218/* Create a new function block and link it approriately to current 11219 function block chain */ 11220 11221static tree 11222enter_block () 11223{ 11224 return (enter_a_block (build_expr_block (NULL_TREE, NULL_TREE))); 11225} 11226 11227/* Link block B supercontext to the previous block. The current 11228 function DECL is used as supercontext when enter_a_block is called 11229 for the first time for a given function. The current function body 11230 (DECL_FUNCTION_BODY) is set to be block B. */ 11231 11232static tree 11233enter_a_block (b) 11234 tree b; 11235{ 11236 tree fndecl = current_function_decl; 11237 11238 if (!fndecl) { 11239 BLOCK_SUPERCONTEXT (b) = current_static_block; 11240 current_static_block = b; 11241 } 11242 11243 else if (!DECL_FUNCTION_BODY (fndecl)) 11244 { 11245 BLOCK_SUPERCONTEXT (b) = fndecl; 11246 DECL_FUNCTION_BODY (fndecl) = b; 11247 } 11248 else 11249 { 11250 BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl); 11251 DECL_FUNCTION_BODY (fndecl) = b; 11252 } 11253 return b; 11254} 11255 11256/* Exit a block by changing the current function body 11257 (DECL_FUNCTION_BODY) to the current block super context, only if 11258 the block being exited isn't the method's top level one. */ 11259 11260static tree 11261exit_block () 11262{ 11263 tree b; 11264 if (current_function_decl) 11265 { 11266 b = DECL_FUNCTION_BODY (current_function_decl); 11267 if (BLOCK_SUPERCONTEXT (b) != current_function_decl) 11268 DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b); 11269 } 11270 else 11271 { 11272 b = current_static_block; 11273 11274 if (BLOCK_SUPERCONTEXT (b)) 11275 current_static_block = BLOCK_SUPERCONTEXT (b); 11276 } 11277 return b; 11278} 11279 11280/* Lookup for NAME in the nested function's blocks, all the way up to 11281 the current toplevel one. It complies with Java's local variable 11282 scoping rules. */ 11283 11284static tree 11285lookup_name_in_blocks (name) 11286 tree name; 11287{ 11288 tree b = GET_CURRENT_BLOCK (current_function_decl); 11289 11290 while (b != current_function_decl) 11291 { 11292 tree current; 11293 11294 /* Paranoid sanity check. To be removed */ 11295 if (TREE_CODE (b) != BLOCK) 11296 fatal ("non block expr function body - lookup_name_in_blocks"); 11297 11298 for (current = BLOCK_EXPR_DECLS (b); current; 11299 current = TREE_CHAIN (current)) 11300 if (DECL_NAME (current) == name) 11301 return current; 11302 b = BLOCK_SUPERCONTEXT (b); 11303 } 11304 return NULL_TREE; 11305} 11306 11307static void 11308maybe_absorb_scoping_blocks () 11309{ 11310 while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl))) 11311 { 11312 tree b = exit_block (); 11313 java_method_add_stmt (current_function_decl, b); 11314 SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno)); 11315 } 11316} 11317 11318 11319/* This section of the source is reserved to build_* functions that 11320 are building incomplete tree nodes and the patch_* functions that 11321 are completing them. */ 11322 11323/* Build a super() constructor invocation. Returns empty_stmt_node if 11324 we're currently dealing with the class java.lang.Object. */ 11325 11326static tree 11327build_super_invocation () 11328{ 11329 if (current_class == object_type_node) 11330 return empty_stmt_node; 11331 else 11332 { 11333 tree super_wfl = build_wfl_node (super_identifier_node); 11334 return build_method_invocation (super_wfl, NULL_TREE); 11335 } 11336} 11337 11338/* Build a SUPER/THIS qualified method invocation. */ 11339 11340static tree 11341build_this_super_qualified_invocation (use_this, name, args, lloc, rloc) 11342 int use_this; 11343 tree name, args; 11344 int lloc, rloc; 11345 11346{ 11347 tree invok; 11348 tree wfl = 11349 build_wfl_node (use_this ? this_identifier_node : super_identifier_node); 11350 EXPR_WFL_LINECOL (wfl) = lloc; 11351 invok = build_method_invocation (name, args); 11352 return make_qualified_primary (wfl, invok, rloc); 11353} 11354 11355/* Build an incomplete CALL_EXPR node. */ 11356 11357static tree 11358build_method_invocation (name, args) 11359 tree name; 11360 tree args; 11361{ 11362 tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE); 11363 TREE_SIDE_EFFECTS (call) = 1; 11364 EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name); 11365 return call; 11366} 11367 11368/* Build an incomplete new xxx(...) node. */ 11369 11370static tree 11371build_new_invocation (name, args) 11372 tree name, args; 11373{ 11374 tree call = build (NEW_CLASS_EXPR, NULL_TREE, name, args, NULL_TREE); 11375 TREE_SIDE_EFFECTS (call) = 1; 11376 EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name); 11377 return call; 11378} 11379 11380/* Build an incomplete assignment expression. */ 11381 11382static tree 11383build_assignment (op, op_location, lhs, rhs) 11384 int op, op_location; 11385 tree lhs, rhs; 11386{ 11387 tree assignment; 11388 /* Build the corresponding binop if we deal with a Compound 11389 Assignment operator. Mark the binop sub-tree as part of a 11390 Compound Assignment expression */ 11391 if (op != ASSIGN_TK) 11392 { 11393 rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs); 11394 COMPOUND_ASSIGN_P (rhs) = 1; 11395 } 11396 assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs); 11397 TREE_SIDE_EFFECTS (assignment) = 1; 11398 EXPR_WFL_LINECOL (assignment) = op_location; 11399 return assignment; 11400} 11401 11402/* Print an INTEGER_CST node in a static buffer, and return the buffer. */ 11403 11404char * 11405print_int_node (node) 11406 tree node; 11407{ 11408 static char buffer [80]; 11409 if (TREE_CONSTANT_OVERFLOW (node)) 11410 sprintf (buffer, "<overflow>"); 11411 11412 if (TREE_INT_CST_HIGH (node) == 0) 11413 sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED, 11414 TREE_INT_CST_LOW (node)); 11415 else if (TREE_INT_CST_HIGH (node) == -1 11416 && TREE_INT_CST_LOW (node) != 0) 11417 { 11418 buffer [0] = '-'; 11419 sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED, 11420 -TREE_INT_CST_LOW (node)); 11421 } 11422 else 11423 sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX, 11424 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node)); 11425 11426 return buffer; 11427} 11428 11429/* Return 1 if an assignment to a FINAL is attempted in a non suitable 11430 context. */ 11431 11432static int 11433check_final_assignment (lvalue, wfl) 11434 tree lvalue, wfl; 11435{ 11436 if (JDECL_P (lvalue) 11437 && FIELD_FINAL (lvalue) && !IS_CLINIT (current_function_decl)) 11438 { 11439 parse_error_context 11440 (wfl, "Can't assign a value to the final variable `%s'", 11441 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); 11442 return 1; 11443 } 11444 return 0; 11445} 11446 11447/* Inline references to java.lang.PRIMTYPE.TYPE when accessed in 11448 read. This is needed to avoid circularities in the implementation 11449 of these fields in libjava. */ 11450 11451static tree 11452maybe_build_primttype_type_ref (rhs, wfl) 11453 tree rhs, wfl; 11454{ 11455 tree to_return = NULL_TREE; 11456 tree rhs_type = TREE_TYPE (rhs); 11457 if (TREE_CODE (rhs) == COMPOUND_EXPR) 11458 { 11459 tree n = TREE_OPERAND (rhs, 1); 11460 if (TREE_CODE (n) == VAR_DECL 11461 && DECL_NAME (n) == TYPE_identifier_node 11462 && rhs_type == class_ptr_type) 11463 { 11464 char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)); 11465 if (!strncmp (self_name, "java.lang.", 10)) 11466 to_return = build_primtype_type_ref (self_name); 11467 } 11468 } 11469 return (to_return ? to_return : rhs ); 11470} 11471 11472/* 15.25 Assignment operators. */ 11473 11474static tree 11475patch_assignment (node, wfl_op1, wfl_op2) 11476 tree node; 11477 tree wfl_op1; 11478 tree wfl_op2; 11479{ 11480 tree rhs = TREE_OPERAND (node, 1); 11481 tree lvalue = TREE_OPERAND (node, 0), llvalue; 11482 tree lhs_type, rhs_type, new_rhs = NULL_TREE; 11483 int error_found = 0; 11484 int lvalue_from_array = 0; 11485 11486 /* Can't assign to a final. */ 11487 if (check_final_assignment (lvalue, wfl_op1)) 11488 error_found = 1; 11489 11490 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 11491 11492 /* Lhs can be a named variable */ 11493 if (JDECL_P (lvalue)) 11494 { 11495 lhs_type = TREE_TYPE (lvalue); 11496 } 11497 /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME + 11498 comment on reason why */ 11499 else if (TREE_CODE (wfl_op1) == ARRAY_REF) 11500 { 11501 lhs_type = TREE_TYPE (lvalue); 11502 lvalue_from_array = 1; 11503 } 11504 /* Or a field access */ 11505 else if (TREE_CODE (lvalue) == COMPONENT_REF) 11506 lhs_type = TREE_TYPE (lvalue); 11507 /* Or a function return slot */ 11508 else if (TREE_CODE (lvalue) == RESULT_DECL) 11509 lhs_type = TREE_TYPE (lvalue); 11510 /* Otherwise, we might want to try to write into an optimized static 11511 final, this is an of a different nature, reported further on. */ 11512 else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION 11513 && resolve_expression_name (wfl_op1, &llvalue)) 11514 { 11515 if (check_final_assignment (llvalue, wfl_op1)) 11516 { 11517 /* What we should do instead is resetting the all the flags 11518 previously set, exchange lvalue for llvalue and continue. */ 11519 error_found = 1; 11520 return error_mark_node; 11521 } 11522 else 11523 lhs_type = TREE_TYPE (lvalue); 11524 } 11525 else 11526 { 11527 parse_error_context (wfl_op1, "Invalid left hand side of assignment"); 11528 error_found = 1; 11529 } 11530 11531 rhs_type = TREE_TYPE (rhs); 11532 /* 5.1 Try the assignment conversion for builtin type. */ 11533 new_rhs = try_builtin_assignconv (wfl_op1, lhs_type, rhs); 11534 11535 /* 5.2 If it failed, try a reference conversion */ 11536 if (!new_rhs && (new_rhs = try_reference_assignconv (lhs_type, rhs))) 11537 lhs_type = promote_type (rhs_type); 11538 11539 /* 15.25.2 If we have a compound assignment, convert RHS into the 11540 type of the LHS */ 11541 else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1))) 11542 new_rhs = convert (lhs_type, rhs); 11543 11544 /* Explicit cast required. This is an error */ 11545 if (!new_rhs) 11546 { 11547 char *t1 = strdup (lang_printable_name (TREE_TYPE (rhs), 0)); 11548 char *t2 = strdup (lang_printable_name (lhs_type, 0)); 11549 tree wfl; 11550 char operation [32]; /* Max size known */ 11551 11552 /* If the assignment is part of a declaration, we use the WFL of 11553 the declared variable to point out the error and call it a 11554 declaration problem. If the assignment is a genuine = 11555 operator, we call is a operator `=' problem, otherwise we 11556 call it an assignment problem. In both of these last cases, 11557 we use the WFL of the operator to indicate the error. */ 11558 11559 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node)) 11560 { 11561 wfl = wfl_op1; 11562 strcpy (operation, "declaration"); 11563 } 11564 else 11565 { 11566 wfl = wfl_operator; 11567 if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1))) 11568 strcpy (operation, "assignment"); 11569 else if (TREE_CODE (TREE_OPERAND (node, 0)) == RESULT_DECL) 11570 strcpy (operation, "`return'"); 11571 else 11572 strcpy (operation, "`='"); 11573 } 11574 11575 parse_error_context 11576 (wfl, (!valid_cast_to_p (rhs_type, lhs_type) ? 11577 "Incompatible type for %s. Can't convert `%s' to `%s'" : 11578 "Incompatible type for %s. Explicit cast " 11579 "needed to convert `%s' to `%s'"), operation, t1, t2); 11580 free (t1); free (t2); 11581 error_found = 1; 11582 } 11583 11584 /* Inline read access to java.lang.PRIMTYPE.TYPE */ 11585 if (new_rhs) 11586 new_rhs = maybe_build_primttype_type_ref (new_rhs, wfl_op2); 11587 11588 if (error_found) 11589 return error_mark_node; 11590 11591 /* 10.10: Array Store Exception runtime check */ 11592 if (!flag_emit_class_files 11593 && !flag_emit_xref 11594 && lvalue_from_array 11595 && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type)) 11596 && !CLASS_FINAL (TYPE_NAME (GET_SKIP_TYPE (rhs_type)))) 11597 { 11598 tree check; 11599 tree base = lvalue; 11600 11601 /* We need to retrieve the right argument for _Jv_CheckArrayStore */ 11602 if (TREE_CODE (lvalue) == COMPOUND_EXPR) 11603 base = TREE_OPERAND (lvalue, 0); 11604 else 11605 { 11606 if (flag_bounds_check) 11607 base = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (base, 0), 1), 0); 11608 else 11609 base = TREE_OPERAND (TREE_OPERAND (base, 0), 0); 11610 } 11611 11612 /* Build the invocation of _Jv_CheckArrayStore */ 11613 new_rhs = save_expr (new_rhs); 11614 check = build (CALL_EXPR, void_type_node, 11615 build_address_of (soft_checkarraystore_node), 11616 tree_cons (NULL_TREE, base, 11617 build_tree_list (NULL_TREE, new_rhs)), 11618 NULL_TREE); 11619 TREE_SIDE_EFFECTS (check) = 1; 11620 11621 /* We have to decide on an insertion point */ 11622 if (TREE_CODE (lvalue) == COMPOUND_EXPR) 11623 { 11624 tree t; 11625 if (flag_bounds_check) 11626 { 11627 t = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0); 11628 TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0) = 11629 build (COMPOUND_EXPR, void_type_node, t, check); 11630 } 11631 else 11632 TREE_OPERAND (lvalue, 1) = build (COMPOUND_EXPR, lhs_type, 11633 check, TREE_OPERAND (lvalue, 1)); 11634 } 11635 else 11636 { 11637 /* Make sure the bound check will happen before the store check */ 11638 if (flag_bounds_check) 11639 TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0) = 11640 build (COMPOUND_EXPR, void_type_node, 11641 TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0), check); 11642 else 11643 lvalue = build (COMPOUND_EXPR, lhs_type, check, lvalue); 11644 } 11645 } 11646 11647 TREE_OPERAND (node, 0) = lvalue; 11648 TREE_OPERAND (node, 1) = new_rhs; 11649 TREE_TYPE (node) = lhs_type; 11650 return node; 11651} 11652 11653/* Check that type SOURCE can be cast into type DEST. If the cast 11654 can't occur at all, return 0 otherwise 1. This function is used to 11655 produce accurate error messages on the reasons why an assignment 11656 failed. */ 11657 11658static tree 11659try_reference_assignconv (lhs_type, rhs) 11660 tree lhs_type, rhs; 11661{ 11662 tree new_rhs = NULL_TREE; 11663 tree rhs_type = TREE_TYPE (rhs); 11664 11665 if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type)) 11666 { 11667 /* `null' may be assigned to any reference type */ 11668 if (rhs == null_pointer_node) 11669 new_rhs = null_pointer_node; 11670 /* Try the reference assignment conversion */ 11671 else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0)) 11672 new_rhs = rhs; 11673 /* This is a magic assignment that we process differently */ 11674 else if (rhs == soft_exceptioninfo_call_node) 11675 new_rhs = rhs; 11676 } 11677 return new_rhs; 11678} 11679 11680/* Check that RHS can be converted into LHS_TYPE by the assignment 11681 conversion (5.2), for the cases of RHS being a builtin type. Return 11682 NULL_TREE if the conversion fails or if because RHS isn't of a 11683 builtin type. Return a converted RHS if the conversion is possible. */ 11684 11685static tree 11686try_builtin_assignconv (wfl_op1, lhs_type, rhs) 11687 tree wfl_op1, lhs_type, rhs; 11688{ 11689 tree new_rhs = NULL_TREE; 11690 tree rhs_type = TREE_TYPE (rhs); 11691 11692 /* Zero accepted everywhere */ 11693 if (TREE_CODE (rhs) == INTEGER_CST 11694 && TREE_INT_CST_HIGH (rhs) == 0 && TREE_INT_CST_LOW (rhs) == 0 11695 && JPRIMITIVE_TYPE_P (rhs_type)) 11696 new_rhs = convert (lhs_type, rhs); 11697 11698 /* 5.1.1 Try Identity Conversion, 11699 5.1.2 Try Widening Primitive Conversion */ 11700 else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)) 11701 new_rhs = convert (lhs_type, rhs); 11702 11703 /* Try a narrowing primitive conversion (5.1.3): 11704 - expression is a constant expression of type int AND 11705 - variable is byte, short or char AND 11706 - The value of the expression is representable in the type of the 11707 variable */ 11708 else if (rhs_type == int_type_node && TREE_CONSTANT (rhs) 11709 && (lhs_type == byte_type_node || lhs_type == char_type_node 11710 || lhs_type == short_type_node)) 11711 { 11712 if (int_fits_type_p (rhs, lhs_type)) 11713 new_rhs = convert (lhs_type, rhs); 11714 else if (wfl_op1) /* Might be called with a NULL */ 11715 parse_warning_context 11716 (wfl_op1, "Constant expression `%s' to wide for narrowing " 11717 "primitive conversion to `%s'", 11718 print_int_node (rhs), lang_printable_name (lhs_type, 0)); 11719 /* Reported a warning that will turn into an error further 11720 down, so we don't return */ 11721 } 11722 11723 return new_rhs; 11724} 11725 11726/* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity 11727 conversion (5.1.1) or widening primitve conversion (5.1.2). Return 11728 0 is the conversion test fails. This implements parts the method 11729 invocation convertion (5.3). */ 11730 11731static int 11732valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type) 11733 tree lhs_type, rhs_type; 11734{ 11735 /* 5.1.1: This is the identity conversion part. */ 11736 if (lhs_type == rhs_type) 11737 return 1; 11738 11739 /* Reject non primitive types */ 11740 if (!JPRIMITIVE_TYPE_P (lhs_type) || !JPRIMITIVE_TYPE_P (rhs_type)) 11741 return 0; 11742 11743 /* 5.1.2: widening primitive conversion. byte, even if it's smaller 11744 than a char can't be converted into a char. Short can't too, but 11745 the < test below takes care of that */ 11746 if (lhs_type == char_type_node && rhs_type == byte_type_node) 11747 return 0; 11748 11749 /* Accept all promoted type here. Note, we can't use <= in the test 11750 below, because we still need to bounce out assignments of short 11751 to char and the likes */ 11752 if (lhs_type == int_type_node 11753 && (rhs_type == promoted_byte_type_node 11754 || rhs_type == promoted_short_type_node 11755 || rhs_type == promoted_char_type_node 11756 || rhs_type == promoted_boolean_type_node)) 11757 return 1; 11758 11759 /* From here, an integral is widened if its precision is smaller 11760 than the precision of the LHS or if the LHS is a floating point 11761 type, or the RHS is a float and the RHS a double. */ 11762 if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type) 11763 && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type))) 11764 || (JINTEGRAL_TYPE_P (rhs_type) && JFLOAT_TYPE_P (lhs_type)) 11765 || (rhs_type == float_type_node && lhs_type == double_type_node)) 11766 return 1; 11767 11768 return 0; 11769} 11770 11771/* Check that something of SOURCE type can be assigned or cast to 11772 something of DEST type at runtime. Return 1 if the operation is 11773 valid, 0 otherwise. If CAST is set to 1, we're treating the case 11774 were SOURCE is cast into DEST, which borrows a lot of the 11775 assignment check. */ 11776 11777static int 11778valid_ref_assignconv_cast_p (source, dest, cast) 11779 tree source; 11780 tree dest; 11781 int cast; 11782{ 11783 /* SOURCE or DEST might be null if not from a declared entity. */ 11784 if (!source || !dest) 11785 return 0; 11786 if (JNULLP_TYPE_P (source)) 11787 return 1; 11788 if (TREE_CODE (source) == POINTER_TYPE) 11789 source = TREE_TYPE (source); 11790 if (TREE_CODE (dest) == POINTER_TYPE) 11791 dest = TREE_TYPE (dest); 11792 /* Case where SOURCE is a class type */ 11793 if (TYPE_CLASS_P (source)) 11794 { 11795 if (TYPE_CLASS_P (dest)) 11796 return source == dest || inherits_from_p (source, dest) 11797 || (cast && inherits_from_p (dest, source)); 11798 if (TYPE_INTERFACE_P (dest)) 11799 { 11800 /* If doing a cast and SOURCE is final, the operation is 11801 always correct a compile time (because even if SOURCE 11802 does not implement DEST, a subclass of SOURCE might). */ 11803 if (cast && !CLASS_FINAL (TYPE_NAME (source))) 11804 return 1; 11805 /* Otherwise, SOURCE must implement DEST */ 11806 return interface_of_p (dest, source); 11807 } 11808 /* DEST is an array, cast permited if SOURCE is of Object type */ 11809 return (cast && source == object_type_node ? 1 : 0); 11810 } 11811 if (TYPE_INTERFACE_P (source)) 11812 { 11813 if (TYPE_CLASS_P (dest)) 11814 { 11815 /* If not casting, DEST must be the Object type */ 11816 if (!cast) 11817 return dest == object_type_node; 11818 /* We're doing a cast. The cast is always valid is class 11819 DEST is not final, otherwise, DEST must implement SOURCE */ 11820 else if (!CLASS_FINAL (TYPE_NAME (dest))) 11821 return 1; 11822 else 11823 return interface_of_p (source, dest); 11824 } 11825 if (TYPE_INTERFACE_P (dest)) 11826 { 11827 /* If doing a cast, then if SOURCE and DEST contain method 11828 with the same signature but different return type, then 11829 this is a (compile time) error */ 11830 if (cast) 11831 { 11832 tree method_source, method_dest; 11833 tree source_type; 11834 tree source_sig; 11835 tree source_name; 11836 for (method_source = TYPE_METHODS (source); method_source; 11837 method_source = TREE_CHAIN (method_source)) 11838 { 11839 source_sig = 11840 build_java_argument_signature (TREE_TYPE (method_source)); 11841 source_type = TREE_TYPE (TREE_TYPE (method_source)); 11842 source_name = DECL_NAME (method_source); 11843 for (method_dest = TYPE_METHODS (dest); 11844 method_dest; method_dest = TREE_CHAIN (method_dest)) 11845 if (source_sig == 11846 build_java_argument_signature (TREE_TYPE (method_dest)) 11847 && source_name == DECL_NAME (method_dest) 11848 && source_type != TREE_TYPE (TREE_TYPE (method_dest))) 11849 return 0; 11850 } 11851 return 1; 11852 } 11853 else 11854 return source == dest || interface_of_p (dest, source); 11855 } 11856 else /* Array */ 11857 return (cast ? 11858 (DECL_NAME (TYPE_NAME (source)) == java_lang_cloneable) : 0); 11859 } 11860 if (TYPE_ARRAY_P (source)) 11861 { 11862 if (TYPE_CLASS_P (dest)) 11863 return dest == object_type_node; 11864 /* Can't cast an array to an interface unless the interface is 11865 java.lang.Cloneable */ 11866 if (TYPE_INTERFACE_P (dest)) 11867 return (DECL_NAME (TYPE_NAME (dest)) == java_lang_cloneable ? 1 : 0); 11868 else /* Arrays */ 11869 { 11870 tree source_element_type = TYPE_ARRAY_ELEMENT (source); 11871 tree dest_element_type = TYPE_ARRAY_ELEMENT (dest); 11872 11873 /* In case of severe errors, they turn out null */ 11874 if (!dest_element_type || !source_element_type) 11875 return 0; 11876 if (source_element_type == dest_element_type) 11877 return 1; 11878 return valid_ref_assignconv_cast_p (source_element_type, 11879 dest_element_type, cast); 11880 } 11881 return 0; 11882 } 11883 return 0; 11884} 11885 11886static int 11887valid_cast_to_p (source, dest) 11888 tree source; 11889 tree dest; 11890{ 11891 if (TREE_CODE (source) == POINTER_TYPE) 11892 source = TREE_TYPE (source); 11893 if (TREE_CODE (dest) == POINTER_TYPE) 11894 dest = TREE_TYPE (dest); 11895 11896 if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE) 11897 return valid_ref_assignconv_cast_p (source, dest, 1); 11898 11899 else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest)) 11900 return 1; 11901 11902 return 0; 11903} 11904 11905/* Method invocation conversion test. Return 1 if type SOURCE can be 11906 converted to type DEST through the methond invocation conversion 11907 process (5.3) */ 11908 11909static tree 11910do_unary_numeric_promotion (arg) 11911 tree arg; 11912{ 11913 tree type = TREE_TYPE (arg); 11914 if (TREE_CODE (type) == INTEGER_TYPE ? TYPE_PRECISION (type) < 32 11915 : TREE_CODE (type) == CHAR_TYPE) 11916 arg = convert (int_type_node, arg); 11917 return arg; 11918} 11919 11920/* Return a non zero value if SOURCE can be converted into DEST using 11921 the method invocation conversion rule (5.3). */ 11922static int 11923valid_method_invocation_conversion_p (dest, source) 11924 tree dest, source; 11925{ 11926 return ((JPRIMITIVE_TYPE_P (source) && JPRIMITIVE_TYPE_P (dest) 11927 && valid_builtin_assignconv_identity_widening_p (dest, source)) 11928 || ((JREFERENCE_TYPE_P (source) || JNULLP_TYPE_P (source)) 11929 && (JREFERENCE_TYPE_P (dest) || JNULLP_TYPE_P (dest)) 11930 && valid_ref_assignconv_cast_p (source, dest, 0))); 11931} 11932 11933/* Build an incomplete binop expression. */ 11934 11935static tree 11936build_binop (op, op_location, op1, op2) 11937 enum tree_code op; 11938 int op_location; 11939 tree op1, op2; 11940{ 11941 tree binop = build (op, NULL_TREE, op1, op2); 11942 TREE_SIDE_EFFECTS (binop) = 1; 11943 /* Store the location of the operator, for better error report. The 11944 string of the operator will be rebuild based on the OP value. */ 11945 EXPR_WFL_LINECOL (binop) = op_location; 11946 return binop; 11947} 11948 11949/* Build the string of the operator retained by NODE. If NODE is part 11950 of a compound expression, add an '=' at the end of the string. This 11951 function is called when an error needs to be reported on an 11952 operator. The string is returned as a pointer to a static character 11953 buffer. */ 11954 11955static char * 11956operator_string (node) 11957 tree node; 11958{ 11959#define BUILD_OPERATOR_STRING(S) \ 11960 { \ 11961 sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \ 11962 return buffer; \ 11963 } 11964 11965 static char buffer [10]; 11966 switch (TREE_CODE (node)) 11967 { 11968 case MULT_EXPR: BUILD_OPERATOR_STRING ("*"); 11969 case RDIV_EXPR: BUILD_OPERATOR_STRING ("/"); 11970 case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%"); 11971 case PLUS_EXPR: BUILD_OPERATOR_STRING ("+"); 11972 case MINUS_EXPR: BUILD_OPERATOR_STRING ("-"); 11973 case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<"); 11974 case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>"); 11975 case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>"); 11976 case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&"); 11977 case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^"); 11978 case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|"); 11979 case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&"); 11980 case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||"); 11981 case EQ_EXPR: BUILD_OPERATOR_STRING ("=="); 11982 case NE_EXPR: BUILD_OPERATOR_STRING ("!="); 11983 case GT_EXPR: BUILD_OPERATOR_STRING (">"); 11984 case GE_EXPR: BUILD_OPERATOR_STRING (">="); 11985 case LT_EXPR: BUILD_OPERATOR_STRING ("<"); 11986 case LE_EXPR: BUILD_OPERATOR_STRING ("<="); 11987 case UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+"); 11988 case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-"); 11989 case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!"); 11990 case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~"); 11991 case PREINCREMENT_EXPR: /* Fall through */ 11992 case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++"); 11993 case PREDECREMENT_EXPR: /* Fall through */ 11994 case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--"); 11995 default: 11996 fatal ("unregistered operator %s - operator_string", 11997 tree_code_name [TREE_CODE (node)]); 11998 } 11999 return NULL; 12000#undef BUILD_OPERATOR_STRING 12001} 12002 12003/* Binary operators (15.16 up to 15.18). We return error_mark_node on 12004 errors but we modify NODE so that it contains the type computed 12005 according to the expression, when it's fixed. Otherwise, we write 12006 error_mark_node as the type. It allows us to further the analysis 12007 of remaining nodes and detects more errors in certain cases. */ 12008 12009static tree 12010patch_binop (node, wfl_op1, wfl_op2) 12011 tree node; 12012 tree wfl_op1; 12013 tree wfl_op2; 12014{ 12015 tree op1 = TREE_OPERAND (node, 0); 12016 tree op2 = TREE_OPERAND (node, 1); 12017 tree op1_type = TREE_TYPE (op1); 12018 tree op2_type = TREE_TYPE (op2); 12019 tree prom_type = NULL_TREE; 12020 int code = TREE_CODE (node); 12021 12022 /* If 1, tell the routine that we have to return error_mark_node 12023 after checking for the initialization of the RHS */ 12024 int error_found = 0; 12025 12026 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 12027 12028 switch (code) 12029 { 12030 /* 15.16 Multiplicative operators */ 12031 case MULT_EXPR: /* 15.16.1 Multiplication Operator * */ 12032 case RDIV_EXPR: /* 15.16.2 Division Operator / */ 12033 case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */ 12034 if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type)) 12035 { 12036 if (!JPRIMITIVE_TYPE_P (op1_type)) 12037 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type); 12038 if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type)) 12039 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type); 12040 TREE_TYPE (node) = error_mark_node; 12041 error_found = 1; 12042 break; 12043 } 12044 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2); 12045 /* Change the division operator if necessary */ 12046 if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE) 12047 TREE_SET_CODE (node, TRUNC_DIV_EXPR); 12048 12049 /* This one is more complicated. FLOATs are processed by a 12050 function call to soft_fmod. Duplicate the value of the 12051 COMPOUND_ASSIGN_P flag. */ 12052 if (code == TRUNC_MOD_EXPR) 12053 { 12054 tree mod = build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2); 12055 COMPOUND_ASSIGN_P (mod) = COMPOUND_ASSIGN_P (node); 12056 TREE_SIDE_EFFECTS (mod) 12057 = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2); 12058 return mod; 12059 } 12060 break; 12061 12062 /* 15.17 Additive Operators */ 12063 case PLUS_EXPR: /* 15.17.1 String Concatenation Operator + */ 12064 12065 /* Operation is valid if either one argument is a string 12066 constant, a String object or a StringBuffer crafted for the 12067 purpose of the a previous usage of the String concatenation 12068 operator */ 12069 12070 if (TREE_CODE (op1) == STRING_CST 12071 || TREE_CODE (op2) == STRING_CST 12072 || JSTRING_TYPE_P (op1_type) 12073 || JSTRING_TYPE_P (op2_type) 12074 || IS_CRAFTED_STRING_BUFFER_P (op1) 12075 || IS_CRAFTED_STRING_BUFFER_P (op2)) 12076 return build_string_concatenation (op1, op2); 12077 12078 case MINUS_EXPR: /* 15.17.2 Additive Operators (+ and -) for 12079 Numeric Types */ 12080 if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type)) 12081 { 12082 if (!JPRIMITIVE_TYPE_P (op1_type)) 12083 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type); 12084 if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type)) 12085 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type); 12086 TREE_TYPE (node) = error_mark_node; 12087 error_found = 1; 12088 break; 12089 } 12090 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2); 12091 break; 12092 12093 /* 15.18 Shift Operators */ 12094 case LSHIFT_EXPR: 12095 case RSHIFT_EXPR: 12096 case URSHIFT_EXPR: 12097 if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type)) 12098 { 12099 if (!JINTEGRAL_TYPE_P (op1_type)) 12100 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type); 12101 else 12102 parse_error_context 12103 (wfl_operator, (JPRIMITIVE_TYPE_P (op2_type) ? 12104 "Incompatible type for `%s'. Explicit cast needed to convert " 12105 "shift distance from `%s' to integral" : 12106 "Incompatible type for `%s'. Can't convert shift distance from " 12107 "`%s' to integral"), 12108 operator_string (node), lang_printable_name (op2_type, 0)); 12109 TREE_TYPE (node) = error_mark_node; 12110 error_found = 1; 12111 break; 12112 } 12113 12114 /* Unary numeric promotion (5.6.1) is performed on each operand 12115 separatly */ 12116 op1 = do_unary_numeric_promotion (op1); 12117 op2 = do_unary_numeric_promotion (op2); 12118 12119 /* The type of the shift expression is the type of the promoted 12120 type of the left-hand operand */ 12121 prom_type = TREE_TYPE (op1); 12122 12123 /* Shift int only up to 0x1f and long up to 0x3f */ 12124 if (prom_type == int_type_node) 12125 op2 = fold (build (BIT_AND_EXPR, int_type_node, op2, 12126 build_int_2 (0x1f, 0))); 12127 else 12128 op2 = fold (build (BIT_AND_EXPR, int_type_node, op2, 12129 build_int_2 (0x3f, 0))); 12130 12131 /* The >>> operator is a >> operating on unsigned quantities */ 12132 if (code == URSHIFT_EXPR && ! flag_emit_class_files) 12133 { 12134 tree to_return; 12135 tree utype = unsigned_type (prom_type); 12136 op1 = convert (utype, op1); 12137 TREE_SET_CODE (node, RSHIFT_EXPR); 12138 TREE_OPERAND (node, 0) = op1; 12139 TREE_OPERAND (node, 1) = op2; 12140 TREE_TYPE (node) = utype; 12141 to_return = convert (prom_type, node); 12142 /* Copy the original value of the COMPOUND_ASSIGN_P flag */ 12143 COMPOUND_ASSIGN_P (to_return) = COMPOUND_ASSIGN_P (node); 12144 TREE_SIDE_EFFECTS (to_return) 12145 = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2); 12146 return to_return; 12147 } 12148 break; 12149 12150 /* 15.19.1 Type Comparison Operator instaceof */ 12151 case INSTANCEOF_EXPR: 12152 12153 TREE_TYPE (node) = boolean_type_node; 12154 12155 if (!(op2_type = resolve_type_during_patch (op2))) 12156 return error_mark_node; 12157 12158 /* The first operand must be a reference type or the null type */ 12159 if (!JREFERENCE_TYPE_P (op1_type) && op1 != null_pointer_node) 12160 error_found = 1; /* Error reported further below */ 12161 12162 /* The second operand must be a reference type */ 12163 if (!JREFERENCE_TYPE_P (op2_type)) 12164 { 12165 SET_WFL_OPERATOR (wfl_operator, node, wfl_op2); 12166 parse_error_context 12167 (wfl_operator, "Invalid argument `%s' for `instanceof'", 12168 lang_printable_name (op2_type, 0)); 12169 error_found = 1; 12170 } 12171 12172 if (!error_found && valid_ref_assignconv_cast_p (op1_type, op2_type, 1)) 12173 { 12174 /* If the first operand is null, the result is always false */ 12175 if (op1 == null_pointer_node) 12176 return boolean_false_node; 12177 else if (flag_emit_class_files) 12178 { 12179 TREE_OPERAND (node, 1) = op2_type; 12180 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1); 12181 return node; 12182 } 12183 /* Otherwise we have to invoke instance of to figure it out */ 12184 else 12185 { 12186 tree call = 12187 build (CALL_EXPR, boolean_type_node, 12188 build_address_of (soft_instanceof_node), 12189 tree_cons 12190 (NULL_TREE, op1, 12191 build_tree_list (NULL_TREE, 12192 build_class_ref (op2_type))), 12193 NULL_TREE); 12194 TREE_SIDE_EFFECTS (call) = TREE_SIDE_EFFECTS (op1); 12195 return call; 12196 } 12197 } 12198 /* There is no way the expression operand can be an instance of 12199 the type operand. This is a compile time error. */ 12200 else 12201 { 12202 char *t1 = strdup (lang_printable_name (op1_type, 0)); 12203 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); 12204 parse_error_context 12205 (wfl_operator, "Impossible for `%s' to be instance of `%s'", 12206 t1, lang_printable_name (op2_type, 0)); 12207 free (t1); 12208 error_found = 1; 12209 } 12210 12211 break; 12212 12213 /* 15.21 Bitwise and Logical Operators */ 12214 case BIT_AND_EXPR: 12215 case BIT_XOR_EXPR: 12216 case BIT_IOR_EXPR: 12217 if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type)) 12218 /* Binary numeric promotion is performed on both operand and the 12219 expression retain that type */ 12220 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2); 12221 12222 else if (TREE_CODE (op1_type) == BOOLEAN_TYPE 12223 && TREE_CODE (op1_type) == BOOLEAN_TYPE) 12224 /* The type of the bitwise operator expression is BOOLEAN */ 12225 prom_type = boolean_type_node; 12226 else 12227 { 12228 if (!JINTEGRAL_TYPE_P (op1_type)) 12229 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type); 12230 if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type)) 12231 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type); 12232 TREE_TYPE (node) = error_mark_node; 12233 error_found = 1; 12234 /* Insert a break here if adding thing before the switch's 12235 break for this case */ 12236 } 12237 break; 12238 12239 /* 15.22 Conditional-And Operator */ 12240 case TRUTH_ANDIF_EXPR: 12241 /* 15.23 Conditional-Or Operator */ 12242 case TRUTH_ORIF_EXPR: 12243 /* Operands must be of BOOLEAN type */ 12244 if (TREE_CODE (op1_type) != BOOLEAN_TYPE || 12245 TREE_CODE (op2_type) != BOOLEAN_TYPE) 12246 { 12247 if (TREE_CODE (op1_type) != BOOLEAN_TYPE) 12248 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type); 12249 if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type)) 12250 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type); 12251 TREE_TYPE (node) = boolean_type_node; 12252 error_found = 1; 12253 break; 12254 } 12255 /* The type of the conditional operators is BOOLEAN */ 12256 prom_type = boolean_type_node; 12257 break; 12258 12259 /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */ 12260 case LT_EXPR: 12261 case GT_EXPR: 12262 case LE_EXPR: 12263 case GE_EXPR: 12264 /* The type of each of the operands must be a primitive numeric 12265 type */ 12266 if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type)) 12267 { 12268 if (!JNUMERIC_TYPE_P (op1_type)) 12269 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type); 12270 if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type)) 12271 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type); 12272 TREE_TYPE (node) = boolean_type_node; 12273 error_found = 1; 12274 break; 12275 } 12276 /* Binary numeric promotion is performed on the operands */ 12277 binary_numeric_promotion (op1_type, op2_type, &op1, &op2); 12278 /* The type of the relation expression is always BOOLEAN */ 12279 prom_type = boolean_type_node; 12280 break; 12281 12282 /* 15.20 Equality Operator */ 12283 case EQ_EXPR: 12284 case NE_EXPR: 12285 /* 15.20.1 Numerical Equality Operators == and != */ 12286 /* Binary numeric promotion is performed on the operands */ 12287 if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type)) 12288 binary_numeric_promotion (op1_type, op2_type, &op1, &op2); 12289 12290 /* 15.20.2 Boolean Equality Operators == and != */ 12291 else if (TREE_CODE (op1_type) == BOOLEAN_TYPE && 12292 TREE_CODE (op2_type) == BOOLEAN_TYPE) 12293 ; /* Nothing to do here */ 12294 12295 /* 15.20.3 Reference Equality Operators == and != */ 12296 /* Types have to be either references or the null type. If 12297 they're references, it must be possible to convert either 12298 type to the other by casting conversion. */ 12299 else if (op1 == null_pointer_node || op2 == null_pointer_node 12300 || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type) 12301 && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1) 12302 || valid_ref_assignconv_cast_p (op2_type, 12303 op1_type, 1)))) 12304 ; /* Nothing to do here */ 12305 12306 /* Else we have an error figure what can't be converted into 12307 what and report the error */ 12308 else 12309 { 12310 char *t1; 12311 t1 = strdup (lang_printable_name (op1_type, 0)); 12312 parse_error_context 12313 (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' " 12314 "to `%s'", operator_string (node), t1, 12315 lang_printable_name (op2_type, 0)); 12316 free (t1); 12317 TREE_TYPE (node) = boolean_type_node; 12318 error_found = 1; 12319 break; 12320 } 12321 prom_type = boolean_type_node; 12322 break; 12323 } 12324 12325 if (error_found) 12326 return error_mark_node; 12327 12328 TREE_OPERAND (node, 0) = op1; 12329 TREE_OPERAND (node, 1) = op2; 12330 TREE_TYPE (node) = prom_type; 12331 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2); 12332 12333 if (flag_emit_xref) 12334 return node; 12335 12336 /* fold does not respect side-effect order as required for Java but not C. 12337 * Also, it sometimes create SAVE_EXPRs which are bad when emitting 12338 * bytecode. 12339 */ 12340 if (flag_emit_class_files ? (TREE_CONSTANT (op1) && TREE_CONSTANT (op2)) 12341 : ! TREE_SIDE_EFFECTS (node)) 12342 node = fold (node); 12343 return node; 12344} 12345 12346/* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non 12347 zero value, the value of CSTE comes after the valude of STRING */ 12348 12349static tree 12350do_merge_string_cste (cste, string, string_len, after) 12351 tree cste; 12352 char *string; 12353 int string_len, after; 12354{ 12355 int len = TREE_STRING_LENGTH (cste) + string_len; 12356 char *old = TREE_STRING_POINTER (cste); 12357 TREE_STRING_LENGTH (cste) = len; 12358 TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1); 12359 if (after) 12360 { 12361 strcpy (TREE_STRING_POINTER (cste), string); 12362 strcat (TREE_STRING_POINTER (cste), old); 12363 } 12364 else 12365 { 12366 strcpy (TREE_STRING_POINTER (cste), old); 12367 strcat (TREE_STRING_POINTER (cste), string); 12368 } 12369 return cste; 12370} 12371 12372/* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a 12373 new STRING_CST on success, NULL_TREE on failure */ 12374 12375static tree 12376merge_string_cste (op1, op2, after) 12377 tree op1, op2; 12378 int after; 12379{ 12380 /* Handle two string constants right away */ 12381 if (TREE_CODE (op2) == STRING_CST) 12382 return do_merge_string_cste (op1, TREE_STRING_POINTER (op2), 12383 TREE_STRING_LENGTH (op2), after); 12384 12385 /* Reasonable integer constant can be treated right away */ 12386 if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2)) 12387 { 12388 static char *boolean_true = "true"; 12389 static char *boolean_false = "false"; 12390 static char *null_pointer = "null"; 12391 char ch[3]; 12392 char *string; 12393 12394 if (op2 == boolean_true_node) 12395 string = boolean_true; 12396 else if (op2 == boolean_false_node) 12397 string = boolean_false; 12398 else if (op2 == null_pointer_node) 12399 string = null_pointer; 12400 else if (TREE_TYPE (op2) == char_type_node) 12401 { 12402 ch[0] = (char )TREE_INT_CST_LOW (op2); 12403 ch[1] = '\0'; 12404 string = ch; 12405 } 12406 else 12407 string = print_int_node (op2); 12408 12409 return do_merge_string_cste (op1, string, strlen (string), after); 12410 } 12411 return NULL_TREE; 12412} 12413 12414/* Tries to statically concatenate OP1 and OP2 if possible. Either one 12415 has to be a STRING_CST and the other part must be a STRING_CST or a 12416 INTEGRAL constant. Return a new STRING_CST if the operation 12417 succeed, NULL_TREE otherwise. 12418 12419 If the case we want to optimize for space, we might want to return 12420 NULL_TREE for each invocation of this routine. FIXME */ 12421 12422static tree 12423string_constant_concatenation (op1, op2) 12424 tree op1, op2; 12425{ 12426 if (TREE_CODE (op1) == STRING_CST || (TREE_CODE (op2) == STRING_CST)) 12427 { 12428 tree string, rest; 12429 int invert; 12430 12431 string = (TREE_CODE (op1) == STRING_CST ? op1 : op2); 12432 rest = (string == op1 ? op2 : op1); 12433 invert = (string == op1 ? 0 : 1 ); 12434 12435 /* Walk REST, only if it looks reasonable */ 12436 if (TREE_CODE (rest) != STRING_CST 12437 && !IS_CRAFTED_STRING_BUFFER_P (rest) 12438 && !JSTRING_TYPE_P (TREE_TYPE (rest)) 12439 && TREE_CODE (rest) == EXPR_WITH_FILE_LOCATION) 12440 { 12441 rest = java_complete_tree (rest); 12442 if (rest == error_mark_node) 12443 return error_mark_node; 12444 rest = fold (rest); 12445 } 12446 return merge_string_cste (string, rest, invert); 12447 } 12448 return NULL_TREE; 12449} 12450 12451/* Implement the `+' operator. Does static optimization if possible, 12452 otherwise create (if necessary) and append elements to a 12453 StringBuffer. The StringBuffer will be carried around until it is 12454 used for a function call or an assignment. Then toString() will be 12455 called on it to turn it into a String object. */ 12456 12457static tree 12458build_string_concatenation (op1, op2) 12459 tree op1, op2; 12460{ 12461 tree result; 12462 int side_effects = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2); 12463 12464 if (flag_emit_xref) 12465 return build (PLUS_EXPR, string_type_node, op1, op2); 12466 12467 /* Try to do some static optimization */ 12468 if ((result = string_constant_concatenation (op1, op2))) 12469 return result; 12470 12471 /* Discard empty strings on either side of the expression */ 12472 if (TREE_CODE (op1) == STRING_CST && TREE_STRING_LENGTH (op1) == 0) 12473 { 12474 op1 = op2; 12475 op2 = NULL_TREE; 12476 } 12477 else if (TREE_CODE (op2) == STRING_CST && TREE_STRING_LENGTH (op2) == 0) 12478 op2 = NULL_TREE; 12479 12480 /* If operands are string constant, turn then into object references */ 12481 if (TREE_CODE (op1) == STRING_CST) 12482 op1 = patch_string_cst (op1); 12483 if (op2 && TREE_CODE (op2) == STRING_CST) 12484 op2 = patch_string_cst (op2); 12485 12486 /* If either one of the constant is null and the other non null 12487 operand is a String object, return it. */ 12488 if (JSTRING_TYPE_P (TREE_TYPE (op1)) && !op2) 12489 return op1; 12490 12491 /* If OP1 isn't already a StringBuffer, create and 12492 initialize a new one */ 12493 if (!IS_CRAFTED_STRING_BUFFER_P (op1)) 12494 { 12495 /* Two solutions here: 12496 1) OP1 is a string reference, we call new StringBuffer(OP1) 12497 2) OP1 is something else, we call new StringBuffer().append(OP1). */ 12498 if (JSTRING_TYPE_P (TREE_TYPE (op1))) 12499 op1 = BUILD_STRING_BUFFER (op1); 12500 else 12501 { 12502 tree aNew = BUILD_STRING_BUFFER (NULL_TREE); 12503 op1 = make_qualified_primary (aNew, BUILD_APPEND (op1), 0); 12504 } 12505 } 12506 12507 if (op2) 12508 { 12509 /* OP1 is no longer the last node holding a crafted StringBuffer */ 12510 IS_CRAFTED_STRING_BUFFER_P (op1) = 0; 12511 /* Create a node for `{new...,xxx}.append (op2)' */ 12512 if (op2) 12513 op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0); 12514 } 12515 12516 /* Mark the last node holding a crafted StringBuffer */ 12517 IS_CRAFTED_STRING_BUFFER_P (op1) = 1; 12518 12519 TREE_SIDE_EFFECTS (op1) = side_effects; 12520 return op1; 12521} 12522 12523/* Patch the string node NODE. NODE can be a STRING_CST of a crafted 12524 StringBuffer. If no string were found to be patched, return 12525 NULL. */ 12526 12527static tree 12528patch_string (node) 12529 tree node; 12530{ 12531 if (node == error_mark_node) 12532 return error_mark_node; 12533 if (TREE_CODE (node) == STRING_CST) 12534 return patch_string_cst (node); 12535 else if (IS_CRAFTED_STRING_BUFFER_P (node)) 12536 { 12537 int saved = ctxp->explicit_constructor_p; 12538 tree invoke = build_method_invocation (wfl_to_string, NULL_TREE); 12539 tree ret; 12540 /* Temporary disable forbid the use of `this'. */ 12541 ctxp->explicit_constructor_p = 0; 12542 ret = java_complete_tree (make_qualified_primary (node, invoke, 0)); 12543 /* Restore it at its previous value */ 12544 ctxp->explicit_constructor_p = saved; 12545 return ret; 12546 } 12547 return NULL_TREE; 12548} 12549 12550/* Build the internal representation of a string constant. */ 12551 12552static tree 12553patch_string_cst (node) 12554 tree node; 12555{ 12556 int location; 12557 if (! flag_emit_class_files) 12558 { 12559 push_obstacks (&permanent_obstack, &permanent_obstack); 12560 node = get_identifier (TREE_STRING_POINTER (node)); 12561 location = alloc_name_constant (CONSTANT_String, node); 12562 node = build_ref_from_constant_pool (location); 12563 } 12564 TREE_TYPE (node) = string_ptr_type_node; 12565 TREE_CONSTANT (node) = 1; 12566 return node; 12567} 12568 12569/* Build an incomplete unary operator expression. */ 12570 12571static tree 12572build_unaryop (op_token, op_location, op1) 12573 int op_token, op_location; 12574 tree op1; 12575{ 12576 enum tree_code op; 12577 tree unaryop; 12578 switch (op_token) 12579 { 12580 case PLUS_TK: op = UNARY_PLUS_EXPR; break; 12581 case MINUS_TK: op = NEGATE_EXPR; break; 12582 case NEG_TK: op = TRUTH_NOT_EXPR; break; 12583 case NOT_TK: op = BIT_NOT_EXPR; break; 12584 default: fatal ("Unknown token `%d' for unary operator - build_unaryop", 12585 op_token); 12586 } 12587 12588 unaryop = build1 (op, NULL_TREE, op1); 12589 TREE_SIDE_EFFECTS (unaryop) = 1; 12590 /* Store the location of the operator, for better error report. The 12591 string of the operator will be rebuild based on the OP value. */ 12592 EXPR_WFL_LINECOL (unaryop) = op_location; 12593 return unaryop; 12594} 12595 12596/* Special case for the ++/-- operators, since they require an extra 12597 argument to build, which is set to NULL and patched 12598 later. IS_POST_P is 1 if the operator, 0 otherwise. */ 12599 12600static tree 12601build_incdec (op_token, op_location, op1, is_post_p) 12602 int op_token, op_location; 12603 tree op1; 12604 int is_post_p; 12605{ 12606 static enum tree_code lookup [2][2] = 12607 { 12608 { PREDECREMENT_EXPR, PREINCREMENT_EXPR, }, 12609 { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, }, 12610 }; 12611 tree node = build (lookup [is_post_p][(op_token - DECR_TK)], 12612 NULL_TREE, op1, NULL_TREE); 12613 TREE_SIDE_EFFECTS (node) = 1; 12614 /* Store the location of the operator, for better error report. The 12615 string of the operator will be rebuild based on the OP value. */ 12616 EXPR_WFL_LINECOL (node) = op_location; 12617 return node; 12618} 12619 12620/* Build an incomplete cast operator, based on the use of the 12621 CONVERT_EXPR. Note that TREE_TYPE of the constructed node is 12622 set. java_complete_tree is trained to walk a CONVERT_EXPR even 12623 though its type is already set. */ 12624 12625static tree 12626build_cast (location, type, exp) 12627 int location; 12628 tree type, exp; 12629{ 12630 tree node = build1 (CONVERT_EXPR, type, exp); 12631 EXPR_WFL_LINECOL (node) = location; 12632 return node; 12633} 12634 12635/* 15.14 Unary operators. We return error_mark_node in case of error, 12636 but preserve the type of NODE if the type is fixed. */ 12637 12638static tree 12639patch_unaryop (node, wfl_op) 12640 tree node; 12641 tree wfl_op; 12642{ 12643 tree op = TREE_OPERAND (node, 0); 12644 tree op_type = TREE_TYPE (op); 12645 tree prom_type = NULL_TREE, value, decl; 12646 int code = TREE_CODE (node); 12647 int error_found = 0; 12648 12649 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 12650 12651 switch (code) 12652 { 12653 /* 15.13.2 Postfix Increment Operator ++ */ 12654 case POSTINCREMENT_EXPR: 12655 /* 15.13.3 Postfix Increment Operator -- */ 12656 case POSTDECREMENT_EXPR: 12657 /* 15.14.1 Prefix Increment Operator ++ */ 12658 case PREINCREMENT_EXPR: 12659 /* 15.14.2 Prefix Decrement Operator -- */ 12660 case PREDECREMENT_EXPR: 12661 decl = strip_out_static_field_access_decl (op); 12662 /* We really should have a JAVA_ARRAY_EXPR to avoid this */ 12663 if (!JDECL_P (decl) 12664 && TREE_CODE (decl) != COMPONENT_REF 12665 && !(flag_emit_class_files && TREE_CODE (decl) == ARRAY_REF) 12666 && TREE_CODE (decl) != INDIRECT_REF 12667 && !(TREE_CODE (decl) == COMPOUND_EXPR 12668 && TREE_OPERAND (decl, 1) 12669 && (TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF))) 12670 { 12671 tree lvalue; 12672 /* Before screaming, check that we're not in fact trying to 12673 increment a optimized static final access, in which case 12674 we issue an different error message. */ 12675 if (!(TREE_CODE (wfl_op) == EXPR_WITH_FILE_LOCATION 12676 && resolve_expression_name (wfl_op, &lvalue) 12677 && check_final_assignment (lvalue, wfl_op))) 12678 parse_error_context (wfl_operator, "Invalid argument to `%s'", 12679 operator_string (node)); 12680 TREE_TYPE (node) = error_mark_node; 12681 error_found = 1; 12682 } 12683 else if (check_final_assignment (op, wfl_op)) 12684 error_found = 1; 12685 12686 /* From now on, we know that op if a variable and that it has a 12687 valid wfl. We use wfl_op to locate errors related to the 12688 ++/-- operand. */ 12689 else if (!JNUMERIC_TYPE_P (op_type)) 12690 { 12691 parse_error_context 12692 (wfl_op, "Invalid argument type `%s' to `%s'", 12693 lang_printable_name (op_type, 0), operator_string (node)); 12694 TREE_TYPE (node) = error_mark_node; 12695 error_found = 1; 12696 } 12697 else 12698 { 12699 /* Before the addition, binary numeric promotion is performed on 12700 both operands */ 12701 value = build_int_2 (1, 0); 12702 TREE_TYPE (node) = 12703 binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value); 12704 /* And write the promoted incremented and increment */ 12705 TREE_OPERAND (node, 0) = op; 12706 TREE_OPERAND (node, 1) = value; 12707 /* Convert the overall back into its original type. */ 12708 return fold (convert (op_type, node)); 12709 } 12710 break; 12711 12712 /* 15.14.3 Unary Plus Operator + */ 12713 case UNARY_PLUS_EXPR: 12714 /* 15.14.4 Unary Minus Operator - */ 12715 case NEGATE_EXPR: 12716 if (!JNUMERIC_TYPE_P (op_type)) 12717 { 12718 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type); 12719 TREE_TYPE (node) = error_mark_node; 12720 error_found = 1; 12721 } 12722 /* Unary numeric promotion is performed on operand */ 12723 else 12724 { 12725 op = do_unary_numeric_promotion (op); 12726 prom_type = TREE_TYPE (op); 12727 if (code == UNARY_PLUS_EXPR) 12728 return fold (op); 12729 } 12730 break; 12731 12732 /* 15.14.5 Bitwise Complement Operator ~ */ 12733 case BIT_NOT_EXPR: 12734 if (!JINTEGRAL_TYPE_P (op_type)) 12735 { 12736 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type); 12737 TREE_TYPE (node) = error_mark_node; 12738 error_found = 1; 12739 } 12740 else 12741 { 12742 op = do_unary_numeric_promotion (op); 12743 prom_type = TREE_TYPE (op); 12744 } 12745 break; 12746 12747 /* 15.14.6 Logical Complement Operator ! */ 12748 case TRUTH_NOT_EXPR: 12749 if (TREE_CODE (op_type) != BOOLEAN_TYPE) 12750 { 12751 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type); 12752 /* But the type is known. We will report an error if further 12753 attempt of a assignment is made with this rhs */ 12754 TREE_TYPE (node) = boolean_type_node; 12755 error_found = 1; 12756 } 12757 else 12758 prom_type = boolean_type_node; 12759 break; 12760 12761 /* 15.15 Cast Expression */ 12762 case CONVERT_EXPR: 12763 value = patch_cast (node, wfl_operator); 12764 if (value == error_mark_node) 12765 { 12766 /* If this cast is part of an assignment, we tell the code 12767 that deals with it not to complain about a mismatch, 12768 because things have been cast, anyways */ 12769 TREE_TYPE (node) = error_mark_node; 12770 error_found = 1; 12771 } 12772 else 12773 { 12774 value = fold (value); 12775 TREE_SIDE_EFFECTS (value) = TREE_SIDE_EFFECTS (op); 12776 return value; 12777 } 12778 break; 12779 } 12780 12781 if (error_found) 12782 return error_mark_node; 12783 12784 /* There are cases where node has been replaced by something else 12785 and we don't end up returning here: UNARY_PLUS_EXPR, 12786 CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */ 12787 TREE_OPERAND (node, 0) = fold (op); 12788 TREE_TYPE (node) = prom_type; 12789 TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op); 12790 return fold (node); 12791} 12792 12793/* Generic type resolution that sometimes takes place during node 12794 patching. Returned the resolved type or generate an error 12795 message. Return the resolved type or NULL_TREE. */ 12796 12797static tree 12798resolve_type_during_patch (type) 12799 tree type; 12800{ 12801 if (unresolved_type_p (type, NULL)) 12802 { 12803 tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE); 12804 if (!type_decl) 12805 { 12806 parse_error_context (type, 12807 "Class `%s' not found in type declaration", 12808 IDENTIFIER_POINTER (EXPR_WFL_NODE (type))); 12809 return NULL_TREE; 12810 } 12811 else 12812 { 12813 CLASS_LOADED_P (TREE_TYPE (type_decl)) = 1; 12814 return TREE_TYPE (type_decl); 12815 } 12816 } 12817 return type; 12818} 12819/* 5.5 Casting Conversion. error_mark_node is returned if an error is 12820 found. Otherwise NODE or something meant to replace it is returned. */ 12821 12822static tree 12823patch_cast (node, wfl_operator) 12824 tree node; 12825 tree wfl_operator; 12826{ 12827 tree op = TREE_OPERAND (node, 0); 12828 tree op_type = TREE_TYPE (op); 12829 tree cast_type = TREE_TYPE (node); 12830 char *t1; 12831 12832 /* First resolve OP_TYPE if unresolved */ 12833 if (!(cast_type = resolve_type_during_patch (cast_type))) 12834 return error_mark_node; 12835 12836 /* Check on cast that are proven correct at compile time */ 12837 if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type)) 12838 { 12839 static tree convert_narrow (); 12840 /* Same type */ 12841 if (cast_type == op_type) 12842 return node; 12843 12844 /* float and double type are converted to the original type main 12845 variant and then to the target type. */ 12846 if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE) 12847 op = convert (integer_type_node, op); 12848 12849 /* Try widening/narowwing convertion. Potentially, things need 12850 to be worked out in gcc so we implement the extreme cases 12851 correctly. fold_convert() needs to be fixed. */ 12852 return convert (cast_type, op); 12853 } 12854 12855 /* It's also valid to cast a boolean into a boolean */ 12856 if (op_type == boolean_type_node && cast_type == boolean_type_node) 12857 return node; 12858 12859 /* null can be casted to references */ 12860 if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type)) 12861 return build_null_of_type (cast_type); 12862 12863 /* The remaining legal casts involve conversion between reference 12864 types. Check for their compile time correctness. */ 12865 if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type) 12866 && valid_ref_assignconv_cast_p (op_type, cast_type, 1)) 12867 { 12868 TREE_TYPE (node) = promote_type (cast_type); 12869 /* Now, the case can be determined correct at compile time if 12870 OP_TYPE can be converted into CAST_TYPE by assignment 12871 conversion (5.2) */ 12872 12873 if (valid_ref_assignconv_cast_p (op_type, cast_type, 0)) 12874 { 12875 TREE_SET_CODE (node, NOP_EXPR); 12876 return node; 12877 } 12878 12879 if (flag_emit_class_files) 12880 { 12881 TREE_SET_CODE (node, CONVERT_EXPR); 12882 return node; 12883 } 12884 12885 /* The cast requires a run-time check */ 12886 return build (CALL_EXPR, promote_type (cast_type), 12887 build_address_of (soft_checkcast_node), 12888 tree_cons (NULL_TREE, build_class_ref (cast_type), 12889 build_tree_list (NULL_TREE, op)), 12890 NULL_TREE); 12891 } 12892 12893 /* Any other casts are proven incorrect at compile time */ 12894 t1 = strdup (lang_printable_name (op_type, 0)); 12895 parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'", 12896 t1, lang_printable_name (cast_type, 0)); 12897 free (t1); 12898 return error_mark_node; 12899} 12900 12901/* Build a null constant and give it the type TYPE. */ 12902 12903static tree 12904build_null_of_type (type) 12905 tree type; 12906{ 12907 tree node = build_int_2 (0, 0); 12908 TREE_TYPE (node) = promote_type (type); 12909 return node; 12910} 12911 12912/* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't 12913 a list of indices. */ 12914static tree 12915build_array_ref (location, array, index) 12916 int location; 12917 tree array, index; 12918{ 12919 tree node = build (ARRAY_REF, NULL_TREE, array, index); 12920 EXPR_WFL_LINECOL (node) = location; 12921 return node; 12922} 12923 12924/* 15.12 Array Access Expression */ 12925 12926static tree 12927patch_array_ref (node) 12928 tree node; 12929{ 12930 tree array = TREE_OPERAND (node, 0); 12931 tree array_type = TREE_TYPE (array); 12932 tree index = TREE_OPERAND (node, 1); 12933 tree index_type = TREE_TYPE (index); 12934 int error_found = 0; 12935 12936 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 12937 12938 if (TREE_CODE (array_type) == POINTER_TYPE) 12939 array_type = TREE_TYPE (array_type); 12940 12941 /* The array reference must be an array */ 12942 if (!TYPE_ARRAY_P (array_type)) 12943 { 12944 parse_error_context 12945 (wfl_operator, "`[]' can only be applied to arrays. It can't be " 12946 "applied to `%s'", lang_printable_name (array_type, 0)); 12947 TREE_TYPE (node) = error_mark_node; 12948 error_found = 1; 12949 } 12950 12951 /* The array index underdoes unary numeric promotion. The promoted 12952 type must be int */ 12953 index = do_unary_numeric_promotion (index); 12954 if (TREE_TYPE (index) != int_type_node) 12955 { 12956 int could_cast = valid_cast_to_p (index_type, int_type_node); 12957 parse_error_context 12958 (wfl_operator, 12959 (could_cast ? "Incompatible type for `[]'. Explicit cast needed to " 12960 "convert `%s' to `int'" : "Incompatible type for `[]'. " 12961 "Can't convert `%s' to `int'"), 12962 lang_printable_name (index_type, 0)); 12963 TREE_TYPE (node) = error_mark_node; 12964 error_found = 1; 12965 } 12966 12967 if (error_found) 12968 return error_mark_node; 12969 12970 array_type = TYPE_ARRAY_ELEMENT (array_type); 12971 12972 if (flag_emit_class_files || flag_emit_xref) 12973 { 12974 TREE_OPERAND (node, 0) = array; 12975 TREE_OPERAND (node, 1) = index; 12976 } 12977 else 12978 { 12979 /* The save_expr is for correct evaluation order. It would be cleaner 12980 to use force_evaluation_order (see comment there), but that is 12981 difficult when we also have to deal with bounds checking. */ 12982 if (TREE_SIDE_EFFECTS (index)) 12983 array = save_expr (array); 12984 node = build_java_arrayaccess (array, array_type, index); 12985 if (TREE_SIDE_EFFECTS (index)) 12986 node = build (COMPOUND_EXPR, array_type, array, node); 12987 } 12988 TREE_TYPE (node) = array_type; 12989 return node; 12990} 12991 12992/* 15.9 Array Creation Expressions */ 12993 12994static tree 12995build_newarray_node (type, dims, extra_dims) 12996 tree type; 12997 tree dims; 12998 int extra_dims; 12999{ 13000 tree node = 13001 build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims), 13002 build_int_2 (extra_dims, 0)); 13003 return node; 13004} 13005 13006static tree 13007patch_newarray (node) 13008 tree node; 13009{ 13010 tree type = TREE_OPERAND (node, 0); 13011 tree dims = TREE_OPERAND (node, 1); 13012 tree cdim, array_type; 13013 int error_found = 0; 13014 int ndims = 0; 13015 int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2)); 13016 13017 /* Dimension types are verified. It's better for the types to be 13018 verified in order. */ 13019 for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ ) 13020 { 13021 int dim_error = 0; 13022 tree dim = TREE_VALUE (cdim); 13023 13024 /* Dim might have been saved during its evaluation */ 13025 dim = (TREE_CODE (dim) == SAVE_EXPR ? dim = TREE_OPERAND (dim, 0) : dim); 13026 13027 /* The type of each specified dimension must be an integral type. */ 13028 if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim))) 13029 dim_error = 1; 13030 13031 /* Each expression undergoes an unary numeric promotion (5.6.1) and the 13032 promoted type must be int. */ 13033 else 13034 { 13035 dim = do_unary_numeric_promotion (dim); 13036 if (TREE_TYPE (dim) != int_type_node) 13037 dim_error = 1; 13038 } 13039 13040 /* Report errors on types here */ 13041 if (dim_error) 13042 { 13043 parse_error_context 13044 (TREE_PURPOSE (cdim), 13045 "Incompatible type for dimension in array creation expression. " 13046 "%s convert `%s' to `int'", 13047 (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ? 13048 "Explicit cast needed to" : "Can't"), 13049 lang_printable_name (TREE_TYPE (dim), 0)); 13050 error_found = 1; 13051 } 13052 13053 TREE_PURPOSE (cdim) = NULL_TREE; 13054 } 13055 13056 /* Resolve array base type if unresolved */ 13057 if (!(type = resolve_type_during_patch (type))) 13058 error_found = 1; 13059 13060 if (error_found) 13061 { 13062 /* We don't want further evaluation of this bogus array creation 13063 operation */ 13064 TREE_TYPE (node) = error_mark_node; 13065 return error_mark_node; 13066 } 13067 13068 /* Set array_type to the actual (promoted) array type of the result. */ 13069 if (TREE_CODE (type) == RECORD_TYPE) 13070 type = build_pointer_type (type); 13071 while (--xdims >= 0) 13072 { 13073 type = promote_type (build_java_array_type (type, -1)); 13074 } 13075 dims = nreverse (dims); 13076 array_type = type; 13077 for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim)) 13078 { 13079 type = array_type; 13080 array_type = build_java_array_type (type, 13081 TREE_CODE (cdim) == INTEGER_CST ? 13082 TREE_INT_CST_LOW (cdim) : -1); 13083 array_type = promote_type (array_type); 13084 } 13085 dims = nreverse (dims); 13086 13087 /* The node is transformed into a function call. Things are done 13088 differently according to the number of dimensions. If the number 13089 of dimension is equal to 1, then the nature of the base type 13090 (primitive or not) matters. */ 13091 if (ndims == 1) 13092 return build_new_array (type, TREE_VALUE (dims)); 13093 13094 /* Can't reuse what's already written in expr.c because it uses the 13095 JVM stack representation. Provide a build_multianewarray. FIXME */ 13096 return build (CALL_EXPR, array_type, 13097 build_address_of (soft_multianewarray_node), 13098 tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)), 13099 tree_cons (NULL_TREE, 13100 build_int_2 (ndims, 0), dims )), 13101 NULL_TREE); 13102} 13103 13104/* 10.6 Array initializer. */ 13105 13106/* Build a wfl for array element that don't have one, so we can 13107 pin-point errors. */ 13108 13109static tree 13110maybe_build_array_element_wfl (node) 13111 tree node; 13112{ 13113 if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION) 13114 return build_expr_wfl (NULL_TREE, ctxp->filename, 13115 ctxp->elc.line, ctxp->elc.prev_col); 13116 else 13117 return NULL_TREE; 13118} 13119 13120/* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes 13121 identification of initialized arrays easier to detect during walk 13122 and expansion. */ 13123 13124static tree 13125build_new_array_init (location, values) 13126 int location; 13127 tree values; 13128{ 13129 tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values); 13130 tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor); 13131 EXPR_WFL_LINECOL (to_return) = location; 13132 return to_return; 13133} 13134 13135/* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error 13136 occurred. Otherwise return NODE after having set its type 13137 appropriately. */ 13138 13139static tree 13140patch_new_array_init (type, node) 13141 tree type, node; 13142{ 13143 int error_seen = 0; 13144 tree current, element_type; 13145 HOST_WIDE_INT length; 13146 int all_constant = 1; 13147 tree init = TREE_OPERAND (node, 0); 13148 13149 if (TREE_CODE (type) != POINTER_TYPE || ! TYPE_ARRAY_P (TREE_TYPE (type))) 13150 { 13151 parse_error_context (node, 13152 "Invalid array initializer for non-array type `%s'", 13153 lang_printable_name (type, 1)); 13154 return error_mark_node; 13155 } 13156 type = TREE_TYPE (type); 13157 element_type = TYPE_ARRAY_ELEMENT (type); 13158 13159 CONSTRUCTOR_ELTS (init) = nreverse (CONSTRUCTOR_ELTS (init)); 13160 13161 for (length = 0, current = CONSTRUCTOR_ELTS (init); 13162 current; length++, current = TREE_CHAIN (current)) 13163 { 13164 tree elt = TREE_VALUE (current); 13165 if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT) 13166 { 13167 error_seen |= array_constructor_check_entry (element_type, current); 13168 elt = TREE_VALUE (current); 13169 /* When compiling to native code, STRING_CST is converted to 13170 INDIRECT_REF, but still with a TREE_CONSTANT flag. */ 13171 if (! TREE_CONSTANT (elt) || TREE_CODE (elt) == INDIRECT_REF) 13172 all_constant = 0; 13173 } 13174 else 13175 { 13176 TREE_VALUE (current) = patch_new_array_init (element_type, elt); 13177 TREE_PURPOSE (current) = NULL_TREE; 13178 all_constant = 0; 13179 } 13180 if (elt && TREE_VALUE (elt) == error_mark_node) 13181 error_seen = 1; 13182 } 13183 13184 if (error_seen) 13185 return error_mark_node; 13186 13187 /* Create a new type. We can't reuse the one we have here by 13188 patching its dimension because it originally is of dimension -1 13189 hence reused by gcc. This would prevent triangular arrays. */ 13190 type = build_java_array_type (element_type, length); 13191 TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type)))); 13192 TREE_TYPE (node) = promote_type (type); 13193 TREE_CONSTANT (init) = all_constant; 13194 TREE_CONSTANT (node) = all_constant; 13195 return node; 13196} 13197 13198/* Verify that one entry of the initializer element list can be 13199 assigned to the array base type. Report 1 if an error occurred, 0 13200 otherwise. */ 13201 13202static int 13203array_constructor_check_entry (type, entry) 13204 tree type, entry; 13205{ 13206 char *array_type_string = NULL; /* For error reports */ 13207 tree value, type_value, new_value, wfl_value, patched; 13208 int error_seen = 0; 13209 13210 new_value = NULL_TREE; 13211 wfl_value = TREE_VALUE (entry); 13212 13213 value = java_complete_tree (TREE_VALUE (entry)); 13214 /* patch_string return error_mark_node if arg is error_mark_node */ 13215 if ((patched = patch_string (value))) 13216 value = patched; 13217 if (value == error_mark_node) 13218 return 1; 13219 13220 type_value = TREE_TYPE (value); 13221 13222 /* At anytime, try_builtin_assignconv can report a warning on 13223 constant overflow during narrowing. */ 13224 SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value); 13225 new_value = try_builtin_assignconv (wfl_operator, type, value); 13226 if (!new_value && (new_value = try_reference_assignconv (type, value))) 13227 type_value = promote_type (type); 13228 13229 /* Check and report errors */ 13230 if (!new_value) 13231 { 13232 char *msg = (!valid_cast_to_p (type_value, type) ? 13233 "Can't" : "Explicit cast needed to"); 13234 if (!array_type_string) 13235 array_type_string = strdup (lang_printable_name (type, 1)); 13236 parse_error_context 13237 (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'", 13238 msg, lang_printable_name (type_value, 1), array_type_string); 13239 error_seen = 1; 13240 } 13241 13242 if (new_value) 13243 { 13244 new_value = maybe_build_primttype_type_ref (new_value, wfl_operator); 13245 TREE_VALUE (entry) = new_value; 13246 } 13247 13248 if (array_type_string) 13249 free (array_type_string); 13250 13251 TREE_PURPOSE (entry) = NULL_TREE; 13252 return error_seen; 13253} 13254 13255static tree 13256build_this (location) 13257 int location; 13258{ 13259 tree node = build_wfl_node (this_identifier_node); 13260 TREE_SET_CODE (node, THIS_EXPR); 13261 EXPR_WFL_LINECOL (node) = location; 13262 return node; 13263} 13264 13265/* 14.15 The return statement. It builds a modify expression that 13266 assigns the returned value to the RESULT_DECL that hold the value 13267 to be returned. */ 13268 13269static tree 13270build_return (location, op) 13271 int location; 13272 tree op; 13273{ 13274 tree node = build1 (RETURN_EXPR, NULL_TREE, op); 13275 EXPR_WFL_LINECOL (node) = location; 13276 node = build_debugable_stmt (location, node); 13277 return node; 13278} 13279 13280static tree 13281patch_return (node) 13282 tree node; 13283{ 13284 tree return_exp = TREE_OPERAND (node, 0); 13285 tree meth = current_function_decl; 13286 tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl)); 13287 int error_found = 0; 13288 13289 TREE_TYPE (node) = error_mark_node; 13290 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 13291 13292 /* It's invalid to have a return value within a function that is 13293 declared with the keyword void or that is a constructor */ 13294 if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth))) 13295 error_found = 1; 13296 13297 /* It's invalid to use a return statement in a static block */ 13298 if (IS_CLINIT (current_function_decl)) 13299 error_found = 1; 13300 13301 /* It's invalid to have a no return value within a function that 13302 isn't declared with the keyword `void' */ 13303 if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth))) 13304 error_found = 2; 13305 13306 if (error_found) 13307 { 13308 if (IS_CLINIT (current_function_decl)) 13309 parse_error_context (wfl_operator, 13310 "`return' inside static initializer."); 13311 13312 else if (!DECL_CONSTRUCTOR_P (meth)) 13313 { 13314 char *t = strdup (lang_printable_name (mtype, 0)); 13315 parse_error_context (wfl_operator, 13316 "`return' with%s value from `%s %s'", 13317 (error_found == 1 ? "" : "out"), 13318 t, lang_printable_name (meth, 0)); 13319 free (t); 13320 } 13321 else 13322 parse_error_context (wfl_operator, 13323 "`return' with value from constructor `%s'", 13324 lang_printable_name (meth, 0)); 13325 return error_mark_node; 13326 } 13327 13328 /* If we have a return_exp, build a modify expression and expand 13329 it. Note: at that point, the assignment is declared valid, but we 13330 may want to carry some more hacks */ 13331 if (return_exp) 13332 { 13333 tree exp = java_complete_tree (return_exp); 13334 tree modify, patched; 13335 13336 /* If the function returned value and EXP are booleans, EXP has 13337 to be converted into the type of DECL_RESULT, which is integer 13338 (see complete_start_java_method) */ 13339 if (TREE_TYPE (exp) == boolean_type_node && 13340 TREE_TYPE (TREE_TYPE (meth)) == boolean_type_node) 13341 exp = convert_to_integer (TREE_TYPE (DECL_RESULT (meth)), exp); 13342 13343 /* `null' can be assigned to a function returning a reference */ 13344 if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth))) && 13345 exp == null_pointer_node) 13346 exp = build_null_of_type (TREE_TYPE (TREE_TYPE (meth))); 13347 13348 if ((patched = patch_string (exp))) 13349 exp = patched; 13350 13351 modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp); 13352 EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node); 13353 modify = java_complete_tree (modify); 13354 13355 if (modify != error_mark_node) 13356 { 13357 TREE_SIDE_EFFECTS (modify) = 1; 13358 TREE_OPERAND (node, 0) = modify; 13359 } 13360 else 13361 return error_mark_node; 13362 } 13363 TREE_TYPE (node) = void_type_node; 13364 TREE_SIDE_EFFECTS (node) = 1; 13365 return node; 13366} 13367 13368/* 14.8 The if Statement */ 13369 13370static tree 13371build_if_else_statement (location, expression, if_body, else_body) 13372 int location; 13373 tree expression, if_body, else_body; 13374{ 13375 tree node; 13376 if (!else_body) 13377 else_body = empty_stmt_node; 13378 node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body); 13379 EXPR_WFL_LINECOL (node) = location; 13380 node = build_debugable_stmt (location, node); 13381 return node; 13382} 13383 13384static tree 13385patch_if_else_statement (node) 13386 tree node; 13387{ 13388 tree expression = TREE_OPERAND (node, 0); 13389 13390 TREE_TYPE (node) = error_mark_node; 13391 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 13392 13393 /* The type of expression must be boolean */ 13394 if (TREE_TYPE (expression) != boolean_type_node 13395 && TREE_TYPE (expression) != promoted_boolean_type_node) 13396 { 13397 parse_error_context 13398 (wfl_operator, 13399 "Incompatible type for `if'. Can't convert `%s' to `boolean'", 13400 lang_printable_name (TREE_TYPE (expression), 0)); 13401 return error_mark_node; 13402 } 13403 13404 TREE_TYPE (node) = void_type_node; 13405 TREE_SIDE_EFFECTS (node) = 1; 13406 CAN_COMPLETE_NORMALLY (node) 13407 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)) 13408 | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2)); 13409 return node; 13410} 13411 13412/* 14.6 Labeled Statements */ 13413 13414/* Action taken when a lableled statement is parsed. a new 13415 LABELED_BLOCK_EXPR is created. No statement is attached to the 13416 label, yet. LABEL can be NULL_TREE for artificially-generated blocks. */ 13417 13418static tree 13419build_labeled_block (location, label) 13420 int location; 13421 tree label; 13422{ 13423 tree label_name ; 13424 tree label_decl, node; 13425 if (label == NULL_TREE || label == continue_identifier_node) 13426 label_name = label; 13427 else 13428 { 13429 label_name = merge_qualified_name (label_id, label); 13430 /* Issue an error if we try to reuse a label that was previously 13431 declared */ 13432 if (IDENTIFIER_LOCAL_VALUE (label_name)) 13433 { 13434 EXPR_WFL_LINECOL (wfl_operator) = location; 13435 parse_error_context (wfl_operator, "Declaration of `%s' shadows " 13436 "a previous label declaration", 13437 IDENTIFIER_POINTER (label)); 13438 EXPR_WFL_LINECOL (wfl_operator) = 13439 EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name)); 13440 parse_error_context (wfl_operator, "This is the location of the " 13441 "previous declaration of label `%s'", 13442 IDENTIFIER_POINTER (label)); 13443 java_error_count--; 13444 } 13445 } 13446 13447 label_decl = create_label_decl (label_name); 13448 node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE); 13449 EXPR_WFL_LINECOL (node) = location; 13450 TREE_SIDE_EFFECTS (node) = 1; 13451 return node; 13452} 13453 13454/* A labeled statement LBE is attached a statement. */ 13455 13456static tree 13457finish_labeled_statement (lbe, statement) 13458 tree lbe; /* Labeled block expr */ 13459 tree statement; 13460{ 13461 /* In anyways, tie the loop to its statement */ 13462 LABELED_BLOCK_BODY (lbe) = statement; 13463 pop_labeled_block (); 13464 POP_LABELED_BLOCK (); 13465 return lbe; 13466} 13467 13468/* 14.10, 14.11, 14.12 Loop Statements */ 13469 13470/* Create an empty LOOP_EXPR and make it the last in the nested loop 13471 list. */ 13472 13473static tree 13474build_new_loop (loop_body) 13475 tree loop_body; 13476{ 13477 tree loop = build (LOOP_EXPR, NULL_TREE, loop_body); 13478 TREE_SIDE_EFFECTS (loop) = 1; 13479 PUSH_LOOP (loop); 13480 return loop; 13481} 13482 13483/* Create a loop body according to the following structure: 13484 COMPOUND_EXPR 13485 COMPOUND_EXPR (loop main body) 13486 EXIT_EXPR (this order is for while/for loops. 13487 LABELED_BLOCK_EXPR the order is reversed for do loops) 13488 LABEL_DECL (a continue occuring here branches at the 13489 BODY end of this labeled block) 13490 INCREMENT (if any) 13491 13492 REVERSED, if non zero, tells that the loop condition expr comes 13493 after the body, like in the do-while loop. 13494 13495 To obtain a loop, the loop body structure described above is 13496 encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR: 13497 13498 LABELED_BLOCK_EXPR 13499 LABEL_DECL (use this label to exit the loop) 13500 LOOP_EXPR 13501 <structure described above> */ 13502 13503static tree 13504build_loop_body (location, condition, reversed) 13505 int location; 13506 tree condition; 13507 int reversed; 13508{ 13509 tree first, second, body; 13510 13511 condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */ 13512 EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */ 13513 condition = build_debugable_stmt (location, condition); 13514 TREE_SIDE_EFFECTS (condition) = 1; 13515 13516 body = build_labeled_block (0, continue_identifier_node); 13517 first = (reversed ? body : condition); 13518 second = (reversed ? condition : body); 13519 return 13520 build (COMPOUND_EXPR, NULL_TREE, 13521 build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node); 13522} 13523 13524/* Install CONDITION (if any) and loop BODY (using REVERSED to tell 13525 their order) on the current loop. Unlink the current loop from the 13526 loop list. */ 13527 13528static tree 13529finish_loop_body (location, condition, body, reversed) 13530 int location; 13531 tree condition, body; 13532 int reversed; 13533{ 13534 tree to_return = ctxp->current_loop; 13535 tree loop_body = LOOP_EXPR_BODY (to_return); 13536 if (condition) 13537 { 13538 tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed); 13539 /* We wrapped the EXIT_EXPR around a WFL so we can debug it. 13540 The real EXIT_EXPR is one operand further. */ 13541 EXPR_WFL_LINECOL (cnode) = location; 13542 /* This one is for accurate error reports */ 13543 EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location; 13544 TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition; 13545 } 13546 LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body; 13547 POP_LOOP (); 13548 return to_return; 13549} 13550 13551/* Tailored version of finish_loop_body for FOR loops, when FOR 13552 loops feature the condition part */ 13553 13554static tree 13555finish_for_loop (location, condition, update, body) 13556 int location; 13557 tree condition, update, body; 13558{ 13559 /* Put the condition and the loop body in place */ 13560 tree loop = finish_loop_body (location, condition, body, 0); 13561 /* LOOP is the current loop which has been now popped of the loop 13562 stack. Install the update block */ 13563 LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update; 13564 return loop; 13565} 13566 13567/* If the loop isn't surrounded by a labeled statement, create one and 13568 insert LOOP as its body. */ 13569 13570static tree 13571patch_loop_statement (loop) 13572 tree loop; 13573{ 13574 tree loop_label; 13575 tree block = ctxp->current_labeled_block; 13576 TREE_TYPE (loop) = void_type_node; 13577 if (block != NULL_TREE) 13578 { 13579 tree block_body = LABELED_BLOCK_BODY (block); 13580 if (IS_FOR_LOOP_P (loop)) 13581 { 13582 if (TREE_CODE (block_body) == BLOCK) 13583 { 13584 block_body = BLOCK_EXPR_BODY (block_body); 13585 if (block_body == loop 13586 || (TREE_CODE (block_body) == COMPOUND_EXPR 13587 && TREE_OPERAND (block_body, 1) == loop)) 13588 return loop; 13589 } 13590 } 13591 else 13592 { 13593 if (block_body == loop) 13594 return loop; 13595 } 13596 } 13597 loop_label = build_labeled_block (0, NULL_TREE); 13598 LABELED_BLOCK_BODY (loop_label) = loop; 13599 PUSH_LABELED_BLOCK (loop_label); 13600 loop = loop_label; 13601 return loop; 13602} 13603 13604/* 14.13, 14.14: break and continue Statements */ 13605 13606/* Build a break or a continue statement. a null NAME indicates an 13607 unlabeled break/continue statement. */ 13608 13609static tree 13610build_bc_statement (location, is_break, name) 13611 int location, is_break; 13612 tree name; 13613{ 13614 tree break_continue, label_block_expr = NULL_TREE; 13615 13616 if (name) 13617 { 13618 if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE 13619 (merge_qualified_name (label_id, EXPR_WFL_NODE (name))))) 13620 /* Null means that we don't have a target for this named 13621 break/continue. In this case, we make the target to be the 13622 label name, so that the error can be reported accuratly in 13623 patch_bc_statement. */ 13624 label_block_expr = EXPR_WFL_NODE (name); 13625 } 13626 /* Unlabeled break/continue will be handled during the 13627 break/continue patch operation */ 13628 break_continue 13629 = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE); 13630 13631 IS_BREAK_STMT_P (break_continue) = is_break; 13632 TREE_SIDE_EFFECTS (break_continue) = 1; 13633 EXPR_WFL_LINECOL (break_continue) = location; 13634 break_continue = build_debugable_stmt (location, break_continue); 13635 return break_continue; 13636} 13637 13638/* Verification of a break/continue statement. */ 13639 13640static tree 13641patch_bc_statement (node) 13642 tree node; 13643{ 13644 tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt; 13645 tree labeled_block = ctxp->current_labeled_block; 13646 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 13647 13648 /* Having an identifier here means that the target is unknown. */ 13649 if (bc_label != NULL_TREE && TREE_CODE (bc_label) == IDENTIFIER_NODE) 13650 { 13651 parse_error_context (wfl_operator, "No label definition found for `%s'", 13652 IDENTIFIER_POINTER (bc_label)); 13653 return error_mark_node; 13654 } 13655 if (! IS_BREAK_STMT_P (node)) 13656 { 13657 /* It's a continue statement. */ 13658 for (;; labeled_block = TREE_CHAIN (labeled_block)) 13659 { 13660 if (labeled_block == NULL_TREE) 13661 { 13662 if (bc_label == NULL_TREE) 13663 parse_error_context (wfl_operator, 13664 "`continue' must be in loop"); 13665 else 13666 parse_error_context 13667 (wfl_operator, "continue label `%s' does not name a loop", 13668 IDENTIFIER_POINTER (bc_label)); 13669 return error_mark_node; 13670 } 13671 if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block)) 13672 == continue_identifier_node) 13673 && (bc_label == NULL_TREE 13674 || TREE_CHAIN (labeled_block) == bc_label)) 13675 { 13676 bc_label = labeled_block; 13677 break; 13678 } 13679 } 13680 } 13681 else if (!bc_label) 13682 { 13683 for (;; labeled_block = TREE_CHAIN (labeled_block)) 13684 { 13685 if (labeled_block == NULL_TREE) 13686 { 13687 parse_error_context (wfl_operator, 13688 "`break' must be in loop or switch"); 13689 return error_mark_node; 13690 } 13691 target_stmt = LABELED_BLOCK_BODY (labeled_block); 13692 if (TREE_CODE (target_stmt) == SWITCH_EXPR 13693 || TREE_CODE (target_stmt) == LOOP_EXPR) 13694 { 13695 bc_label = labeled_block; 13696 break; 13697 } 13698 } 13699 } 13700 13701 EXIT_BLOCK_LABELED_BLOCK (node) = bc_label; 13702 CAN_COMPLETE_NORMALLY (bc_label) = 1; 13703 13704 /* Our break/continue don't return values. */ 13705 TREE_TYPE (node) = void_type_node; 13706 /* Encapsulate the break within a compound statement so that it's 13707 expanded all the times by expand_expr (and not clobered 13708 sometimes, like after a if statement) */ 13709 node = add_stmt_to_compound (NULL_TREE, void_type_node, node); 13710 TREE_SIDE_EFFECTS (node) = 1; 13711 return node; 13712} 13713 13714/* Process the exit expression belonging to a loop. Its type must be 13715 boolean. */ 13716 13717static tree 13718patch_exit_expr (node) 13719 tree node; 13720{ 13721 tree expression = TREE_OPERAND (node, 0); 13722 TREE_TYPE (node) = error_mark_node; 13723 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 13724 13725 /* The type of expression must be boolean */ 13726 if (TREE_TYPE (expression) != boolean_type_node) 13727 { 13728 parse_error_context 13729 (wfl_operator, 13730 "Incompatible type for loop conditional. Can't convert `%s' to " 13731 "`boolean'", 13732 lang_printable_name (TREE_TYPE (expression), 0)); 13733 return error_mark_node; 13734 } 13735 /* Now we know things are allright, invert the condition, fold and 13736 return */ 13737 TREE_OPERAND (node, 0) = 13738 fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression)); 13739 13740 if (! integer_zerop (TREE_OPERAND (node, 0)) 13741 && ctxp->current_loop != NULL_TREE 13742 && TREE_CODE (ctxp->current_loop) == LOOP_EXPR) 13743 CAN_COMPLETE_NORMALLY (ctxp->current_loop) = 1; 13744 if (! integer_onep (TREE_OPERAND (node, 0))) 13745 CAN_COMPLETE_NORMALLY (node) = 1; 13746 13747 13748 TREE_TYPE (node) = void_type_node; 13749 return node; 13750} 13751 13752/* 14.9 Switch statement */ 13753 13754static tree 13755patch_switch_statement (node) 13756 tree node; 13757{ 13758 tree se = TREE_OPERAND (node, 0), se_type; 13759 13760 /* Complete the switch expression */ 13761 se = TREE_OPERAND (node, 0) = java_complete_tree (se); 13762 se_type = TREE_TYPE (se); 13763 /* The type of the switch expression must be char, byte, short or 13764 int */ 13765 if (!JINTEGRAL_TYPE_P (se_type)) 13766 { 13767 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); 13768 parse_error_context (wfl_operator, "Incompatible type for `switch'. " 13769 "Can't convert `%s' to `int'", 13770 lang_printable_name (se_type, 0)); 13771 /* This is what java_complete_tree will check */ 13772 TREE_OPERAND (node, 0) = error_mark_node; 13773 return error_mark_node; 13774 } 13775 13776 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1)); 13777 13778 /* Ready to return */ 13779 if (TREE_CODE (TREE_OPERAND (node, 1)) == ERROR_MARK) 13780 { 13781 TREE_TYPE (node) = error_mark_node; 13782 return error_mark_node; 13783 } 13784 TREE_TYPE (node) = void_type_node; 13785 TREE_SIDE_EFFECTS (node) = 1; 13786 CAN_COMPLETE_NORMALLY (node) 13787 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)) 13788 || ! SWITCH_HAS_DEFAULT (node); 13789 return node; 13790} 13791 13792/* 14.18 The try statement */ 13793 13794static tree 13795build_try_statement (location, try_block, catches) 13796 int location; 13797 tree try_block, catches; 13798{ 13799 tree node = build (TRY_EXPR, NULL_TREE, try_block, catches); 13800 EXPR_WFL_LINECOL (node) = location; 13801 return node; 13802} 13803 13804static tree 13805build_try_finally_statement (location, try_block, finally) 13806 int location; 13807 tree try_block, finally; 13808{ 13809 tree node = build (TRY_FINALLY_EXPR, NULL_TREE, try_block, finally); 13810 EXPR_WFL_LINECOL (node) = location; 13811 return node; 13812} 13813 13814static tree 13815patch_try_statement (node) 13816 tree node; 13817{ 13818 int error_found = 0; 13819 tree try = TREE_OPERAND (node, 0); 13820 /* Exception handlers are considered in left to right order */ 13821 tree catch = nreverse (TREE_OPERAND (node, 1)); 13822 tree current, caught_type_list = NULL_TREE; 13823 13824 /* Check catch clauses, if any. Every time we find an error, we try 13825 to process the next catch clause. We process the catch clause before 13826 the try block so that when processing the try block we can check thrown 13827 exceptions againts the caught type list. */ 13828 for (current = catch; current; current = TREE_CHAIN (current)) 13829 { 13830 tree carg_decl, carg_type; 13831 tree sub_current, catch_block, catch_clause; 13832 int unreachable; 13833 13834 /* At this point, the structure of the catch clause is 13835 CATCH_EXPR (catch node) 13836 BLOCK (with the decl of the parameter) 13837 COMPOUND_EXPR 13838 MODIFY_EXPR (assignment of the catch parameter) 13839 BLOCK (catch clause block) 13840 */ 13841 catch_clause = TREE_OPERAND (current, 0); 13842 carg_decl = BLOCK_EXPR_DECLS (catch_clause); 13843 carg_type = TREE_TYPE (TREE_TYPE (carg_decl)); 13844 13845 /* Catch clauses can't have more than one parameter declared, 13846 but it's already enforced by the grammar. Make sure that the 13847 only parameter of the clause statement in of class Throwable 13848 or a subclass of Throwable, but that was done earlier. The 13849 catch clause parameter type has also been resolved. */ 13850 13851 /* Just make sure that the catch clause parameter type inherits 13852 from java.lang.Throwable */ 13853 if (!inherits_from_p (carg_type, throwable_type_node)) 13854 { 13855 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current); 13856 parse_error_context (wfl_operator, 13857 "Can't catch class `%s'. Catch clause " 13858 "parameter type must be a subclass of " 13859 "class `java.lang.Throwable'", 13860 lang_printable_name (carg_type, 0)); 13861 error_found = 1; 13862 continue; 13863 } 13864 13865 /* Partial check for unreachable catch statement: The catch 13866 clause is reachable iff is no earlier catch block A in 13867 the try statement such that the type of the catch 13868 clause's parameter is the same as or a subclass of the 13869 type of A's parameter */ 13870 unreachable = 0; 13871 for (sub_current = catch; 13872 sub_current != current; sub_current = TREE_CHAIN (sub_current)) 13873 { 13874 tree sub_catch_clause, decl; 13875 sub_catch_clause = TREE_OPERAND (sub_current, 0); 13876 decl = BLOCK_EXPR_DECLS (sub_catch_clause); 13877 13878 if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl)))) 13879 { 13880 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current); 13881 parse_error_context 13882 (wfl_operator, "`catch' not reached because of the catch " 13883 "clause at line %d", EXPR_WFL_LINENO (sub_current)); 13884 unreachable = error_found = 1; 13885 break; 13886 } 13887 } 13888 /* Complete the catch clause block */ 13889 catch_block = java_complete_tree (TREE_OPERAND (current, 0)); 13890 if (catch_block == error_mark_node) 13891 { 13892 error_found = 1; 13893 continue; 13894 } 13895 if (CAN_COMPLETE_NORMALLY (catch_block)) 13896 CAN_COMPLETE_NORMALLY (node) = 1; 13897 TREE_OPERAND (current, 0) = catch_block; 13898 13899 if (unreachable) 13900 continue; 13901 13902 /* Things to do here: the exception must be thrown */ 13903 13904 /* Link this type to the caught type list */ 13905 caught_type_list = tree_cons (NULL_TREE, carg_type, caught_type_list); 13906 } 13907 13908 PUSH_EXCEPTIONS (caught_type_list); 13909 if ((try = java_complete_tree (try)) == error_mark_node) 13910 error_found = 1; 13911 if (CAN_COMPLETE_NORMALLY (try)) 13912 CAN_COMPLETE_NORMALLY (node) = 1; 13913 POP_EXCEPTIONS (); 13914 13915 /* Verification ends here */ 13916 if (error_found) 13917 return error_mark_node; 13918 13919 TREE_OPERAND (node, 0) = try; 13920 TREE_OPERAND (node, 1) = catch; 13921 TREE_TYPE (node) = void_type_node; 13922 return node; 13923} 13924 13925/* 14.17 The synchronized Statement */ 13926 13927static tree 13928patch_synchronized_statement (node, wfl_op1) 13929 tree node, wfl_op1; 13930{ 13931 tree expr = java_complete_tree (TREE_OPERAND (node, 0)); 13932 tree block = TREE_OPERAND (node, 1); 13933 13934 tree enter, exit, expr_decl, assignment; 13935 13936 if (expr == error_mark_node) 13937 { 13938 block = java_complete_tree (block); 13939 return expr; 13940 } 13941 13942 /* The TYPE of expr must be a reference type */ 13943 if (!JREFERENCE_TYPE_P (TREE_TYPE (expr))) 13944 { 13945 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); 13946 parse_error_context (wfl_operator, "Incompatible type for `synchronized'" 13947 ". Can't convert `%s' to `java.lang.Object'", 13948 lang_printable_name (TREE_TYPE (expr), 0)); 13949 return error_mark_node; 13950 } 13951 13952 if (flag_emit_xref) 13953 { 13954 TREE_OPERAND (node, 0) = expr; 13955 TREE_OPERAND (node, 1) = java_complete_tree (block); 13956 CAN_COMPLETE_NORMALLY (node) = 1; 13957 return node; 13958 } 13959 13960 /* Generate a try-finally for the synchronized statement, except 13961 that the handler that catches all throw exception calls 13962 _Jv_MonitorExit and then rethrow the exception. 13963 The synchronized statement is then implemented as: 13964 TRY 13965 { 13966 _Jv_MonitorEnter (expression) 13967 synchronized_block 13968 _Jv_MonitorExit (expression) 13969 } 13970 CATCH_ALL 13971 { 13972 e = _Jv_exception_info (); 13973 _Jv_MonitorExit (expression) 13974 Throw (e); 13975 } */ 13976 13977 expr_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (expr)); 13978 BUILD_MONITOR_ENTER (enter, expr_decl); 13979 BUILD_MONITOR_EXIT (exit, expr_decl); 13980 CAN_COMPLETE_NORMALLY (enter) = 1; 13981 CAN_COMPLETE_NORMALLY (exit) = 1; 13982 assignment = build (MODIFY_EXPR, NULL_TREE, expr_decl, expr); 13983 TREE_SIDE_EFFECTS (assignment) = 1; 13984 node = build1 (CLEANUP_POINT_EXPR, NULL_TREE, 13985 build (COMPOUND_EXPR, NULL_TREE, 13986 build (WITH_CLEANUP_EXPR, NULL_TREE, 13987 build (COMPOUND_EXPR, NULL_TREE, 13988 assignment, enter), 13989 NULL_TREE, exit), 13990 block)); 13991 node = build_expr_block (node, expr_decl); 13992 13993 return java_complete_tree (node); 13994} 13995 13996/* 14.16 The throw Statement */ 13997 13998static tree 13999patch_throw_statement (node, wfl_op1) 14000 tree node, wfl_op1; 14001{ 14002 tree expr = TREE_OPERAND (node, 0); 14003 tree type = TREE_TYPE (expr); 14004 int unchecked_ok = 0, tryblock_throws_ok = 0; 14005 14006 /* Thrown expression must be assignable to java.lang.Throwable */ 14007 if (!try_reference_assignconv (throwable_type_node, expr)) 14008 { 14009 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); 14010 parse_error_context (wfl_operator, "Can't throw `%s'; it must be a " 14011 "subclass of class `java.lang.Throwable'", 14012 lang_printable_name (type, 0)); 14013 /* If the thrown expression was a reference, we further the 14014 compile-time check. */ 14015 if (!JREFERENCE_TYPE_P (type)) 14016 return error_mark_node; 14017 } 14018 14019 /* At least one of the following must be true */ 14020 14021 /* The type of the throw expression is a not checked exception, 14022 i.e. is a unchecked expression. */ 14023 unchecked_ok = IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type)); 14024 14025 /* Throw is contained in a try statement and at least one catch 14026 clause can receive the thrown expression or the current method is 14027 declared to throw such an exception. Or, the throw statement is 14028 contained in a method or constructor declaration and the type of 14029 the Expression is assignable to at least one type listed in the 14030 throws clause the declaration. */ 14031 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); 14032 if (!unchecked_ok) 14033 tryblock_throws_ok = check_thrown_exceptions_do (TREE_TYPE (expr)); 14034 if (!(unchecked_ok || tryblock_throws_ok)) 14035 { 14036 /* If there is a surrounding try block that has no matching 14037 clatch clause, report it first. A surrounding try block exits 14038 only if there is something after the list of checked 14039 exception thrown by the current function (if any). */ 14040 if (IN_TRY_BLOCK_P ()) 14041 parse_error_context (wfl_operator, "Checked exception `%s' can't be " 14042 "caught by any of the catch clause(s) " 14043 "of the surrounding `try' block", 14044 lang_printable_name (type, 0)); 14045 /* If we have no surrounding try statement and the method doesn't have 14046 any throws, report it now. FIXME */ 14047 14048 /* We report that the exception can't be throw from a try block 14049 in all circumstances but when the `throw' is inside a static 14050 block. */ 14051 else if (!EXCEPTIONS_P (currently_caught_type_list) 14052 && !tryblock_throws_ok) 14053 { 14054 if (IS_CLINIT (current_function_decl)) 14055 parse_error_context (wfl_operator, "Checked exception `%s' can't " 14056 "be thrown in initializer", 14057 lang_printable_name (type, 0)); 14058 else 14059 parse_error_context (wfl_operator, "Checked exception `%s' isn't " 14060 "thrown from a `try' block", 14061 lang_printable_name (type, 0)); 14062 } 14063 /* Otherwise, the current method doesn't have the appropriate 14064 throws declaration */ 14065 else 14066 parse_error_context (wfl_operator, "Checked exception `%s' doesn't " 14067 "match any of current method's `throws' " 14068 "declaration(s)", 14069 lang_printable_name (type, 0)); 14070 return error_mark_node; 14071 } 14072 14073 if (! flag_emit_class_files && ! flag_emit_xref) 14074 BUILD_THROW (node, expr); 14075 14076 /* If doing xrefs, keep the location where the `throw' was seen. */ 14077 if (flag_emit_xref) 14078 EXPR_WFL_LINECOL (node) = EXPR_WFL_LINECOL (wfl_op1); 14079 return node; 14080} 14081 14082/* Check that exception said to be thrown by method DECL can be 14083 effectively caught from where DECL is invoked. */ 14084 14085static void 14086check_thrown_exceptions (location, decl) 14087 int location; 14088 tree decl; 14089{ 14090 tree throws; 14091 /* For all the unchecked exceptions thrown by DECL */ 14092 for (throws = DECL_FUNCTION_THROWS (decl); throws; 14093 throws = TREE_CHAIN (throws)) 14094 if (!check_thrown_exceptions_do (TREE_VALUE (throws))) 14095 { 14096#if 1 14097 /* Temporary hack to suppresses errors about cloning arrays. FIXME */ 14098 if (DECL_NAME (decl) == get_identifier ("clone")) 14099 continue; 14100#endif 14101 EXPR_WFL_LINECOL (wfl_operator) = location; 14102 parse_error_context 14103 (wfl_operator, "Exception `%s' must be caught, or it must be " 14104 "declared in the `throws' clause of `%s'", 14105 lang_printable_name (TREE_VALUE (throws), 0), 14106 IDENTIFIER_POINTER (DECL_NAME (current_function_decl))); 14107 } 14108} 14109 14110/* Return 1 if checked EXCEPTION is caught at the current nesting level of 14111 try-catch blocks, OR is listed in the `throws' clause of the 14112 current method. */ 14113 14114static int 14115check_thrown_exceptions_do (exception) 14116 tree exception; 14117{ 14118 tree list = currently_caught_type_list; 14119 resolve_and_layout (exception, NULL_TREE); 14120 /* First, all the nested try-catch-finally at that stage. The 14121 last element contains `throws' clause exceptions, if any. */ 14122 if (IS_UNCHECKED_EXCEPTION_P (exception)) 14123 return 1; 14124 while (list) 14125 { 14126 tree caught; 14127 for (caught = TREE_VALUE (list); caught; caught = TREE_CHAIN (caught)) 14128 if (valid_ref_assignconv_cast_p (exception, TREE_VALUE (caught), 0)) 14129 return 1; 14130 list = TREE_CHAIN (list); 14131 } 14132 return 0; 14133} 14134 14135static void 14136purge_unchecked_exceptions (mdecl) 14137 tree mdecl; 14138{ 14139 tree throws = DECL_FUNCTION_THROWS (mdecl); 14140 tree new = NULL_TREE; 14141 14142 while (throws) 14143 { 14144 tree next = TREE_CHAIN (throws); 14145 if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws))) 14146 { 14147 TREE_CHAIN (throws) = new; 14148 new = throws; 14149 } 14150 throws = next; 14151 } 14152 /* List is inverted here, but it doesn't matter */ 14153 DECL_FUNCTION_THROWS (mdecl) = new; 14154} 14155 14156/* 15.24 Conditional Operator ?: */ 14157 14158static tree 14159patch_conditional_expr (node, wfl_cond, wfl_op1) 14160 tree node, wfl_cond, wfl_op1; 14161{ 14162 tree cond = TREE_OPERAND (node, 0); 14163 tree op1 = TREE_OPERAND (node, 1); 14164 tree op2 = TREE_OPERAND (node, 2); 14165 tree resulting_type = NULL_TREE; 14166 tree t1, t2, patched; 14167 int error_found = 0; 14168 14169 /* Operands of ?: might be StringBuffers crafted as a result of a 14170 string concatenation. Obtain a descent operand here. */ 14171 if ((patched = patch_string (op1))) 14172 TREE_OPERAND (node, 1) = op1 = patched; 14173 if ((patched = patch_string (op2))) 14174 TREE_OPERAND (node, 2) = op2 = patched; 14175 14176 t1 = TREE_TYPE (op1); 14177 t2 = TREE_TYPE (op2); 14178 14179 /* The first expression must be a boolean */ 14180 if (TREE_TYPE (cond) != boolean_type_node) 14181 { 14182 SET_WFL_OPERATOR (wfl_operator, node, wfl_cond); 14183 parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't " 14184 "convert `%s' to `boolean'", 14185 lang_printable_name (TREE_TYPE (cond), 0)); 14186 error_found = 1; 14187 } 14188 14189 /* Second and third can be numeric, boolean (i.e. primitive), 14190 references or null. Anything else results in an error */ 14191 if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2)) 14192 || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node) 14193 && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node)) 14194 || (t1 == boolean_type_node && t2 == boolean_type_node))) 14195 error_found = 1; 14196 14197 /* Determine the type of the conditional expression. Same types are 14198 easy to deal with */ 14199 else if (t1 == t2) 14200 resulting_type = t1; 14201 14202 /* There are different rules for numeric types */ 14203 else if (JNUMERIC_TYPE_P (t1)) 14204 { 14205 /* if byte/short found, the resulting type is short */ 14206 if ((t1 == byte_type_node && t2 == short_type_node) 14207 || (t1 == short_type_node && t2 == byte_type_node)) 14208 resulting_type = short_type_node; 14209 14210 /* If t1 is a constant int and t2 is of type byte, short or char 14211 and t1's value fits in t2, then the resulting type is t2 */ 14212 else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1))) 14213 && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2)) 14214 resulting_type = t2; 14215 14216 /* If t2 is a constant int and t1 is of type byte, short or char 14217 and t2's value fits in t1, then the resulting type is t1 */ 14218 else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2))) 14219 && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1)) 14220 resulting_type = t1; 14221 14222 /* Otherwise, binary numeric promotion is applied and the 14223 resulting type is the promoted type of operand 1 and 2 */ 14224 else 14225 resulting_type = binary_numeric_promotion (t1, t2, 14226 &TREE_OPERAND (node, 1), 14227 &TREE_OPERAND (node, 2)); 14228 } 14229 14230 /* Cases of a reference and a null type */ 14231 else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node) 14232 resulting_type = t1; 14233 14234 else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node) 14235 resulting_type = t2; 14236 14237 /* Last case: different reference types. If a type can be converted 14238 into the other one by assignment conversion, the latter 14239 determines the type of the expression */ 14240 else if ((resulting_type = try_reference_assignconv (t1, op2))) 14241 resulting_type = promote_type (t1); 14242 14243 else if ((resulting_type = try_reference_assignconv (t2, op1))) 14244 resulting_type = promote_type (t2); 14245 14246 /* If we don't have any resulting type, we're in trouble */ 14247 if (!resulting_type) 14248 { 14249 char *t = strdup (lang_printable_name (t1, 0)); 14250 SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); 14251 parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't " 14252 "convert `%s' to `%s'", t, 14253 lang_printable_name (t2, 0)); 14254 free (t); 14255 error_found = 1; 14256 } 14257 14258 if (error_found) 14259 { 14260 TREE_TYPE (node) = error_mark_node; 14261 return error_mark_node; 14262 } 14263 14264 TREE_TYPE (node) = resulting_type; 14265 TREE_SET_CODE (node, COND_EXPR); 14266 CAN_COMPLETE_NORMALLY (node) = 1; 14267 return node; 14268} 14269 14270/* Try to constant fold NODE. 14271 If NODE is not a constant expression, return NULL_EXPR. 14272 CONTEXT is a static final VAR_DECL whose initializer we are folding. */ 14273 14274static tree 14275fold_constant_for_init (node, context) 14276 tree node; 14277 tree context; 14278{ 14279 tree op0, op1, val; 14280 enum tree_code code = TREE_CODE (node); 14281 14282 if (code == STRING_CST) 14283 return node; 14284 14285 if (code == INTEGER_CST || code == REAL_CST) 14286 return convert (TREE_TYPE (context), node); 14287 if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL) 14288 return NULL_TREE; 14289 14290 switch (code) 14291 { 14292 case PLUS_EXPR: 14293 case MINUS_EXPR: 14294 case MULT_EXPR: 14295 case TRUNC_MOD_EXPR: 14296 case RDIV_EXPR: 14297 case LSHIFT_EXPR: 14298 case RSHIFT_EXPR: 14299 case URSHIFT_EXPR: 14300 case BIT_AND_EXPR: 14301 case BIT_XOR_EXPR: 14302 case BIT_IOR_EXPR: 14303 case TRUTH_ANDIF_EXPR: 14304 case TRUTH_ORIF_EXPR: 14305 case EQ_EXPR: 14306 case NE_EXPR: 14307 case GT_EXPR: 14308 case GE_EXPR: 14309 case LT_EXPR: 14310 case LE_EXPR: 14311 op0 = TREE_OPERAND (node, 0); 14312 op1 = TREE_OPERAND (node, 1); 14313 val = fold_constant_for_init (op0, context); 14314 if (val == NULL_TREE || ! TREE_CONSTANT (val)) 14315 return NULL_TREE; 14316 TREE_OPERAND (node, 0) = val; 14317 val = fold_constant_for_init (op1, context); 14318 if (val == NULL_TREE || ! TREE_CONSTANT (val)) 14319 return NULL_TREE; 14320 TREE_OPERAND (node, 1) = val; 14321 return patch_binop (node, op0, op1); 14322 14323 case UNARY_PLUS_EXPR: 14324 case NEGATE_EXPR: 14325 case TRUTH_NOT_EXPR: 14326 case BIT_NOT_EXPR: 14327 case CONVERT_EXPR: 14328 op0 = TREE_OPERAND (node, 0); 14329 val = fold_constant_for_init (op0, context); 14330 if (val == NULL_TREE || ! TREE_CONSTANT (val)) 14331 return NULL_TREE; 14332 TREE_OPERAND (node, 0) = val; 14333 return patch_unaryop (node, op0); 14334 break; 14335 14336 case COND_EXPR: 14337 val = fold_constant_for_init (TREE_OPERAND (node, 0), context); 14338 if (val == NULL_TREE || ! TREE_CONSTANT (val)) 14339 return NULL_TREE; 14340 TREE_OPERAND (node, 0) = val; 14341 val = fold_constant_for_init (TREE_OPERAND (node, 1), context); 14342 if (val == NULL_TREE || ! TREE_CONSTANT (val)) 14343 return NULL_TREE; 14344 TREE_OPERAND (node, 1) = val; 14345 val = fold_constant_for_init (TREE_OPERAND (node, 2), context); 14346 if (val == NULL_TREE || ! TREE_CONSTANT (val)) 14347 return NULL_TREE; 14348 TREE_OPERAND (node, 2) = val; 14349 return integer_zerop (TREE_OPERAND (node, 0)) ? TREE_OPERAND (node, 1) 14350 : TREE_OPERAND (node, 2); 14351 14352 case VAR_DECL: 14353 case FIELD_DECL: 14354 if (! FIELD_FINAL (node) 14355 || DECL_INITIAL (node) == NULL_TREE) 14356 return NULL_TREE; 14357 val = DECL_INITIAL (node); 14358 /* Guard against infinite recursion. */ 14359 DECL_INITIAL (node) = NULL_TREE; 14360 val = fold_constant_for_init (val, node); 14361 DECL_INITIAL (node) = val; 14362 return val; 14363 14364 case EXPR_WITH_FILE_LOCATION: 14365 /* Compare java_complete_tree and resolve_expression_name. */ 14366 if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */ 14367 || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE) 14368 { 14369 tree name = EXPR_WFL_NODE (node); 14370 tree decl; 14371 if (PRIMARY_P (node)) 14372 return NULL_TREE; 14373 else if (! QUALIFIED_P (name)) 14374 { 14375 decl = lookup_field_wrapper (DECL_CONTEXT (context), name); 14376 if (decl == NULL_TREE 14377 || (! FIELD_STATIC (decl) && ! FIELD_FINAL (decl))) 14378 return NULL_TREE; 14379 return fold_constant_for_init (decl, decl); 14380 } 14381 else 14382 { 14383 /* Wait until the USE_COMPONENT_REF re-write. FIXME. */ 14384 qualify_ambiguous_name (node); 14385 if (resolve_field_access (node, &decl, NULL) 14386 && decl != NULL_TREE) 14387 return fold_constant_for_init (decl, decl); 14388 return NULL_TREE; 14389 } 14390 } 14391 else 14392 { 14393 op0 = TREE_OPERAND (node, 0); 14394 val = fold_constant_for_init (op0, context); 14395 if (val == NULL_TREE || ! TREE_CONSTANT (val)) 14396 return NULL_TREE; 14397 TREE_OPERAND (node, 0) = val; 14398 return val; 14399 } 14400 14401#ifdef USE_COMPONENT_REF 14402 case IDENTIFIER: 14403 case COMPONENT_REF: 14404 ?; 14405#endif 14406 14407 default: 14408 return NULL_TREE; 14409 } 14410} 14411 14412#ifdef USE_COMPONENT_REF 14413/* Context is 'T' for TypeName, 'P' for PackageName, 14414 'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */ 14415 14416tree 14417resolve_simple_name (name, context) 14418 tree name; 14419 int context; 14420{ 14421} 14422 14423tree 14424resolve_qualified_name (name, context) 14425 tree name; 14426 int context; 14427{ 14428} 14429#endif 14430