2 /* A Bison parser, made from ./parse.y
3 by GNU Bison version 1.25
6 #define YYBISON 1 /* Identify Bison output. */
8 #define yyparse java_parse
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
26 #define BOOL_AND_TK 269
27 #define BOOL_OR_TK 270
34 #define PLUS_ASSIGN_TK 277
35 #define MINUS_ASSIGN_TK 278
36 #define MULT_ASSIGN_TK 279
37 #define DIV_ASSIGN_TK 280
38 #define REM_ASSIGN_TK 281
39 #define LS_ASSIGN_TK 282
40 #define SRS_ASSIGN_TK 283
41 #define ZRS_ASSIGN_TK 284
42 #define AND_ASSIGN_TK 285
43 #define XOR_ASSIGN_TK 286
44 #define OR_ASSIGN_TK 287
46 #define PRIVATE_TK 289
47 #define PROTECTED_TK 290
50 #define SYNCHRONIZED_TK 293
51 #define VOLATILE_TK 294
52 #define TRANSIENT_TK 295
55 #define ABSTRACT_TK 298
56 #define MODIFIER_TK 299
59 #define DEFAULT_TK 302
62 #define BOOLEAN_TK 305
64 #define IMPLEMENTS_TK 307
69 #define INSTANCEOF_TK 312
73 #define INTERFACE_TK 316
75 #define EXTENDS_TK 318
76 #define FINALLY_TK 319
85 #define CONTINUE_TK 328
87 #define PACKAGE_TK 330
94 #define INTEGRAL_TK 337
100 #define REL_CL_TK 343
103 #define ASSIGN_ANY_TK 346
104 #define ASSIGN_TK 347
114 #define STRING_LIT_TK 357
115 #define CHAR_LIT_TK 358
116 #define INT_LIT_TK 359
117 #define FP_LIT_TK 360
120 #define BOOL_LIT_TK 363
133 #include "java-tree.h"
141 #include "function.h"
143 #include "defaults.h"
145 #ifndef DIR_SEPARATOR
146 #define DIR_SEPARATOR '/'
149 /* Local function prototypes */
150 static char *java_accstring_lookup
PROTO ((int));
151 static void classitf_redefinition_error
PROTO ((const char *,tree
, tree
, tree
));
152 static void variable_redefinition_error
PROTO ((tree
, tree
, tree
, int));
153 static void check_modifiers
PROTO ((const char *, int, int));
154 static tree create_class
PROTO ((int, tree
, tree
, tree
));
155 static tree create_interface
PROTO ((int, tree
, tree
));
156 static tree find_field
PROTO ((tree
, tree
));
157 static tree lookup_field_wrapper
PROTO ((tree
, tree
));
158 static int duplicate_declaration_error_p
PROTO ((tree
, tree
, tree
));
159 static void register_fields
PROTO ((int, tree
, tree
));
160 static tree parser_qualified_classname
PROTO ((tree
));
161 static int parser_check_super
PROTO ((tree
, tree
, tree
));
162 static int parser_check_super_interface
PROTO ((tree
, tree
, tree
));
163 static void check_modifiers_consistency
PROTO ((int));
164 static tree lookup_cl
PROTO ((tree
));
165 static tree lookup_java_method2
PROTO ((tree
, tree
, int));
166 static tree method_header
PROTO ((int, tree
, tree
, tree
));
167 static void fix_method_argument_names
PROTO ((tree
,tree
));
168 static tree method_declarator
PROTO ((tree
, tree
));
169 static void parse_warning_context
PVPROTO ((tree cl
, const char *msg
, ...))
171 static void issue_warning_error_from_context
PROTO ((tree
, const char *msg
, va_list));
172 static void parse_ctor_invocation_error
PROTO ((void));
173 static tree parse_jdk1_1_error
PROTO ((const char *));
174 static void complete_class_report_errors
PROTO ((jdep
*));
175 static int process_imports
PROTO ((void));
176 static void read_import_dir
PROTO ((tree
));
177 static int find_in_imports_on_demand
PROTO ((tree
));
178 static int find_in_imports
PROTO ((tree
));
179 static int check_pkg_class_access
PROTO ((tree
, tree
));
180 static tree resolve_package
PROTO ((tree
, tree
*));
181 static tree lookup_package_type
PROTO ((const char *, int));
182 static tree lookup_package_type_and_set_next
PROTO ((const char *, int, tree
*));
183 static tree resolve_class
PROTO ((tree
, tree
, tree
));
184 static void declare_local_variables
PROTO ((int, tree
, tree
));
185 static void source_start_java_method
PROTO ((tree
));
186 static void source_end_java_method
PROTO ((void));
187 static void expand_start_java_method
PROTO ((tree
));
188 static tree find_name_in_single_imports
PROTO ((tree
));
189 static void check_abstract_method_header
PROTO ((tree
));
190 static tree lookup_java_interface_method2
PROTO ((tree
, tree
));
191 static tree resolve_expression_name
PROTO ((tree
, tree
*));
192 static tree maybe_create_class_interface_decl
PROTO ((tree
, tree
, tree
));
193 static int check_class_interface_creation
PROTO ((int, int, tree
,
195 static tree patch_method_invocation
PROTO ((tree
, tree
, tree
,
197 static int breakdown_qualified
PROTO ((tree
*, tree
*, tree
));
198 static tree resolve_and_layout
PROTO ((tree
, tree
));
199 static tree resolve_no_layout
PROTO ((tree
, tree
));
200 static int invocation_mode
PROTO ((tree
, int));
201 static tree find_applicable_accessible_methods_list
PROTO ((int, tree
,
203 static void search_applicable_methods_list
PROTO ((int, tree
, tree
, tree
,
205 static tree find_most_specific_methods_list
PROTO ((tree
));
206 static int argument_types_convertible
PROTO ((tree
, tree
));
207 static tree patch_invoke
PROTO ((tree
, tree
, tree
));
208 static tree lookup_method_invoke
PROTO ((int, tree
, tree
, tree
, tree
));
209 static tree register_incomplete_type
PROTO ((int, tree
, tree
, tree
));
210 static tree obtain_incomplete_type
PROTO ((tree
));
211 static tree java_complete_lhs
PROTO ((tree
));
212 static tree java_complete_tree
PROTO ((tree
));
213 static void java_complete_expand_method
PROTO ((tree
));
214 static int unresolved_type_p
PROTO ((tree
, tree
*));
215 static void create_jdep_list
PROTO ((struct parser_ctxt
*));
216 static tree build_expr_block
PROTO ((tree
, tree
));
217 static tree enter_block
PROTO ((void));
218 static tree enter_a_block
PROTO ((tree
));
219 static tree exit_block
PROTO ((void));
220 static tree lookup_name_in_blocks
PROTO ((tree
));
221 static void maybe_absorb_scoping_blocks
PROTO ((void));
222 static tree build_method_invocation
PROTO ((tree
, tree
));
223 static tree build_new_invocation
PROTO ((tree
, tree
));
224 static tree build_assignment
PROTO ((int, int, tree
, tree
));
225 static tree build_binop
PROTO ((enum tree_code
, int, tree
, tree
));
226 static int check_final_assignment
PROTO ((tree
,tree
));
227 static tree patch_assignment
PROTO ((tree
, tree
, tree
));
228 static tree patch_binop
PROTO ((tree
, tree
, tree
));
229 static tree build_unaryop
PROTO ((int, int, tree
));
230 static tree build_incdec
PROTO ((int, int, tree
, int));
231 static tree patch_unaryop
PROTO ((tree
, tree
));
232 static tree build_cast
PROTO ((int, tree
, tree
));
233 static tree build_null_of_type
PROTO ((tree
));
234 static tree patch_cast
PROTO ((tree
, tree
));
235 static int valid_ref_assignconv_cast_p
PROTO ((tree
, tree
, int));
236 static int valid_builtin_assignconv_identity_widening_p
PROTO ((tree
, tree
));
237 static int valid_cast_to_p
PROTO ((tree
, tree
));
238 static int valid_method_invocation_conversion_p
PROTO ((tree
, tree
));
239 static tree try_builtin_assignconv
PROTO ((tree
, tree
, tree
));
240 static tree try_reference_assignconv
PROTO ((tree
, tree
));
241 static tree build_unresolved_array_type
PROTO ((tree
));
242 static tree build_array_from_name
PROTO ((tree
, tree
, tree
, tree
*));
243 static tree build_array_ref
PROTO ((int, tree
, tree
));
244 static tree patch_array_ref
PROTO ((tree
));
245 static tree make_qualified_name
PROTO ((tree
, tree
, int));
246 static tree merge_qualified_name
PROTO ((tree
, tree
));
247 static tree make_qualified_primary
PROTO ((tree
, tree
, int));
248 static int resolve_qualified_expression_name
PROTO ((tree
, tree
*,
250 static void qualify_ambiguous_name
PROTO ((tree
));
251 static void maybe_generate_clinit
PROTO ((void));
252 static tree resolve_field_access
PROTO ((tree
, tree
*, tree
*));
253 static tree build_newarray_node
PROTO ((tree
, tree
, int));
254 static tree patch_newarray
PROTO ((tree
));
255 static tree resolve_type_during_patch
PROTO ((tree
));
256 static tree build_this
PROTO ((int));
257 static tree build_return
PROTO ((int, tree
));
258 static tree patch_return
PROTO ((tree
));
259 static tree maybe_access_field
PROTO ((tree
, tree
, tree
));
260 static int complete_function_arguments
PROTO ((tree
));
261 static int check_for_static_method_reference
PROTO ((tree
, tree
, tree
, tree
, tree
));
262 static int not_accessible_p
PROTO ((tree
, tree
, int));
263 static void check_deprecation
PROTO ((tree
, tree
));
264 static int class_in_current_package
PROTO ((tree
));
265 static tree build_if_else_statement
PROTO ((int, tree
, tree
, tree
));
266 static tree patch_if_else_statement
PROTO ((tree
));
267 static tree add_stmt_to_compound
PROTO ((tree
, tree
, tree
));
268 static tree add_stmt_to_block
PROTO ((tree
, tree
, tree
));
269 static tree patch_exit_expr
PROTO ((tree
));
270 static tree build_labeled_block
PROTO ((int, tree
));
271 static tree finish_labeled_statement
PROTO ((tree
, tree
));
272 static tree build_bc_statement
PROTO ((int, int, tree
));
273 static tree patch_bc_statement
PROTO ((tree
));
274 static tree patch_loop_statement
PROTO ((tree
));
275 static tree build_new_loop
PROTO ((tree
));
276 static tree build_loop_body
PROTO ((int, tree
, int));
277 static tree finish_loop_body
PROTO ((int, tree
, tree
, int));
278 static tree build_debugable_stmt
PROTO ((int, tree
));
279 static tree finish_for_loop
PROTO ((int, tree
, tree
, tree
));
280 static tree patch_switch_statement
PROTO ((tree
));
281 static tree string_constant_concatenation
PROTO ((tree
, tree
));
282 static tree build_string_concatenation
PROTO ((tree
, tree
));
283 static tree patch_string_cst
PROTO ((tree
));
284 static tree patch_string
PROTO ((tree
));
285 static tree build_try_statement
PROTO ((int, tree
, tree
));
286 static tree build_try_finally_statement
PROTO ((int, tree
, tree
));
287 static tree patch_try_statement
PROTO ((tree
));
288 static tree patch_synchronized_statement
PROTO ((tree
, tree
));
289 static tree patch_throw_statement
PROTO ((tree
, tree
));
290 static void check_thrown_exceptions
PROTO ((int, tree
));
291 static int check_thrown_exceptions_do
PROTO ((tree
));
292 static void purge_unchecked_exceptions
PROTO ((tree
));
293 static void check_throws_clauses
PROTO ((tree
, tree
, tree
));
294 static void finish_method_declaration
PROTO ((tree
));
295 static tree build_super_invocation
PROTO ((void));
296 static int verify_constructor_circularity
PROTO ((tree
, tree
));
297 static char *constructor_circularity_msg
PROTO ((tree
, tree
));
298 static tree build_this_super_qualified_invocation
PROTO ((int, tree
, tree
,
300 static const char *get_printable_method_name
PROTO ((tree
));
301 static tree patch_conditional_expr
PROTO ((tree
, tree
, tree
));
302 static void maybe_generate_finit
PROTO ((void));
303 static void fix_constructors
PROTO ((tree
));
304 static int verify_constructor_super
PROTO ((void));
305 static tree create_artificial_method
PROTO ((tree
, int, tree
, tree
, tree
));
306 static void start_artificial_method_body
PROTO ((tree
));
307 static void end_artificial_method_body
PROTO ((tree
));
308 static int check_method_redefinition
PROTO ((tree
, tree
));
309 static int reset_method_name
PROTO ((tree
));
310 static void java_check_regular_methods
PROTO ((tree
));
311 static void java_check_abstract_methods
PROTO ((tree
));
312 static tree maybe_build_primttype_type_ref
PROTO ((tree
, tree
));
313 static void unreachable_stmt_error
PROTO ((tree
));
314 static tree find_expr_with_wfl
PROTO ((tree
));
315 static void missing_return_error
PROTO ((tree
));
316 static tree build_new_array_init
PROTO ((int, tree
));
317 static tree patch_new_array_init
PROTO ((tree
, tree
));
318 static tree maybe_build_array_element_wfl
PROTO ((tree
));
319 static int array_constructor_check_entry
PROTO ((tree
, tree
));
320 static const char *purify_type_name
PROTO ((const char *));
321 static tree fold_constant_for_init
PROTO ((tree
, tree
));
322 static tree strip_out_static_field_access_decl
PROTO ((tree
));
323 static jdeplist
*reverse_jdep_list
PROTO ((struct parser_ctxt
*));
324 static void static_ref_err
PROTO ((tree
, tree
, tree
));
325 static void parser_add_interface
PROTO ((tree
, tree
, tree
));
326 static void add_superinterfaces
PROTO ((tree
, tree
));
327 static tree jdep_resolve_class
PROTO ((jdep
*));
328 static int note_possible_classname
PROTO ((const char *, int));
329 static void java_complete_expand_methods
PROTO ((void));
330 static void java_expand_finals
PROTO ((void));
331 static tree cut_identifier_in_qualified
PROTO ((tree
));
332 static tree java_stabilize_reference
PROTO ((tree
));
333 static tree do_unary_numeric_promotion
PROTO ((tree
));
334 static char * operator_string
PROTO ((tree
));
335 static tree do_merge_string_cste
PROTO ((tree
, const char *, int, int));
336 static tree merge_string_cste
PROTO ((tree
, tree
, int));
337 static tree java_refold
PROTO ((tree
));
338 static int java_decl_equiv
PROTO ((tree
, tree
));
339 static int binop_compound_p
PROTO ((enum tree_code
));
340 static tree search_loop
PROTO ((tree
));
341 static int labeled_block_contains_loop_p
PROTO ((tree
, tree
));
342 static void check_abstract_method_definitions
PROTO ((int, tree
, tree
));
343 static void java_check_abstract_method_definitions
PROTO ((tree
));
345 /* Number of error found so far. */
346 int java_error_count
;
347 /* Number of warning found so far. */
348 int java_warning_count
;
349 /* Tell when not to fold, when doing xrefs */
352 /* The current parser context */
353 struct parser_ctxt
*ctxp
;
355 /* List of things that were analyzed for which code will be generated */
356 static struct parser_ctxt
*ctxp_for_generation
= NULL
;
358 /* binop_lookup maps token to tree_code. It is used where binary
359 operations are involved and required by the parser. RDIV_EXPR
360 covers both integral/floating point division. The code is changed
361 once the type of both operator is worked out. */
363 static enum tree_code binop_lookup
[19] =
365 PLUS_EXPR
, MINUS_EXPR
, MULT_EXPR
, RDIV_EXPR
, TRUNC_MOD_EXPR
,
366 LSHIFT_EXPR
, RSHIFT_EXPR
, URSHIFT_EXPR
,
367 BIT_AND_EXPR
, BIT_XOR_EXPR
, BIT_IOR_EXPR
,
368 TRUTH_ANDIF_EXPR
, TRUTH_ORIF_EXPR
,
369 EQ_EXPR
, NE_EXPR
, GT_EXPR
, GE_EXPR
, LT_EXPR
, LE_EXPR
,
371 #define BINOP_LOOKUP(VALUE) \
372 binop_lookup [((VALUE) - PLUS_TK)% \
373 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
375 /* This is the end index for binary operators that can also be used
376 in compound assignements. */
377 #define BINOP_COMPOUND_CANDIDATES 11
379 /* Fake WFL used to report error message. It is initialized once if
380 needed and reused with it's location information is overriden. */
381 tree wfl_operator
= NULL_TREE
;
383 /* The "$L" identifier we use to create labels. */
384 static tree label_id
= NULL_TREE
;
386 /* The "StringBuffer" identifier used for the String `+' operator. */
387 static tree wfl_string_buffer
= NULL_TREE
;
389 /* The "append" identifier used for String `+' operator. */
390 static tree wfl_append
= NULL_TREE
;
392 /* The "toString" identifier used for String `+' operator. */
393 static tree wfl_to_string
= NULL_TREE
;
395 /* The "java.lang" import qualified name. */
396 static tree java_lang_id
= NULL_TREE
;
398 /* The "java.lang.Cloneable" qualified name. */
399 static tree java_lang_cloneable
= NULL_TREE
;
401 /* Context and flag for static blocks */
402 static tree current_static_block
= NULL_TREE
;
405 #line 330 "./parse.y"
415 #line 340 "./parse.y"
433 #define YYFLAG -32768
436 #define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 266)
438 static const char yytranslate
[] = { 0,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
465 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
466 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
467 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
468 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
469 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
470 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
471 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
472 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
473 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
474 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
479 static const short yyprhs
[] = { 0,
480 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
481 20, 22, 24, 26, 28, 30, 32, 34, 38, 42,
482 46, 50, 54, 56, 58, 60, 64, 66, 67, 69,
483 71, 73, 76, 79, 82, 86, 88, 91, 93, 96,
484 100, 103, 107, 109, 111, 115, 118, 122, 128, 133,
485 139, 141, 143, 145, 147, 149, 152, 153, 161, 162,
486 169, 173, 176, 180, 185, 186, 189, 193, 196, 197,
487 200, 203, 205, 209, 213, 216, 220, 222, 225, 227,
488 229, 231, 233, 235, 238, 240, 242, 244, 248, 253,
489 255, 259, 263, 265, 269, 273, 278, 280, 284, 287,
490 291, 295, 297, 299, 300, 304, 307, 311, 315, 320,
491 325, 328, 332, 335, 339, 342, 346, 351, 355, 359,
492 363, 365, 369, 373, 376, 380, 383, 387, 388, 391,
493 394, 396, 400, 404, 406, 409, 411, 414, 418, 420,
494 421, 425, 428, 432, 436, 441, 444, 448, 452, 457,
495 459, 462, 467, 473, 481, 488, 490, 492, 493, 498,
496 499, 505, 506, 512, 513, 520, 524, 529, 532, 536,
497 539, 543, 546, 550, 552, 555, 557, 559, 561, 563,
498 565, 568, 571, 574, 578, 583, 585, 589, 593, 596,
499 600, 602, 604, 606, 609, 611, 613, 615, 618, 621,
500 625, 627, 629, 631, 633, 635, 637, 639, 641, 643,
501 645, 647, 649, 651, 653, 655, 657, 659, 661, 663,
502 665, 667, 669, 671, 674, 677, 680, 683, 686, 689,
503 692, 695, 699, 704, 709, 715, 720, 726, 733, 741,
504 748, 750, 752, 754, 756, 758, 760, 762, 768, 771,
505 775, 780, 788, 796, 797, 801, 806, 809, 813, 819,
506 822, 826, 830, 835, 837, 840, 843, 845, 848, 852,
507 855, 858, 862, 865, 870, 873, 876, 880, 885, 888,
508 890, 898, 906, 913, 917, 923, 928, 936, 943, 946,
509 949, 953, 956, 957, 959, 961, 964, 965, 967, 969,
510 973, 977, 980, 984, 987, 991, 994, 998, 1001, 1005,
511 1008, 1012, 1015, 1019, 1023, 1026, 1030, 1036, 1042, 1045,
512 1050, 1054, 1056, 1060, 1064, 1069, 1072, 1074, 1077, 1080,
513 1085, 1088, 1092, 1097, 1100, 1103, 1105, 1107, 1109, 1111,
514 1115, 1117, 1119, 1121, 1123, 1127, 1131, 1135, 1139, 1143,
515 1147, 1151, 1155, 1161, 1166, 1173, 1179, 1184, 1190, 1196,
516 1203, 1207, 1211, 1216, 1222, 1225, 1229, 1233, 1237, 1239,
517 1243, 1247, 1251, 1255, 1260, 1265, 1270, 1275, 1279, 1283,
518 1285, 1288, 1292, 1296, 1299, 1302, 1306, 1310, 1314, 1318,
519 1321, 1325, 1330, 1336, 1343, 1349, 1356, 1361, 1366, 1371,
520 1376, 1380, 1385, 1389, 1394, 1396, 1398, 1400, 1402, 1405,
521 1408, 1410, 1412, 1415, 1418, 1420, 1423, 1426, 1429, 1432,
522 1435, 1438, 1440, 1443, 1446, 1448, 1451, 1454, 1460, 1465,
523 1470, 1476, 1481, 1484, 1490, 1495, 1501, 1503, 1507, 1511,
524 1515, 1519, 1523, 1527, 1529, 1533, 1537, 1541, 1545, 1547,
525 1551, 1555, 1559, 1563, 1567, 1571, 1573, 1577, 1581, 1585,
526 1589, 1593, 1597, 1601, 1605, 1609, 1613, 1615, 1619, 1623,
527 1627, 1631, 1633, 1637, 1641, 1643, 1647, 1651, 1653, 1657,
528 1661, 1663, 1667, 1671, 1673, 1677, 1681, 1683, 1689, 1694,
529 1698, 1704, 1706, 1708, 1712, 1716, 1718, 1720, 1722, 1724,
533 static const short yyrhs
[] = { 123,
534 0, 104, 0, 105, 0, 108, 0, 103, 0, 102,
535 0, 109, 0, 113, 0, 114, 0, 82, 0, 85,
536 0, 50, 0, 115, 0, 118, 0, 119, 0, 115,
537 0, 115, 0, 113, 97, 98, 0, 119, 97, 98,
538 0, 118, 97, 98, 0, 113, 97, 1, 0, 118,
539 97, 1, 0, 120, 0, 121, 0, 122, 0, 119,
540 101, 122, 0, 86, 0, 0, 126, 0, 124, 0,
541 125, 0, 126, 124, 0, 126, 125, 0, 124, 125,
542 0, 126, 124, 125, 0, 127, 0, 124, 127, 0,
543 130, 0, 125, 130, 0, 75, 119, 99, 0, 75,
544 1, 0, 75, 119, 1, 0, 128, 0, 129, 0,
545 55, 119, 99, 0, 55, 1, 0, 55, 119, 1,
546 0, 55, 119, 101, 5, 99, 0, 55, 119, 101,
547 1, 0, 55, 119, 101, 5, 1, 0, 132, 0,
548 166, 0, 99, 0, 1, 0, 44, 0, 131, 44,
549 0, 0, 131, 67, 122, 135, 136, 133, 138, 0,
550 0, 67, 122, 135, 136, 134, 138, 0, 131, 67,
551 1, 0, 67, 1, 0, 67, 122, 1, 0, 131,
552 67, 122, 1, 0, 0, 63, 116, 0, 63, 116,
553 1, 0, 63, 1, 0, 0, 52, 137, 0, 52,
554 1, 0, 117, 0, 137, 100, 117, 0, 137, 100,
555 1, 0, 95, 96, 0, 95, 139, 96, 0, 140,
556 0, 139, 140, 0, 141, 0, 156, 0, 158, 0,
557 179, 0, 142, 0, 142, 99, 0, 147, 0, 132,
558 0, 166, 0, 112, 143, 99, 0, 131, 112, 143,
559 99, 0, 144, 0, 143, 100, 144, 0, 143, 100,
560 1, 0, 145, 0, 145, 92, 146, 0, 145, 92,
561 1, 0, 145, 92, 146, 1, 0, 122, 0, 145,
562 97, 98, 0, 122, 1, 0, 145, 97, 1, 0,
563 145, 98, 1, 0, 264, 0, 177, 0, 0, 149,
564 148, 155, 0, 149, 1, 0, 112, 150, 153, 0,
565 59, 150, 153, 0, 131, 112, 150, 153, 0, 131,
566 59, 150, 153, 0, 112, 1, 0, 131, 112, 1,
567 0, 59, 1, 0, 131, 59, 1, 0, 131, 1,
568 0, 122, 93, 94, 0, 122, 93, 151, 94, 0,
569 150, 97, 98, 0, 122, 93, 1, 0, 150, 97,
570 1, 0, 152, 0, 151, 100, 152, 0, 151, 100,
571 1, 0, 112, 145, 0, 131, 112, 145, 0, 112,
572 1, 0, 131, 112, 1, 0, 0, 53, 154, 0,
573 53, 1, 0, 116, 0, 154, 100, 116, 0, 154,
574 100, 1, 0, 179, 0, 179, 99, 0, 99, 0,
575 157, 179, 0, 157, 179, 99, 0, 44, 0, 0,
576 160, 159, 162, 0, 161, 153, 0, 131, 161, 153,
577 0, 120, 93, 94, 0, 120, 93, 151, 94, 0,
578 180, 163, 0, 180, 164, 163, 0, 180, 182, 163,
579 0, 180, 164, 182, 163, 0, 181, 0, 181, 99,
580 0, 165, 93, 94, 99, 0, 165, 93, 233, 94,
581 99, 0, 119, 101, 65, 93, 233, 94, 99, 0,
582 119, 101, 65, 93, 94, 99, 0, 76, 0, 65,
583 0, 0, 61, 122, 167, 172, 0, 0, 131, 61,
584 122, 168, 172, 0, 0, 61, 122, 171, 169, 172,
585 0, 0, 131, 61, 122, 171, 170, 172, 0, 61,
586 122, 1, 0, 131, 61, 122, 1, 0, 63, 117,
587 0, 171, 100, 117, 0, 63, 1, 0, 171, 100,
588 1, 0, 95, 96, 0, 95, 173, 96, 0, 174,
589 0, 173, 174, 0, 175, 0, 176, 0, 132, 0,
590 166, 0, 142, 0, 149, 99, 0, 149, 1, 0,
591 95, 96, 0, 95, 178, 96, 0, 95, 178, 100,
592 96, 0, 146, 0, 178, 100, 146, 0, 178, 100,
593 1, 0, 95, 96, 0, 180, 182, 181, 0, 95,
594 0, 96, 0, 183, 0, 182, 183, 0, 184, 0,
595 186, 0, 132, 0, 185, 99, 0, 112, 143, 0,
596 131, 112, 143, 0, 188, 0, 191, 0, 195, 0,
597 196, 0, 207, 0, 211, 0, 188, 0, 192, 0,
598 197, 0, 208, 0, 212, 0, 179, 0, 189, 0,
599 193, 0, 198, 0, 210, 0, 218, 0, 219, 0,
600 220, 0, 222, 0, 221, 0, 224, 0, 99, 0,
601 122, 88, 0, 190, 186, 0, 122, 1, 0, 190,
602 187, 0, 194, 99, 0, 1, 99, 0, 1, 95,
603 0, 1, 96, 0, 165, 93, 1, 0, 165, 93,
604 94, 1, 0, 165, 93, 233, 1, 0, 165, 93,
605 233, 94, 1, 0, 119, 101, 65, 1, 0, 119,
606 101, 65, 93, 1, 0, 119, 101, 65, 93, 233,
607 1, 0, 119, 101, 65, 93, 233, 94, 1, 0,
608 119, 101, 65, 93, 94, 1, 0, 261, 0, 245,
609 0, 246, 0, 242, 0, 243, 0, 239, 0, 231,
610 0, 48, 93, 264, 94, 186, 0, 48, 1, 0,
611 48, 93, 1, 0, 48, 93, 264, 1, 0, 48,
612 93, 264, 94, 187, 56, 186, 0, 48, 93, 264,
613 94, 187, 56, 187, 0, 0, 200, 199, 201, 0,
614 68, 93, 264, 94, 0, 68, 1, 0, 68, 93,
615 1, 0, 68, 93, 264, 94, 1, 0, 95, 96,
616 0, 95, 204, 96, 0, 95, 202, 96, 0, 95,
617 202, 204, 96, 0, 203, 0, 202, 203, 0, 204,
618 182, 0, 205, 0, 204, 205, 0, 62, 265, 88,
619 0, 47, 88, 0, 62, 1, 0, 62, 265, 1,
620 0, 47, 1, 0, 66, 93, 264, 94, 0, 206,
621 186, 0, 66, 1, 0, 66, 93, 1, 0, 66,
622 93, 264, 1, 0, 206, 187, 0, 51, 0, 209,
623 186, 66, 93, 264, 94, 99, 0, 214, 99, 264,
624 99, 216, 94, 186, 0, 214, 99, 99, 216, 94,
625 186, 0, 214, 99, 1, 0, 214, 99, 264, 99,
626 1, 0, 214, 99, 99, 1, 0, 214, 99, 264,
627 99, 216, 94, 187, 0, 214, 99, 99, 216, 94,
628 187, 0, 71, 93, 0, 71, 1, 0, 71, 93,
629 1, 0, 213, 215, 0, 0, 217, 0, 185, 0,
630 217, 1, 0, 0, 217, 0, 194, 0, 217, 100,
631 194, 0, 217, 100, 1, 0, 54, 99, 0, 54,
632 122, 99, 0, 54, 1, 0, 54, 122, 1, 0,
633 73, 99, 0, 73, 122, 99, 0, 73, 1, 0,
634 73, 122, 1, 0, 58, 99, 0, 58, 264, 99,
635 0, 58, 1, 0, 58, 264, 1, 0, 49, 264,
636 99, 0, 49, 1, 0, 49, 264, 1, 0, 223,
637 93, 264, 94, 179, 0, 223, 93, 264, 94, 1,
638 0, 223, 1, 0, 223, 93, 1, 94, 0, 223,
639 93, 1, 0, 131, 0, 70, 179, 225, 0, 70,
640 179, 228, 0, 70, 179, 225, 228, 0, 70, 1,
641 0, 226, 0, 225, 226, 0, 227, 179, 0, 60,
642 93, 152, 94, 0, 60, 1, 0, 60, 93, 1,
643 0, 60, 93, 1, 94, 0, 64, 179, 0, 64,
644 1, 0, 230, 0, 234, 0, 111, 0, 76, 0,
645 93, 264, 94, 0, 231, 0, 238, 0, 239, 0,
646 240, 0, 119, 101, 67, 0, 113, 101, 67, 0,
647 59, 101, 67, 0, 119, 101, 76, 0, 93, 264,
648 1, 0, 119, 101, 1, 0, 113, 101, 1, 0,
649 59, 101, 1, 0, 72, 116, 93, 233, 94, 0,
650 72, 116, 93, 94, 0, 72, 116, 93, 233, 94,
651 138, 0, 72, 116, 93, 94, 138, 0, 232, 122,
652 93, 94, 0, 232, 122, 93, 94, 138, 0, 232,
653 122, 93, 233, 94, 0, 232, 122, 93, 233, 94,
654 138, 0, 72, 1, 99, 0, 72, 116, 1, 0,
655 72, 116, 93, 1, 0, 72, 116, 93, 233, 1,
656 0, 232, 1, 0, 232, 122, 1, 0, 119, 101,
657 72, 0, 229, 101, 72, 0, 264, 0, 233, 100,
658 264, 0, 233, 100, 1, 0, 72, 113, 235, 0,
659 72, 115, 235, 0, 72, 113, 235, 237, 0, 72,
660 115, 235, 237, 0, 72, 115, 237, 177, 0, 72,
661 113, 237, 177, 0, 72, 1, 98, 0, 72, 1,
662 97, 0, 236, 0, 235, 236, 0, 97, 264, 98,
663 0, 97, 264, 1, 0, 97, 1, 0, 97, 98,
664 0, 237, 97, 98, 0, 237, 97, 1, 0, 229,
665 101, 122, 0, 65, 101, 122, 0, 65, 1, 0,
666 119, 93, 94, 0, 119, 93, 233, 94, 0, 229,
667 101, 122, 93, 94, 0, 229, 101, 122, 93, 233,
668 94, 0, 65, 101, 122, 93, 94, 0, 65, 101,
669 122, 93, 233, 94, 0, 65, 101, 1, 94, 0,
670 65, 101, 1, 101, 0, 119, 97, 264, 98, 0,
671 230, 97, 264, 98, 0, 119, 97, 1, 0, 119,
672 97, 264, 1, 0, 230, 97, 1, 0, 230, 97,
673 264, 1, 0, 229, 0, 119, 0, 242, 0, 243,
674 0, 241, 46, 0, 241, 45, 0, 245, 0, 246,
675 0, 3, 244, 0, 4, 244, 0, 247, 0, 3,
676 1, 0, 4, 1, 0, 46, 244, 0, 46, 1,
677 0, 45, 244, 0, 45, 1, 0, 241, 0, 89,
678 244, 0, 90, 244, 0, 248, 0, 89, 1, 0,
679 90, 1, 0, 93, 113, 237, 94, 244, 0, 93,
680 113, 94, 244, 0, 93, 264, 94, 247, 0, 93,
681 119, 237, 94, 247, 0, 93, 113, 97, 1, 0,
682 93, 1, 0, 93, 113, 237, 94, 1, 0, 93,
683 113, 94, 1, 0, 93, 119, 237, 94, 1, 0,
684 244, 0, 249, 5, 244, 0, 249, 6, 244, 0,
685 249, 7, 244, 0, 249, 5, 1, 0, 249, 6,
686 1, 0, 249, 7, 1, 0, 249, 0, 250, 3,
687 249, 0, 250, 4, 249, 0, 250, 3, 1, 0,
688 250, 4, 1, 0, 250, 0, 251, 8, 250, 0,
689 251, 9, 250, 0, 251, 10, 250, 0, 251, 8,
690 1, 0, 251, 9, 1, 0, 251, 10, 1, 0,
691 251, 0, 252, 20, 251, 0, 252, 18, 251, 0,
692 252, 21, 251, 0, 252, 19, 251, 0, 252, 57,
693 114, 0, 252, 20, 1, 0, 252, 18, 1, 0,
694 252, 21, 1, 0, 252, 19, 1, 0, 252, 57,
695 1, 0, 252, 0, 253, 16, 252, 0, 253, 17,
696 252, 0, 253, 16, 1, 0, 253, 17, 1, 0,
697 253, 0, 254, 11, 253, 0, 254, 11, 1, 0,
698 254, 0, 255, 12, 254, 0, 255, 12, 1, 0,
699 255, 0, 256, 13, 255, 0, 256, 13, 1, 0,
700 256, 0, 257, 14, 256, 0, 257, 14, 1, 0,
701 257, 0, 258, 15, 257, 0, 258, 15, 1, 0,
702 258, 0, 258, 87, 264, 88, 259, 0, 258, 87,
703 88, 1, 0, 258, 87, 1, 0, 258, 87, 264,
704 88, 1, 0, 259, 0, 261, 0, 262, 263, 260,
705 0, 262, 263, 1, 0, 119, 0, 238, 0, 240,
706 0, 91, 0, 92, 0, 260, 0, 264, 0
712 static const short yyrline
[] = { 0,
713 484, 490, 492, 493, 494, 495, 496, 500, 502, 505,
714 507, 508, 511, 513, 516, 520, 524, 528, 534, 536,
715 538, 540, 545, 547, 550, 554, 559, 564, 566, 567,
716 568, 569, 570, 571, 572, 575, 580, 586, 588, 591,
717 594, 596, 600, 602, 605, 632, 634, 638, 651, 653,
718 657, 664, 669, 671, 681, 686, 701, 705, 708, 711,
719 714, 716, 718, 723, 727, 729, 731, 733, 737, 739,
720 741, 748, 754, 759, 763, 772, 782, 784, 787, 789,
721 790, 791, 795, 797, 799, 800, 802, 807, 810, 820,
722 823, 825, 829, 832, 839, 845, 853, 855, 857, 859,
723 861, 865, 867, 871, 878, 879, 883, 886, 888, 890,
724 892, 897, 899, 901, 903, 910, 913, 915, 924, 926,
725 930, 935, 940, 944, 949, 954, 956, 963, 965, 967,
726 971, 974, 976, 980, 982, 983, 988, 994, 1001, 1009,
727 1016, 1019, 1022, 1026, 1029, 1033, 1042, 1044, 1046, 1050,
728 1052, 1055, 1062, 1070, 1072, 1076, 1083, 1093, 1097, 1100,
729 1103, 1106, 1109, 1112, 1115, 1118, 1120, 1124, 1130, 1135,
730 1137, 1141, 1144, 1148, 1150, 1153, 1155, 1156, 1158, 1162,
731 1166, 1172, 1177, 1180, 1182, 1186, 1192, 1196, 1201, 1210,
732 1214, 1219, 1231, 1233, 1236, 1238, 1240, 1244, 1248, 1251,
733 1255, 1257, 1258, 1259, 1260, 1261, 1265, 1267, 1268, 1269,
734 1270, 1274, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283,
735 1284, 1285, 1288, 1293, 1304, 1307, 1311, 1318, 1328, 1334,
736 1340, 1346, 1348, 1353, 1355, 1360, 1362, 1364, 1366, 1368,
737 1372, 1374, 1375, 1376, 1377, 1378, 1379, 1382, 1388, 1390,
738 1392, 1396, 1401, 1406, 1412, 1422, 1428, 1430, 1432, 1439,
739 1442, 1444, 1446, 1450, 1452, 1455, 1459, 1461, 1464, 1471,
740 1477, 1479, 1481, 1485, 1493, 1496, 1498, 1500, 1504, 1509,
741 1518, 1523, 1526, 1533, 1535, 1537, 1541, 1544, 1553, 1560,
742 1562, 1566, 1579, 1581, 1587, 1593, 1597, 1599, 1603, 1606,
743 1608, 1612, 1615, 1617, 1619, 1623, 1626, 1628, 1630, 1634,
744 1637, 1639, 1641, 1645, 1651, 1653, 1657, 1664, 1666, 1668,
745 1670, 1674, 1686, 1689, 1691, 1696, 1700, 1702, 1709, 1717,
746 1734, 1736, 1741, 1745, 1748, 1753, 1755, 1758, 1760, 1762,
747 1764, 1765, 1766, 1767, 1771, 1773, 1775, 1780, 1782, 1784,
748 1786, 1788, 1792, 1795, 1800, 1802, 1807, 1808, 1809, 1810,
749 1811, 1813, 1815, 1817, 1819, 1821, 1825, 1827, 1830, 1836,
750 1841, 1845, 1848, 1850, 1852, 1856, 1858, 1860, 1862, 1866,
751 1869, 1873, 1879, 1881, 1889, 1916, 1918, 1922, 1927, 1934,
752 1938, 1941, 1943, 1954, 1965, 1970, 1979, 1981, 1985, 1988,
753 1990, 1995, 2000, 2005, 2012, 2014, 2015, 2016, 2019, 2024,
754 2029, 2031, 2032, 2034, 2036, 2037, 2039, 2043, 2046, 2050,
755 2053, 2057, 2059, 2061, 2063, 2064, 2066, 2070, 2079, 2081,
756 2083, 2096, 2098, 2104, 2106, 2108, 2112, 2114, 2119, 2124,
757 2129, 2131, 2133, 2137, 2139, 2144, 2149, 2151, 2155, 2157,
758 2162, 2167, 2172, 2174, 2176, 2180, 2182, 2187, 2192, 2197,
759 2202, 2204, 2206, 2208, 2210, 2212, 2216, 2218, 2223, 2228,
760 2230, 2234, 2236, 2241, 2245, 2247, 2252, 2256, 2258, 2263,
761 2267, 2269, 2274, 2278, 2280, 2285, 2289, 2291, 2296, 2302,
762 2304, 2308, 2310, 2313, 2316, 2324, 2326, 2327, 2330, 2332,
768 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
770 static const char * const yytname
[] = { "$","error","$undefined.","PLUS_TK",
771 "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
772 "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
773 "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
774 "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
775 "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
776 "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
777 "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
778 "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
779 "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
780 "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
781 "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
782 "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
783 "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
784 "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
785 "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
786 "goal","literal","type","primitive_type","reference_type","class_or_interface_type",
787 "class_type","interface_type","array_type","name","simple_name","qualified_name",
788 "identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
789 "import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
790 "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
791 "interface_type_list","class_body","class_body_declarations","class_body_declaration",
792 "class_member_declaration","field_declaration","variable_declarators","variable_declarator",
793 "variable_declarator_id","variable_initializer","method_declaration","@3","method_header",
794 "method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list",
795 "method_body","static_initializer","static","constructor_declaration","@4","constructor_header",
796 "constructor_declarator","constructor_body","constructor_block_end","explicit_constructor_invocation",
797 "this_or_super","interface_declaration","@5","@6","@7","@8","extends_interfaces",
798 "interface_body","interface_member_declarations","interface_member_declaration",
799 "constant_declaration","abstract_method_declaration","array_initializer","variable_initializers",
800 "block","block_begin","block_end","block_statements","block_statement","local_variable_declaration_statement",
801 "local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement",
802 "empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
803 "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
804 "switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups",
805 "switch_block_statement_group","switch_labels","switch_label","while_expression",
806 "while_statement","while_statement_nsi","do_statement_begin","do_statement",
807 "for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update",
808 "statement_expression_list","break_statement","continue_statement","return_statement",
809 "throw_statement","synchronized_statement","synchronized","try_statement","catches",
810 "catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array",
811 "class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression",
812 "dim_exprs","dim_expr","dims","field_access","method_invocation","array_access",
813 "postfix_expression","post_increment_expression","post_decrement_expression",
814 "unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus",
815 "cast_expression","multiplicative_expression","additive_expression","shift_expression",
816 "relational_expression","equality_expression","and_expression","exclusive_or_expression",
817 "inclusive_or_expression","conditional_and_expression","conditional_or_expression",
818 "conditional_expression","assignment_expression","assignment","left_hand_side",
819 "assignment_operator","expression","constant_expression", NULL
823 static const short yyr1
[] = { 0,
824 110, 111, 111, 111, 111, 111, 111, 112, 112, 113,
825 113, 113, 114, 114, 115, 116, 117, 118, 118, 118,
826 118, 118, 119, 119, 120, 121, 122, 123, 123, 123,
827 123, 123, 123, 123, 123, 124, 124, 125, 125, 126,
828 126, 126, 127, 127, 128, 128, 128, 129, 129, 129,
829 130, 130, 130, 130, 131, 131, 133, 132, 134, 132,
830 132, 132, 132, 132, 135, 135, 135, 135, 136, 136,
831 136, 137, 137, 137, 138, 138, 139, 139, 140, 140,
832 140, 140, 141, 141, 141, 141, 141, 142, 142, 143,
833 143, 143, 144, 144, 144, 144, 145, 145, 145, 145,
834 145, 146, 146, 148, 147, 147, 149, 149, 149, 149,
835 149, 149, 149, 149, 149, 150, 150, 150, 150, 150,
836 151, 151, 151, 152, 152, 152, 152, 153, 153, 153,
837 154, 154, 154, 155, 155, 155, 156, 156, 157, 159,
838 158, 160, 160, 161, 161, 162, 162, 162, 162, 163,
839 163, 164, 164, 164, 164, 165, 165, 167, 166, 168,
840 166, 169, 166, 170, 166, 166, 166, 171, 171, 171,
841 171, 172, 172, 173, 173, 174, 174, 174, 174, 175,
842 176, 176, 177, 177, 177, 178, 178, 178, 179, 179,
843 180, 181, 182, 182, 183, 183, 183, 184, 185, 185,
844 186, 186, 186, 186, 186, 186, 187, 187, 187, 187,
845 187, 188, 188, 188, 188, 188, 188, 188, 188, 188,
846 188, 188, 189, 190, 191, 191, 192, 193, 193, 193,
847 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
848 194, 194, 194, 194, 194, 194, 194, 195, 195, 195,
849 195, 196, 197, 199, 198, 200, 200, 200, 200, 201,
850 201, 201, 201, 202, 202, 203, 204, 204, 205, 205,
851 205, 205, 205, 206, 207, 207, 207, 207, 208, 209,
852 210, 211, 211, 211, 211, 211, 212, 212, 213, 213,
853 213, 214, 215, 215, 215, 215, 216, 216, 217, 217,
854 217, 218, 218, 218, 218, 219, 219, 219, 219, 220,
855 220, 220, 220, 221, 221, 221, 222, 222, 222, 222,
856 222, 223, 224, 224, 224, 224, 225, 225, 226, 227,
857 227, 227, 227, 228, 228, 229, 229, 230, 230, 230,
858 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
859 230, 230, 231, 231, 231, 231, 231, 231, 231, 231,
860 231, 231, 231, 231, 231, 231, 232, 232, 233, 233,
861 233, 234, 234, 234, 234, 234, 234, 234, 234, 235,
862 235, 236, 236, 236, 237, 237, 237, 238, 238, 238,
863 239, 239, 239, 239, 239, 239, 239, 239, 240, 240,
864 240, 240, 240, 240, 241, 241, 241, 241, 242, 243,
865 244, 244, 244, 244, 244, 244, 244, 245, 245, 246,
866 246, 247, 247, 247, 247, 247, 247, 248, 248, 248,
867 248, 248, 248, 248, 248, 248, 249, 249, 249, 249,
868 249, 249, 249, 250, 250, 250, 250, 250, 251, 251,
869 251, 251, 251, 251, 251, 252, 252, 252, 252, 252,
870 252, 252, 252, 252, 252, 252, 253, 253, 253, 253,
871 253, 254, 254, 254, 255, 255, 255, 256, 256, 256,
872 257, 257, 257, 258, 258, 258, 259, 259, 259, 259,
873 259, 260, 260, 261, 261, 262, 262, 262, 263, 263,
877 static const short yyr2
[] = { 0,
878 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
879 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
880 3, 3, 1, 1, 1, 3, 1, 0, 1, 1,
881 1, 2, 2, 2, 3, 1, 2, 1, 2, 3,
882 2, 3, 1, 1, 3, 2, 3, 5, 4, 5,
883 1, 1, 1, 1, 1, 2, 0, 7, 0, 6,
884 3, 2, 3, 4, 0, 2, 3, 2, 0, 2,
885 2, 1, 3, 3, 2, 3, 1, 2, 1, 1,
886 1, 1, 1, 2, 1, 1, 1, 3, 4, 1,
887 3, 3, 1, 3, 3, 4, 1, 3, 2, 3,
888 3, 1, 1, 0, 3, 2, 3, 3, 4, 4,
889 2, 3, 2, 3, 2, 3, 4, 3, 3, 3,
890 1, 3, 3, 2, 3, 2, 3, 0, 2, 2,
891 1, 3, 3, 1, 2, 1, 2, 3, 1, 0,
892 3, 2, 3, 3, 4, 2, 3, 3, 4, 1,
893 2, 4, 5, 7, 6, 1, 1, 0, 4, 0,
894 5, 0, 5, 0, 6, 3, 4, 2, 3, 2,
895 3, 2, 3, 1, 2, 1, 1, 1, 1, 1,
896 2, 2, 2, 3, 4, 1, 3, 3, 2, 3,
897 1, 1, 1, 2, 1, 1, 1, 2, 2, 3,
898 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
899 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
900 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
901 2, 3, 4, 4, 5, 4, 5, 6, 7, 6,
902 1, 1, 1, 1, 1, 1, 1, 5, 2, 3,
903 4, 7, 7, 0, 3, 4, 2, 3, 5, 2,
904 3, 3, 4, 1, 2, 2, 1, 2, 3, 2,
905 2, 3, 2, 4, 2, 2, 3, 4, 2, 1,
906 7, 7, 6, 3, 5, 4, 7, 6, 2, 2,
907 3, 2, 0, 1, 1, 2, 0, 1, 1, 3,
908 3, 2, 3, 2, 3, 2, 3, 2, 3, 2,
909 3, 2, 3, 3, 2, 3, 5, 5, 2, 4,
910 3, 1, 3, 3, 4, 2, 1, 2, 2, 4,
911 2, 3, 4, 2, 2, 1, 1, 1, 1, 3,
912 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
913 3, 3, 5, 4, 6, 5, 4, 5, 5, 6,
914 3, 3, 4, 5, 2, 3, 3, 3, 1, 3,
915 3, 3, 3, 4, 4, 4, 4, 3, 3, 1,
916 2, 3, 3, 2, 2, 3, 3, 3, 3, 2,
917 3, 4, 5, 6, 5, 6, 4, 4, 4, 4,
918 3, 4, 3, 4, 1, 1, 1, 1, 2, 2,
919 1, 1, 2, 2, 1, 2, 2, 2, 2, 2,
920 2, 1, 2, 2, 1, 2, 2, 5, 4, 4,
921 5, 4, 2, 5, 4, 5, 1, 3, 3, 3,
922 3, 3, 3, 1, 3, 3, 3, 3, 1, 3,
923 3, 3, 3, 3, 3, 1, 3, 3, 3, 3,
924 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
925 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
926 1, 3, 3, 1, 3, 3, 1, 5, 4, 3,
927 5, 1, 1, 3, 3, 1, 1, 1, 1, 1,
931 static const short yydefact
[] = { 0,
932 54, 55, 0, 0, 0, 0, 53, 1, 0, 0,
933 0, 36, 43, 44, 38, 0, 51, 52, 46, 27,
934 0, 23, 24, 25, 0, 62, 0, 41, 0, 0,
935 37, 39, 0, 0, 56, 0, 0, 47, 45, 0,
936 166, 0, 0, 162, 63, 0, 69, 42, 40, 0,
937 0, 0, 61, 0, 49, 0, 26, 170, 17, 168,
938 15, 0, 159, 0, 0, 68, 16, 0, 0, 59,
939 167, 0, 164, 64, 69, 50, 48, 12, 0, 10,
940 11, 172, 0, 8, 9, 13, 14, 15, 0, 178,
941 180, 0, 179, 0, 174, 176, 177, 171, 169, 163,
942 67, 71, 72, 70, 0, 161, 0, 57, 113, 0,
943 128, 111, 0, 0, 90, 93, 128, 0, 0, 0,
944 115, 0, 0, 182, 181, 173, 175, 0, 0, 60,
945 165, 0, 0, 0, 0, 108, 99, 88, 0, 0,
946 0, 0, 107, 21, 18, 22, 20, 19, 114, 128,
947 112, 0, 128, 74, 73, 55, 191, 75, 23, 0,
948 86, 0, 77, 79, 83, 85, 0, 80, 0, 81,
949 140, 128, 87, 82, 0, 58, 119, 116, 0, 0,
950 0, 121, 130, 131, 129, 120, 118, 92, 0, 91,
951 95, 0, 0, 0, 0, 0, 0, 0, 339, 0,
952 0, 0, 0, 6, 5, 2, 3, 4, 7, 338,
953 0, 406, 0, 103, 405, 336, 341, 0, 337, 342,
954 343, 344, 422, 407, 408, 437, 411, 412, 415, 425,
955 444, 449, 456, 467, 472, 475, 478, 481, 484, 487,
956 492, 501, 493, 0, 102, 100, 98, 101, 110, 89,
957 109, 189, 0, 128, 76, 78, 84, 106, 0, 137,
958 0, 142, 0, 0, 0, 280, 0, 0, 0, 0,
959 0, 0, 0, 0, 339, 0, 223, 0, 8, 406,
960 0, 322, 197, 0, 212, 0, 193, 195, 0, 196,
961 201, 213, 0, 202, 214, 0, 203, 204, 215, 254,
962 0, 205, 0, 216, 206, 293, 0, 217, 218, 219,
963 221, 220, 0, 222, 247, 246, 0, 244, 245, 242,
964 243, 241, 126, 124, 0, 117, 0, 0, 416, 406,
965 342, 344, 413, 417, 414, 421, 420, 419, 418, 0,
966 390, 0, 0, 0, 16, 0, 426, 423, 427, 424,
967 433, 0, 406, 0, 183, 186, 0, 0, 0, 0,
968 0, 96, 0, 0, 365, 0, 410, 409, 0, 0,
969 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
970 0, 0, 0, 0, 0, 0, 0, 0, 0, 499,
971 500, 0, 144, 0, 143, 136, 105, 134, 138, 191,
972 141, 0, 230, 231, 229, 249, 0, 315, 0, 304,
973 302, 0, 312, 310, 0, 276, 0, 257, 0, 326,
974 0, 290, 0, 308, 306, 0, 0, 199, 0, 0,
975 226, 224, 0, 0, 192, 190, 194, 198, 406, 322,
976 225, 228, 0, 275, 0, 406, 0, 295, 299, 292,
977 0, 0, 319, 0, 127, 125, 123, 122, 133, 132,
978 352, 347, 0, 389, 379, 378, 361, 0, 372, 380,
979 0, 373, 0, 362, 0, 0, 0, 0, 0, 0,
980 349, 340, 184, 0, 351, 346, 391, 0, 369, 401,
981 0, 350, 345, 367, 348, 368, 388, 403, 0, 366,
982 0, 441, 438, 442, 439, 443, 440, 447, 445, 448,
983 446, 453, 450, 454, 451, 455, 452, 463, 458, 465,
984 460, 462, 457, 464, 459, 466, 0, 461, 470, 468,
985 471, 469, 474, 473, 477, 476, 480, 479, 483, 482,
986 486, 485, 490, 0, 0, 495, 494, 145, 135, 406,
987 146, 0, 0, 150, 0, 250, 0, 316, 314, 305,
988 303, 313, 311, 277, 0, 258, 0, 0, 0, 323,
989 327, 0, 324, 291, 309, 307, 340, 0, 200, 232,
990 0, 0, 0, 255, 0, 296, 0, 284, 0, 0,
991 321, 0, 397, 398, 0, 384, 385, 0, 381, 374,
992 0, 377, 375, 376, 363, 354, 0, 435, 429, 432,
993 0, 0, 430, 188, 185, 187, 392, 0, 402, 399,
994 0, 404, 400, 357, 0, 489, 0, 0, 147, 0,
995 0, 151, 148, 251, 0, 278, 274, 0, 331, 0,
996 335, 334, 328, 325, 329, 236, 0, 233, 234, 0,
997 0, 0, 260, 0, 264, 0, 267, 0, 301, 300,
998 286, 0, 298, 0, 320, 0, 395, 0, 383, 382,
999 387, 386, 356, 364, 353, 434, 428, 436, 431, 371,
1000 370, 393, 0, 358, 359, 491, 488, 0, 149, 0,
1001 0, 0, 248, 0, 201, 0, 208, 209, 0, 210,
1002 211, 0, 259, 332, 0, 237, 0, 0, 235, 273,
1003 270, 271, 502, 0, 262, 265, 0, 261, 0, 268,
1004 0, 0, 285, 0, 318, 317, 396, 355, 394, 360,
1005 0, 152, 0, 0, 0, 227, 279, 0, 333, 330,
1006 240, 238, 0, 272, 269, 263, 0, 283, 0, 0,
1007 0, 153, 0, 252, 0, 0, 239, 281, 282, 155,
1008 0, 0, 0, 0, 154, 0, 0, 0, 0, 288,
1009 0, 253, 287, 0, 0, 0
1012 static const short yydefgoto
[] = { 774,
1013 210, 278, 211, 85, 86, 68, 60, 87, 212, 22,
1014 23, 24, 8, 9, 10, 11, 12, 13, 14, 15,
1015 440, 283, 132, 105, 47, 70, 104, 130, 162, 163,
1016 164, 91, 114, 115, 116, 213, 166, 259, 92, 111,
1017 181, 182, 136, 185, 397, 168, 169, 170, 261, 171,
1018 172, 401, 551, 552, 284, 18, 43, 72, 65, 107,
1019 44, 63, 94, 95, 96, 97, 214, 357, 285, 175,
1020 554, 719, 287, 288, 289, 290, 694, 291, 292, 293,
1021 294, 697, 295, 296, 297, 298, 698, 299, 443, 300,
1022 584, 654, 655, 656, 657, 301, 302, 700, 303, 304,
1023 305, 701, 306, 307, 450, 662, 663, 308, 309, 310,
1024 311, 312, 313, 314, 570, 571, 572, 573, 215, 216,
1025 217, 218, 488, 219, 469, 470, 471, 220, 221, 222,
1026 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
1027 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
1028 243, 244, 392, 489, 714
1031 static const short yypact
[] = { 409,
1032 -32768,-32768, 168, -48, 226, 450,-32768,-32768, 240, 262,
1033 446,-32768,-32768,-32768,-32768, 723,-32768,-32768,-32768,-32768,
1034 13,-32768,-32768,-32768, 348,-32768, 250,-32768, 74, 474,
1035 -32768,-32768, 487, 587,-32768, -48, 465,-32768,-32768, 476,
1036 -32768, 467, -49, -42,-32768, 470, 41,-32768,-32768, -48,
1037 589, 359,-32768, 337,-32768, 66,-32768,-32768,-32768,-32768,
1038 0, 1441,-32768, 488, -49,-32768,-32768, 307, 496,-32768,
1039 -32768, -49, -42,-32768, 41,-32768,-32768,-32768, 511,-32768,
1040 -32768,-32768, 539, 12,-32768,-32768, 133, 442, 645,-32768,
1041 -32768, 77,-32768, 1574,-32768,-32768,-32768,-32768,-32768,-32768,
1042 -32768,-32768,-32768, 21, 169,-32768, -49,-32768,-32768, 196,
1043 1,-32768, 501, 181,-32768, 746, 1, 105, 107, 336,
1044 -32768, 557, 558,-32768,-32768,-32768,-32768, 565, 1027,-32768,
1045 -32768, 169, 590, 574, 170,-32768,-32768,-32768, 576, 2045,
1046 180, 390,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1,
1047 -32768, 504, 1,-32768,-32768, 347, 237,-32768, 376, 645,
1048 -32768, 1354,-32768,-32768, 404,-32768, 52,-32768, 403,-32768,
1049 -32768, 516,-32768,-32768, 1837,-32768,-32768,-32768, 583, 876,
1050 321,-32768,-32768,-32768, 479,-32768,-32768,-32768, 513,-32768,
1051 -32768, 2741, 2792, 2857, 2908, 491, 47, 670,-32768, 2973,
1052 3024, 3089, 5088,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1053 541, 958, 29,-32768, 562, 571,-32768, 584,-32768, 370,
1054 -32768, 424, 696,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1055 1057, 872, 1116, 888, 878, 676, 698, 668, 712, 209,
1056 -32768,-32768,-32768, 797,-32768,-32768,-32768,-32768,-32768,-32768,
1057 -32768,-32768, 931, 516,-32768,-32768,-32768,-32768, 472, 635,
1058 662,-32768, 178, 271, 3140,-32768, 115, 732, 118, 293,
1059 325, 148, 343, 149, 678, 5387,-32768, -48, 628, 709,
1060 437, 833,-32768, 687,-32768, 1769,-32768,-32768, 699,-32768,
1061 -32768,-32768, 1905,-32768,-32768, 714,-32768,-32768,-32768,-32768,
1062 1905,-32768, 1905,-32768,-32768, 5438, 721,-32768,-32768,-32768,
1063 -32768,-32768, 412,-32768, 577, 766, 696, 887, 905,-32768,
1064 -32768,-32768,-32768, 879, 594,-32768, 663, 616,-32768, 731,
1065 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 30,
1066 -32768, 657, 1030, 736, 736, 413,-32768,-32768,-32768,-32768,
1067 -32768, 772, 1044, 19,-32768,-32768, 719, 32, 5155, 3205,
1068 563,-32768, 8, 3256,-32768, 416,-32768,-32768, 3321, 3372,
1069 3437, 3488, 3553, 3604, 3669, 3720, 3785, 3836, 3901, 3952,
1070 690, 4017, 4068, 4133, 4184, 4249, 4300, 4365, 2096,-32768,
1071 -32768, 4416,-32768, 561,-32768,-32768,-32768, 751,-32768,-32768,
1072 -32768, 1769,-32768,-32768,-32768,-32768, 4481,-32768, 86,-32768,
1073 -32768, 121,-32768,-32768, 167,-32768, 4532,-32768, 4597,-32768,
1074 791,-32768, 4996,-32768,-32768, 211, 43, 757, 2161, 892,
1075 -32768,-32768, -48, 2212,-32768,-32768,-32768,-32768, 1056, 834,
1076 -32768,-32768, 785,-32768, 818, 910, 876,-32768,-32768,-32768,
1077 55, 2277,-32768, 4648,-32768, 879,-32768,-32768,-32768,-32768,
1078 -32768,-32768, -37, 793,-32768,-32768,-32768, 2328, 736,-32768,
1079 -32, 736, -32,-32768, 2393, 4713, 201, 521, 2444, 748,
1080 -32768, 5463,-32768, 1130,-32768,-32768,-32768, 573,-32768,-32768,
1081 243,-32768,-32768,-32768,-32768,-32768, 798,-32768, 248,-32768,
1082 5206,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1057,-32768,
1083 1057,-32768, 872,-32768, 872,-32768, 872,-32768, 1116,-32768,
1084 1116,-32768, 1116,-32768, 1116,-32768, 12,-32768,-32768, 888,
1085 -32768, 888,-32768, 878,-32768, 676,-32768, 698,-32768, 668,
1086 -32768, 712,-32768, 897, 816,-32768,-32768,-32768,-32768, 982,
1087 -32768, 1769, 819, 822, 1769,-32768, 236,-32768,-32768,-32768,
1088 -32768,-32768,-32768,-32768, 354,-32768, 829, 429, 216, 791,
1089 -32768, 403,-32768,-32768,-32768,-32768,-32768, 434, 757,-32768,
1090 924, 24, 692,-32768, 835,-32768, 5130,-32768, 5021, 831,
1091 842, 844,-32768,-32768, 5271,-32768,-32768, 260,-32768, 846,
1092 264,-32768, 846,-32768,-32768, 169, 84,-32768,-32768,-32768,
1093 4764, 1427,-32768,-32768,-32768,-32768,-32768, 4829,-32768,-32768,
1094 5322,-32768,-32768, 169, 623,-32768, 4880, 928,-32768, 1769,
1095 2509,-32768,-32768,-32768, 1971,-32768,-32768, 255,-32768, 665,
1096 -32768,-32768,-32768,-32768,-32768,-32768, 2560,-32768,-32768, 940,
1097 411, 4945,-32768, 727,-32768, 1544,-32768, 5387,-32768,-32768,
1098 -32768, 852, 848, 5063,-32768, 342,-32768, 644,-32768,-32768,
1099 -32768,-32768,-32768,-32768, 169,-32768,-32768,-32768,-32768,-32768,
1100 -32768,-32768, 669,-32768, 169,-32768,-32768, 440,-32768, 228,
1101 94, 444,-32768, 900, 904, 1971,-32768,-32768, 1971,-32768,
1102 -32768, 864,-32768, 875, 885,-32768, 965, 106,-32768,-32768,
1103 -32768,-32768,-32768, 456,-32768,-32768, 1618,-32768, 1686,-32768,
1104 889, 1905,-32768, 894,-32768,-32768,-32768,-32768,-32768,-32768,
1105 2625,-32768, 235, 4481, 1905,-32768,-32768, 2676,-32768,-32768,
1106 -32768,-32768, 971,-32768,-32768,-32768, 891,-32768, 1905, 238,
1107 116,-32768, 362,-32768, 5021, 899,-32768,-32768,-32768,-32768,
1108 241, 1971, 921, 5063,-32768, 962, 1971, 929, 1971,-32768,
1109 1971,-32768,-32768, 1026, 1028,-32768
1112 static const short yypgoto
[] = {-32768,
1113 -32768, -57, -60, 648, -24, -121, 332,-32768, -3, 485,
1114 -32768, 130,-32768, 1022, 770,-32768, 212,-32768,-32768, 851,
1115 153, 17,-32768,-32768, 981, 961,-32768, -128,-32768, 883,
1116 -32768, 126, -117, 901, -167, -193,-32768,-32768, 388, 639,
1117 788, -326, -98,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1118 896,-32768, 64,-32768, 636, -2,-32768,-32768,-32768,-32768,
1119 995, 646,-32768, 954,-32768,-32768, 387,-32768, -120, 799,
1120 781, -164, -279,-32768, 752, -70, 25, -364,-32768, -343,
1121 -32768,-32768,-32768, -270,-32768,-32768,-32768,-32768,-32768,-32768,
1122 -32768,-32768, 415, 422, -621, -342,-32768,-32768,-32768,-32768,
1123 -32768,-32768,-32768, -304,-32768, -623, 760,-32768,-32768,-32768,
1124 -32768,-32768,-32768,-32768,-32768, 508,-32768, 517,-32768,-32768,
1125 218,-32768, -413,-32768, 744, 399, -329, 1085, 275, 1199,
1126 335, 397, 553, -111, 610, 641, -467,-32768, 633, 780,
1127 642, 626, 697, 706, 715, 705, 707,-32768, 471, 708,
1128 779,-32768,-32768, -132,-32768
1135 static const short yytable
[] = { 21,
1136 458, 84, 29, 176, 83, 152, 437, 245, 174, 356,
1137 286, 324, 184, 38, 613, 473, 17, 59, 143, 481,
1138 582, 67, 478, 480, 649, 17, 17, 17, 84, 362,
1139 461, 123, 485, 84, 720, 449, 83, 20, 61, 59,
1140 724, 174, 61, 481, 59, 62, 17, 341, 260, 17,
1141 17, 249, 258, 134, 251, 586, 593, 64, 88, 93,
1142 61, 607, 203, 594, 601, 61, 76, 17, 84, 354,
1143 245, 83, 84, 262, 48, 179, 346, 124, 90, 496,
1144 333, 335, 337, 339, 674, 88, 558, 625, 348, 350,
1145 88, 93, 69, 20, 649, 720, 462, 135, 486, 84,
1146 50, 84, 123, 59, 83, 144, 742, 146, 118, 67,
1147 90, 39, 482, 40, 279, 410, 742, 650, 341, 84,
1148 128, 560, 325, 618, 61, 88, 173, -94, -94, 88,
1149 61, 763, 409, 25, 27, 415, 577, 344, 398, 600,
1150 768, 352, 603, 427, 679, 161, -104, 342, 420, 424,
1151 -104, 421, 16, -294, 587, 395, 88, 456, 88, 173,
1152 428, 16, 16, 16, 77, 52, 54, 562, 19, 57,
1153 186, 280, 49, 345, 50, 125, 88, 675, 161, 57,
1154 246, 668, 16, 618, 559, 16, 16, 733, 330, 330,
1155 330, 330, 84, 618, 61, 179, 330, 330, 353, 743,
1156 20, 610, 145, 16, 147, 618, 460, 683, 110, 761,
1157 -157, 575, 113, 411, 89, 618, 641, 691, 342, 561,
1158 31, 84, 441, 388, 433, 279, 26, 491, 648, 119,
1159 444, 499, 445, 708, 20, 709, 634, 555, 741, -30,
1160 1, 757, 157, 619, 31, 279, 89, 425, 622, 88,
1161 45, 110, 113, 20, 165, 703, 545, 503, 505, 507,
1162 669, -31, 1, 129, 671, 563, 84, 187, 189, 179,
1163 695, 406, 403, 404, 557, 437, 405, 247, 88, 138,
1164 139, 160, 280, 2, 565, 180, 567, 165, 133, 439,
1165 616, 696, 699, 416, 3, 389, 491, 439, 597, 439,
1166 4, -65, 446, 67, 281, 2, 5, 101, 189, 576,
1167 157, 20, 46, 705, 160, 579, 660, 751, 449, 590,
1168 527, 592, 4, 88, 61, 418, 732, 282, 5, 635,
1169 702, 695, 252, 752, 695, 598, 760, 74, 7, 765,
1170 620, 279, 725, 422, -65, 623, 491, 366, 41, -256,
1171 437, 245, 696, 699, 636, 696, 699, 670, -66, 71,
1172 7, 672, 634, 407, 609, 330, 330, 330, 330, 330,
1173 330, 330, 330, 330, 330, 330, 330, 88, 330, 330,
1174 330, 330, 330, 330, 330, 417, 84, 630, -65, 433,
1175 248, 702, 315, 449, 702, 99, 412, 695, 550, 46,
1176 103, -66, 695, 426, 695, 180, 695, 189, -28, 1,
1177 42, 710, 453, 474, 326, 281, 500, 419, 696, 699,
1178 327, 42, 281, 696, 699, 696, 699, 696, 699, 639,
1179 281, -65, 281, 148, 646, 423, 157, 431, 282, 437,
1180 646, -139, -158, 88, 406, -29, 1, 637, 642, 316,
1181 28, 645, 2, -160, 189, 762, 744, 702, 447, 155,
1182 -497, -497, 702, 3, 702, 53, 702, 58, 253, 4,
1183 66, 464, 330, -34, 1, 5, 55, 673, 330, 180,
1184 56, -25, -25, 6, 449, 681, -32, 1, 98, 2,
1185 57, 279, 497, 449, 279, 684, 102, 157, 711, 677,
1186 3, 137, 257, 315, 454, 475, 4, 7, 501, 317,
1187 315, 109, 5, 137, -498, -498, 167, 2, 315, 713,
1188 315, 640, -25, 315, 432, 721, 647, -25, -25, -25,
1189 2, 281, 731, -25, 4, 20, 734, -25, 120, 112,
1190 5, 3, 50, 745, 7, 726, 728, 4, 280, 167,
1191 20, 280, 20, 5, 282, 20, 730, 149, 151, 57,
1192 316, 20, 189, 492, 693, 154, 157, 316, 134, 279,
1193 396, 318, 7, 20, 183, 316, 188, 316, 328, 84,
1194 316, 20, 179, 323, 365, 7, -33, 1, -35, 1,
1195 177, 340, -97, 133, 455, 279, 20, -97, -97, -97,
1196 -97, 753, 250, 139, -97, 756, -97, 330, 330, -97,
1197 -97, -97, -97, 159, 611, 629, 459, 601, 633, 315,
1198 317, -341, -341, 330, 20, 441, 280, 317, 444, 493,
1199 2, 439, 2, 2, 494, 317, 88, 317, 495, 78,
1200 317, 358, 20, 20, 159, 121, 159, 4, 20, 4,
1201 20, 748, 280, 5, 548, 5, 279, 463, 279, 20,
1202 327, 20, 363, 457, 754, 704, 617, 364, 20, 20,
1203 343, 80, 618, -341, 81, 20, 316, -341, 759, 20,
1204 386, 281, 318, 178, 281, 7, 384, 7, 35, 318,
1205 526, 693, 439, 689, 78, 439, 748, 318, 754, 318,
1206 759, 20, 318, 122, 282, 36, 2, 282, 2, 385,
1207 100, 37, 78, 280, 78, 280, 685, 106, 439, 78,
1208 736, 117, 618, 737, 118, 387, 80, 319, 358, 81,
1209 20, 439, 413, 399, 192, 193, 317, 727, 651, 78,
1210 367, 368, 20, 618, 80, 439, 80, 81, 20, 81,
1211 20, 80, 131, 652, 81, 20, 400, 57, 439, 281,
1212 150, 153, 729, 439, 281, 439, 35, 439, 618, 315,
1213 -156, 80, 315, 651, 81, 20, 194, 195, 30, 434,
1214 34, 78, 282, 36, 320, 281, 766, 653, 652, 37,
1215 196, 770, 180, 772, -15, 773, 197, 438, 318, -496,
1216 -496, 359, 51, 198, 315, 429, 315, 199, 282, 430,
1217 -343, -343, 442, 80, 483, 321, 81, 20, 484, 452,
1218 200, 201, 715, 359, 202, 281, 316, 360, 281, 316,
1219 414, 361, 468, 204, 205, 206, 207, 140, 319, 208,
1220 209, 612, 141, 142, 601, 319, 281, 315, 281, 549,
1221 568, 281, 315, 319, 569, 319, 139, 602, 319, 604,
1222 32, 316, -343, 316, 281, 476, -343, 599, 477, 282,
1223 599, 282, 358, 315, 372, 373, 35, 35, 281, 583,
1224 32, 315, 78, 585, 32, 595, 317, 390, 391, 317,
1225 621, 281, 492, 382, 383, 320, 281, 626, 281, 37,
1226 281, 32, 320, 627, 316, 377, 378, 379, 380, 316,
1227 320, 631, 320, 315, 80, 320, 315, 81, 20, 35,
1228 632, 317, 638, 317, 648, 78, 321, 658, 492, 664,
1229 316, -407, -407, 321, 315, 665, 315, 666, 316, 315,
1230 709, 321, 601, 321, 381, 722, 321, 587, 318, -408,
1231 -408, 318, 315, 322, 319, 735, 578, 80, 493, -207,
1232 81, 20, 738, 494, 317, 741, 315, 495, 739, 317,
1233 316, 757, 315, 316, 2, 141, 142, 20, 740, 315,
1234 78, 315, 747, 318, 315, 318, 315, 749, 315, 758,
1235 317, 316, 688, 316, 493, -15, 316, 764, 317, 494,
1236 -496, -496, 359, 495, 509, 511, 429, 530, 532, 316,
1237 361, 320, 80, 20, 767, 81, 20, 769, 519, 521,
1238 523, 525, 771, 316, 393, 775, 318, 776, 528, 316,
1239 317, 318, 33, 317, 75, 108, 316, 553, 316, 190,
1240 394, 316, 321, 316, 256, 316, 73, 127, -496, -496,
1241 359, 317, 318, 317, 360, 254, 317, 448, 361, 402,
1242 318, 369, 370, 371, 322, 451, 436, -15, 716, 317,
1243 156, 322, -496, -496, 359, 717, 78, 643, 429, 322,
1244 534, 322, 628, 317, 322, 79, 644, 4, 472, 317,
1245 536, 540, 318, 5, 542, 318, 317, 687, 317, 547,
1246 538, 317, 0, 317, 319, 317, 0, 319, 80, 0,
1247 0, 81, 20, 318, 0, 318, 0, 0, 318, 0,
1248 0, 157, 158, 374, 375, 376, 465, 466, 467, 0,
1249 614, 318, 192, 193, -496, -496, 359, 0, 0, 319,
1250 479, 319, 0, 0, 361, 318, -496, -496, 359, 0,
1251 0, 318, 360, 513, 515, 517, 430, 0, 318, 0,
1252 318, 320, 0, 318, 320, 318, 0, 318, 0, 0,
1253 0, 0, 0, 0, 194, 195, 0, 0, 0, 78,
1254 322, 0, 319, 0, 0, 0, 0, 319, 196, 0,
1255 0, 0, 321, 0, 197, 321, 320, 0, 320, 0,
1256 0, 198, 0, 0, 0, 199, 0, 0, 319, 0,
1257 0, 80, 0, 0, 81, 20, 319, 0, 200, 201,
1258 0, 0, 202, 0, 203, 615, 0, 321, 0, 321,
1259 0, 204, 205, 206, 207, 0, 0, 208, 209, 320,
1260 0, 0, 0, 0, 320, 0, 0, 0, 319, 0,
1261 0, 319, 0, 0, 0, 0, 0, 0, 0, 0,
1262 0, 0, 0, 0, 0, 320, 0, 0, 0, 319,
1263 321, 319, 0, 320, 319, 321, 331, 331, 331, 331,
1264 0, 0, 0, 0, 331, 331, 0, 319, 0, 0,
1265 0, 0, 0, 0, 0, 0, 321, 0, 0, 0,
1266 0, 319, 0, 0, 321, 320, 0, 319, 320, 0,
1267 0, 0, 0, 0, 319, 0, 319, 0, 0, 319,
1268 0, 319, 0, 319, 0, 0, 320, 0, 320, 0,
1269 322, 320, 0, 322, 0, 0, 321, 0, 0, 321,
1270 0, 0, 0, 0, 320, 0, 0, 0, 0, 0,
1271 0, 0, 0, 0, 0, 0, 0, 321, 320, 321,
1272 0, 0, 321, 0, 320, 322, 0, 322, 0, 0,
1273 0, 320, 0, 320, 0, 321, 320, 0, 320, 0,
1274 320, 0, 0, 0, 0, 0, 0, 0, 0, 321,
1275 332, 332, 332, 332, 0, 321, 0, 156, 332, 332,
1276 0, 0, 321, 78, 321, 0, 0, 321, 322, 321,
1277 0, 321, 79, 322, 4, 0, 0, 0, 0, 0,
1278 5, 0, 0, 0, 0, 0, 0, 678, 0, 0,
1279 0, 0, 0, 0, 322, 80, 0, 0, 81, 20,
1280 0, 0, 322, 0, 0, 0, 0, 0, 157, 255,
1281 0, 0, 0, 331, 331, 331, 331, 331, 331, 331,
1282 331, 331, 331, 331, 331, 0, 331, 331, 331, 331,
1283 331, 331, 331, 0, 322, 0, 78, 322, 0, 0,
1284 0, 0, 0, 0, 2, 196, 0, 0, 0, 0,
1285 78, 197, 0, 0, 0, 322, 0, 322, 198, 79,
1286 322, 4, 199, 0, 0, 0, 0, 5, 80, 0,
1287 0, 81, 20, 322, 0, 200, 201, 0, 0, 202,
1288 0, 0, 80, 0, 0, 81, 20, 322, 204, 205,
1289 206, 207, 0, 322, 208, 209, 82, 0, 0, 0,
1290 322, 0, 322, 0, 263, 322, 0, 322, 0, 322,
1291 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1292 331, 0, 0, 0, 0, 0, 331, 332, 332, 332,
1293 332, 332, 332, 332, 332, 332, 332, 332, 332, 0,
1294 332, 332, 332, 332, 332, 332, 332, 2, 194, 195,
1295 651, 264, 265, 78, 266, 0, 0, 267, 0, 0,
1296 0, 268, 196, 0, 0, 652, 0, 0, 269, 270,
1297 5, 271, 0, 272, 273, 198, 274, 2, 263, 275,
1298 0, 0, 0, 78, 0, 80, 0, 0, 81, 20,
1299 0, 0, 79, 0, 4, 0, 276, 0, 157, 718,
1300 5, 0, 277, 0, 0, 204, 205, 206, 207, 0,
1301 0, 208, 209, 0, 0, 80, 0, 0, 81, 20,
1302 0, 2, 194, 195, 651, 264, 265, 78, 266, 126,
1303 0, 267, 0, 0, 332, 268, 196, 0, 0, 652,
1304 332, 0, 269, 270, 5, 271, 263, 272, 273, 198,
1305 274, 0, 0, 275, 0, 331, 331, 0, 0, 80,
1306 0, 0, 81, 20, 0, 0, 0, 0, 0, 0,
1307 276, 331, 157, 746, 0, 0, 277, 0, 0, 204,
1308 205, 206, 207, 0, 0, 208, 209, 0, 0, 2,
1309 194, 195, -266, 264, 265, 78, 266, 0, 0, 267,
1310 0, 0, 0, 268, 196, 0, 0, -266, 0, 0,
1311 269, 270, 5, 271, 0, 272, 273, 198, 274, 0,
1312 0, 275, 0, 0, 0, 0, 0, 80, 0, 263,
1313 81, 20, 0, 0, 0, 0, 0, 0, 276, 0,
1314 157, -266, 0, 0, 277, 0, 0, 204, 205, 206,
1315 207, 0, 0, 208, 209, 0, 0, 0, 0, 0,
1316 0, 0, 0, 0, 0, 0, 0, 0, 0, 332,
1317 332, 0, 2, 194, 195, 0, 264, 265, 78, 266,
1318 0, 0, 267, 0, 0, 332, 268, 196, 0, 0,
1319 0, 0, 0, 269, 270, 5, 271, 263, 272, 273,
1320 198, 274, 0, 0, 275, 0, 0, 0, 0, 0,
1321 80, 0, 0, 81, 20, 0, 0, 0, 0, 0,
1322 0, 276, 0, 157, 435, 0, 0, 277, 0, 0,
1323 204, 205, 206, 207, 0, 0, 208, 209, 0, 0,
1324 2, 194, 195, 0, 264, 265, 78, 266, 0, 0,
1325 267, 0, 0, 0, 268, 196, 0, 0, 0, 0,
1326 0, 269, 270, 5, 271, 263, 272, 273, 198, 274,
1327 0, 0, 275, 0, 0, 0, 0, 0, 80, 0,
1328 0, 81, 20, 0, 0, 0, 0, 0, 0, 276,
1329 0, 157, 0, 0, 0, 277, 0, 0, 204, 205,
1330 206, 207, 0, 0, 208, 209, 0, 0, 2, 194,
1331 195, 0, 264, 265, 78, 266, 0, 0, 267, 0,
1332 0, 0, 268, 196, 0, 0, 0, 0, 0, 269,
1333 270, 263, 271, 0, 272, 273, 198, 274, 0, 0,
1334 275, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1335 20, 0, 0, 0, 0, 0, 0, 276, 0, 157,
1336 0, 0, 0, 277, 0, 0, 204, 205, 206, 207,
1337 0, 0, 208, 209, 2, 194, 195, 0, 692, 265,
1338 78, 266, 0, 0, 267, 0, 0, 0, 268, 196,
1339 0, 0, 0, 0, 0, 269, 270, 0, 271, 0,
1340 272, 273, 198, 274, 0, 191, 275, 192, 193, 0,
1341 0, 0, 80, 0, 0, 81, 20, 0, 0, 0,
1342 0, 0, 0, 276, 0, 157, 0, 0, 0, 277,
1343 0, 0, 204, 205, 206, 207, 0, 0, 208, 209,
1344 0, 0, 0, 0, 0, 0, 0, 0, 0, 194,
1345 195, 0, 0, 0, 78, 0, 543, 0, 192, 193,
1346 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1347 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1348 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1349 20, 0, 0, 200, 201, 0, 0, 202, 0, 203,
1350 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1351 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1352 197, 490, 0, 192, 193, 0, 0, 198, 0, 0,
1353 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1354 81, 20, 0, 544, 200, 201, 0, 0, 202, 0,
1355 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1356 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1357 78, 0, 580, 0, 192, 193, 0, 0, 0, 196,
1358 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1359 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1360 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1361 201, 0, 0, 202, 0, 0, 194, 195, 148, 0,
1362 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1363 196, 0, 0, 0, 0, 0, 197, 588, 0, 192,
1364 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1365 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1366 200, 201, 0, 0, 202, 581, 0, 0, 0, 0,
1367 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1368 209, 194, 195, 0, 0, 0, 78, 0, 596, 0,
1369 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1370 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1371 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1372 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1373 0, 0, 194, 195, 0, 589, 0, 78, 204, 205,
1374 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1375 0, 0, 197, 605, 0, 192, 193, 0, 0, 198,
1376 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1377 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1378 202, 0, 0, 0, 0, 597, 0, 0, 0, 204,
1379 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1380 0, 0, 78, 0, 490, 0, 192, 193, 0, 0,
1381 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1382 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1383 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1384 0, 200, 201, 0, 0, 202, 606, 0, 194, 195,
1385 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1386 208, 209, 196, 0, 0, 0, 0, 0, 197, 580,
1387 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1388 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1389 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1390 0, 597, 0, 0, 0, 204, 205, 206, 207, 0,
1391 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1392 706, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1393 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1394 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1395 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1396 0, 202, 690, 0, 194, 195, 0, 0, 0, 78,
1397 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1398 0, 0, 0, 0, 197, 706, 0, 192, 193, 0,
1399 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1400 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1401 0, 0, 202, 707, 0, 0, 0, 0, 0, 0,
1402 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1403 195, 0, 0, 0, 78, 0, 588, 0, 192, 193,
1404 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1405 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1406 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1407 20, 0, 0, 200, 201, 0, 0, 202, 750, 0,
1408 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1409 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1410 197, 329, 0, 192, 193, 0, 0, 198, 0, 0,
1411 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1412 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1413 0, 0, 0, 0, 755, 0, 0, 204, 205, 206,
1414 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1415 78, 0, 334, 0, 192, 193, 0, 0, 0, 196,
1416 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1417 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1418 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1419 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1420 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1421 196, 0, 0, 0, 0, 0, 197, 336, 0, 192,
1422 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1423 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1424 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1425 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1426 209, 194, 195, 0, 0, 0, 78, 0, 338, 0,
1427 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1428 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1429 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1430 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1431 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1432 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1433 0, 0, 197, 347, 0, 192, 193, 0, 0, 198,
1434 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1435 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1436 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1437 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1438 0, 0, 78, 0, 349, 0, 192, 193, 0, 0,
1439 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1440 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1441 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1442 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1443 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1444 208, 209, 196, 0, 0, 0, 0, 0, 197, 351,
1445 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1446 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1447 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1448 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1449 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1450 408, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1451 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1452 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1453 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1454 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1455 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1456 0, 0, 0, 0, 197, 490, 0, 192, 193, 0,
1457 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1458 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1459 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1460 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1461 195, 0, 0, 0, 78, 0, 498, 0, 192, 193,
1462 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1463 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1464 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1465 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1466 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1467 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1468 197, 502, 0, 192, 193, 0, 0, 198, 0, 0,
1469 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1470 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1471 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1472 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1473 78, 0, 504, 0, 192, 193, 0, 0, 0, 196,
1474 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1475 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1476 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1477 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1478 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1479 196, 0, 0, 0, 0, 0, 197, 506, 0, 192,
1480 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1481 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1482 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1483 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1484 209, 194, 195, 0, 0, 0, 78, 0, 508, 0,
1485 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1486 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1487 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1488 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1489 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1490 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1491 0, 0, 197, 510, 0, 192, 193, 0, 0, 198,
1492 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1493 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1494 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1495 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1496 0, 0, 78, 0, 512, 0, 192, 193, 0, 0,
1497 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1498 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1499 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1500 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1501 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1502 208, 209, 196, 0, 0, 0, 0, 0, 197, 514,
1503 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1504 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1505 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1506 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1507 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1508 516, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1509 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1510 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1511 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1512 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1513 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1514 0, 0, 0, 0, 197, 518, 0, 192, 193, 0,
1515 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1516 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1517 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1518 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1519 195, 0, 0, 0, 78, 0, 520, 0, 192, 193,
1520 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1521 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1522 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1523 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1524 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1525 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1526 197, 522, 0, 192, 193, 0, 0, 198, 0, 0,
1527 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1528 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1529 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1530 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1531 78, 0, 524, 0, 192, 193, 0, 0, 0, 196,
1532 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1533 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1534 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1535 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1536 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1537 196, 0, 0, 0, 0, 0, 197, 529, 0, 192,
1538 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1539 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1540 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1541 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1542 209, 194, 195, 0, 0, 0, 78, 0, 531, 0,
1543 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1544 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1545 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1546 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1547 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1548 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1549 0, 0, 197, 533, 0, 192, 193, 0, 0, 198,
1550 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1551 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1552 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1553 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1554 0, 0, 78, 0, 535, 0, 192, 193, 0, 0,
1555 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1556 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1557 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1558 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1559 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1560 208, 209, 196, 0, 0, 0, 0, 0, 197, 537,
1561 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1562 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1563 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1564 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1565 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1566 539, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1567 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1568 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1569 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1570 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1571 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1572 0, 0, 0, 0, 197, 541, 0, 192, 193, 0,
1573 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1574 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1575 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1576 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1577 195, 0, 0, 0, 78, 0, 546, 0, 192, 193,
1578 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1579 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1580 199, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1581 20, 0, 0, 200, 201, 0, 0, 202, 0, 0,
1582 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1583 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1584 197, 556, 0, 192, 193, 0, 0, 198, 0, 0,
1585 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1586 81, 20, 0, 0, 200, 201, 0, 0, 202, 0,
1587 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1588 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1589 78, 0, 564, 0, 192, 193, 0, 0, 0, 196,
1590 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1591 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1592 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1593 201, 0, 0, 202, 0, 0, 194, 195, 0, 0,
1594 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1595 196, 0, 0, 0, 0, 0, 197, 566, 0, 192,
1596 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1597 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1598 200, 201, 0, 0, 202, 0, 0, 0, 0, 0,
1599 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1600 209, 194, 195, 0, 0, 0, 78, 0, 591, 0,
1601 192, 193, 0, 0, 0, 196, 0, 0, 0, 0,
1602 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1603 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1604 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1605 0, 0, 194, 195, 0, 0, 0, 78, 204, 205,
1606 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1607 0, 0, 197, 608, 0, 192, 193, 0, 0, 198,
1608 0, 0, 0, 199, 0, 0, 0, 0, 0, 80,
1609 0, 0, 81, 20, 0, 0, 200, 201, 0, 0,
1610 202, 0, 0, 0, 0, 0, 0, 0, 0, 204,
1611 205, 206, 207, 0, 0, 208, 209, 194, 195, 0,
1612 0, 0, 78, 0, 676, 0, 192, 193, 0, 0,
1613 0, 196, 0, 0, 0, 0, 0, 197, 0, 0,
1614 0, 0, 0, 0, 198, 0, 0, 0, 199, 0,
1615 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1616 0, 200, 201, 0, 0, 202, 0, 0, 194, 195,
1617 0, 0, 0, 78, 204, 205, 206, 207, 0, 0,
1618 208, 209, 196, 0, 0, 0, 0, 0, 197, 680,
1619 0, 192, 193, 0, 0, 198, 0, 0, 0, 199,
1620 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1621 0, 0, 200, 201, 0, 0, 202, 0, 0, 0,
1622 0, 0, 0, 0, 0, 204, 205, 206, 207, 0,
1623 0, 208, 209, 194, 195, 0, 0, 0, 78, 0,
1624 686, 0, 192, 193, 0, 0, 0, 196, 0, 0,
1625 0, 0, 0, 197, 0, 0, 0, 0, 0, 0,
1626 198, 0, 0, 0, 199, 0, 0, 0, 0, 0,
1627 80, 0, 0, 81, 20, 0, 0, 200, 201, 0,
1628 0, 202, 0, 0, 194, 195, 0, 0, 0, 78,
1629 204, 205, 206, 207, 0, 0, 208, 209, 196, 0,
1630 0, 0, 0, 0, 197, 712, 0, 192, 193, 0,
1631 0, 198, 0, 0, 0, 199, 0, 0, 0, 0,
1632 0, 80, 0, 0, 81, 20, 0, 0, 200, 201,
1633 0, 0, 202, 0, 0, 0, 0, 0, 0, 0,
1634 0, 204, 205, 206, 207, 0, 0, 208, 209, 194,
1635 195, 0, 0, 0, 78, 0, 574, 0, 0, 0,
1636 0, 0, 0, 196, 0, 0, 0, 0, 0, 197,
1637 0, 0, 0, 0, 0, 0, 198, 0, 0, 0,
1638 199, 661, 0, 0, 0, 0, 80, 0, 0, 81,
1639 20, 0, 0, 200, 201, 0, 0, 202, 0, -289,
1640 -289, -289, 0, 0, 0, -289, 204, 205, 206, 207,
1641 0, 0, 208, 209, -289, 0, 0, 0, 0, 0,
1642 -289, 0, 0, 723, 0, 194, 195, -289, 0, 0,
1643 78, -289, 0, 0, 0, 0, 0, -289, 0, 196,
1644 -289, -289, 0, 0, 0, 197, 0, 0, -289, 0,
1645 192, 193, 198, 0, -289, 0, 199, -289, -289, -289,
1646 -289, 0, 80, -289, -289, 81, 20, 194, 195, 0,
1647 0, 0, 78, 276, -297, 0, 0, 0, 0, 0,
1648 0, 196, 204, 205, 206, 207, 0, 197, 208, 209,
1649 659, 0, 194, 195, 198, 0, 0, 78, 199, 0,
1650 0, 0, 0, 0, 80, 0, 196, 81, 20, 0,
1651 0, 0, 197, 0, 0, 276, -297, 192, 193, 198,
1652 0, 0, 0, 199, 204, 205, 206, 207, 0, 80,
1653 208, 209, 81, 20, 194, 195, 200, 201, 0, 78,
1654 202, 0, 203, 355, 0, 0, 0, 0, 196, 204,
1655 205, 206, 207, 0, 197, 208, 209, 0, 0, 194,
1656 195, 198, 0, 0, 78, 199, 0, 0, 192, 193,
1657 0, 80, 0, 196, 81, 20, 0, 0, 0, 197,
1658 0, 0, 276, 0, 0, 0, 198, 0, 0, 0,
1659 199, 204, 205, 206, 207, 0, 80, 208, 209, 81,
1660 20, 0, 0, 200, 201, 0, 0, 202, 487, 0,
1661 194, 195, 0, 0, 0, 78, 204, 205, 206, 207,
1662 0, 0, 208, 209, 196, 0, 0, 0, 0, 0,
1663 197, 0, 0, 192, 193, 0, 0, 198, 0, 0,
1664 0, 199, 0, 0, 0, 0, 0, 80, 0, 0,
1665 81, 20, 0, 0, 200, 201, 0, 0, 202, 624,
1666 0, 0, 0, 0, 0, 0, 0, 204, 205, 206,
1667 207, 0, 0, 208, 209, 194, 195, 0, 0, 0,
1668 78, 0, 0, 0, 192, 193, 0, 0, 0, 196,
1669 0, 0, 0, 0, 0, 197, 0, 0, 0, 0,
1670 0, 0, 198, 0, 0, 0, 199, 0, 0, 0,
1671 0, 0, 80, 0, 0, 81, 20, 0, 0, 200,
1672 201, 0, 0, 202, 667, 0, 194, 195, 0, 0,
1673 0, 78, 204, 205, 206, 207, 0, 0, 208, 209,
1674 196, 0, 0, 0, 0, 0, 197, 0, 0, 192,
1675 193, 0, 0, 198, 0, 0, 0, 199, 0, 0,
1676 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1677 200, 201, 0, 0, 202, 682, 0, 0, 0, 0,
1678 0, 0, 0, 204, 205, 206, 207, 0, 0, 208,
1679 209, 194, 195, 0, 0, 0, 78, 0, 0, 0,
1680 0, 0, 0, 0, 0, 196, 0, 0, 0, 0,
1681 0, 197, 0, 0, 0, 0, 0, 0, 198, 0,
1682 0, 0, 199, 0, 0, 0, 0, 0, 80, 0,
1683 0, 81, 20, 0, 0, 200, 201, 0, 0, 202,
1684 0, 2, 194, 195, 0, 0, 0, 78, 204, 205,
1685 206, 207, 0, 0, 208, 209, 196, 0, 0, 0,
1686 0, 0, 197, 0, 0, 0, 0, 0, 0, 198,
1687 0, 0, 78, 199, 0, 0, 0, 0, 0, 80,
1688 0, 196, 81, 20, 0, 0, 0, 197, 0, 0,
1689 276, 0, 0, 0, 198, 0, 0, 0, 199, 204,
1690 205, 206, 207, 0, 80, 208, 209, 81, 20, 0,
1691 0, 200, 201, 0, 0, 202, 0, 0, 0, 0,
1692 0, 0, 0, 0, 204, 205, 206, 207, 0, 0,
1696 static const short yycheck
[] = { 3,
1697 327, 62, 6, 132, 62, 123, 286, 140, 129, 203,
1698 175, 179, 134, 1, 482, 345, 0, 42, 117, 1,
1699 434, 46, 352, 353, 1, 9, 10, 11, 89, 1,
1700 1, 89, 1, 94, 656, 306, 94, 86, 42, 64,
1701 664, 162, 46, 1, 69, 95, 30, 1, 169, 33,
1702 34, 150, 1, 53, 153, 1, 94, 100, 62, 62,
1703 64, 475, 95, 101, 97, 69, 1, 51, 129, 202,
1704 203, 129, 133, 172, 1, 133, 198, 1, 62, 72,
1705 192, 193, 194, 195, 1, 89, 1, 501, 200, 201,
1706 94, 94, 52, 86, 1, 717, 67, 97, 67, 160,
1707 101, 162, 160, 128, 162, 1, 1, 1, 97, 134,
1708 94, 99, 94, 101, 175, 1, 1, 94, 1, 180,
1709 100, 1, 180, 100, 128, 129, 129, 99, 100, 133,
1710 134, 755, 265, 4, 5, 268, 94, 198, 259, 469,
1711 764, 202, 472, 276, 612, 129, 95, 101, 1, 1,
1712 99, 272, 0, 99, 100, 254, 160, 325, 162, 162,
1713 278, 9, 10, 11, 99, 36, 37, 1, 1, 40,
1714 1, 175, 99, 198, 101, 99, 180, 94, 162, 50,
1715 1, 595, 30, 100, 99, 33, 34, 94, 192, 193,
1716 194, 195, 253, 100, 198, 253, 200, 201, 202, 94,
1717 86, 1, 98, 51, 98, 100, 328, 621, 79, 94,
1718 93, 1, 83, 99, 62, 100, 1, 631, 101, 99,
1719 9, 282, 293, 15, 282, 286, 1, 360, 1, 97,
1720 301, 364, 303, 647, 86, 1, 1, 402, 1, 0,
1721 1, 1, 95, 1, 33, 306, 94, 99, 1, 253,
1722 1, 122, 123, 86, 129, 1, 389, 369, 370, 371,
1723 1, 0, 1, 95, 1, 99, 327, 98, 139, 327,
1724 635, 1, 95, 96, 407, 555, 99, 98, 282, 99,
1725 100, 129, 286, 44, 417, 133, 419, 162, 93, 293,
1726 484, 635, 635, 1, 55, 87, 429, 301, 98, 303,
1727 61, 52, 306, 328, 175, 44, 67, 1, 179, 99,
1728 95, 86, 63, 640, 162, 433, 587, 731, 589, 452,
1729 381, 454, 61, 327, 328, 1, 99, 175, 67, 94,
1730 635, 696, 96, 99, 699, 468, 99, 1, 99, 99,
1731 98, 402, 1, 1, 95, 98, 479, 218, 1, 95,
1732 630, 484, 696, 696, 1, 699, 699, 98, 52, 1,
1733 99, 98, 1, 93, 476, 369, 370, 371, 372, 373,
1734 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
1735 384, 385, 386, 387, 388, 93, 447, 552, 52, 447,
1736 1, 696, 175, 664, 699, 64, 267, 762, 402, 63,
1737 69, 95, 767, 274, 769, 253, 771, 278, 0, 1,
1738 63, 1, 1, 1, 94, 286, 1, 93, 762, 762,
1739 100, 63, 293, 767, 767, 769, 769, 771, 771, 1,
1740 301, 95, 303, 98, 1, 93, 95, 1, 286, 719,
1741 1, 95, 95, 447, 1, 0, 1, 94, 569, 175,
1742 1, 572, 44, 95, 325, 94, 1, 762, 306, 128,
1743 91, 92, 767, 55, 769, 1, 771, 1, 93, 61,
1744 1, 342, 476, 0, 1, 67, 1, 606, 482, 327,
1745 5, 45, 46, 75, 755, 618, 0, 1, 1, 44,
1746 361, 552, 363, 764, 555, 624, 1, 95, 88, 611,
1747 55, 1, 99, 286, 93, 93, 61, 99, 93, 175,
1748 293, 1, 67, 1, 91, 92, 129, 44, 301, 652,
1749 303, 93, 86, 306, 88, 658, 93, 91, 92, 93,
1750 44, 402, 93, 97, 61, 86, 93, 101, 97, 1,
1751 67, 55, 101, 88, 99, 666, 675, 61, 552, 162,
1752 86, 555, 86, 67, 402, 86, 685, 1, 1, 430,
1753 286, 86, 433, 1, 635, 1, 95, 293, 53, 630,
1754 99, 175, 99, 86, 1, 301, 1, 303, 100, 640,
1755 306, 86, 640, 1, 1, 99, 0, 1, 0, 1,
1756 1, 101, 92, 93, 1, 656, 86, 97, 98, 99,
1757 100, 734, 99, 100, 92, 738, 94, 611, 612, 97,
1758 98, 99, 100, 129, 94, 552, 1, 97, 555, 402,
1759 286, 45, 46, 627, 86, 696, 630, 293, 699, 67,
1760 44, 635, 44, 44, 72, 301, 640, 303, 76, 50,
1761 306, 101, 86, 86, 160, 1, 162, 61, 86, 61,
1762 86, 722, 656, 67, 94, 67, 717, 1, 719, 86,
1763 100, 86, 101, 1, 735, 1, 94, 97, 86, 86,
1764 1, 82, 100, 97, 85, 86, 402, 101, 749, 86,
1765 13, 552, 286, 94, 555, 99, 11, 99, 44, 293,
1766 1, 762, 696, 630, 50, 699, 767, 301, 769, 303,
1767 771, 86, 306, 59, 552, 61, 44, 555, 44, 12,
1768 65, 67, 50, 717, 50, 719, 94, 72, 722, 50,
1769 696, 83, 100, 699, 97, 14, 82, 175, 101, 85,
1770 86, 735, 1, 99, 3, 4, 402, 94, 47, 50,
1771 45, 46, 86, 100, 82, 749, 82, 85, 86, 85,
1772 86, 82, 107, 62, 85, 86, 95, 628, 762, 630,
1773 122, 123, 94, 767, 635, 769, 44, 771, 100, 552,
1774 93, 82, 555, 47, 85, 86, 45, 46, 9, 93,
1775 11, 50, 630, 61, 175, 656, 762, 96, 62, 67,
1776 59, 767, 640, 769, 86, 771, 65, 99, 402, 91,
1777 92, 93, 33, 72, 587, 97, 589, 76, 656, 101,
1778 45, 46, 99, 82, 96, 175, 85, 86, 100, 99,
1779 89, 90, 96, 93, 93, 696, 552, 97, 699, 555,
1780 99, 101, 97, 102, 103, 104, 105, 92, 286, 108,
1781 109, 94, 97, 98, 97, 293, 717, 630, 719, 99,
1782 60, 722, 635, 301, 64, 303, 100, 471, 306, 473,
1783 10, 587, 97, 589, 735, 94, 101, 469, 97, 717,
1784 472, 719, 101, 656, 3, 4, 44, 44, 749, 95,
1785 30, 664, 50, 66, 34, 93, 552, 91, 92, 555,
1786 93, 762, 1, 16, 17, 286, 767, 1, 769, 67,
1787 771, 51, 293, 88, 630, 18, 19, 20, 21, 635,
1788 301, 93, 303, 696, 82, 306, 699, 85, 86, 44,
1789 99, 587, 94, 589, 1, 50, 286, 93, 1, 99,
1790 656, 45, 46, 293, 717, 94, 719, 94, 664, 722,
1791 1, 301, 97, 303, 57, 94, 306, 100, 552, 45,
1792 46, 555, 735, 175, 402, 56, 65, 82, 67, 56,
1793 85, 86, 99, 72, 630, 1, 749, 76, 94, 635,
1794 696, 1, 755, 699, 44, 97, 98, 86, 94, 762,
1795 50, 764, 94, 587, 767, 589, 769, 94, 771, 99,
1796 656, 717, 65, 719, 67, 86, 722, 99, 664, 72,
1797 91, 92, 93, 76, 372, 373, 97, 382, 383, 735,
1798 101, 402, 82, 86, 94, 85, 86, 56, 377, 378,
1799 379, 380, 94, 749, 94, 0, 630, 0, 381, 755,
1800 696, 635, 11, 699, 54, 75, 762, 402, 764, 139,
1801 253, 767, 402, 769, 162, 771, 52, 94, 91, 92,
1802 93, 717, 656, 719, 97, 160, 722, 306, 101, 261,
1803 664, 5, 6, 7, 286, 306, 286, 86, 654, 735,
1804 44, 293, 91, 92, 93, 654, 50, 570, 97, 301,
1805 384, 303, 101, 749, 306, 59, 570, 61, 345, 755,
1806 385, 387, 696, 67, 388, 699, 762, 627, 764, 392,
1807 386, 767, -1, 769, 552, 771, -1, 555, 82, -1,
1808 -1, 85, 86, 717, -1, 719, -1, -1, 722, -1,
1809 -1, 95, 96, 8, 9, 10, 97, 98, 99, -1,
1810 1, 735, 3, 4, 91, 92, 93, -1, -1, 587,
1811 97, 589, -1, -1, 101, 749, 91, 92, 93, -1,
1812 -1, 755, 97, 374, 375, 376, 101, -1, 762, -1,
1813 764, 552, -1, 767, 555, 769, -1, 771, -1, -1,
1814 -1, -1, -1, -1, 45, 46, -1, -1, -1, 50,
1815 402, -1, 630, -1, -1, -1, -1, 635, 59, -1,
1816 -1, -1, 552, -1, 65, 555, 587, -1, 589, -1,
1817 -1, 72, -1, -1, -1, 76, -1, -1, 656, -1,
1818 -1, 82, -1, -1, 85, 86, 664, -1, 89, 90,
1819 -1, -1, 93, -1, 95, 96, -1, 587, -1, 589,
1820 -1, 102, 103, 104, 105, -1, -1, 108, 109, 630,
1821 -1, -1, -1, -1, 635, -1, -1, -1, 696, -1,
1822 -1, 699, -1, -1, -1, -1, -1, -1, -1, -1,
1823 -1, -1, -1, -1, -1, 656, -1, -1, -1, 717,
1824 630, 719, -1, 664, 722, 635, 192, 193, 194, 195,
1825 -1, -1, -1, -1, 200, 201, -1, 735, -1, -1,
1826 -1, -1, -1, -1, -1, -1, 656, -1, -1, -1,
1827 -1, 749, -1, -1, 664, 696, -1, 755, 699, -1,
1828 -1, -1, -1, -1, 762, -1, 764, -1, -1, 767,
1829 -1, 769, -1, 771, -1, -1, 717, -1, 719, -1,
1830 552, 722, -1, 555, -1, -1, 696, -1, -1, 699,
1831 -1, -1, -1, -1, 735, -1, -1, -1, -1, -1,
1832 -1, -1, -1, -1, -1, -1, -1, 717, 749, 719,
1833 -1, -1, 722, -1, 755, 587, -1, 589, -1, -1,
1834 -1, 762, -1, 764, -1, 735, 767, -1, 769, -1,
1835 771, -1, -1, -1, -1, -1, -1, -1, -1, 749,
1836 192, 193, 194, 195, -1, 755, -1, 44, 200, 201,
1837 -1, -1, 762, 50, 764, -1, -1, 767, 630, 769,
1838 -1, 771, 59, 635, 61, -1, -1, -1, -1, -1,
1839 67, -1, -1, -1, -1, -1, -1, 1, -1, -1,
1840 -1, -1, -1, -1, 656, 82, -1, -1, 85, 86,
1841 -1, -1, 664, -1, -1, -1, -1, -1, 95, 96,
1842 -1, -1, -1, 369, 370, 371, 372, 373, 374, 375,
1843 376, 377, 378, 379, 380, -1, 382, 383, 384, 385,
1844 386, 387, 388, -1, 696, -1, 50, 699, -1, -1,
1845 -1, -1, -1, -1, 44, 59, -1, -1, -1, -1,
1846 50, 65, -1, -1, -1, 717, -1, 719, 72, 59,
1847 722, 61, 76, -1, -1, -1, -1, 67, 82, -1,
1848 -1, 85, 86, 735, -1, 89, 90, -1, -1, 93,
1849 -1, -1, 82, -1, -1, 85, 86, 749, 102, 103,
1850 104, 105, -1, 755, 108, 109, 96, -1, -1, -1,
1851 762, -1, 764, -1, 1, 767, -1, 769, -1, 771,
1852 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1853 476, -1, -1, -1, -1, -1, 482, 369, 370, 371,
1854 372, 373, 374, 375, 376, 377, 378, 379, 380, -1,
1855 382, 383, 384, 385, 386, 387, 388, 44, 45, 46,
1856 47, 48, 49, 50, 51, -1, -1, 54, -1, -1,
1857 -1, 58, 59, -1, -1, 62, -1, -1, 65, 66,
1858 67, 68, -1, 70, 71, 72, 73, 44, 1, 76,
1859 -1, -1, -1, 50, -1, 82, -1, -1, 85, 86,
1860 -1, -1, 59, -1, 61, -1, 93, -1, 95, 96,
1861 67, -1, 99, -1, -1, 102, 103, 104, 105, -1,
1862 -1, 108, 109, -1, -1, 82, -1, -1, 85, 86,
1863 -1, 44, 45, 46, 47, 48, 49, 50, 51, 96,
1864 -1, 54, -1, -1, 476, 58, 59, -1, -1, 62,
1865 482, -1, 65, 66, 67, 68, 1, 70, 71, 72,
1866 73, -1, -1, 76, -1, 611, 612, -1, -1, 82,
1867 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
1868 93, 627, 95, 96, -1, -1, 99, -1, -1, 102,
1869 103, 104, 105, -1, -1, 108, 109, -1, -1, 44,
1870 45, 46, 47, 48, 49, 50, 51, -1, -1, 54,
1871 -1, -1, -1, 58, 59, -1, -1, 62, -1, -1,
1872 65, 66, 67, 68, -1, 70, 71, 72, 73, -1,
1873 -1, 76, -1, -1, -1, -1, -1, 82, -1, 1,
1874 85, 86, -1, -1, -1, -1, -1, -1, 93, -1,
1875 95, 96, -1, -1, 99, -1, -1, 102, 103, 104,
1876 105, -1, -1, 108, 109, -1, -1, -1, -1, -1,
1877 -1, -1, -1, -1, -1, -1, -1, -1, -1, 611,
1878 612, -1, 44, 45, 46, -1, 48, 49, 50, 51,
1879 -1, -1, 54, -1, -1, 627, 58, 59, -1, -1,
1880 -1, -1, -1, 65, 66, 67, 68, 1, 70, 71,
1881 72, 73, -1, -1, 76, -1, -1, -1, -1, -1,
1882 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
1883 -1, 93, -1, 95, 96, -1, -1, 99, -1, -1,
1884 102, 103, 104, 105, -1, -1, 108, 109, -1, -1,
1885 44, 45, 46, -1, 48, 49, 50, 51, -1, -1,
1886 54, -1, -1, -1, 58, 59, -1, -1, -1, -1,
1887 -1, 65, 66, 67, 68, 1, 70, 71, 72, 73,
1888 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1889 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1890 -1, 95, -1, -1, -1, 99, -1, -1, 102, 103,
1891 104, 105, -1, -1, 108, 109, -1, -1, 44, 45,
1892 46, -1, 48, 49, 50, 51, -1, -1, 54, -1,
1893 -1, -1, 58, 59, -1, -1, -1, -1, -1, 65,
1894 66, 1, 68, -1, 70, 71, 72, 73, -1, -1,
1895 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1896 86, -1, -1, -1, -1, -1, -1, 93, -1, 95,
1897 -1, -1, -1, 99, -1, -1, 102, 103, 104, 105,
1898 -1, -1, 108, 109, 44, 45, 46, -1, 48, 49,
1899 50, 51, -1, -1, 54, -1, -1, -1, 58, 59,
1900 -1, -1, -1, -1, -1, 65, 66, -1, 68, -1,
1901 70, 71, 72, 73, -1, 1, 76, 3, 4, -1,
1902 -1, -1, 82, -1, -1, 85, 86, -1, -1, -1,
1903 -1, -1, -1, 93, -1, 95, -1, -1, -1, 99,
1904 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1905 -1, -1, -1, -1, -1, -1, -1, -1, -1, 45,
1906 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1907 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1908 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1909 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1910 86, -1, -1, 89, 90, -1, -1, 93, -1, 95,
1911 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
1912 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1913 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1914 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1915 85, 86, -1, 88, 89, 90, -1, -1, 93, -1,
1916 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
1917 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1918 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1919 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
1920 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1921 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1922 90, -1, -1, 93, -1, -1, 45, 46, 98, -1,
1923 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
1924 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
1925 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1926 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1927 89, 90, -1, -1, 93, 94, -1, -1, -1, -1,
1928 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1929 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
1930 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
1931 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1932 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1933 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1934 -1, -1, 45, 46, -1, 99, -1, 50, 102, 103,
1935 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
1936 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
1937 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1938 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1939 93, -1, -1, -1, -1, 98, -1, -1, -1, 102,
1940 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
1941 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
1942 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
1943 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1944 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1945 -1, 89, 90, -1, -1, 93, 94, -1, 45, 46,
1946 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
1947 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
1948 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
1949 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1950 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
1951 -1, 98, -1, -1, -1, 102, 103, 104, 105, -1,
1952 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
1953 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
1954 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
1955 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1956 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1957 -1, 93, 94, -1, 45, 46, -1, -1, -1, 50,
1958 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
1959 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
1960 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1961 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1962 -1, -1, 93, 94, -1, -1, -1, -1, -1, -1,
1963 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
1964 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1965 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1966 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1967 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1968 86, -1, -1, 89, 90, -1, -1, 93, 94, -1,
1969 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
1970 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1971 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1972 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1973 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
1974 -1, -1, -1, -1, 99, -1, -1, 102, 103, 104,
1975 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1976 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1977 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
1978 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1979 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1980 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
1981 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
1982 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
1983 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1984 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1985 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
1986 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1987 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
1988 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
1989 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1990 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1991 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1992 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
1993 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
1994 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
1995 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1996 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1997 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
1998 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
1999 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2000 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2001 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2002 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2003 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2004 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2005 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
2006 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
2007 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2008 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
2009 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2010 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
2011 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
2012 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
2013 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2014 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2015 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
2016 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2017 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
2018 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2019 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2020 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
2021 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2022 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
2023 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2024 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2025 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2026 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2027 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2028 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2029 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
2030 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2031 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2032 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2033 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2034 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2035 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2036 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2037 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2038 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2039 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2040 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
2041 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2042 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2043 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2044 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2045 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
2046 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2047 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2048 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2049 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2050 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2051 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2052 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
2053 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2054 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2055 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
2056 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2057 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2058 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2059 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2060 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2061 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2062 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2063 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
2064 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
2065 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2066 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
2067 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2068 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
2069 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
2070 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
2071 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2072 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2073 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
2074 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2075 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
2076 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2077 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2078 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
2079 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2080 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
2081 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2082 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2083 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2084 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2085 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2086 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2087 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
2088 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2089 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2090 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2091 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2092 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2093 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2094 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2095 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2096 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2097 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2098 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
2099 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2100 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2101 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2102 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2103 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
2104 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2105 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2106 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2107 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2108 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2109 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2110 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
2111 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2112 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2113 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
2114 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2115 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2116 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2117 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2118 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2119 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2120 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2121 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
2122 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
2123 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2124 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
2125 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2126 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
2127 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
2128 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
2129 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2130 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2131 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
2132 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2133 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
2134 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2135 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2136 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
2137 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2138 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
2139 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2140 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2141 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2142 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
2143 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2144 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2145 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
2146 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2147 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
2148 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2149 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2150 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
2151 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2152 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2153 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2154 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2155 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2156 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
2157 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2158 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2159 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2160 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2161 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
2162 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2163 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2164 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2165 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2166 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2167 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2168 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
2169 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2170 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2171 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
2172 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2173 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2174 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2175 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2176 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2177 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2178 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2179 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
2180 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
2181 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2182 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
2183 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2184 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
2185 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
2186 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
2187 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
2188 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
2189 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
2190 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2191 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
2192 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2193 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2194 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
2195 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2196 46, -1, -1, -1, 50, -1, 1, -1, -1, -1,
2197 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2198 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2199 76, 1, -1, -1, -1, -1, 82, -1, -1, 85,
2200 86, -1, -1, 89, 90, -1, -1, 93, -1, 44,
2201 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2202 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2203 65, -1, -1, 1, -1, 45, 46, 72, -1, -1,
2204 50, 76, -1, -1, -1, -1, -1, 82, -1, 59,
2205 85, 86, -1, -1, -1, 65, -1, -1, 93, -1,
2206 3, 4, 72, -1, 99, -1, 76, 102, 103, 104,
2207 105, -1, 82, 108, 109, 85, 86, 45, 46, -1,
2208 -1, -1, 50, 93, 94, -1, -1, -1, -1, -1,
2209 -1, 59, 102, 103, 104, 105, -1, 65, 108, 109,
2210 1, -1, 45, 46, 72, -1, -1, 50, 76, -1,
2211 -1, -1, -1, -1, 82, -1, 59, 85, 86, -1,
2212 -1, -1, 65, -1, -1, 93, 94, 3, 4, 72,
2213 -1, -1, -1, 76, 102, 103, 104, 105, -1, 82,
2214 108, 109, 85, 86, 45, 46, 89, 90, -1, 50,
2215 93, -1, 95, 96, -1, -1, -1, -1, 59, 102,
2216 103, 104, 105, -1, 65, 108, 109, -1, -1, 45,
2217 46, 72, -1, -1, 50, 76, -1, -1, 3, 4,
2218 -1, 82, -1, 59, 85, 86, -1, -1, -1, 65,
2219 -1, -1, 93, -1, -1, -1, 72, -1, -1, -1,
2220 76, 102, 103, 104, 105, -1, 82, 108, 109, 85,
2221 86, -1, -1, 89, 90, -1, -1, 93, 94, -1,
2222 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2223 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2224 65, -1, -1, 3, 4, -1, -1, 72, -1, -1,
2225 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2226 85, 86, -1, -1, 89, 90, -1, -1, 93, 94,
2227 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2228 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2229 50, -1, -1, -1, 3, 4, -1, -1, -1, 59,
2230 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2231 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2232 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2233 90, -1, -1, 93, 94, -1, 45, 46, -1, -1,
2234 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2235 59, -1, -1, -1, -1, -1, 65, -1, -1, 3,
2236 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2237 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2238 89, 90, -1, -1, 93, 94, -1, -1, -1, -1,
2239 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2240 109, 45, 46, -1, -1, -1, 50, -1, -1, -1,
2241 -1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
2242 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2243 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2244 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2245 -1, 44, 45, 46, -1, -1, -1, 50, 102, 103,
2246 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2247 -1, -1, 65, -1, -1, -1, -1, -1, -1, 72,
2248 -1, -1, 50, 76, -1, -1, -1, -1, -1, 82,
2249 -1, 59, 85, 86, -1, -1, -1, 65, -1, -1,
2250 93, -1, -1, -1, 72, -1, -1, -1, 76, 102,
2251 103, 104, 105, -1, 82, 108, 109, 85, 86, -1,
2252 -1, 89, 90, -1, -1, 93, -1, -1, -1, -1,
2253 -1, -1, -1, -1, 102, 103, 104, 105, -1, -1,
2258 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2259 #line 3 "/usr/cygnus/gnupro-98r1/share/bison.simple"
2261 /* Skeleton output parser for bison,
2262 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2264 This program is free software; you can redistribute it and/or modify
2265 it under the terms of the GNU General Public License as published by
2266 the Free Software Foundation; either version 2, or (at your option)
2269 This program is distributed in the hope that it will be useful,
2270 but WITHOUT ANY WARRANTY; without even the implied warranty of
2271 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2272 GNU General Public License for more details.
2274 You should have received a copy of the GNU General Public License
2275 along with this program; if not, write to the Free Software
2276 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
2278 /* As a special exception, when this file is copied by Bison into a
2279 Bison output file, you may use that output file without restriction.
2280 This special exception was added by the Free Software Foundation
2281 in version 1.24 of Bison. */
2285 #define alloca __builtin_alloca
2286 #else /* not GNU C. */
2287 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
2289 #else /* not sparc */
2290 #if defined (MSDOS) && !defined (__TURBOC__)
2292 #else /* not MSDOS, or __TURBOC__ */
2296 #else /* not MSDOS, __TURBOC__, or _AIX */
2300 void *alloca (unsigned int);
2302 #else /* not __cplusplus */
2304 #endif /* not __cplusplus */
2306 #endif /* not _AIX */
2307 #endif /* not MSDOS, or __TURBOC__ */
2308 #endif /* not sparc. */
2309 #endif /* not GNU C. */
2310 #endif /* alloca not defined. */
2312 /* This is the parser code that is written into each bison parser
2313 when the %semantic_parser declaration is not specified in the grammar.
2314 It was written by Richard Stallman by simplifying the hairy parser
2315 used when %semantic_parser is specified. */
2317 /* Note: there must be only one dollar sign in this file.
2318 It is replaced by the list of actions, each action
2319 as one case of the switch. */
2321 #define yyerrok (yyerrstatus = 0)
2322 #define yyclearin (yychar = YYEMPTY)
2325 #define YYACCEPT return(0)
2326 #define YYABORT return(1)
2327 #define YYERROR goto yyerrlab1
2328 /* Like YYERROR except do call yyerror.
2329 This remains here temporarily to ease the
2330 transition to the new meaning of YYERROR, for GCC.
2331 Once GCC version 2 has supplanted version 1, this can go. */
2332 #define YYFAIL goto yyerrlab
2333 #define YYRECOVERING() (!!yyerrstatus)
2334 #define YYBACKUP(token, value) \
2336 if (yychar == YYEMPTY && yylen == 1) \
2337 { yychar = (token), yylval = (value); \
2338 yychar1 = YYTRANSLATE (yychar); \
2343 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2347 #define YYERRCODE 256
2350 #define YYLEX yylex()
2356 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2358 #define YYLEX yylex(&yylval, &yylloc)
2360 #else /* not YYLSP_NEEDED */
2362 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2364 #define YYLEX yylex(&yylval)
2366 #endif /* not YYLSP_NEEDED */
2369 /* If nonreentrant, generate the variables here */
2373 int yychar
; /* the lookahead symbol */
2374 YYSTYPE yylval
; /* the semantic value of the */
2375 /* lookahead symbol */
2378 YYLTYPE yylloc
; /* location data for the lookahead */
2382 int yynerrs
; /* number of parse errors so far */
2383 #endif /* not YYPURE */
2386 int yydebug
; /* nonzero means print parse trace */
2387 /* Since this is uninitialized, it does not stop multiple parsers
2391 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2394 #define YYINITDEPTH 200
2397 /* YYMAXDEPTH is the maximum size the stacks can grow to
2398 (effective only if the built-in stack extension method is used). */
2405 #define YYMAXDEPTH 10000
2408 /* Prevent warning if -Wstrict-prototypes. */
2413 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2414 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2415 #else /* not GNU C or C++ */
2418 /* This is the most reliable way to avoid incompatibilities
2419 in available built-in functions on various systems. */
2421 __yy_memcpy (to
, from
, count
)
2426 register char *f
= from
;
2427 register char *t
= to
;
2428 register int i
= count
;
2434 #else /* __cplusplus */
2436 /* This is the most reliable way to avoid incompatibilities
2437 in available built-in functions on various systems. */
2439 __yy_memcpy (char *to
, char *from
, int count
)
2441 register char *f
= from
;
2442 register char *t
= to
;
2443 register int i
= count
;
2452 #line 196 "/usr/cygnus/gnupro-98r1/share/bison.simple"
2454 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2455 into yyparse. The argument should have type void *.
2456 It should actually point to an object.
2457 Grammar actions can access the variable by casting it
2458 to the proper pointer type. */
2460 #ifdef YYPARSE_PARAM
2462 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2463 #define YYPARSE_PARAM_DECL
2464 #else /* not __cplusplus */
2465 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2466 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2467 #endif /* not __cplusplus */
2468 #else /* not YYPARSE_PARAM */
2469 #define YYPARSE_PARAM_ARG
2470 #define YYPARSE_PARAM_DECL
2471 #endif /* not YYPARSE_PARAM */
2474 yyparse(YYPARSE_PARAM_ARG
)
2477 register int yystate
;
2479 register short *yyssp
;
2480 register YYSTYPE
*yyvsp
;
2481 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
2482 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
2484 short yyssa
[YYINITDEPTH
]; /* the state stack */
2485 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
2487 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
2488 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
2491 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
2492 YYLTYPE
*yyls
= yylsa
;
2495 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2497 #define YYPOPSTACK (yyvsp--, yyssp--)
2500 int yystacksize
= YYINITDEPTH
;
2511 YYSTYPE yyval
; /* the variable used to return */
2512 /* semantic values from the action */
2519 fprintf(stderr
, "Starting parse\n");
2525 yychar
= YYEMPTY
; /* Cause a token to be read. */
2527 /* Initialize stack pointers.
2528 Waste one element of value and location stack
2529 so that they stay on the same level as the state stack.
2530 The wasted elements are never initialized. */
2538 /* Push a new state, which is found in yystate . */
2539 /* In all cases, when you get here, the value and location stacks
2540 have just been pushed. so pushing a state here evens the stacks. */
2545 if (yyssp
>= yyss
+ yystacksize
- 1)
2547 /* Give user a chance to reallocate the stack */
2548 /* Use copies of these so that the &'s don't force the real ones into memory. */
2549 YYSTYPE
*yyvs1
= yyvs
;
2550 short *yyss1
= yyss
;
2552 YYLTYPE
*yyls1
= yyls
;
2555 /* Get the current used size of the three stacks, in elements. */
2556 int size
= yyssp
- yyss
+ 1;
2559 /* Each stack pointer address is followed by the size of
2560 the data in use in that stack, in bytes. */
2562 /* This used to be a conditional around just the two extra args,
2563 but that might be undefined if yyoverflow is a macro. */
2564 yyoverflow("parser stack overflow",
2565 &yyss1
, size
* sizeof (*yyssp
),
2566 &yyvs1
, size
* sizeof (*yyvsp
),
2567 &yyls1
, size
* sizeof (*yylsp
),
2570 yyoverflow("parser stack overflow",
2571 &yyss1
, size
* sizeof (*yyssp
),
2572 &yyvs1
, size
* sizeof (*yyvsp
),
2576 yyss
= yyss1
; yyvs
= yyvs1
;
2580 #else /* no yyoverflow */
2581 /* Extend the stack our own way. */
2582 if (yystacksize
>= YYMAXDEPTH
)
2584 yyerror("parser stack overflow");
2588 if (yystacksize
> YYMAXDEPTH
)
2589 yystacksize
= YYMAXDEPTH
;
2590 yyss
= (short *) alloca (yystacksize
* sizeof (*yyssp
));
2591 __yy_memcpy ((char *)yyss
, (char *)yyss1
, size
* sizeof (*yyssp
));
2592 yyvs
= (YYSTYPE
*) alloca (yystacksize
* sizeof (*yyvsp
));
2593 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
, size
* sizeof (*yyvsp
));
2595 yyls
= (YYLTYPE
*) alloca (yystacksize
* sizeof (*yylsp
));
2596 __yy_memcpy ((char *)yyls
, (char *)yyls1
, size
* sizeof (*yylsp
));
2598 #endif /* no yyoverflow */
2600 yyssp
= yyss
+ size
- 1;
2601 yyvsp
= yyvs
+ size
- 1;
2603 yylsp
= yyls
+ size
- 1;
2608 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
2611 if (yyssp
>= yyss
+ yystacksize
- 1)
2617 fprintf(stderr
, "Entering state %d\n", yystate
);
2623 /* Do appropriate processing given the current state. */
2624 /* Read a lookahead token if we need one and don't already have one. */
2627 /* First try to decide what to do without reference to lookahead token. */
2629 yyn
= yypact
[yystate
];
2633 /* Not known => get a lookahead token if don't already have one. */
2635 /* yychar is either YYEMPTY or YYEOF
2636 or a valid token in external form. */
2638 if (yychar
== YYEMPTY
)
2642 fprintf(stderr
, "Reading a token: ");
2647 /* Convert token to internal form (in yychar1) for indexing tables with */
2649 if (yychar
<= 0) /* This means end of input. */
2652 yychar
= YYEOF
; /* Don't call YYLEX any more */
2656 fprintf(stderr
, "Now at end of input.\n");
2661 yychar1
= YYTRANSLATE(yychar
);
2666 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
2667 /* Give the individual parser a way to print the precise meaning
2668 of a token, for further debugging info. */
2670 YYPRINT (stderr
, yychar
, yylval
);
2672 fprintf (stderr
, ")\n");
2678 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
2683 /* yyn is what to do for this token type in this state.
2684 Negative => reduce, -yyn is rule number.
2685 Positive => shift, yyn is new state.
2686 New state is final state => don't bother to shift,
2687 just return success.
2688 0, or most negative number => error. */
2703 /* Shift the lookahead token. */
2707 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
2710 /* Discard the token being shifted unless it is eof. */
2711 if (yychar
!= YYEOF
)
2719 /* count tokens shifted since error; after three, turn off error status. */
2720 if (yyerrstatus
) yyerrstatus
--;
2725 /* Do the default action for the current state. */
2728 yyn
= yydefact
[yystate
];
2732 /* Do a reduction. yyn is the number of a rule to reduce with. */
2736 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
2743 fprintf (stderr
, "Reducing via rule %d (line %d), ",
2746 /* Print the symbols being reduced, and their result. */
2747 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
2748 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
2749 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
2757 #line 486 "./parse.y"
2761 #line 530 "./parse.y"
2763 yyval
.node
= build_java_array_type (yyvsp
[-2].node
, -1);
2764 CLASS_LOADED_P (yyval
.node
) = 1;
2768 #line 535 "./parse.y"
2769 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
2772 #line 537 "./parse.y"
2773 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
2776 #line 539 "./parse.y"
2777 {RULE ("']' expected"); RECOVER
;;
2780 #line 541 "./parse.y"
2781 {RULE ("']' expected"); RECOVER
;;
2784 #line 556 "./parse.y"
2785 { yyval
.node
= make_qualified_name (yyvsp
[-2].node
, yyvsp
[0].node
, yyvsp
[-1].operator.location
); ;
2788 #line 565 "./parse.y"
2789 {yyval
.node
= NULL
;;
2792 #line 577 "./parse.y"
2798 #line 581 "./parse.y"
2804 #line 593 "./parse.y"
2805 { ctxp
->package
= EXPR_WFL_NODE (yyvsp
[-1].node
); ;
2808 #line 595 "./parse.y"
2809 {yyerror ("Missing name"); RECOVER
;;
2812 #line 597 "./parse.y"
2813 {yyerror ("';' expected"); RECOVER
;;
2816 #line 607 "./parse.y"
2818 tree name
= EXPR_WFL_NODE (yyvsp
[-1].node
), node
, last_name
;
2819 int i
= IDENTIFIER_LENGTH (name
)-1;
2820 const char *last
= &IDENTIFIER_POINTER (name
)[i
];
2821 while (last
!= IDENTIFIER_POINTER (name
))
2823 if (last
[0] == '.')
2827 last_name
= get_identifier (++last
);
2828 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name
))
2830 tree err
= find_name_in_single_imports (last_name
);
2831 if (err
&& err
!= name
)
2833 (yyvsp
[-1].node
, "Ambiguous class: `%s' and `%s'",
2834 IDENTIFIER_POINTER (name
),
2835 IDENTIFIER_POINTER (err
));
2837 REGISTER_IMPORT (yyvsp
[-1].node
, last_name
)
2840 REGISTER_IMPORT (yyvsp
[-1].node
, last_name
);
2844 #line 633 "./parse.y"
2845 {yyerror ("Missing name"); RECOVER
;;
2848 #line 635 "./parse.y"
2849 {yyerror ("';' expected"); RECOVER
;;
2852 #line 640 "./parse.y"
2854 tree name
= EXPR_WFL_NODE (yyvsp
[-3].node
);
2855 /* Don't import java.lang.* twice. */
2856 if (name
!= java_lang_id
)
2858 tree node
= build_tree_list (yyvsp
[-3].node
, NULL_TREE
);
2859 read_import_dir (yyvsp
[-3].node
);
2860 TREE_CHAIN (node
) = ctxp
->import_demand_list
;
2861 ctxp
->import_demand_list
= node
;
2866 #line 652 "./parse.y"
2867 {yyerror ("'*' expected"); RECOVER
;;
2870 #line 654 "./parse.y"
2871 {yyerror ("';' expected"); RECOVER
;;
2874 #line 659 "./parse.y"
2876 maybe_generate_finit ();
2877 maybe_generate_clinit ();
2878 yyval
.node
= yyvsp
[0].node
;
2882 #line 665 "./parse.y"
2884 maybe_generate_clinit ();
2885 yyval
.node
= yyvsp
[0].node
;
2889 #line 670 "./parse.y"
2890 { yyval
.node
= NULL
; ;
2893 #line 672 "./parse.y"
2896 yyerror ("Class or interface declaration expected");
2900 #line 683 "./parse.y"
2902 yyval
.value
= (1 << yyvsp
[0].value
);
2906 #line 687 "./parse.y"
2908 int acc
= (1 << yyvsp
[0].value
);
2909 if (yyval
.value
& acc
)
2911 (ctxp
->modifier_ctx
[yyvsp
[0].value
], "Modifier `%s' declared twice",
2912 java_accstring_lookup (acc
));
2920 #line 703 "./parse.y"
2921 { create_class (yyvsp
[-4].value
, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
2924 #line 705 "./parse.y"
2926 yyval
.node
= yyvsp
[0].node
;
2930 #line 709 "./parse.y"
2931 { create_class (0, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
2934 #line 711 "./parse.y"
2936 yyval
.node
= yyvsp
[0].node
;
2940 #line 715 "./parse.y"
2941 {yyerror ("Missing class name"); RECOVER
;;
2944 #line 717 "./parse.y"
2945 {yyerror ("Missing class name"); RECOVER
;;
2948 #line 719 "./parse.y"
2950 if (!ctxp
->class_err
) yyerror ("'{' expected");
2955 #line 724 "./parse.y"
2956 {if (!ctxp
->class_err
) yyerror ("'{' expected"); RECOVER
;;
2959 #line 728 "./parse.y"
2960 { yyval
.node
= NULL
; ;
2963 #line 730 "./parse.y"
2964 { yyval
.node
= yyvsp
[0].node
; ;
2967 #line 732 "./parse.y"
2968 {yyerror ("'{' expected"); ctxp
->class_err
=1;;
2971 #line 734 "./parse.y"
2972 {yyerror ("Missing super class name"); ctxp
->class_err
=1;;
2975 #line 738 "./parse.y"
2976 { yyval
.node
= NULL_TREE
; ;
2979 #line 740 "./parse.y"
2980 { yyval
.node
= yyvsp
[0].node
; ;
2983 #line 742 "./parse.y"
2986 yyerror ("Missing interface name");
2990 #line 750 "./parse.y"
2992 ctxp
->interface_number
= 1;
2993 yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
);
2997 #line 755 "./parse.y"
2999 ctxp
->interface_number
++;
3000 yyval
.node
= chainon (yyvsp
[-2].node
, build_tree_list (yyvsp
[0].node
, NULL_TREE
));
3004 #line 760 "./parse.y"
3005 {yyerror ("Missing interface name"); RECOVER
;;
3008 #line 765 "./parse.y"
3010 /* Store the location of the `}' when doing xrefs */
3012 DECL_END_SOURCE_LINE (ctxp
->current_parsed_class
) =
3013 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
3014 yyval
.node
= ctxp
->current_parsed_class
;
3018 #line 773 "./parse.y"
3020 /* Store the location of the `}' when doing xrefs */
3022 DECL_END_SOURCE_LINE (ctxp
->current_parsed_class
) =
3023 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
3024 yyval
.node
= ctxp
->current_parsed_class
;
3028 #line 792 "./parse.y"
3029 { yyval
.node
= parse_jdk1_1_error ("instance initializer"); ;
3032 #line 798 "./parse.y"
3033 { yyval
.node
= yyvsp
[-1].node
; ;
3036 #line 801 "./parse.y"
3037 { yyval
.node
= parse_jdk1_1_error ("inner classe declaration"); ;
3040 #line 803 "./parse.y"
3041 { yyval
.node
= parse_jdk1_1_error ("inner interface declaration"); ;
3044 #line 809 "./parse.y"
3045 { register_fields (0, yyvsp
[-2].node
, yyvsp
[-1].node
); ;
3048 #line 811 "./parse.y"
3051 ("Illegal modifier `%s' for field declaration",
3052 yyvsp
[-3].value
, FIELD_MODIFIERS
);
3053 check_modifiers_consistency (yyvsp
[-3].value
);
3054 register_fields (yyvsp
[-3].value
, yyvsp
[-2].node
, yyvsp
[-1].node
);
3058 #line 824 "./parse.y"
3059 { yyval
.node
= chainon (yyvsp
[-2].node
, yyvsp
[0].node
); ;
3062 #line 826 "./parse.y"
3063 {yyerror ("Missing term"); RECOVER
;;
3066 #line 831 "./parse.y"
3067 { yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
); ;
3070 #line 833 "./parse.y"
3072 if (java_error_count
)
3073 yyvsp
[0].node
= NULL_TREE
;
3074 yyval
.node
= build_tree_list
3075 (yyvsp
[-2].node
, build_assignment (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
));
3079 #line 840 "./parse.y"
3081 yyerror ("Missing variable initializer");
3082 yyval
.node
= build_tree_list (yyvsp
[-2].node
, NULL_TREE
);
3087 #line 846 "./parse.y"
3089 yyerror ("';' expected");
3090 yyval
.node
= build_tree_list (yyvsp
[-3].node
, NULL_TREE
);
3095 #line 856 "./parse.y"
3096 { yyval
.node
= build_unresolved_array_type (yyvsp
[-2].node
); ;
3099 #line 858 "./parse.y"
3100 {yyerror ("Invalid declaration"); DRECOVER(vdi
);;
3103 #line 860 "./parse.y"
3104 {yyerror ("']' expected"); DRECOVER(vdi
);;
3107 #line 862 "./parse.y"
3108 {yyerror ("Unbalanced ']'"); DRECOVER(vdi
);;
3111 #line 873 "./parse.y"
3113 current_function_decl
= yyvsp
[0].node
;
3114 source_start_java_method (current_function_decl
);
3118 #line 878 "./parse.y"
3119 { finish_method_declaration (yyvsp
[0].node
); ;
3122 #line 880 "./parse.y"
3123 {YYNOT_TWICE
yyerror ("'{' expected"); RECOVER
;;
3126 #line 885 "./parse.y"
3127 { yyval
.node
= method_header (0, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3130 #line 887 "./parse.y"
3131 { yyval
.node
= method_header (0, void_type_node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3134 #line 889 "./parse.y"
3135 { yyval
.node
= method_header (yyvsp
[-3].value
, yyvsp
[-2].node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3138 #line 891 "./parse.y"
3139 { yyval
.node
= method_header (yyvsp
[-3].value
, void_type_node
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3142 #line 893 "./parse.y"
3144 yyerror ("Invalid method declaration, method name required");
3149 #line 898 "./parse.y"
3153 #line 900 "./parse.y"
3154 {yyerror ("Identifier expected"); RECOVER
;;
3157 #line 902 "./parse.y"
3158 {yyerror ("Identifier expected"); RECOVER
;;
3161 #line 904 "./parse.y"
3163 yyerror ("Invalid method declaration, return type required");
3168 #line 912 "./parse.y"
3169 { yyval
.node
= method_declarator (yyvsp
[-2].node
, NULL_TREE
); ;
3172 #line 914 "./parse.y"
3173 { yyval
.node
= method_declarator (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
3176 #line 916 "./parse.y"
3178 EXPR_WFL_LINECOL (wfl_operator
) = yyvsp
[-1].operator.location
;
3179 TREE_PURPOSE (yyvsp
[-2].node
) =
3180 build_unresolved_array_type (TREE_PURPOSE (yyvsp
[-2].node
));
3181 parse_warning_context
3183 "Discouraged form of returned type specification");
3187 #line 925 "./parse.y"
3188 {yyerror ("')' expected"); DRECOVER(method_declarator
);;
3191 #line 927 "./parse.y"
3192 {yyerror ("']' expected"); RECOVER
;;
3195 #line 932 "./parse.y"
3197 ctxp
->formal_parameter_number
= 1;
3201 #line 936 "./parse.y"
3203 ctxp
->formal_parameter_number
+= 1;
3204 yyval
.node
= chainon (yyvsp
[-2].node
, yyvsp
[0].node
);
3208 #line 941 "./parse.y"
3209 {yyerror ("Missing formal parameter term"); RECOVER
;;
3212 #line 946 "./parse.y"
3214 yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[-1].node
);
3218 #line 950 "./parse.y"
3220 parse_jdk1_1_error ("final parameters");
3221 yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[-1].node
);
3225 #line 955 "./parse.y"
3226 {yyerror ("Missing identifier"); RECOVER
;;
3229 #line 957 "./parse.y"
3231 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp
[-2].value
));
3232 yyerror ("Missing identifier"); RECOVER
;
3236 #line 964 "./parse.y"
3237 { yyval
.node
= NULL_TREE
; ;
3240 #line 966 "./parse.y"
3241 { yyval
.node
= yyvsp
[0].node
; ;
3244 #line 968 "./parse.y"
3245 {yyerror ("Missing class type term"); RECOVER
;;
3248 #line 973 "./parse.y"
3249 { yyval
.node
= build_tree_list (yyvsp
[0].node
, yyvsp
[0].node
); ;
3252 #line 975 "./parse.y"
3253 { yyval
.node
= tree_cons (yyvsp
[0].node
, yyvsp
[0].node
, yyvsp
[-2].node
); ;
3256 #line 977 "./parse.y"
3257 {yyerror ("Missing class type term"); RECOVER
;;
3260 #line 984 "./parse.y"
3261 { yyval
.node
= NULL_TREE
; ;
3264 #line 990 "./parse.y"
3266 TREE_CHAIN (yyvsp
[0].node
) = ctxp
->static_initialized
;
3267 ctxp
->static_initialized
= yyvsp
[0].node
;
3271 #line 995 "./parse.y"
3273 TREE_CHAIN (yyvsp
[-1].node
) = ctxp
->static_initialized
;
3274 ctxp
->static_initialized
= yyvsp
[-1].node
;
3278 #line 1003 "./parse.y"
3280 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp
[0].value
));
3284 #line 1011 "./parse.y"
3286 current_function_decl
= yyvsp
[0].node
;
3287 source_start_java_method (current_function_decl
);
3291 #line 1016 "./parse.y"
3292 { finish_method_declaration (yyvsp
[0].node
); ;
3295 #line 1021 "./parse.y"
3296 { yyval
.node
= method_header (0, NULL_TREE
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3299 #line 1023 "./parse.y"
3300 { yyval
.node
= method_header (yyvsp
[-2].value
, NULL_TREE
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3303 #line 1028 "./parse.y"
3304 { yyval
.node
= method_declarator (yyvsp
[-2].node
, NULL_TREE
); ;
3307 #line 1030 "./parse.y"
3308 { yyval
.node
= method_declarator (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
3311 #line 1038 "./parse.y"
3313 BLOCK_EXPR_BODY (yyvsp
[0].node
) = empty_stmt_node
;
3314 yyval
.node
= yyvsp
[0].node
;
3318 #line 1043 "./parse.y"
3319 { yyval
.node
= yyvsp
[0].node
; ;
3322 #line 1045 "./parse.y"
3323 { yyval
.node
= yyvsp
[0].node
; ;
3326 #line 1047 "./parse.y"
3327 { yyval
.node
= yyvsp
[0].node
; ;
3330 #line 1057 "./parse.y"
3332 yyval
.node
= build_method_invocation (yyvsp
[-3].node
, NULL_TREE
);
3333 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-3].node
), yyval
.node
);
3334 yyval
.node
= java_method_add_stmt (current_function_decl
, yyval
.node
);
3338 #line 1063 "./parse.y"
3340 yyval
.node
= build_method_invocation (yyvsp
[-4].node
, yyvsp
[-2].node
);
3341 yyval
.node
= build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyval
.node
);
3342 yyval
.node
= java_method_add_stmt (current_function_decl
, yyval
.node
);
3346 #line 1071 "./parse.y"
3347 {yyval
.node
= parse_jdk1_1_error ("explicit constructor invocation"); ;
3350 #line 1073 "./parse.y"
3351 {yyval
.node
= parse_jdk1_1_error ("explicit constructor invocation"); ;
3354 #line 1078 "./parse.y"
3356 tree wfl
= build_wfl_node (this_identifier_node
);
3357 EXPR_WFL_LINECOL (wfl
) = yyvsp
[0].operator.location
;
3362 #line 1084 "./parse.y"
3364 tree wfl
= build_wfl_node (super_identifier_node
);
3365 EXPR_WFL_LINECOL (wfl
) = yyvsp
[0].operator.location
;
3370 #line 1095 "./parse.y"
3371 { create_interface (0, yyvsp
[0].node
, NULL_TREE
); ;
3374 #line 1097 "./parse.y"
3376 yyval
.node
= yyvsp
[0].node
;
3380 #line 1101 "./parse.y"
3381 { create_interface (yyvsp
[-2].value
, yyvsp
[0].node
, NULL_TREE
); ;
3384 #line 1103 "./parse.y"
3386 yyval
.node
= yyvsp
[0].node
;
3390 #line 1107 "./parse.y"
3391 { create_interface (0, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3394 #line 1109 "./parse.y"
3396 yyval
.node
= yyvsp
[0].node
;
3400 #line 1113 "./parse.y"
3401 { create_interface (yyvsp
[-3].value
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3404 #line 1115 "./parse.y"
3406 yyval
.node
= yyvsp
[0].node
;
3410 #line 1119 "./parse.y"
3411 {yyerror ("'{' expected"); RECOVER
;;
3414 #line 1121 "./parse.y"
3415 {yyerror ("'{' expected"); RECOVER
;;
3418 #line 1126 "./parse.y"
3420 ctxp
->interface_number
= 1;
3421 yyval
.node
= build_tree_list (yyvsp
[0].node
, NULL_TREE
);
3425 #line 1131 "./parse.y"
3427 ctxp
->interface_number
++;
3428 yyval
.node
= chainon (yyvsp
[-2].node
, build_tree_list (yyvsp
[0].node
, NULL_TREE
));
3432 #line 1136 "./parse.y"
3433 {yyerror ("Invalid interface type"); RECOVER
;;
3436 #line 1138 "./parse.y"
3437 {yyerror ("Missing term"); RECOVER
;;
3440 #line 1143 "./parse.y"
3441 { yyval
.node
= NULL_TREE
; ;
3444 #line 1145 "./parse.y"
3445 { yyval
.node
= NULL_TREE
; ;
3448 #line 1157 "./parse.y"
3449 { yyval
.node
= parse_jdk1_1_error ("inner class declaration"); ;
3452 #line 1159 "./parse.y"
3453 { yyval
.node
= parse_jdk1_1_error ("inner interface declaration"); ;
3456 #line 1168 "./parse.y"
3458 check_abstract_method_header (yyvsp
[-1].node
);
3459 current_function_decl
= NULL_TREE
; /* FIXME ? */
3463 #line 1173 "./parse.y"
3464 {yyerror ("';' expected"); RECOVER
;;
3467 #line 1179 "./parse.y"
3468 { yyval
.node
= build_new_array_init (yyvsp
[-1].operator.location
, NULL_TREE
); ;
3471 #line 1181 "./parse.y"
3472 { yyval
.node
= build_new_array_init (yyvsp
[-2].operator.location
, yyvsp
[-1].node
); ;
3475 #line 1183 "./parse.y"
3476 { yyval
.node
= build_new_array_init (yyvsp
[-3].operator.location
, yyvsp
[-2].node
); ;
3479 #line 1188 "./parse.y"
3481 yyval
.node
= tree_cons (maybe_build_array_element_wfl (yyvsp
[0].node
),
3482 yyvsp
[0].node
, NULL_TREE
);
3486 #line 1193 "./parse.y"
3488 yyval
.node
= tree_cons (maybe_build_array_element_wfl (yyvsp
[0].node
), yyvsp
[0].node
, yyvsp
[-2].node
);
3492 #line 1197 "./parse.y"
3493 {yyerror ("Missing term"); RECOVER
;;
3496 #line 1203 "./parse.y"
3498 /* Store the location of the `}' when doing xrefs */
3499 if (current_function_decl
&& flag_emit_xref
)
3500 DECL_END_SOURCE_LINE (current_function_decl
) =
3501 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
3502 yyval
.node
= empty_stmt_node
;
3506 #line 1211 "./parse.y"
3507 { yyval
.node
= yyvsp
[0].node
; ;
3510 #line 1216 "./parse.y"
3514 #line 1221 "./parse.y"
3516 maybe_absorb_scoping_blocks ();
3517 /* Store the location of the `}' when doing xrefs */
3518 if (current_function_decl
&& flag_emit_xref
)
3519 DECL_END_SOURCE_LINE (current_function_decl
) =
3520 EXPR_WFL_ADD_COL (yyvsp
[0].operator.location
, 1);
3521 yyval
.node
= exit_block ();
3525 #line 1239 "./parse.y"
3526 { java_method_add_stmt (current_function_decl
, yyvsp
[0].node
); ;
3529 #line 1241 "./parse.y"
3530 { parse_jdk1_1_error ("inner class declaration"); ;
3533 #line 1250 "./parse.y"
3534 { declare_local_variables (0, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3537 #line 1252 "./parse.y"
3538 { declare_local_variables (yyvsp
[-2].value
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
3541 #line 1262 "./parse.y"
3542 { yyval
.node
= exit_block (); ;
3545 #line 1271 "./parse.y"
3546 { yyval
.node
= exit_block (); ;
3549 #line 1290 "./parse.y"
3550 { yyval
.node
= empty_stmt_node
; ;
3553 #line 1295 "./parse.y"
3555 yyval
.node
= build_labeled_block (EXPR_WFL_LINECOL (yyvsp
[-1].node
),
3556 EXPR_WFL_NODE (yyvsp
[-1].node
));
3558 push_labeled_block (yyval
.node
);
3559 PUSH_LABELED_BLOCK (yyval
.node
);
3563 #line 1306 "./parse.y"
3564 { yyval
.node
= finish_labeled_statement (yyvsp
[-1].node
, yyvsp
[0].node
); ;
3567 #line 1308 "./parse.y"
3568 {yyerror ("':' expected"); RECOVER
;;
3571 #line 1313 "./parse.y"
3572 { yyval
.node
= finish_labeled_statement (yyvsp
[-1].node
, yyvsp
[0].node
); ;
3575 #line 1320 "./parse.y"
3577 /* We have a statement. Generate a WFL around it so
3579 yyval
.node
= build_expr_wfl (yyvsp
[-1].node
, input_filename
, lineno
, 0);
3580 /* We know we have a statement, so set the debug
3581 info to be eventually generate here. */
3582 yyval
.node
= JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval
.node
);
3586 #line 1329 "./parse.y"
3588 if (ctxp
->prevent_ese
!= lineno
)
3589 yyerror ("Invalid expression statement");
3590 DRECOVER (expr_stmt
);
3594 #line 1335 "./parse.y"
3596 if (ctxp
->prevent_ese
!= lineno
)
3597 yyerror ("Invalid expression statement");
3598 DRECOVER (expr_stmt
);
3602 #line 1341 "./parse.y"
3604 if (ctxp
->prevent_ese
!= lineno
)
3605 yyerror ("Invalid expression statement");
3606 DRECOVER (expr_stmt
);
3610 #line 1347 "./parse.y"
3611 {yyerror ("')' expected"); RECOVER
;;
3614 #line 1349 "./parse.y"
3616 parse_ctor_invocation_error ();
3621 #line 1354 "./parse.y"
3622 {yyerror ("')' expected"); RECOVER
;;
3625 #line 1356 "./parse.y"
3627 parse_ctor_invocation_error ();
3632 #line 1361 "./parse.y"
3633 {yyerror ("'(' expected"); RECOVER
;;
3636 #line 1363 "./parse.y"
3637 {yyerror ("')' expected"); RECOVER
;;
3640 #line 1365 "./parse.y"
3641 {yyerror ("')' expected"); RECOVER
;;
3644 #line 1367 "./parse.y"
3645 {yyerror ("';' expected"); RECOVER
;;
3648 #line 1369 "./parse.y"
3649 {yyerror ("';' expected"); RECOVER
;;
3652 #line 1384 "./parse.y"
3654 yyval
.node
= build_if_else_statement (yyvsp
[-3].operator.location
, yyvsp
[-2].node
,
3655 yyvsp
[0].node
, NULL_TREE
);
3659 #line 1389 "./parse.y"
3660 {yyerror ("'(' expected"); RECOVER
;;
3663 #line 1391 "./parse.y"
3664 {yyerror ("Missing term"); RECOVER
;;
3667 #line 1393 "./parse.y"
3668 {yyerror ("')' expected"); RECOVER
;;
3671 #line 1398 "./parse.y"
3672 { yyval
.node
= build_if_else_statement (yyvsp
[-5].operator.location
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3675 #line 1403 "./parse.y"
3676 { yyval
.node
= build_if_else_statement (yyvsp
[-5].operator.location
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3679 #line 1408 "./parse.y"
3685 #line 1412 "./parse.y"
3687 /* Make into "proper list" of COMPOUND_EXPRs.
3688 I.e. make the last statment also have its own
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
);
3696 #line 1424 "./parse.y"
3698 yyval
.node
= build (SWITCH_EXPR
, NULL_TREE
, yyvsp
[-1].node
, NULL_TREE
);
3699 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-2].operator.location
;
3703 #line 1429 "./parse.y"
3704 {yyerror ("'(' expected"); RECOVER
;;
3707 #line 1431 "./parse.y"
3708 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement
);;
3711 #line 1433 "./parse.y"
3712 {yyerror ("'{' expected"); RECOVER
;;
3715 #line 1441 "./parse.y"
3716 { yyval
.node
= NULL_TREE
; ;
3719 #line 1443 "./parse.y"
3720 { yyval
.node
= NULL_TREE
; ;
3723 #line 1445 "./parse.y"
3724 { yyval
.node
= NULL_TREE
; ;
3727 #line 1447 "./parse.y"
3728 { yyval
.node
= NULL_TREE
; ;
3731 #line 1466 "./parse.y"
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
);
3739 #line 1472 "./parse.y"
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
);
3747 #line 1478 "./parse.y"
3748 {yyerror ("Missing or invalid constant expression"); RECOVER
;;
3751 #line 1480 "./parse.y"
3752 {yyerror ("':' expected"); RECOVER
;;
3755 #line 1482 "./parse.y"
3756 {yyerror ("':' expected"); RECOVER
;;
3759 #line 1487 "./parse.y"
3761 tree body
= build_loop_body (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, 0);
3762 yyval
.node
= build_new_loop (body
);
3766 #line 1495 "./parse.y"
3767 { yyval
.node
= finish_loop_body (0, NULL_TREE
, yyvsp
[0].node
, 0); ;
3770 #line 1497 "./parse.y"
3771 {YYERROR_NOW
; yyerror ("'(' expected"); RECOVER
;;
3774 #line 1499 "./parse.y"
3775 {yyerror ("Missing term and ')' expected"); RECOVER
;;
3778 #line 1501 "./parse.y"
3779 {yyerror ("')' expected"); RECOVER
;;
3782 #line 1506 "./parse.y"
3783 { yyval
.node
= finish_loop_body (0, NULL_TREE
, yyvsp
[0].node
, 0); ;
3786 #line 1511 "./parse.y"
3788 tree body
= build_loop_body (0, NULL_TREE
, 1);
3789 yyval
.node
= build_new_loop (body
);
3793 #line 1520 "./parse.y"
3794 { yyval
.node
= finish_loop_body (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[-5].node
, 1); ;
3797 #line 1525 "./parse.y"
3798 { yyval
.node
= finish_for_loop (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
3801 #line 1527 "./parse.y"
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) =
3810 #line 1534 "./parse.y"
3811 {yyerror ("Invalid control expression"); RECOVER
;;
3814 #line 1536 "./parse.y"
3815 {yyerror ("Invalid update expression"); RECOVER
;;
3818 #line 1538 "./parse.y"
3819 {yyerror ("Invalid update expression"); RECOVER
;;
3822 #line 1543 "./parse.y"
3823 { yyval
.node
= finish_for_loop (EXPR_WFL_LINECOL (yyvsp
[-4].node
), yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
);;
3826 #line 1545 "./parse.y"
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) =
3835 #line 1555 "./parse.y"
3837 /* This scope defined for local variable that may be
3838 defined within the scope of the for loop */
3843 #line 1561 "./parse.y"
3844 {yyerror ("'(' expected"); DRECOVER(for_1
);;
3847 #line 1563 "./parse.y"
3848 {yyerror ("Invalid init statement"); RECOVER
;;
3851 #line 1568 "./parse.y"
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
);
3864 #line 1580 "./parse.y"
3865 { yyval
.node
= empty_stmt_node
; ;
3868 #line 1582 "./parse.y"
3870 /* Init statement recorded within the previously
3871 defined block scope */
3872 yyval
.node
= java_method_add_stmt (current_function_decl
, yyvsp
[0].node
);
3876 #line 1588 "./parse.y"
3878 /* Local variable are recorded within the previously
3879 defined block scope */
3880 yyval
.node
= NULL_TREE
;
3884 #line 1594 "./parse.y"
3885 {yyerror ("';' expected"); DRECOVER(for_init_1
);;
3888 #line 1598 "./parse.y"
3889 {yyval
.node
= empty_stmt_node
;;
3892 #line 1600 "./parse.y"
3893 { yyval
.node
= build_debugable_stmt (BUILD_LOCATION (), yyvsp
[0].node
); ;
3896 #line 1605 "./parse.y"
3897 { yyval
.node
= add_stmt_to_compound (NULL_TREE
, NULL_TREE
, yyvsp
[0].node
); ;
3900 #line 1607 "./parse.y"
3901 { yyval
.node
= add_stmt_to_compound (yyvsp
[-2].node
, NULL_TREE
, yyvsp
[0].node
); ;
3904 #line 1609 "./parse.y"
3905 {yyerror ("Missing term"); RECOVER
;;
3908 #line 1614 "./parse.y"
3909 { yyval
.node
= build_bc_statement (yyvsp
[-1].operator.location
, 1, NULL_TREE
); ;
3912 #line 1616 "./parse.y"
3913 { yyval
.node
= build_bc_statement (yyvsp
[-2].operator.location
, 1, yyvsp
[-1].node
); ;
3916 #line 1618 "./parse.y"
3917 {yyerror ("Missing term"); RECOVER
;;
3920 #line 1620 "./parse.y"
3921 {yyerror ("';' expected"); RECOVER
;;
3924 #line 1625 "./parse.y"
3925 { yyval
.node
= build_bc_statement (yyvsp
[-1].operator.location
, 0, NULL_TREE
); ;
3928 #line 1627 "./parse.y"
3929 { yyval
.node
= build_bc_statement (yyvsp
[-2].operator.location
, 0, yyvsp
[-1].node
); ;
3932 #line 1629 "./parse.y"
3933 {yyerror ("Missing term"); RECOVER
;;
3936 #line 1631 "./parse.y"
3937 {yyerror ("';' expected"); RECOVER
;;
3940 #line 1636 "./parse.y"
3941 { yyval
.node
= build_return (yyvsp
[-1].operator.location
, NULL_TREE
); ;
3944 #line 1638 "./parse.y"
3945 { yyval
.node
= build_return (yyvsp
[-2].operator.location
, yyvsp
[-1].node
); ;
3948 #line 1640 "./parse.y"
3949 {yyerror ("Missing term"); RECOVER
;;
3952 #line 1642 "./parse.y"
3953 {yyerror ("';' expected"); RECOVER
;;
3956 #line 1647 "./parse.y"
3958 yyval
.node
= build1 (THROW_EXPR
, NULL_TREE
, yyvsp
[-1].node
);
3959 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-2].operator.location
;
3963 #line 1652 "./parse.y"
3964 {yyerror ("Missing term"); RECOVER
;;
3967 #line 1654 "./parse.y"
3968 {yyerror ("';' expected"); RECOVER
;;
3971 #line 1659 "./parse.y"
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
));
3979 #line 1665 "./parse.y"
3980 {yyerror ("'{' expected"); RECOVER
;;
3983 #line 1667 "./parse.y"
3984 {yyerror ("'(' expected"); RECOVER
;;
3987 #line 1669 "./parse.y"
3988 {yyerror ("Missing term"); RECOVER
;;
3991 #line 1671 "./parse.y"
3992 {yyerror ("Missing term"); RECOVER
;;
3995 #line 1676 "./parse.y"
3997 check_modifiers ("Illegal modifier `%s'. Only "
3998 "`synchronized' was expected here",
3999 yyvsp
[0].value
, ACC_SYNCHRONIZED
);
4000 if (yyvsp
[0].value
!= ACC_SYNCHRONIZED
)
4001 MODIFIER_WFL (SYNCHRONIZED_TK
) =
4002 build_wfl_node (NULL_TREE
);
4006 #line 1688 "./parse.y"
4007 { yyval
.node
= build_try_statement (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
4010 #line 1690 "./parse.y"
4011 { yyval
.node
= build_try_finally_statement (yyvsp
[-2].operator.location
, yyvsp
[-1].node
, yyvsp
[0].node
); ;
4014 #line 1692 "./parse.y"
4015 { yyval
.node
= build_try_finally_statement
4016 (yyvsp
[-3].operator.location
, build_try_statement (yyvsp
[-3].operator.location
,
4017 yyvsp
[-2].node
, yyvsp
[-1].node
), yyvsp
[0].node
);
4021 #line 1697 "./parse.y"
4022 {yyerror ("'{' expected"); DRECOVER (try_statement
);;
4025 #line 1703 "./parse.y"
4027 TREE_CHAIN (yyvsp
[0].node
) = yyvsp
[-1].node
;
4028 yyval
.node
= yyvsp
[0].node
;
4032 #line 1711 "./parse.y"
4034 java_method_add_stmt (current_function_decl
, yyvsp
[0].node
);
4036 yyval
.node
= yyvsp
[-1].node
;
4040 #line 1719 "./parse.y"
4042 /* We add a block to define a scope for
4043 formal_parameter (CCBP). The formal parameter is
4044 declared initialized by the appropriate function
4046 tree ccpb
= enter_block ();
4047 tree init
= build_assignment (ASSIGN_TK
, yyvsp
[-2].operator.location
,
4048 TREE_PURPOSE (yyvsp
[-1].node
),
4049 soft_exceptioninfo_call_node
);
4050 declare_local_variables (0, TREE_VALUE (yyvsp
[-1].node
),
4051 build_tree_list (TREE_PURPOSE (yyvsp
[-1].node
),
4053 yyval
.node
= build1 (CATCH_EXPR
, NULL_TREE
, ccpb
);
4054 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-3].operator.location
;
4058 #line 1735 "./parse.y"
4059 {yyerror ("'(' expected"); RECOVER
; yyval
.node
= NULL_TREE
;;
4062 #line 1737 "./parse.y"
4064 yyerror ("Missing term or ')' expected");
4065 RECOVER
; yyval
.node
= NULL_TREE
;
4069 #line 1742 "./parse.y"
4070 {yyerror ("Missing term"); RECOVER
; yyval
.node
= NULL_TREE
;;
4073 #line 1747 "./parse.y"
4074 { yyval
.node
= yyvsp
[0].node
; ;
4077 #line 1749 "./parse.y"
4078 {yyerror ("'{' expected"); RECOVER
; ;
4081 #line 1761 "./parse.y"
4082 { yyval
.node
= build_this (yyvsp
[0].operator.location
); ;
4085 #line 1763 "./parse.y"
4086 {yyval
.node
= yyvsp
[-1].node
;;
4089 #line 1772 "./parse.y"
4090 { yyval
.node
= parse_jdk1_1_error ("named class literals"); ;
4093 #line 1774 "./parse.y"
4094 { yyval
.node
= build_class_ref (yyvsp
[-2].node
); ;
4097 #line 1776 "./parse.y"
4098 { yyval
.node
= build_class_ref (void_type_node
); ;
4101 #line 1781 "./parse.y"
4102 { yyval
.node
= parse_jdk1_1_error ("class literals"); ;
4105 #line 1783 "./parse.y"
4106 {yyerror ("')' expected"); RECOVER
;;
4109 #line 1785 "./parse.y"
4110 {yyerror ("'class' or 'this' expected" ); RECOVER
;;
4113 #line 1787 "./parse.y"
4114 {yyerror ("'class' expected" ); RECOVER
;;
4117 #line 1789 "./parse.y"
4118 {yyerror ("'class' expected" ); RECOVER
;;
4121 #line 1794 "./parse.y"
4122 { yyval
.node
= build_new_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4125 #line 1796 "./parse.y"
4126 { yyval
.node
= build_new_invocation (yyvsp
[-2].node
, NULL_TREE
); ;
4129 #line 1801 "./parse.y"
4130 { yyval
.node
= parse_jdk1_1_error ("inner class instance creation"); ;
4133 #line 1803 "./parse.y"
4134 { yyval
.node
= parse_jdk1_1_error ("inner class instance creation"); ;
4137 #line 1812 "./parse.y"
4138 {yyerror ("'(' expected"); DRECOVER(new_1
);;
4141 #line 1814 "./parse.y"
4142 {yyerror ("'(' expected"); RECOVER
;;
4145 #line 1816 "./parse.y"
4146 {yyerror ("')' or term expected"); RECOVER
;;
4149 #line 1818 "./parse.y"
4150 {yyerror ("')' expected"); RECOVER
;;
4153 #line 1820 "./parse.y"
4154 {YYERROR_NOW
; yyerror ("Identifier expected"); RECOVER
;;
4157 #line 1822 "./parse.y"
4158 {yyerror ("'(' expected"); RECOVER
;;
4161 #line 1832 "./parse.y"
4163 yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, NULL_TREE
);
4164 ctxp
->formal_parameter_number
= 1;
4168 #line 1837 "./parse.y"
4170 ctxp
->formal_parameter_number
+= 1;
4171 yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, yyvsp
[-2].node
);
4175 #line 1842 "./parse.y"
4176 {yyerror ("Missing term"); RECOVER
;;
4179 #line 1847 "./parse.y"
4180 { yyval
.node
= build_newarray_node (yyvsp
[-1].node
, yyvsp
[0].node
, 0); ;
4183 #line 1849 "./parse.y"
4184 { yyval
.node
= build_newarray_node (yyvsp
[-1].node
, yyvsp
[0].node
, 0); ;
4187 #line 1851 "./parse.y"
4188 { yyval
.node
= build_newarray_node (yyvsp
[-2].node
, yyvsp
[-1].node
, CURRENT_OSB (ctxp
));;
4191 #line 1853 "./parse.y"
4192 { yyval
.node
= build_newarray_node (yyvsp
[-2].node
, yyvsp
[-1].node
, CURRENT_OSB (ctxp
));;
4195 #line 1857 "./parse.y"
4196 { yyval
.node
= parse_jdk1_1_error ("anonymous array"); ;
4199 #line 1859 "./parse.y"
4200 { yyval
.node
= parse_jdk1_1_error ("anonymous array"); ;
4203 #line 1861 "./parse.y"
4204 {yyerror ("'[' expected"); DRECOVER ("]");;
4207 #line 1863 "./parse.y"
4208 {yyerror ("']' expected"); RECOVER
;;
4211 #line 1868 "./parse.y"
4212 { yyval
.node
= build_tree_list (NULL_TREE
, yyvsp
[0].node
); ;
4215 #line 1870 "./parse.y"
4216 { yyval
.node
= tree_cons (NULL_TREE
, yyvsp
[0].node
, yyval
.node
); ;
4219 #line 1875 "./parse.y"
4221 EXPR_WFL_LINECOL (yyvsp
[-1].node
) = yyvsp
[-2].operator.location
;
4222 yyval
.node
= yyvsp
[-1].node
;
4226 #line 1880 "./parse.y"
4227 {yyerror ("']' expected"); RECOVER
;;
4230 #line 1882 "./parse.y"
4232 yyerror ("Missing term");
4233 yyerror ("']' expected");
4238 #line 1891 "./parse.y"
4241 /* If not initialized, allocate memory for the osb
4243 if (!ctxp
->osb_limit
)
4245 allocate
= ctxp
->osb_limit
= 32;
4246 ctxp
->osb_depth
= -1;
4248 /* If capacity overflown, reallocate a bigger chuck */
4249 else if (ctxp
->osb_depth
+1 == ctxp
->osb_limit
)
4250 allocate
= ctxp
->osb_limit
<< 1;
4254 allocate
*= sizeof (int);
4255 if (ctxp
->osb_number
)
4256 ctxp
->osb_number
= (int *)xrealloc (ctxp
->osb_number
,
4259 ctxp
->osb_number
= (int *)xmalloc (allocate
);
4262 CURRENT_OSB (ctxp
) = 1;
4266 #line 1917 "./parse.y"
4267 { CURRENT_OSB (ctxp
)++; ;
4270 #line 1919 "./parse.y"
4271 { yyerror ("']' expected"); RECOVER
;;
4274 #line 1924 "./parse.y"
4275 { yyval
.node
= make_qualified_primary (yyvsp
[-2].node
, yyvsp
[0].node
, yyvsp
[-1].operator.location
); ;
4278 #line 1928 "./parse.y"
4281 build_wfl_node (super_identifier_node
);
4282 EXPR_WFL_LINECOL (super_wfl
) = yyvsp
[-2].operator.location
;
4283 yyval
.node
= make_qualified_name (super_wfl
, yyvsp
[0].node
, yyvsp
[-1].operator.location
);
4287 #line 1935 "./parse.y"
4288 {yyerror ("Field expected"); DRECOVER (super_field_acces
);;
4291 #line 1940 "./parse.y"
4292 { yyval
.node
= build_method_invocation (yyvsp
[-2].node
, NULL_TREE
); ;
4295 #line 1942 "./parse.y"
4296 { yyval
.node
= build_method_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4299 #line 1944 "./parse.y"
4301 if (TREE_CODE (yyvsp
[-4].node
) == THIS_EXPR
)
4302 yyval
.node
= build_this_super_qualified_invocation
4303 (1, yyvsp
[-2].node
, NULL_TREE
, 0, yyvsp
[-3].operator.location
);
4306 tree invok
= build_method_invocation (yyvsp
[-2].node
, NULL_TREE
);
4307 yyval
.node
= make_qualified_primary (yyvsp
[-4].node
, invok
, yyvsp
[-3].operator.location
);
4312 #line 1955 "./parse.y"
4314 if (TREE_CODE (yyvsp
[-5].node
) == THIS_EXPR
)
4315 yyval
.node
= build_this_super_qualified_invocation
4316 (1, yyvsp
[-3].node
, yyvsp
[-1].node
, 0, yyvsp
[-4].operator.location
);
4319 tree invok
= build_method_invocation (yyvsp
[-3].node
, yyvsp
[-1].node
);
4320 yyval
.node
= make_qualified_primary (yyvsp
[-5].node
, invok
, yyvsp
[-4].operator.location
);
4325 #line 1966 "./parse.y"
4327 yyval
.node
= build_this_super_qualified_invocation
4328 (0, yyvsp
[-2].node
, NULL_TREE
, yyvsp
[-4].operator.location
, yyvsp
[-3].operator.location
);
4332 #line 1971 "./parse.y"
4334 yyval
.node
= build_this_super_qualified_invocation
4335 (0, yyvsp
[-3].node
, yyvsp
[-1].node
, yyvsp
[-5].operator.location
, yyvsp
[-4].operator.location
);
4339 #line 1980 "./parse.y"
4340 { yyerror ("'(' expected"); DRECOVER (method_invocation
); ;
4343 #line 1982 "./parse.y"
4344 { yyerror ("'(' expected"); DRECOVER (method_invocation
); ;
4347 #line 1987 "./parse.y"
4348 { yyval
.node
= build_array_ref (yyvsp
[-2].operator.location
, yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4351 #line 1989 "./parse.y"
4352 { yyval
.node
= build_array_ref (yyvsp
[-2].operator.location
, yyvsp
[-3].node
, yyvsp
[-1].node
); ;
4355 #line 1991 "./parse.y"
4357 yyerror ("Missing term and ']' expected");
4358 DRECOVER(array_access
);
4362 #line 1996 "./parse.y"
4364 yyerror ("']' expected");
4365 DRECOVER(array_access
);
4369 #line 2001 "./parse.y"
4371 yyerror ("Missing term and ']' expected");
4372 DRECOVER(array_access
);
4376 #line 2006 "./parse.y"
4378 yyerror ("']' expected");
4379 DRECOVER(array_access
);
4383 #line 2021 "./parse.y"
4384 { yyval
.node
= build_incdec (yyvsp
[0].operator.token
, yyvsp
[0].operator.location
, yyvsp
[-1].node
, 1); ;
4387 #line 2026 "./parse.y"
4388 { yyval
.node
= build_incdec (yyvsp
[0].operator.token
, yyvsp
[0].operator.location
, yyvsp
[-1].node
, 1); ;
4391 #line 2033 "./parse.y"
4392 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4395 #line 2035 "./parse.y"
4396 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4399 #line 2038 "./parse.y"
4400 {yyerror ("Missing term"); RECOVER
;
4403 #line 2040 "./parse.y"
4404 {yyerror ("Missing term"); RECOVER
;
4407 #line 2045 "./parse.y"
4408 {yyval
.node
= build_incdec (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
, 0); ;
4411 #line 2047 "./parse.y"
4412 {yyerror ("Missing term"); RECOVER
;
4415 #line 2052 "./parse.y"
4416 {yyval
.node
= build_incdec (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
, 0); ;
4419 #line 2054 "./parse.y"
4420 {yyerror ("Missing term"); RECOVER
;
4423 #line 2060 "./parse.y"
4424 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4427 #line 2062 "./parse.y"
4428 {yyval
.node
= build_unaryop (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[0].node
); ;
4431 #line 2065 "./parse.y"
4432 {yyerror ("Missing term"); RECOVER
;
4435 #line 2067 "./parse.y"
4436 {yyerror ("Missing term"); RECOVER
;
4439 #line 2072 "./parse.y"
4441 tree type
= yyvsp
[-3].node
;
4442 while (CURRENT_OSB (ctxp
)--)
4443 type
= build_java_array_type (type
, -1);
4445 yyval
.node
= build_cast (yyvsp
[-4].operator.location
, type
, yyvsp
[0].node
);
4449 #line 2080 "./parse.y"
4450 { yyval
.node
= build_cast (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4453 #line 2082 "./parse.y"
4454 { yyval
.node
= build_cast (yyvsp
[-3].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4457 #line 2084 "./parse.y"
4460 while (CURRENT_OSB (ctxp
)--)
4461 obstack_1grow (&temporary_obstack
, '[');
4463 obstack_grow0 (&temporary_obstack
,
4464 IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp
[-3].node
)),
4465 IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp
[-3].node
)));
4466 ptr
= obstack_finish (&temporary_obstack
);
4467 EXPR_WFL_NODE (yyvsp
[-3].node
) = get_identifier (ptr
);
4468 yyval
.node
= build_cast (yyvsp
[-4].operator.location
, yyvsp
[-3].node
, yyvsp
[0].node
);
4472 #line 2097 "./parse.y"
4473 {yyerror ("']' expected, invalid type expression");;
4476 #line 2099 "./parse.y"
4478 if (ctxp
->prevent_ese
!= lineno
)
4479 yyerror ("Invalid type expression"); RECOVER
;
4484 #line 2105 "./parse.y"
4485 {yyerror ("Missing term"); RECOVER
;;
4488 #line 2107 "./parse.y"
4489 {yyerror ("Missing term"); RECOVER
;;
4492 #line 2109 "./parse.y"
4493 {yyerror ("Missing term"); RECOVER
;;
4496 #line 2115 "./parse.y"
4498 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
),
4499 yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
);
4503 #line 2120 "./parse.y"
4505 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4506 yyvsp
[-2].node
, yyvsp
[0].node
);
4510 #line 2125 "./parse.y"
4512 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4513 yyvsp
[-2].node
, yyvsp
[0].node
);
4517 #line 2130 "./parse.y"
4518 {yyerror ("Missing term"); RECOVER
;;
4521 #line 2132 "./parse.y"
4522 {yyerror ("Missing term"); RECOVER
;;
4525 #line 2134 "./parse.y"
4526 {yyerror ("Missing term"); RECOVER
;;
4529 #line 2140 "./parse.y"
4531 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4532 yyvsp
[-2].node
, yyvsp
[0].node
);
4536 #line 2145 "./parse.y"
4538 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4539 yyvsp
[-2].node
, yyvsp
[0].node
);
4543 #line 2150 "./parse.y"
4544 {yyerror ("Missing term"); RECOVER
;;
4547 #line 2152 "./parse.y"
4548 {yyerror ("Missing term"); RECOVER
;;
4551 #line 2158 "./parse.y"
4553 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4554 yyvsp
[-2].node
, yyvsp
[0].node
);
4558 #line 2163 "./parse.y"
4560 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4561 yyvsp
[-2].node
, yyvsp
[0].node
);
4565 #line 2168 "./parse.y"
4567 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4568 yyvsp
[-2].node
, yyvsp
[0].node
);
4572 #line 2173 "./parse.y"
4573 {yyerror ("Missing term"); RECOVER
;;
4576 #line 2175 "./parse.y"
4577 {yyerror ("Missing term"); RECOVER
;;
4580 #line 2177 "./parse.y"
4581 {yyerror ("Missing term"); RECOVER
;;
4584 #line 2183 "./parse.y"
4586 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4587 yyvsp
[-2].node
, yyvsp
[0].node
);
4591 #line 2188 "./parse.y"
4593 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4594 yyvsp
[-2].node
, yyvsp
[0].node
);
4598 #line 2193 "./parse.y"
4600 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4601 yyvsp
[-2].node
, yyvsp
[0].node
);
4605 #line 2198 "./parse.y"
4607 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4608 yyvsp
[-2].node
, yyvsp
[0].node
);
4612 #line 2203 "./parse.y"
4613 { yyval
.node
= build_binop (INSTANCEOF_EXPR
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4616 #line 2205 "./parse.y"
4617 {yyerror ("Missing term"); RECOVER
;;
4620 #line 2207 "./parse.y"
4621 {yyerror ("Missing term"); RECOVER
;;
4624 #line 2209 "./parse.y"
4625 {yyerror ("Missing term"); RECOVER
;;
4628 #line 2211 "./parse.y"
4629 {yyerror ("Missing term"); RECOVER
;;
4632 #line 2213 "./parse.y"
4633 {yyerror ("Invalid reference type"); RECOVER
;;
4636 #line 2219 "./parse.y"
4638 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4639 yyvsp
[-2].node
, yyvsp
[0].node
);
4643 #line 2224 "./parse.y"
4645 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4646 yyvsp
[-2].node
, yyvsp
[0].node
);
4650 #line 2229 "./parse.y"
4651 {yyerror ("Missing term"); RECOVER
;;
4654 #line 2231 "./parse.y"
4655 {yyerror ("Missing term"); RECOVER
;;
4658 #line 2237 "./parse.y"
4660 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4661 yyvsp
[-2].node
, yyvsp
[0].node
);
4665 #line 2242 "./parse.y"
4666 {yyerror ("Missing term"); RECOVER
;;
4669 #line 2248 "./parse.y"
4671 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4672 yyvsp
[-2].node
, yyvsp
[0].node
);
4676 #line 2253 "./parse.y"
4677 {yyerror ("Missing term"); RECOVER
;;
4680 #line 2259 "./parse.y"
4682 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4683 yyvsp
[-2].node
, yyvsp
[0].node
);
4687 #line 2264 "./parse.y"
4688 {yyerror ("Missing term"); RECOVER
;;
4691 #line 2270 "./parse.y"
4693 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4694 yyvsp
[-2].node
, yyvsp
[0].node
);
4698 #line 2275 "./parse.y"
4699 {yyerror ("Missing term"); RECOVER
;;
4702 #line 2281 "./parse.y"
4704 yyval
.node
= build_binop (BINOP_LOOKUP (yyvsp
[-1].operator.token
), yyvsp
[-1].operator.location
,
4705 yyvsp
[-2].node
, yyvsp
[0].node
);
4709 #line 2286 "./parse.y"
4710 {yyerror ("Missing term"); RECOVER
;;
4713 #line 2292 "./parse.y"
4715 yyval
.node
= build (CONDITIONAL_EXPR
, NULL_TREE
, yyvsp
[-4].node
, yyvsp
[-2].node
, yyvsp
[0].node
);
4716 EXPR_WFL_LINECOL (yyval
.node
) = yyvsp
[-3].operator.location
;
4720 #line 2297 "./parse.y"
4723 yyerror ("Missing term");
4728 #line 2303 "./parse.y"
4729 {yyerror ("Missing term"); DRECOVER (2);;
4732 #line 2305 "./parse.y"
4733 {yyerror ("Missing term"); DRECOVER (3);;
4736 #line 2315 "./parse.y"
4737 { yyval
.node
= build_assignment (yyvsp
[-1].operator.token
, yyvsp
[-1].operator.location
, yyvsp
[-2].node
, yyvsp
[0].node
); ;
4740 #line 2317 "./parse.y"
4742 if (ctxp
->prevent_ese
!= lineno
)
4743 yyerror ("Missing term");
4748 /* the action file gets copied in in place of this dollarsign */
4749 #line 498 "/usr/cygnus/gnupro-98r1/share/bison.simple"
4760 short *ssp1
= yyss
- 1;
4761 fprintf (stderr
, "state stack now");
4762 while (ssp1
!= yyssp
)
4763 fprintf (stderr
, " %d", *++ssp1
);
4764 fprintf (stderr
, "\n");
4774 yylsp
->first_line
= yylloc
.first_line
;
4775 yylsp
->first_column
= yylloc
.first_column
;
4776 yylsp
->last_line
= (yylsp
-1)->last_line
;
4777 yylsp
->last_column
= (yylsp
-1)->last_column
;
4782 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
4783 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
4787 /* Now "shift" the result of the reduction.
4788 Determine what state that goes to,
4789 based on the state we popped back to
4790 and the rule number reduced by. */
4794 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
4795 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
4796 yystate
= yytable
[yystate
];
4798 yystate
= yydefgoto
[yyn
- YYNTBASE
];
4802 yyerrlab
: /* here on detecting error */
4805 /* If not already recovering from an error, report this error. */
4809 #ifdef YYERROR_VERBOSE
4810 yyn
= yypact
[yystate
];
4812 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
4819 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
4820 for (x
= (yyn
< 0 ? -yyn
: 0);
4821 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
4822 if (yycheck
[x
+ yyn
] == x
)
4823 size
+= strlen(yytname
[x
]) + 15, count
++;
4824 msg
= (char *) malloc(size
+ 15);
4827 strcpy(msg
, "parse error");
4832 for (x
= (yyn
< 0 ? -yyn
: 0);
4833 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
4834 if (yycheck
[x
+ yyn
] == x
)
4836 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
4837 strcat(msg
, yytname
[x
]);
4846 yyerror ("parse error; also virtual memory exceeded");
4849 #endif /* YYERROR_VERBOSE */
4850 yyerror("parse error");
4854 yyerrlab1
: /* here on error raised explicitly by an action */
4856 if (yyerrstatus
== 3)
4858 /* if just tried and failed to reuse lookahead token after an error, discard it. */
4860 /* return failure if at end of input */
4861 if (yychar
== YYEOF
)
4866 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
4872 /* Else will try to reuse lookahead token
4873 after shifting the error token. */
4875 yyerrstatus
= 3; /* Each real token shifted decrements this */
4879 yyerrdefault
: /* current state does not do anything special for the error token. */
4882 /* This is wrong; only states that explicitly want error tokens
4883 should shift them. */
4884 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
4885 if (yyn
) goto yydefault
;
4888 yyerrpop
: /* pop the current state because it cannot handle the error token */
4890 if (yyssp
== yyss
) YYABORT
;
4900 short *ssp1
= yyss
- 1;
4901 fprintf (stderr
, "Error: state stack now");
4902 while (ssp1
!= yyssp
)
4903 fprintf (stderr
, " %d", *++ssp1
);
4904 fprintf (stderr
, "\n");
4910 yyn
= yypact
[yystate
];
4915 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
4934 fprintf(stderr
, "Shifting error token, ");
4945 #line 2343 "./parse.y"
4949 /* Flag for the error report routine to issue the error the first time
4950 it's called (overriding the default behavior which is to drop the
4951 first invocation and honor the second one, taking advantage of a
4953 static int force_error
= 0;
4955 /* Create a new parser context and make it the current one. */
4958 java_push_parser_context ()
4960 struct parser_ctxt
*new =
4961 (struct parser_ctxt
*)xmalloc(sizeof (struct parser_ctxt
));
4963 bzero ((PTR
) new, sizeof (struct parser_ctxt
));
4968 ctxp
->incomplete_class
= ctxp
->next
->incomplete_class
;
4969 ctxp
->gclass_list
= ctxp
->next
->gclass_list
;
4973 /* If the first file of a file list was a class file, no context
4974 exists for a source file to be parsed. This boolean remembers that
4975 java_parser_context_save_global might have created a dummy one, so
4976 that java_parser_context_restore_global can pop it. */
4977 static int extra_ctxp_pushed_p
= 0;
4980 java_parser_context_save_global ()
4984 java_push_parser_context ();
4985 extra_ctxp_pushed_p
= 1;
4987 ctxp
->finput
= finput
;
4988 ctxp
->lineno
= lineno
;
4989 ctxp
->current_class
= current_class
;
4990 ctxp
->filename
= input_filename
;
4991 ctxp
->current_function_decl
= current_function_decl
;
4995 java_parser_context_restore_global ()
4997 finput
= ctxp
->finput
;
4998 lineno
= ctxp
->lineno
;
4999 current_class
= ctxp
->current_class
;
5000 input_filename
= ctxp
->filename
;
5001 current_function_decl
= ctxp
->current_function_decl
;
5002 if (!ctxp
->next
&& extra_ctxp_pushed_p
)
5004 java_pop_parser_context (0);
5005 extra_ctxp_pushed_p
= 0;
5010 java_pop_parser_context (generate
)
5014 struct parser_ctxt
*toFree
, *next
;
5023 next
->incomplete_class
= ctxp
->incomplete_class
;
5024 next
->gclass_list
= ctxp
->gclass_list
;
5025 lineno
= ctxp
->lineno
;
5026 finput
= ctxp
->finput
;
5027 current_class
= ctxp
->current_class
;
5030 /* Set the single import class file flag to 0 for the current list
5031 of imported things */
5032 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
5033 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current
)) = 0;
5035 /* And restore those of the previous context */
5036 if ((ctxp
= next
)) /* Assignment is really meant here */
5037 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
5038 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current
)) = 1;
5042 toFree
->next
= ctxp_for_generation
;
5043 ctxp_for_generation
= toFree
;
5049 /* Reporting an constructor invocation error. */
5051 parse_ctor_invocation_error ()
5053 if (DECL_CONSTRUCTOR_P (current_function_decl
))
5054 yyerror ("Constructor invocation must be first thing in a constructor");
5056 yyerror ("Only constructors can invoke constructors");
5059 /* Reporting JDK1.1 features not implemented. */
5062 parse_jdk1_1_error (msg
)
5065 sorry (": `%s' JDK1.1(TM) feature", msg
);
5067 return empty_stmt_node
;
5070 static int do_warning
= 0;
5077 static int prev_lineno
;
5078 static const char *prev_msg
;
5081 char *remainder
, *code_from_source
;
5082 extern struct obstack temporary_obstack
;
5084 if (!force_error
&& prev_lineno
== lineno
)
5087 /* Save current error location but report latter, when the context is
5089 if (ctxp
->java_error_flag
== 0)
5091 ctxp
->java_error_flag
= 1;
5093 /* Do something to use the previous line if we're reaching the
5094 end of the file... */
5095 #ifdef VERBOSE_SKELETON
5096 printf ("* Error detected (%s)\n", (msg
? msg
: "(null)"));
5101 /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
5102 if (!force_error
&& msg
== prev_msg
&& prev_lineno
== elc
.line
)
5105 ctxp
->java_error_flag
= 0;
5107 java_warning_count
++;
5111 if (elc
.col
== 0 && msg
[1] == ';')
5113 elc
.col
= ctxp
->p_line
->char_col
-1;
5114 elc
.line
= ctxp
->p_line
->lineno
;
5117 save_lineno
= lineno
;
5118 prev_lineno
= lineno
= elc
.line
;
5121 code_from_source
= java_get_line_col (ctxp
->filename
, elc
.line
, elc
.col
);
5122 obstack_grow0 (&temporary_obstack
,
5123 code_from_source
, strlen (code_from_source
));
5124 remainder
= obstack_finish (&temporary_obstack
);
5126 warning ("%s.\n%s", msg
, remainder
);
5128 error ("%s.\n%s", msg
, remainder
);
5130 /* This allow us to cheaply avoid an extra 'Invalid expression
5131 statement' error report when errors have been already reported on
5132 the same line. This occurs when we report an error but don't have
5133 a synchronization point other than ';', which
5134 expression_statement is the only one to take care of. */
5135 ctxp
->prevent_ese
= lineno
= save_lineno
;
5139 issue_warning_error_from_context (cl
, msg
, ap
)
5144 char *saved
, *saved_input_filename
;
5146 vsprintf (buffer
, msg
, ap
);
5149 ctxp
->elc
.line
= EXPR_WFL_LINENO (cl
);
5150 ctxp
->elc
.col
= (EXPR_WFL_COLNO (cl
) == 0xfff ? -1 :
5151 (EXPR_WFL_COLNO (cl
) == 0xffe ? -2 : EXPR_WFL_COLNO (cl
)));
5153 /* We have a CL, that's a good reason for using it if it contains data */
5154 saved
= ctxp
->filename
;
5155 if (TREE_CODE (cl
) == EXPR_WITH_FILE_LOCATION
&& EXPR_WFL_FILENAME_NODE (cl
))
5156 ctxp
->filename
= EXPR_WFL_FILENAME (cl
);
5157 saved_input_filename
= input_filename
;
5158 input_filename
= ctxp
->filename
;
5160 java_error (buffer
);
5161 ctxp
->filename
= saved
;
5162 input_filename
= saved_input_filename
;
5166 /* Issue an error message at a current source line CL */
5169 parse_error_context
VPROTO ((tree cl
, const char *msg
, ...))
5171 #ifndef ANSI_PROTOTYPES
5178 #ifndef ANSI_PROTOTYPES
5179 cl
= va_arg (ap
, tree
);
5180 msg
= va_arg (ap
, const char *);
5182 issue_warning_error_from_context (cl
, msg
, ap
);
5186 /* Issue a warning at a current source line CL */
5189 parse_warning_context
VPROTO ((tree cl
, const char *msg
, ...))
5191 #ifndef ANSI_PROTOTYPES
5198 #ifndef ANSI_PROTOTYPES
5199 cl
= va_arg (ap
, tree
);
5200 msg
= va_arg (ap
, const char *);
5203 force_error
= do_warning
= 1;
5204 issue_warning_error_from_context (cl
, msg
, ap
);
5205 do_warning
= force_error
= 0;
5210 find_expr_with_wfl (node
)
5218 switch (TREE_CODE (node
))
5221 node
= BLOCK_EXPR_BODY (node
);
5225 to_return
= find_expr_with_wfl (TREE_OPERAND (node
, 0));
5228 node
= TREE_OPERAND (node
, 1);
5232 node
= TREE_OPERAND (node
, 0);
5235 case LABELED_BLOCK_EXPR
:
5236 node
= TREE_OPERAND (node
, 1);
5240 code
= TREE_CODE_CLASS (TREE_CODE (node
));
5241 if (((code
== '1') || (code
== '2') || (code
== 'e'))
5242 && EXPR_WFL_LINECOL (node
))
5250 /* Issue a missing return statement error. Uses METHOD to figure the
5251 last line of the method the error occurs in. */
5254 missing_return_error (method
)
5257 EXPR_WFL_SET_LINECOL (wfl_operator
, DECL_SOURCE_LINE_LAST (method
), -2);
5258 parse_error_context (wfl_operator
, "Missing return statement");
5261 /* Issue an unreachable statement error. From NODE, find the next
5262 statement to report appropriately. */
5264 unreachable_stmt_error (node
)
5267 /* Browse node to find the next expression node that has a WFL. Use
5268 the location to report the error */
5269 if (TREE_CODE (node
) == COMPOUND_EXPR
)
5270 node
= find_expr_with_wfl (TREE_OPERAND (node
, 1));
5272 node
= find_expr_with_wfl (node
);
5276 EXPR_WFL_SET_LINECOL (wfl_operator
, EXPR_WFL_LINENO (node
), -2);
5277 parse_error_context (wfl_operator
, "Unreachable statement");
5280 fatal ("Can't get valid statement - unreachable_stmt_error");
5284 java_report_errors ()
5286 if (java_error_count
)
5287 fprintf (stderr
, "%d error%s",
5288 java_error_count
, (java_error_count
== 1 ? "" : "s"));
5289 if (java_warning_count
)
5290 fprintf (stderr
, "%s%d warning%s", (java_error_count
? ", " : ""),
5291 java_warning_count
, (java_warning_count
== 1 ? "" : "s"));
5292 if (java_error_count
|| java_warning_count
)
5293 putc ('\n', stderr
);
5294 return java_error_count
;
5298 java_accstring_lookup (flags
)
5301 static char buffer
[80];
5302 #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
5304 /* Access modifier looked-up first for easier report on forbidden
5306 if (flags
& ACC_PUBLIC
) COPY_RETURN ("public");
5307 if (flags
& ACC_PRIVATE
) COPY_RETURN ("private");
5308 if (flags
& ACC_PROTECTED
) COPY_RETURN ("protected");
5309 if (flags
& ACC_STATIC
) COPY_RETURN ("static");
5310 if (flags
& ACC_FINAL
) COPY_RETURN ("final");
5311 if (flags
& ACC_SYNCHRONIZED
) COPY_RETURN ("synchronized");
5312 if (flags
& ACC_VOLATILE
) COPY_RETURN ("volatile");
5313 if (flags
& ACC_TRANSIENT
) COPY_RETURN ("transient");
5314 if (flags
& ACC_NATIVE
) COPY_RETURN ("native");
5315 if (flags
& ACC_INTERFACE
) COPY_RETURN ("interface");
5316 if (flags
& ACC_ABSTRACT
) COPY_RETURN ("abstract");
5323 /* Issuing error messages upon redefinition of classes, interfaces or
5327 classitf_redefinition_error (context
, id
, decl
, cl
)
5328 const char *context
;
5331 parse_error_context (cl
, "%s `%s' already defined in %s:%d",
5332 context
, IDENTIFIER_POINTER (id
),
5333 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
5334 /* Here we should point out where its redefined. It's a unicode. FIXME */
5338 variable_redefinition_error (context
, name
, type
, line
)
5339 tree context
, name
, type
;
5342 const char *type_name
;
5344 /* Figure a proper name for type. We might haven't resolved it */
5345 if (TREE_CODE (type
) == POINTER_TYPE
&& !TREE_TYPE (type
))
5346 type_name
= IDENTIFIER_POINTER (TYPE_NAME (type
));
5348 type_name
= lang_printable_name (type
, 0);
5350 parse_error_context (context
,
5351 "Variable `%s' is already defined in this method and "
5352 "was declared `%s %s' at line %d",
5353 IDENTIFIER_POINTER (name
),
5354 type_name
, IDENTIFIER_POINTER (name
), line
);
5358 build_array_from_name (type
, type_wfl
, name
, ret_name
)
5359 tree type
, type_wfl
, name
, *ret_name
;
5364 /* Eventually get more dims */
5365 string
= IDENTIFIER_POINTER (name
);
5366 while (string
[more_dims
] == '[')
5369 /* If we have, then craft a new type for this variable */
5372 name
= get_identifier (&string
[more_dims
]);
5374 /* If we have a pointer, use its type */
5375 if (TREE_CODE (type
) == POINTER_TYPE
)
5376 type
= TREE_TYPE (type
);
5378 /* Building the first dimension of a primitive type uses this
5380 if (JPRIMITIVE_TYPE_P (type
))
5382 type
= build_java_array_type (type
, -1);
5383 CLASS_LOADED_P (type
) = 1;
5386 /* Otherwise, if we have a WFL for this type, use it (the type
5387 is already an array on an unresolved type, and we just keep
5388 on adding dimensions) */
5392 /* Add all the dimensions */
5394 type
= build_unresolved_array_type (type
);
5396 /* The type may have been incomplete in the first place */
5398 type
= obtain_incomplete_type (type
);
5405 /* Build something that the type identifier resolver will identify as
5406 being an array to an unresolved type. TYPE_WFL is a WFL on a
5410 build_unresolved_array_type (type_or_wfl
)
5415 /* TYPE_OR_WFL might be an array on a resolved type. In this case,
5416 just create a array type */
5417 if (TREE_CODE (type_or_wfl
) == RECORD_TYPE
)
5419 tree type
= build_java_array_type (type_or_wfl
, -1);
5420 CLASS_LOADED_P (type
) = CLASS_LOADED_P (type_or_wfl
);
5424 obstack_1grow (&temporary_obstack
, '[');
5425 obstack_grow0 (&temporary_obstack
,
5426 IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl
)),
5427 IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl
)));
5428 ptr
= obstack_finish (&temporary_obstack
);
5429 return build_expr_wfl (get_identifier (ptr
),
5430 EXPR_WFL_FILENAME (type_or_wfl
),
5431 EXPR_WFL_LINENO (type_or_wfl
),
5432 EXPR_WFL_COLNO (type_or_wfl
));
5435 /* Check modifiers. If one doesn't fit, retrieve it in its declaration line
5436 and point it out. */
5439 check_modifiers (message
, value
, mask
)
5440 const char *message
;
5444 /* Should point out the one that don't fit. ASCII/unicode,
5445 going backward. FIXME */
5448 int i
, remainder
= value
& ~mask
;
5449 for (i
= 0; i
<= 10; i
++)
5450 if ((1 << i
) & remainder
)
5451 parse_error_context (ctxp
->modifier_ctx
[i
], message
,
5452 java_accstring_lookup (1 << i
));
5457 parser_add_interface (class_decl
, interface_decl
, wfl
)
5458 tree class_decl
, interface_decl
, wfl
;
5460 if (maybe_add_interface (TREE_TYPE (class_decl
), TREE_TYPE (interface_decl
)))
5461 parse_error_context (wfl
, "Interface `%s' repeated",
5462 IDENTIFIER_POINTER (DECL_NAME (interface_decl
)));
5465 /* Bulk of common class/interface checks. Return 1 if an error was
5466 encountered. TAG is 0 for a class, 1 for an interface. */
5469 check_class_interface_creation (is_interface
, flags
, raw_name
, qualified_name
, decl
, cl
)
5470 int is_interface
, flags
;
5471 tree raw_name
, qualified_name
, decl
, cl
;
5476 fprintf (stderr
, " %s %s", (is_interface
? "interface" : "class"),
5477 IDENTIFIER_POINTER (qualified_name
));
5479 /* Scope of an interface/class type name:
5480 - Can't be imported by a single type import
5481 - Can't already exists in the package */
5482 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name
)
5483 && (node
= find_name_in_single_imports (raw_name
)))
5486 (cl
, "%s name `%s' clashes with imported type `%s'",
5487 (is_interface
? "Interface" : "Class"),
5488 IDENTIFIER_POINTER (raw_name
), IDENTIFIER_POINTER (node
));
5491 if (decl
&& CLASS_COMPLETE_P (decl
))
5493 classitf_redefinition_error ((is_interface
? "Interface" : "Class"),
5494 qualified_name
, decl
, cl
);
5498 /* If public, file name should match class/interface name */
5499 if (flags
& ACC_PUBLIC
)
5503 /* Contains OS dependent assumption on path separator. FIXME */
5504 for (f
= &input_filename
[strlen (input_filename
)];
5505 f
!= input_filename
&& f
[0] != '/' && f
[0] != DIR_SEPARATOR
;
5508 if (f
[0] == '/' || f
[0] == DIR_SEPARATOR
)
5510 if (strncmp (IDENTIFIER_POINTER (raw_name
),
5511 f
, IDENTIFIER_LENGTH (raw_name
)) ||
5512 f
[IDENTIFIER_LENGTH (raw_name
)] != '.')
5513 parse_error_context (cl
, "Public %s `%s' must be defined in a file "
5515 (is_interface
? "interface" : "class"),
5516 IDENTIFIER_POINTER (qualified_name
),
5517 IDENTIFIER_POINTER (raw_name
));
5520 check_modifiers ((is_interface
?
5521 "Illegal modifier `%s' for interface declaration" :
5522 "Illegal modifier `%s' for class declaration"), flags
,
5523 (is_interface
? INTERFACE_MODIFIERS
: CLASS_MODIFIERS
));
5527 /* If DECL is NULL, create and push a new DECL, record the current
5528 line CL and do other maintenance things. */
5531 maybe_create_class_interface_decl (decl
, qualified_name
, cl
)
5532 tree decl
, qualified_name
, cl
;
5535 decl
= push_class (make_class (), qualified_name
);
5537 /* Take care of the file and line business */
5538 DECL_SOURCE_FILE (decl
) = EXPR_WFL_FILENAME (cl
);
5539 /* If we're emiting xrefs, store the line/col number information */
5541 DECL_SOURCE_LINE (decl
) = EXPR_WFL_LINECOL (cl
);
5543 DECL_SOURCE_LINE (decl
) = EXPR_WFL_LINENO (cl
);
5544 CLASS_FROM_SOURCE_P (TREE_TYPE (decl
)) = 1;
5545 CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl
)) =
5546 IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl
));
5548 ctxp
->current_parsed_class
= decl
;
5550 /* Link the declaration to the already seen ones */
5551 TREE_CHAIN (decl
) = ctxp
->class_list
;
5552 ctxp
->class_list
= decl
;
5554 /* Create a new nodes in the global lists */
5555 ctxp
->gclass_list
= tree_cons (NULL_TREE
, decl
, ctxp
->gclass_list
);
5556 all_class_list
= tree_cons (NULL_TREE
, decl
, all_class_list
);
5558 /* Install a new dependency list element */
5559 create_jdep_list (ctxp
);
5561 SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
5562 IDENTIFIER_POINTER (qualified_name
)));
5567 add_superinterfaces (decl
, interface_list
)
5568 tree decl
, interface_list
;
5571 /* Superinterface(s): if present and defined, parser_check_super_interface ()
5572 takes care of ensuring that:
5573 - This is an accessible interface type,
5574 - Circularity detection.
5575 parser_add_interface is then called. If present but not defined,
5576 the check operation is delayed until the super interface gets
5578 for (node
= interface_list
; node
; node
= TREE_CHAIN (node
))
5580 tree current
= TREE_PURPOSE (node
);
5581 tree idecl
= IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current
));
5582 if (idecl
&& CLASS_LOADED_P (TREE_TYPE (idecl
)))
5584 if (!parser_check_super_interface (idecl
, decl
, current
))
5585 parser_add_interface (decl
, idecl
, current
);
5588 register_incomplete_type (JDEP_INTERFACE
,
5589 current
, decl
, NULL_TREE
);
5593 /* Create an interface in pass1 and return its decl. Return the
5594 interface's decl in pass 2. */
5597 create_interface (flags
, id
, super
)
5601 tree raw_name
= EXPR_WFL_NODE (id
);
5602 tree q_name
= parser_qualified_classname (id
);
5603 tree decl
= IDENTIFIER_CLASS_VALUE (q_name
);
5605 EXPR_WFL_NODE (id
) = q_name
; /* Keep source location, even if refined. */
5607 /* Basic checks: scope, redefinition, modifiers */
5608 if (check_class_interface_creation (1, flags
, raw_name
, q_name
, decl
, id
))
5611 /* Interface modifiers check
5612 - public/abstract allowed (already done at that point)
5613 - abstract is obsolete (comes first, it's a warning, or should be)
5614 - Can't use twice the same (checked in the modifier rule) */
5615 if ((flags
& ACC_ABSTRACT
) && flag_redundant
)
5616 parse_warning_context
5617 (MODIFIER_WFL (ABSTRACT_TK
),
5618 "Redundant use of `abstract' modifier. Interface `%s' is implicitely "
5619 "abstract", IDENTIFIER_POINTER (raw_name
));
5621 /* Create a new decl if DECL is NULL, otherwise fix it */
5622 decl
= maybe_create_class_interface_decl (decl
, q_name
, id
);
5624 /* Set super info and mark the class a complete */
5625 set_super_info (ACC_INTERFACE
| flags
, TREE_TYPE (decl
),
5626 object_type_node
, ctxp
->interface_number
);
5627 ctxp
->interface_number
= 0;
5628 CLASS_COMPLETE_P (decl
) = 1;
5629 add_superinterfaces (decl
, super
);
5634 /* Create an class in pass1 and return its decl. Return class
5635 interface's decl in pass 2. */
5638 create_class (flags
, id
, super
, interfaces
)
5640 tree id
, super
, interfaces
;
5642 tree raw_name
= EXPR_WFL_NODE (id
);
5643 tree class_id
, decl
;
5644 tree super_decl_type
;
5646 class_id
= parser_qualified_classname (id
);
5647 decl
= IDENTIFIER_CLASS_VALUE (class_id
);
5648 ctxp
->current_parsed_class_un
= EXPR_WFL_NODE (id
);
5649 EXPR_WFL_NODE (id
) = class_id
;
5651 /* Basic check: scope, redefinition, modifiers */
5652 if (check_class_interface_creation (0, flags
, raw_name
, class_id
, decl
, id
))
5655 /* Class modifier check:
5656 - Allowed modifier (already done at that point)
5657 - abstract AND final forbidden
5658 - Public classes defined in the correct file */
5659 if ((flags
& ACC_ABSTRACT
) && (flags
& ACC_FINAL
))
5660 parse_error_context (id
, "Class `%s' can't be declared both abstract "
5661 "and final", IDENTIFIER_POINTER (raw_name
));
5663 /* Create a new decl if DECL is NULL, otherwise fix it */
5664 decl
= maybe_create_class_interface_decl (decl
, class_id
, id
);
5666 /* If SUPER exists, use it, otherwise use Object */
5669 /* Can't extend java.lang.Object */
5670 if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id
)) == object_type_node
)
5672 parse_error_context (id
, "Can't extend `java.lang.Object'");
5677 register_incomplete_type (JDEP_SUPER
, super
, decl
, NULL_TREE
);
5679 else if (TREE_TYPE (decl
) != object_type_node
)
5680 super_decl_type
= object_type_node
;
5681 /* We're defining java.lang.Object */
5683 super_decl_type
= NULL_TREE
;
5685 /* Set super info and mark the class a complete */
5686 set_super_info (flags
, TREE_TYPE (decl
), super_decl_type
,
5687 ctxp
->interface_number
);
5688 ctxp
->interface_number
= 0;
5689 CLASS_COMPLETE_P (decl
) = 1;
5690 add_superinterfaces (decl
, interfaces
);
5692 /* If doing xref, store the location at which the inherited class
5693 (if any) was seen. */
5694 if (flag_emit_xref
&& super
)
5695 DECL_INHERITED_SOURCE_LINE (decl
) = EXPR_WFL_LINECOL (super
);
5697 /* Eventually sets the @deprecated tag flag */
5698 CHECK_DEPRECATED (decl
);
5703 /* Can't use lookup_field () since we don't want to load the class and
5704 can't set the CLASS_LOADED_P flag */
5707 find_field (class, name
)
5712 for (decl
= TYPE_FIELDS (class); decl
; decl
= TREE_CHAIN (decl
))
5714 if (DECL_NAME (decl
) == name
)
5720 /* Wrap around lookup_field that doesn't potentially upset the value
5724 lookup_field_wrapper (class, name
)
5729 java_parser_context_save_global ();
5730 decl
= lookup_field (&type
, name
);
5731 java_parser_context_restore_global ();
5732 return decl
== error_mark_node
? NULL
: decl
;
5735 /* Find duplicate field within the same class declarations and report
5736 the error. Returns 1 if a duplicated field was found, 0
5740 duplicate_declaration_error_p (new_field_name
, new_type
, cl
)
5741 tree new_field_name
, new_type
, cl
;
5743 /* This might be modified to work with method decl as well */
5744 tree decl
= find_field (TREE_TYPE (ctxp
->current_parsed_class
),
5748 char *t1
= xstrdup (purify_type_name
5749 ((TREE_CODE (new_type
) == POINTER_TYPE
5750 && TREE_TYPE (new_type
) == NULL_TREE
) ?
5751 IDENTIFIER_POINTER (TYPE_NAME (new_type
)) :
5752 lang_printable_name (new_type
, 1)));
5753 /* The type may not have been completed by the time we report
5755 char *t2
= xstrdup (purify_type_name
5756 ((TREE_CODE (TREE_TYPE (decl
)) == POINTER_TYPE
5757 && TREE_TYPE (TREE_TYPE (decl
)) == NULL_TREE
) ?
5758 IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl
))) :
5759 lang_printable_name (TREE_TYPE (decl
), 1)));
5761 (cl
, "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
5762 t1
, IDENTIFIER_POINTER (new_field_name
),
5763 t2
, IDENTIFIER_POINTER (DECL_NAME (decl
)),
5764 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
5772 /* Field registration routine. If TYPE doesn't exist, field
5773 declarations are linked to the undefined TYPE dependency list, to
5774 be later resolved in java_complete_class () */
5777 register_fields (flags
, type
, variable_list
)
5779 tree type
, variable_list
;
5781 tree current
, saved_type
;
5782 tree class_type
= TREE_TYPE (ctxp
->current_parsed_class
);
5783 int saved_lineno
= lineno
;
5785 tree wfl
= NULL_TREE
;
5787 /* If we're adding fields to interfaces, those fields are public,
5789 if (CLASS_INTERFACE (TYPE_NAME (class_type
)))
5791 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK
),
5793 "%s", "interface field(s)");
5794 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK
),
5796 "%s", "interface field(s)");
5797 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK
),
5798 flags
, ACC_FINAL
, "%s", "interface field(s)");
5799 check_modifiers ("Illegal interface member modifier `%s'", flags
,
5800 INTERFACE_FIELD_MODIFIERS
);
5801 flags
|= (ACC_PUBLIC
| ACC_STATIC
| ACC_FINAL
);
5804 /* Obtain a suitable type for resolution, if necessary */
5805 SET_TYPE_FOR_RESOLUTION (type
, wfl
, must_chain
);
5807 /* If TYPE is fully resolved and we don't have a reference, make one */
5808 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
5810 for (current
= variable_list
, saved_type
= type
; current
;
5811 current
= TREE_CHAIN (current
), type
= saved_type
)
5815 tree cl
= TREE_PURPOSE (current
);
5816 tree init
= TREE_VALUE (current
);
5817 tree current_name
= EXPR_WFL_NODE (cl
);
5819 /* Process NAME, as it may specify extra dimension(s) for it */
5820 type
= build_array_from_name (type
, wfl
, current_name
, ¤t_name
);
5822 /* Type adjustment. We may have just readjusted TYPE because
5823 the variable specified more dimensions. Make sure we have
5824 a reference if we can and don't have one already. Also
5825 change the name if we have an init. */
5826 if (type
!= saved_type
)
5828 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
5830 EXPR_WFL_NODE (TREE_OPERAND (init
, 0)) = current_name
;
5833 real_type
= GET_REAL_TYPE (type
);
5834 /* Check for redeclarations */
5835 if (duplicate_declaration_error_p (current_name
, real_type
, cl
))
5838 /* Set lineno to the line the field was found and create a
5839 declaration for it. Eventually sets the @deprecated tag flag. */
5841 lineno
= EXPR_WFL_LINECOL (cl
);
5843 lineno
= EXPR_WFL_LINENO (cl
);
5844 field_decl
= add_field (class_type
, current_name
, real_type
, flags
);
5845 CHECK_DEPRECATED (field_decl
);
5847 /* Check if we must chain. */
5849 register_incomplete_type (JDEP_FIELD
, wfl
, field_decl
, type
);
5851 /* If we have an initialization value tied to the field */
5854 /* The field is declared static */
5855 if (flags
& ACC_STATIC
)
5857 /* We include the field and its initialization part into
5858 a list used to generate <clinit>. After <clinit> is
5859 walked, field initializations will be processed and
5860 fields initialized with known constants will be taken
5861 out of <clinit> and have their DECL_INITIAL set
5863 TREE_CHAIN (init
) = ctxp
->static_initialized
;
5864 ctxp
->static_initialized
= init
;
5865 if (TREE_OPERAND (init
, 1)
5866 && TREE_CODE (TREE_OPERAND (init
, 1)) == NEW_ARRAY_INIT
)
5867 TREE_STATIC (TREE_OPERAND (init
, 1)) = 1;
5869 /* A non-static field declared with an immediate initialization is
5870 to be initialized in <init>, if any. This field is remembered
5871 to be processed at the time of the generation of <init>. */
5874 TREE_CHAIN (init
) = ctxp
->non_static_initialized
;
5875 ctxp
->non_static_initialized
= init
;
5877 MODIFY_EXPR_FROM_INITIALIZATION_P (init
) = 1;
5878 DECL_INITIAL (field_decl
) = TREE_OPERAND (init
, 1);
5881 lineno
= saved_lineno
;
5884 /* Generate the method $finit$ that initializes fields initialized
5885 upon declaration. */
5888 maybe_generate_finit ()
5890 tree mdecl
, current
;
5892 if (!ctxp
->non_static_initialized
|| java_error_count
)
5895 mdecl
= create_artificial_method (TREE_TYPE (ctxp
->current_parsed_class
),
5896 ACC_PRIVATE
, void_type_node
,
5897 finit_identifier_node
, end_params_node
);
5898 start_artificial_method_body (mdecl
);
5900 ctxp
->non_static_initialized
= nreverse (ctxp
->non_static_initialized
);
5901 for (current
= ctxp
->non_static_initialized
; current
;
5902 current
= TREE_CHAIN (current
))
5903 java_method_add_stmt (mdecl
,
5904 build_debugable_stmt (EXPR_WFL_LINECOL (current
),
5907 end_artificial_method_body (mdecl
);
5908 CLASS_HAS_FINIT_P (TREE_TYPE (ctxp
->current_parsed_class
)) = 1;
5909 ctxp
->non_static_initialized
= NULL_TREE
;
5912 /* Check whether it is necessary to generate a <clinit> for the class
5916 maybe_generate_clinit ()
5920 if (!ctxp
->static_initialized
|| java_error_count
)
5923 mdecl
= create_artificial_method (TREE_TYPE (ctxp
->current_parsed_class
),
5924 ACC_STATIC
, void_type_node
,
5925 clinit_identifier_node
, end_params_node
);
5926 start_artificial_method_body (mdecl
);
5928 /* Keep initialization in order to enforce 8.5 */
5929 ctxp
->static_initialized
= nreverse (ctxp
->static_initialized
);
5931 /* We process the list of assignment we produced as the result of
5932 the declaration of initialized static field and add them as
5933 statement to the <clinit> method. */
5934 for (c
= ctxp
->static_initialized
; c
; c
= TREE_CHAIN (c
))
5936 /* We build the assignment expression that will initialize the
5937 field to its value. There are strict rules on static
5938 initializers (8.5). FIXME */
5939 java_method_add_stmt (mdecl
,
5940 build_debugable_stmt (EXPR_WFL_LINECOL (c
), c
));
5943 end_artificial_method_body (mdecl
);
5944 ctxp
->static_initialized
= NULL_TREE
;
5947 /* Shared accros method_declarator and method_header to remember the
5948 patch stage that was reached during the declaration of the method.
5949 A method DECL is built differently is there is no patch
5950 (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
5951 pending on the currently defined method. */
5953 static int patch_stage
;
5955 /* Check the method declaration and add the method to its current
5956 class. If the argument list is known to contain incomplete types,
5957 the method is partially added and the registration will be resume
5958 once the method arguments resolved. If TYPE is NULL, we're dealing
5959 with a constructor. */
5962 method_header (flags
, type
, mdecl
, throws
)
5964 tree type
, mdecl
, throws
;
5966 tree meth
= TREE_VALUE (mdecl
);
5967 tree id
= TREE_PURPOSE (mdecl
);
5968 tree type_wfl
= NULL_TREE
;
5969 tree meth_name
= NULL_TREE
;
5970 tree current
, orig_arg
, this_class
;
5972 int constructor_ok
= 0, must_chain
;
5974 check_modifiers_consistency (flags
);
5976 if (ctxp
->current_parsed_class
)
5977 this_class
= TREE_TYPE (ctxp
->current_parsed_class
);
5981 /* There are some forbidden modifiers for an abstract method and its
5982 class must be abstract as well. */
5983 if (type
&& (flags
& ACC_ABSTRACT
))
5985 ABSTRACT_CHECK (flags
, ACC_PRIVATE
, id
, "Private");
5986 ABSTRACT_CHECK (flags
, ACC_STATIC
, id
, "Static");
5987 ABSTRACT_CHECK (flags
, ACC_FINAL
, id
, "Final");
5988 ABSTRACT_CHECK (flags
, ACC_NATIVE
, id
, "Native");
5989 ABSTRACT_CHECK (flags
, ACC_SYNCHRONIZED
,id
, "Synchronized");
5990 if (!CLASS_ABSTRACT (TYPE_NAME (this_class
))
5991 && !CLASS_INTERFACE (TYPE_NAME (this_class
)))
5993 (id
, "Class `%s' must be declared abstract to define abstract "
5995 IDENTIFIER_POINTER (DECL_NAME (ctxp
->current_parsed_class
)),
5996 IDENTIFIER_POINTER (EXPR_WFL_NODE (id
)));
5998 /* Things to be checked when declaring a constructor */
6001 int ec
= java_error_count
;
6002 /* 8.6: Constructor declarations: we might be trying to define a
6003 method without specifying a return type. */
6004 if (EXPR_WFL_NODE (id
) != ctxp
->current_parsed_class_un
)
6006 (id
, "Invalid method declaration, return type required");
6007 /* 8.6.3: Constructor modifiers */
6010 JCONSTRUCTOR_CHECK (flags
, ACC_ABSTRACT
, id
, "abstract");
6011 JCONSTRUCTOR_CHECK (flags
, ACC_STATIC
, id
, "static");
6012 JCONSTRUCTOR_CHECK (flags
, ACC_FINAL
, id
, "final");
6013 JCONSTRUCTOR_CHECK (flags
, ACC_NATIVE
, id
, "native");
6014 JCONSTRUCTOR_CHECK (flags
, ACC_SYNCHRONIZED
, id
, "synchronized");
6016 /* If we found error here, we don't consider it's OK to tread
6017 the method definition as a constructor, for the rest of this
6019 if (ec
== java_error_count
)
6023 /* Method declared within the scope of an interface are implicitly
6024 abstract and public. Conflicts with other erroneously provided
6025 modifiers are checked right after. */
6027 if (CLASS_INTERFACE (TYPE_NAME (this_class
)))
6029 /* If FLAGS isn't set because of a modifier, turn the
6030 corresponding modifier WFL to NULL so we issue a warning on
6031 the obsolete use of the modifier */
6032 if (!(flags
& ACC_PUBLIC
))
6033 MODIFIER_WFL (PUBLIC_TK
) = NULL
;
6034 if (!(flags
& ACC_ABSTRACT
))
6035 MODIFIER_WFL (ABSTRACT_TK
) = NULL
;
6036 flags
|= ACC_PUBLIC
;
6037 flags
|= ACC_ABSTRACT
;
6040 /* Modifiers context reset moved up, so abstract method declaration
6041 modifiers can be later checked. */
6043 /* Set constructor returned type to void and method name to <init>,
6044 unless we found an error identifier the constructor (in which
6045 case we retain the original name) */
6048 type
= void_type_node
;
6050 meth_name
= init_identifier_node
;
6053 meth_name
= EXPR_WFL_NODE (id
);
6055 /* Do the returned type resolution and registration if necessary */
6056 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
6059 type
= build_array_from_name (type
, type_wfl
, meth_name
, &meth_name
);
6060 EXPR_WFL_NODE (id
) = meth_name
;
6061 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
6065 patch_stage
= JDEP_METHOD_RETURN
;
6066 register_incomplete_type (patch_stage
, type_wfl
, id
, type
);
6067 TREE_TYPE (meth
) = GET_REAL_TYPE (type
);
6070 TREE_TYPE (meth
) = type
;
6072 saved_lineno
= lineno
;
6073 /* When defining an abstract or interface method, the curly
6074 bracket at level 1 doesn't exist because there is no function
6076 lineno
= (ctxp
->first_ccb_indent1
? ctxp
->first_ccb_indent1
:
6077 EXPR_WFL_LINENO (id
));
6079 /* Remember the original argument list */
6080 orig_arg
= TYPE_ARG_TYPES (meth
);
6082 if (patch_stage
) /* includes ret type and/or all args */
6085 meth
= add_method_1 (this_class
, flags
, meth_name
, meth
);
6086 /* Patch for the return type */
6087 if (patch_stage
== JDEP_METHOD_RETURN
)
6089 jdep
= CLASSD_LAST (ctxp
->classd_list
);
6090 JDEP_GET_PATCH (jdep
) = &TREE_TYPE (TREE_TYPE (meth
));
6092 /* This is the stop JDEP. METH allows the function's signature
6094 register_incomplete_type (JDEP_METHOD_END
, NULL_TREE
, meth
, NULL_TREE
);
6097 meth
= add_method (this_class
, flags
, meth_name
,
6098 build_java_signature (meth
));
6100 /* Fix the method argument list so we have the argument name
6102 fix_method_argument_names (orig_arg
, meth
);
6104 /* Register the parameter number and re-install the current line
6106 DECL_MAX_LOCALS (meth
) = ctxp
->formal_parameter_number
+1;
6107 lineno
= saved_lineno
;
6109 /* Register exception specified by the `throws' keyword for
6110 resolution and set the method decl appropriate field to the list.
6111 Note: the grammar ensures that what we get here are class
6115 throws
= nreverse (throws
);
6116 for (current
= throws
; current
; current
= TREE_CHAIN (current
))
6118 register_incomplete_type (JDEP_EXCEPTION
, TREE_VALUE (current
),
6119 NULL_TREE
, NULL_TREE
);
6120 JDEP_GET_PATCH (CLASSD_LAST (ctxp
->classd_list
)) =
6121 &TREE_VALUE (current
);
6123 DECL_FUNCTION_THROWS (meth
) = throws
;
6126 /* We set the DECL_NAME to ID so we can track the location where
6127 the function was declared. This allow us to report
6128 redefinition error accurately. When method are verified,
6129 DECL_NAME is reinstalled properly (using the content of the
6130 WFL node ID) (see check_method_redefinition). We don't do that
6131 when Object is being defined. Constructor <init> names will be
6132 reinstalled the same way. */
6133 if (TREE_TYPE (ctxp
->current_parsed_class
) != object_type_node
)
6134 DECL_NAME (meth
) = id
;
6136 /* Set the flag if we correctly processed a constructor */
6138 DECL_CONSTRUCTOR_P (meth
) = 1;
6140 /* Eventually set the @deprecated tag flag */
6141 CHECK_DEPRECATED (meth
);
6143 /* If doing xref, store column and line number information instead
6144 of the line number only. */
6146 DECL_SOURCE_LINE (meth
) = EXPR_WFL_LINECOL (id
);
6152 fix_method_argument_names (orig_arg
, meth
)
6153 tree orig_arg
, meth
;
6155 tree arg
= TYPE_ARG_TYPES (TREE_TYPE (meth
));
6156 if (TREE_CODE (TREE_TYPE (meth
)) == METHOD_TYPE
)
6158 TREE_PURPOSE (arg
) = this_identifier_node
;
6159 arg
= TREE_CHAIN (arg
);
6161 while (orig_arg
!= end_params_node
)
6163 TREE_PURPOSE (arg
) = TREE_PURPOSE (orig_arg
);
6164 orig_arg
= TREE_CHAIN (orig_arg
);
6165 arg
= TREE_CHAIN (arg
);
6169 /* Complete the method declaration with METHOD_BODY. */
6172 finish_method_declaration (method_body
)
6177 if (!current_function_decl
)
6180 flags
= get_access_flags_from_decl (current_function_decl
);
6182 /* 8.4.5 Method Body */
6183 if ((flags
& ACC_ABSTRACT
|| flags
& ACC_NATIVE
) && method_body
)
6185 tree wfl
= DECL_NAME (current_function_decl
);
6186 parse_error_context (wfl
,
6187 "%s method `%s' can't have a body defined",
6188 (METHOD_NATIVE (current_function_decl
) ?
6189 "Native" : "Abstract"),
6190 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
6191 method_body
= NULL_TREE
;
6193 else if (!(flags
& ACC_ABSTRACT
) && !(flags
& ACC_NATIVE
) && !method_body
)
6195 tree wfl
= DECL_NAME (current_function_decl
);
6196 parse_error_context (wfl
,
6197 "Non native and non abstract method `%s' must "
6198 "have a body defined",
6199 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
6200 method_body
= NULL_TREE
;
6203 if (flag_emit_class_files
&& method_body
6204 && TREE_CODE (method_body
) == NOP_EXPR
6205 && TREE_TYPE (current_function_decl
)
6206 && TREE_TYPE (TREE_TYPE (current_function_decl
)) == void_type_node
)
6207 method_body
= build1 (RETURN_EXPR
, void_type_node
, NULL
);
6209 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl
)) = method_body
;
6210 maybe_absorb_scoping_blocks ();
6211 /* Exit function's body */
6213 /* Merge last line of the function with first line, directly in the
6214 function decl. It will be used to emit correct debug info. */
6215 if (!flag_emit_xref
)
6216 DECL_SOURCE_LINE_MERGE (current_function_decl
, ctxp
->last_ccb_indent1
);
6217 /* So we don't have an irrelevant function declaration context for
6218 the next static block we'll see. */
6219 current_function_decl
= NULL_TREE
;
6222 /* Build a an error message for constructor circularity errors. */
6225 constructor_circularity_msg (from
, to
)
6228 static char string
[4096];
6229 char *t
= xstrdup (lang_printable_name (from
, 0));
6230 sprintf (string
, "`%s' invokes `%s'", t
, lang_printable_name (to
, 0));
6235 /* Verify a circular call to METH. Return 1 if an error is found, 0
6239 verify_constructor_circularity (meth
, current
)
6242 static tree list
= NULL_TREE
;
6244 for (c
= DECL_CONSTRUCTOR_CALLS (current
); c
; c
= TREE_CHAIN (c
))
6246 if (TREE_VALUE (c
) == meth
)
6252 list
= nreverse (list
);
6253 for (liste
= list
; liste
; liste
= TREE_CHAIN (liste
))
6256 (TREE_PURPOSE (TREE_PURPOSE (liste
)),
6257 constructor_circularity_msg
6258 (TREE_VALUE (liste
), TREE_VALUE (TREE_PURPOSE (liste
))));
6262 t
= xstrdup (lang_printable_name (meth
, 0));
6263 parse_error_context (TREE_PURPOSE (c
),
6264 "%s: recursive invocation of constructor `%s'",
6265 constructor_circularity_msg (current
, meth
), t
);
6271 for (c
= DECL_CONSTRUCTOR_CALLS (current
); c
; c
= TREE_CHAIN (c
))
6273 list
= tree_cons (c
, current
, list
);
6274 if (verify_constructor_circularity (meth
, TREE_VALUE (c
)))
6276 list
= TREE_CHAIN (list
);
6281 /* Check modifiers that can be declared but exclusively */
6284 check_modifiers_consistency (flags
)
6288 tree cl
= NULL_TREE
;
6290 THIS_MODIFIER_ONLY (flags
, ACC_PUBLIC
, 0, acc_count
, cl
);
6291 THIS_MODIFIER_ONLY (flags
, ACC_PRIVATE
, 1, acc_count
, cl
);
6292 THIS_MODIFIER_ONLY (flags
, ACC_PROTECTED
, 2, acc_count
, cl
);
6295 (cl
, "Inconsistent member declaration. At most one of `public', "
6296 "`private', or `protected' may be specified");
6299 /* Check the methode header METH for abstract specifics features */
6302 check_abstract_method_header (meth
)
6305 int flags
= get_access_flags_from_decl (meth
);
6306 /* DECL_NAME might still be a WFL node */
6307 tree name
= GET_METHOD_NAME (meth
);
6309 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK
), flags
,
6310 ACC_ABSTRACT
, "abstract method `%s'",
6311 IDENTIFIER_POINTER (name
));
6312 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK
), flags
,
6313 ACC_PUBLIC
, "abstract method `%s'",
6314 IDENTIFIER_POINTER (name
));
6316 check_modifiers ("Illegal modifier `%s' for interface method",
6317 flags
, INTERFACE_METHOD_MODIFIERS
);
6320 /* Create a FUNCTION_TYPE node and start augmenting it with the
6321 declared function arguments. Arguments type that can't be resolved
6322 are left as they are, but the returned node is marked as containing
6323 incomplete types. */
6326 method_declarator (id
, list
)
6329 tree arg_types
= NULL_TREE
, current
, node
;
6330 tree meth
= make_node (FUNCTION_TYPE
);
6333 patch_stage
= JDEP_NO_PATCH
;
6335 for (current
= list
; current
; current
= TREE_CHAIN (current
))
6338 tree wfl_name
= TREE_PURPOSE (current
);
6339 tree type
= TREE_VALUE (current
);
6340 tree name
= EXPR_WFL_NODE (wfl_name
);
6341 tree already
, arg_node
;
6342 tree type_wfl
= NULL_TREE
;
6345 /* Obtain a suitable type for resolution, if necessary */
6346 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
6348 /* Process NAME, as it may specify extra dimension(s) for it */
6349 type
= build_array_from_name (type
, type_wfl
, name
, &name
);
6350 EXPR_WFL_NODE (wfl_name
) = name
;
6352 real_type
= GET_REAL_TYPE (type
);
6353 if (TREE_CODE (real_type
) == RECORD_TYPE
)
6355 real_type
= promote_type (real_type
);
6356 if (TREE_CODE (type
) == TREE_LIST
)
6357 TREE_PURPOSE (type
) = real_type
;
6360 /* Check redefinition */
6361 for (already
= arg_types
; already
; already
= TREE_CHAIN (already
))
6362 if (TREE_PURPOSE (already
) == name
)
6365 (wfl_name
, "Variable `%s' is used more than once in the "
6366 "argument list of method `%s'", IDENTIFIER_POINTER (name
),
6367 IDENTIFIER_POINTER (EXPR_WFL_NODE (id
)));
6371 /* If we've an incomplete argument type, we know there is a location
6372 to patch when the type get resolved, later. */
6376 patch_stage
= JDEP_METHOD
;
6377 type
= register_incomplete_type (patch_stage
,
6378 type_wfl
, wfl_name
, type
);
6379 jdep
= CLASSD_LAST (ctxp
->classd_list
);
6380 JDEP_MISC (jdep
) = id
;
6383 /* The argument node: a name and a (possibly) incomplete type */
6384 arg_node
= build_tree_list (name
, real_type
);
6386 JDEP_GET_PATCH (jdep
) = &TREE_VALUE (arg_node
);
6387 TREE_CHAIN (arg_node
) = arg_types
;
6388 arg_types
= arg_node
;
6390 TYPE_ARG_TYPES (meth
) = chainon (nreverse (arg_types
), end_params_node
);
6391 node
= build_tree_list (id
, meth
);
6396 unresolved_type_p (wfl
, returned
)
6401 if (TREE_CODE (wfl
) == EXPR_WITH_FILE_LOCATION
)
6403 tree decl
= IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl
));
6405 *returned
= (decl
? TREE_TYPE (decl
) : NULL_TREE
);
6413 /* From NAME, build a qualified identifier node using the
6414 qualification from the current package definition. */
6417 parser_qualified_classname (name
)
6421 return merge_qualified_name (ctxp
->package
, EXPR_WFL_NODE (name
));
6423 return EXPR_WFL_NODE (name
);
6426 /* Called once the type a interface extends is resolved. Returns 0 if
6427 everything is OK. */
6430 parser_check_super_interface (super_decl
, this_decl
, this_wfl
)
6431 tree super_decl
, this_decl
, this_wfl
;
6433 tree super_type
= TREE_TYPE (super_decl
);
6435 /* Has to be an interface */
6436 if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl
))))
6439 (this_wfl
, "Can't use %s `%s' to implement/extend %s `%s'",
6440 (TYPE_ARRAY_P (super_type
) ? "array" : "class"),
6441 IDENTIFIER_POINTER (DECL_NAME (super_decl
)),
6442 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl
))) ?
6443 "interface" : "class"),
6444 IDENTIFIER_POINTER (DECL_NAME (this_decl
)));
6448 /* Check scope: same package OK, other package: OK if public */
6449 if (check_pkg_class_access (DECL_NAME (super_decl
), lookup_cl (this_decl
)))
6452 SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
6453 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6454 IDENTIFIER_POINTER (DECL_NAME (super_decl
))));
6458 /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
6459 0 if everthing is OK. */
6462 parser_check_super (super_decl
, this_decl
, wfl
)
6463 tree super_decl
, this_decl
, wfl
;
6465 tree super_type
= TREE_TYPE (super_decl
);
6467 /* SUPER should be a CLASS (neither an array nor an interface) */
6468 if (TYPE_ARRAY_P (super_type
) || CLASS_INTERFACE (TYPE_NAME (super_type
)))
6471 (wfl
, "Class `%s' can't subclass %s `%s'",
6472 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6473 (CLASS_INTERFACE (TYPE_NAME (super_type
)) ? "interface" : "array"),
6474 IDENTIFIER_POINTER (DECL_NAME (super_decl
)));
6478 if (CLASS_FINAL (TYPE_NAME (super_type
)))
6480 parse_error_context (wfl
, "Can't subclass final classes: %s",
6481 IDENTIFIER_POINTER (DECL_NAME (super_decl
)));
6485 /* Check scope: same package OK, other package: OK if public */
6486 if (check_pkg_class_access (DECL_NAME (super_decl
), wfl
))
6489 SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
6490 IDENTIFIER_POINTER (DECL_NAME (this_decl
)),
6491 IDENTIFIER_POINTER (DECL_NAME (super_decl
))));
6495 /* Create a new dependency list and link it (in a LIFO manner) to the
6496 CTXP list of type dependency list. */
6499 create_jdep_list (ctxp
)
6500 struct parser_ctxt
*ctxp
;
6502 jdeplist
*new = (jdeplist
*)xmalloc (sizeof (jdeplist
));
6503 new->first
= new->last
= NULL
;
6504 new->next
= ctxp
->classd_list
;
6505 ctxp
->classd_list
= new;
6509 reverse_jdep_list (ctxp
)
6510 struct parser_ctxt
*ctxp
;
6512 register jdeplist
*prev
= NULL
, *current
, *next
;
6513 for (current
= ctxp
->classd_list
; current
; current
= next
)
6515 next
= current
->next
;
6516 current
->next
= prev
;
6522 /* Create a fake pointer based on the ID stored in
6523 TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
6524 registered again. */
6527 obtain_incomplete_type (type_name
)
6532 if (TREE_CODE (type_name
) == EXPR_WITH_FILE_LOCATION
)
6533 name
= EXPR_WFL_NODE (type_name
);
6534 else if (INCOMPLETE_TYPE_P (type_name
))
6535 name
= TYPE_NAME (type_name
);
6537 fatal ("invalid type name - obtain_incomplete_type");
6539 for (ptr
= ctxp
->incomplete_class
; ptr
; ptr
= TREE_CHAIN (ptr
))
6540 if (TYPE_NAME (ptr
) == name
)
6545 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6546 BUILD_PTR_FROM_NAME (ptr
, name
);
6549 TREE_CHAIN (ptr
) = ctxp
->incomplete_class
;
6550 ctxp
->incomplete_class
= ptr
;
6556 /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
6557 non NULL instead of computing a new fake type based on WFL. The new
6558 dependency is inserted in the current type dependency list, in FIFO
6562 register_incomplete_type (kind
, wfl
, decl
, ptr
)
6564 tree wfl
, decl
, ptr
;
6566 jdep
*new = (jdep
*)xmalloc (sizeof (jdep
));
6568 if (!ptr
&& kind
!= JDEP_METHOD_END
) /* JDEP_METHOD_END is a mere marker */
6569 ptr
= obtain_incomplete_type (wfl
);
6571 JDEP_KIND (new) = kind
;
6572 JDEP_DECL (new) = decl
;
6573 JDEP_SOLV (new) = ptr
;
6574 JDEP_WFL (new) = wfl
;
6575 JDEP_CHAIN (new) = NULL
;
6576 JDEP_MISC (new) = NULL_TREE
;
6577 JDEP_GET_PATCH (new) = (tree
*)NULL
;
6579 JDEP_INSERT (ctxp
->classd_list
, new);
6585 java_check_circular_reference ()
6588 for (current
= ctxp
->class_list
; current
; current
= TREE_CHAIN (current
))
6590 tree type
= TREE_TYPE (current
);
6591 if (CLASS_INTERFACE (TYPE_NAME (type
)))
6593 /* Check all interfaces this class extends */
6594 tree basetype_vec
= TYPE_BINFO_BASETYPES (type
);
6599 n
= TREE_VEC_LENGTH (basetype_vec
);
6600 for (i
= 0; i
< n
; i
++)
6602 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
);
6603 if (vec_elt
&& BINFO_TYPE (vec_elt
) != object_type_node
6604 && interface_of_p (type
, BINFO_TYPE (vec_elt
)))
6605 parse_error_context (lookup_cl (current
),
6606 "Cyclic interface inheritance");
6610 if (inherits_from_p (CLASSTYPE_SUPER (type
), type
))
6611 parse_error_context (lookup_cl (current
),
6612 "Cyclic class inheritance");
6616 /* safe_layout_class just makes sure that we can load a class without
6617 disrupting the current_class, input_file, lineno, etc, information
6618 about the class processed currently. */
6621 safe_layout_class (class)
6624 tree save_current_class
= current_class
;
6625 char *save_input_filename
= input_filename
;
6626 int save_lineno
= lineno
;
6628 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6630 layout_class (class);
6633 current_class
= save_current_class
;
6634 input_filename
= save_input_filename
;
6635 lineno
= save_lineno
;
6636 CLASS_LOADED_P (class) = 1;
6640 jdep_resolve_class (dep
)
6645 if (JDEP_RESOLVED_P (dep
))
6646 decl
= JDEP_RESOLVED_DECL (dep
);
6649 decl
= resolve_class (JDEP_TO_RESOLVE (dep
),
6650 JDEP_DECL (dep
), JDEP_WFL (dep
));
6651 JDEP_RESOLVED (dep
, decl
);
6655 complete_class_report_errors (dep
);
6660 /* Complete unsatisfied class declaration and their dependencies */
6663 java_complete_class ()
6670 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6672 /* Process imports and reverse the import on demand list */
6674 if (ctxp
->import_demand_list
)
6675 ctxp
->import_demand_list
= nreverse (ctxp
->import_demand_list
);
6677 /* Rever things so we have the right order */
6678 ctxp
->class_list
= nreverse (ctxp
->class_list
);
6679 ctxp
->classd_list
= reverse_jdep_list (ctxp
);
6681 for (cclassd
= ctxp
->classd_list
, cclass
= ctxp
->class_list
;
6683 cclass
= TREE_CHAIN (cclass
), cclassd
= CLASSD_CHAIN (cclassd
))
6686 for (dep
= CLASSD_FIRST (cclassd
); dep
; dep
= JDEP_CHAIN (dep
))
6689 if (!(decl
= jdep_resolve_class (dep
)))
6692 /* Now it's time to patch */
6693 switch (JDEP_KIND (dep
))
6696 /* Simply patch super */
6697 if (parser_check_super (decl
, JDEP_DECL (dep
), JDEP_WFL (dep
)))
6699 BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
6700 (TREE_TYPE (JDEP_DECL (dep
)))), 0)) = TREE_TYPE (decl
);
6705 /* We do part of the job done in add_field */
6706 tree field_decl
= JDEP_DECL (dep
);
6707 tree field_type
= TREE_TYPE (decl
);
6708 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6709 if (TREE_CODE (field_type
) == RECORD_TYPE
)
6710 field_type
= promote_type (field_type
);
6712 TREE_TYPE (field_decl
) = field_type
;
6713 DECL_ALIGN (field_decl
) = 0;
6714 layout_decl (field_decl
, 0);
6715 SOURCE_FRONTEND_DEBUG
6716 (("Completed field/var decl `%s' with `%s'",
6717 IDENTIFIER_POINTER (DECL_NAME (field_decl
)),
6718 IDENTIFIER_POINTER (DECL_NAME (decl
))));
6721 case JDEP_METHOD
: /* We start patching a method */
6722 case JDEP_METHOD_RETURN
:
6728 type
= TREE_TYPE(decl
);
6729 if (TREE_CODE (type
) == RECORD_TYPE
)
6730 type
= promote_type (type
);
6731 JDEP_APPLY_PATCH (dep
, type
);
6732 SOURCE_FRONTEND_DEBUG
6733 (((JDEP_KIND (dep
) == JDEP_METHOD_RETURN
?
6734 "Completing fct `%s' with ret type `%s'":
6735 "Completing arg `%s' with type `%s'"),
6736 IDENTIFIER_POINTER (EXPR_WFL_NODE
6737 (JDEP_DECL_WFL (dep
))),
6738 IDENTIFIER_POINTER (DECL_NAME (decl
))));
6742 dep
= JDEP_CHAIN (dep
);
6743 if (JDEP_KIND (dep
) == JDEP_METHOD_END
)
6746 decl
= jdep_resolve_class (dep
);
6750 tree mdecl
= JDEP_DECL (dep
), signature
;
6751 push_obstacks (&permanent_obstack
, &permanent_obstack
);
6752 /* Recompute and reset the signature */
6753 signature
= build_java_signature (TREE_TYPE (mdecl
));
6754 set_java_signature (TREE_TYPE (mdecl
), signature
);
6761 case JDEP_INTERFACE
:
6762 if (parser_check_super_interface (decl
, JDEP_DECL (dep
),
6765 parser_add_interface (JDEP_DECL (dep
), decl
, JDEP_WFL (dep
));
6770 type
= TREE_TYPE(decl
);
6771 if (TREE_CODE (type
) == RECORD_TYPE
)
6772 type
= promote_type (type
);
6773 JDEP_APPLY_PATCH (dep
, type
);
6777 JDEP_APPLY_PATCH (dep
, TREE_TYPE (decl
));
6778 SOURCE_FRONTEND_DEBUG
6779 (("Completing a random type dependency on a '%s' node",
6780 tree_code_name
[TREE_CODE (JDEP_DECL (dep
))]));
6783 case JDEP_EXCEPTION
:
6784 JDEP_APPLY_PATCH (dep
, TREE_TYPE (decl
));
6785 SOURCE_FRONTEND_DEBUG
6786 (("Completing `%s' `throws' argument node",
6787 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
)))));
6791 fatal ("Can't handle patch code %d - java_complete_class",
6800 /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
6804 resolve_class (class_type
, decl
, cl
)
6805 tree class_type
, decl
, cl
;
6807 const char *name
= IDENTIFIER_POINTER (TYPE_NAME (class_type
));
6808 const char *base
= name
;
6809 tree resolved_type
= TREE_TYPE (class_type
);
6810 tree resolved_type_decl
;
6812 if (resolved_type
!= NULL_TREE
)
6814 tree resolved_type_decl
= TYPE_NAME (resolved_type
);
6815 if (resolved_type_decl
== NULL_TREE
6816 || TREE_CODE (resolved_type_decl
) == IDENTIFIER_NODE
)
6818 resolved_type_decl
= build_decl (TYPE_DECL
,
6819 TYPE_NAME (class_type
),
6822 return resolved_type_decl
;
6825 /* 1- Check to see if we have an array. If true, find what we really
6827 while (name
[0] == '[')
6830 TYPE_NAME (class_type
) = get_identifier (name
);
6832 /* 2- Resolve the bare type */
6833 if (!(resolved_type_decl
= do_resolve_class (class_type
, decl
, cl
)))
6835 resolved_type
= TREE_TYPE (resolved_type_decl
);
6837 /* 3- If we have and array, reconstruct the array down to its nesting */
6840 while (base
!= name
)
6842 if (TREE_CODE (resolved_type
) == RECORD_TYPE
)
6843 resolved_type
= promote_type (resolved_type
);
6844 resolved_type
= build_java_array_type (resolved_type
, -1);
6845 CLASS_LOADED_P (resolved_type
) = 1;
6848 /* Build a fake decl for this, since this is what is expected to
6850 resolved_type_decl
=
6851 build_decl (TYPE_DECL
, TYPE_NAME (resolved_type
), resolved_type
);
6852 /* Figure how those two things are important for error report. FIXME */
6853 DECL_SOURCE_LINE (resolved_type_decl
) = 0;
6854 DECL_SOURCE_FILE (resolved_type_decl
) = input_filename
;
6855 TYPE_NAME (class_type
) = TYPE_NAME (resolved_type
);
6857 TREE_TYPE (class_type
) = resolved_type
;
6858 return resolved_type_decl
;
6861 /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
6862 are used to report error messages. */
6865 do_resolve_class (class_type
, decl
, cl
)
6870 tree new_class_decl
;
6871 tree original_name
= NULL_TREE
;
6873 /* Do not try to replace TYPE_NAME (class_type) by a variable, since
6874 its is changed by find_in_imports{_on_demand} */
6876 /* 1- Check for the type in single imports */
6877 if (find_in_imports (class_type
))
6880 /* 2- And check for the type in the current compilation unit. If it fails,
6881 try with a name qualified with the package name if appropriate. */
6882 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6884 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6885 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6886 load_class (TYPE_NAME (class_type
), 0);
6887 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6890 original_name
= TYPE_NAME (class_type
);
6891 if (!QUALIFIED_P (TYPE_NAME (class_type
)) && ctxp
->package
)
6892 TYPE_NAME (class_type
) = merge_qualified_name (ctxp
->package
,
6893 TYPE_NAME (class_type
));
6895 if (!(new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6896 load_class (TYPE_NAME (class_type
), 0);
6897 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6899 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6900 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6901 load_class (TYPE_NAME (class_type
), 0);
6902 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6905 new_name
= TYPE_NAME (class_type
);
6906 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (new_name
)) != NULL_TREE
)
6908 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl
)) &&
6909 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl
)))
6910 load_class (new_name
, 0);
6911 return IDENTIFIER_CLASS_VALUE (new_name
);
6915 tree
class = read_class (new_name
);
6916 if (class != NULL_TREE
)
6918 tree decl
= IDENTIFIER_CLASS_VALUE (new_name
);
6919 if (decl
== NULL_TREE
)
6920 decl
= push_class (class, new_name
);
6925 TYPE_NAME (class_type
) = original_name
;
6927 /* 3- Check an other compilation unit that bears the name of type */
6928 load_class (TYPE_NAME (class_type
), 0);
6929 if (check_pkg_class_access (TYPE_NAME (class_type
),
6930 (cl
? cl
: lookup_cl (decl
))))
6933 if ((new_class_decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
))))
6934 return new_class_decl
;
6936 /* 4- Check the import on demands. Don't allow bar.baz to be
6937 imported from foo.* */
6938 if (!QUALIFIED_P (TYPE_NAME (class_type
)))
6939 if (find_in_imports_on_demand (class_type
))
6942 /* 5- Last call for a resolution */
6943 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
6946 /* Resolve NAME and lay it out (if not done and if not the current
6947 parsed class). Return a decl node. This function is meant to be
6948 called when type resolution is necessary during the walk pass. */
6951 resolve_and_layout (something
, cl
)
6957 /* Don't do that on the current class */
6958 if (something
== current_class
)
6959 return TYPE_NAME (current_class
);
6961 /* Don't do anything for void and other primitive types */
6962 if (JPRIMITIVE_TYPE_P (something
) || something
== void_type_node
)
6965 /* Pointer types can be reall pointer types or fake pointers. When
6966 finding a real pointer, recheck for primitive types */
6967 if (TREE_CODE (something
) == POINTER_TYPE
)
6969 if (TREE_TYPE (something
))
6971 something
= TREE_TYPE (something
);
6972 if (JPRIMITIVE_TYPE_P (something
) || something
== void_type_node
)
6976 something
= TYPE_NAME (something
);
6979 /* Don't do anything for arrays of primitive types */
6980 if (TREE_CODE (something
) == RECORD_TYPE
&& TYPE_ARRAY_P (something
)
6981 && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something
)))
6984 /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL
6986 if (TREE_CODE (something
) != IDENTIFIER_NODE
)
6987 something
= (TREE_CODE (TYPE_NAME (something
)) == TYPE_DECL
?
6988 DECL_NAME (TYPE_NAME (something
)) : TYPE_NAME (something
));
6990 if (!(decl
= resolve_no_layout (something
, cl
)))
6993 /* Resolve and layout if necessary */
6994 layout_class_methods (TREE_TYPE (decl
));
6995 /* Check methods, but only once */
6996 if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl
))
6997 && !CLASS_LOADED_P (TREE_TYPE (decl
)))
6998 CHECK_METHODS (decl
);
6999 if (TREE_TYPE (decl
) != current_class
&& !CLASS_LOADED_P (TREE_TYPE (decl
)))
7000 safe_layout_class (TREE_TYPE (decl
));
7005 /* Resolve a class, returns its decl but doesn't perform any
7006 layout. The current parsing context is saved and restored */
7009 resolve_no_layout (name
, cl
)
7013 BUILD_PTR_FROM_NAME (ptr
, name
);
7014 java_parser_context_save_global ();
7015 decl
= resolve_class (ptr
, NULL_TREE
, cl
);
7016 java_parser_context_restore_global ();
7021 /* Called when reporting errors. Skip leader '[' in a complex array
7022 type description that failed to be resolved. */
7025 purify_type_name (name
)
7028 while (*name
&& *name
== '[')
7033 /* The type CURRENT refers to can't be found. We print error messages. */
7036 complete_class_report_errors (dep
)
7041 if (!JDEP_WFL (dep
))
7044 name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
)));
7045 switch (JDEP_KIND (dep
))
7049 (JDEP_WFL (dep
), "Superclass `%s' of class `%s' not found",
7050 purify_type_name (name
),
7051 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7055 (JDEP_WFL (dep
), "Type `%s' not found in declaration of field `%s'",
7056 purify_type_name (name
),
7057 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7059 case JDEP_METHOD
: /* Covers arguments */
7061 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
7062 "argument `%s' of method `%s'",
7063 purify_type_name (name
),
7064 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep
))),
7065 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep
))));
7067 case JDEP_METHOD_RETURN
: /* Covers return type */
7069 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
7070 "return type of method `%s'",
7071 purify_type_name (name
),
7072 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep
))));
7074 case JDEP_INTERFACE
:
7076 (JDEP_WFL (dep
), "Superinterface `%s' of %s `%s' not found",
7077 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
))),
7078 (CLASS_OR_INTERFACE (JDEP_DECL (dep
), "class", "interface")),
7079 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7083 (JDEP_WFL (dep
), "Type `%s' not found in the declaration of the "
7084 "local variable `%s'",
7085 purify_type_name (IDENTIFIER_POINTER
7086 (EXPR_WFL_NODE (JDEP_WFL (dep
)))),
7087 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep
))));
7089 case JDEP_EXCEPTION
: /* As specified by `throws' */
7091 (JDEP_WFL (dep
), "Class `%s' not found in `throws'",
7092 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep
))));
7095 /* Fix for -Wall. Just break doing nothing. The error will be
7101 /* Check uninitialized final. */
7108 /* Return a static string containing the DECL prototype string. If
7109 DECL is a constructor, use the class name instead of the form
7113 get_printable_method_name (decl
)
7116 const char *to_return
;
7117 tree name
= NULL_TREE
;
7119 if (DECL_CONSTRUCTOR_P (decl
))
7121 name
= DECL_NAME (decl
);
7122 DECL_NAME (decl
) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl
)));
7125 to_return
= lang_printable_name (decl
, 0);
7126 if (DECL_CONSTRUCTOR_P (decl
))
7127 DECL_NAME (decl
) = name
;
7132 /* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
7133 nevertheless needs to be verfied, 1 otherwise. */
7136 reset_method_name (method
)
7139 if (!IS_CLINIT (method
) && DECL_NAME (method
) != finit_identifier_node
)
7141 /* NAME is just the plain name when Object is being defined */
7142 if (DECL_CONTEXT (method
) != object_type_node
)
7143 DECL_NAME (method
) = (DECL_CONSTRUCTOR_P (method
) ?
7144 init_identifier_node
: GET_METHOD_NAME (method
));
7151 /* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
7154 java_get_real_method_name (method_decl
)
7157 tree method_name
= DECL_NAME (method_decl
);
7158 if (DECL_CONSTRUCTOR_P (method_decl
))
7159 return init_identifier_node
;
7161 /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
7162 and still can be a constructor. FIXME */
7164 /* Don't confuse method only bearing the name of their class as
7166 else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl
))
7168 && ctxp
->current_parsed_class_un
== EXPR_WFL_NODE (method_name
)
7169 && get_access_flags_from_decl (method_decl
) <= ACC_PROTECTED
7170 && TREE_TYPE (TREE_TYPE (method_decl
)) == void_type_node
)
7171 return init_identifier_node
;
7173 return EXPR_WFL_NODE (method_name
);
7176 /* Track method being redefined inside the same class. As a side
7177 effect, set DECL_NAME to an IDENTIFIER (prior entering this
7178 function it's a FWL, so we can track errors more accurately.) */
7181 check_method_redefinition (class, method
)
7185 tree cl
= DECL_NAME (method
);
7186 tree sig
= TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method
));
7187 /* decl name of artificial <clinit> and $finit$ doesn't need to be
7188 fixed and checked */
7190 /* Reset the method name before running the check. If it returns 1,
7191 the method doesn't need to be verified with respect to method
7192 redeclaration and we return 0 */
7193 if (reset_method_name (method
))
7196 name
= DECL_NAME (method
);
7197 for (redef
= TYPE_METHODS (class); redef
; redef
= TREE_CHAIN (redef
))
7199 if (redef
== method
)
7201 if (DECL_NAME (redef
) == name
7202 && sig
== TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef
)))
7205 (cl
, "Duplicate %s declaration `%s'",
7206 (DECL_CONSTRUCTOR_P (redef
) ? "constructor" : "method"),
7207 get_printable_method_name (redef
));
7215 check_abstract_method_definitions (do_interface
, class_decl
, type
)
7217 tree class_decl
, type
;
7219 tree
class = TREE_TYPE (class_decl
);
7220 tree method
, end_type
;
7222 end_type
= (do_interface
? object_type_node
: type
);
7223 for (method
= TYPE_METHODS (type
); method
; method
= TREE_CHAIN (method
))
7225 tree other_super
, other_method
, method_sig
, method_name
;
7228 if (!METHOD_ABSTRACT (method
) || METHOD_FINAL (method
))
7231 /* Now verify that somewhere in between TYPE and CLASS,
7232 abstract method METHOD gets a non abstract definition
7233 that is inherited by CLASS. */
7235 method_sig
= build_java_signature (TREE_TYPE (method
));
7236 method_name
= DECL_NAME (method
);
7237 if (TREE_CODE (method_name
) == EXPR_WITH_FILE_LOCATION
)
7238 method_name
= EXPR_WFL_NODE (method_name
);
7240 for (other_super
= class; other_super
!= end_type
;
7241 other_super
= CLASSTYPE_SUPER (other_super
))
7243 for (other_method
= TYPE_METHODS (other_super
); other_method
;
7244 other_method
= TREE_CHAIN (other_method
))
7246 tree s
= build_java_signature (TREE_TYPE (other_method
));
7247 tree other_name
= DECL_NAME (other_method
);
7249 if (TREE_CODE (other_name
) == EXPR_WITH_FILE_LOCATION
)
7250 other_name
= EXPR_WFL_NODE (other_name
);
7251 if (!IS_CLINIT (other_method
)
7252 && !DECL_CONSTRUCTOR_P (other_method
)
7253 && method_name
== other_name
&& method_sig
== s
)
7261 /* Report that abstract METHOD didn't find an implementation
7262 that CLASS can use. */
7265 char *t
= xstrdup (lang_printable_name
7266 (TREE_TYPE (TREE_TYPE (method
)), 0));
7267 tree ccn
= DECL_NAME (TYPE_NAME (DECL_CONTEXT (method
)));
7268 tree saved_wfl
= NULL_TREE
;
7270 if (TREE_CODE (DECL_NAME (method
)) == EXPR_WITH_FILE_LOCATION
)
7272 saved_wfl
= DECL_NAME (method
);
7273 DECL_NAME (method
) = EXPR_WFL_NODE (DECL_NAME (method
));
7277 (lookup_cl (class_decl
),
7278 "Class `%s' doesn't define the abstract method `%s %s' from "
7279 "%s `%s'. This method must be defined or %s `%s' must be "
7280 "declared abstract",
7281 IDENTIFIER_POINTER (DECL_NAME (class_decl
)),
7282 t
, lang_printable_name (method
, 0),
7283 (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method
))) ?
7284 "interface" : "class"),
7285 IDENTIFIER_POINTER (ccn
),
7286 (CLASS_INTERFACE (class_decl
) ? "interface" : "class"),
7287 IDENTIFIER_POINTER (DECL_NAME (class_decl
)));
7292 DECL_NAME (method
) = saved_wfl
;
7297 /* Check that CLASS_DECL somehoow implements all inherited abstract
7301 java_check_abstract_method_definitions (class_decl
)
7304 tree
class = TREE_TYPE (class_decl
);
7308 if (CLASS_ABSTRACT (class_decl
))
7311 /* Check for inherited types */
7312 for (super
= CLASSTYPE_SUPER (class); super
!= object_type_node
;
7313 super
= CLASSTYPE_SUPER (super
))
7315 if (!CLASS_ABSTRACT (TYPE_NAME (super
)))
7318 check_abstract_method_definitions (0, class_decl
, super
);
7321 /* Check for implemented interfaces. */
7322 vector
= TYPE_BINFO_BASETYPES (class);
7323 for (i
= 1; i
< TREE_VEC_LENGTH (vector
); i
++)
7325 super
= BINFO_TYPE (TREE_VEC_ELT (vector
, i
));
7326 check_abstract_method_definitions (1, class_decl
, super
);
7330 /* Check all the methods of CLASS_DECL. Methods are first completed
7331 then checked according to regular method existance rules. If no
7332 constructor for CLASS_DECL were encountered, then build its
7336 java_check_regular_methods (class_decl
)
7339 int saw_constructor
= 0;
7341 tree
class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl
));
7342 tree super_class
= CLASSTYPE_SUPER (class);
7343 tree saved_found_wfl
= NULL_TREE
, found
= NULL_TREE
;
7346 /* It is not necessary to check methods defined in java.lang.Object */
7347 if (class == object_type_node
)
7350 if (!TYPE_NVIRTUALS (class))
7351 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7353 /* Should take interfaces into account. FIXME */
7354 for (method
= TYPE_METHODS (class); method
; method
= TREE_CHAIN (method
))
7357 tree method_wfl
= DECL_NAME (method
);
7360 /* If we previously found something and its name was saved,
7362 if (found
&& saved_found_wfl
)
7364 DECL_NAME (found
) = saved_found_wfl
;
7365 saved_found_wfl
= NULL_TREE
;
7368 /* Check for redefinitions */
7369 if (check_method_redefinition (class, method
))
7372 /* If we see one constructor a mark so we don't generate the
7373 default one. Also skip other verifications: constructors
7374 can't be inherited hence hiden or overriden */
7375 if (DECL_CONSTRUCTOR_P (method
))
7377 saw_constructor
= 1;
7381 /* We verify things thrown by the method. They must inherits from
7382 java.lang.Throwable */
7383 for (mthrows
= DECL_FUNCTION_THROWS (method
);
7384 mthrows
; mthrows
= TREE_CHAIN (mthrows
))
7386 if (!inherits_from_p (TREE_VALUE (mthrows
), throwable_type_node
))
7388 (TREE_PURPOSE (mthrows
), "Class `%s' in `throws' clause must be "
7389 "a subclass of class `java.lang.Throwable'",
7391 (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows
)))));
7394 sig
= build_java_argument_signature (TREE_TYPE (method
));
7395 found
= lookup_argument_method (super_class
, DECL_NAME (method
), sig
);
7397 /* Nothing overrides or it's a private method. */
7400 if (METHOD_PRIVATE (found
))
7406 /* If found wasn't verified, it's DECL_NAME won't be set properly.
7407 We set it temporarily for the sake of the error report. */
7408 saved_found_wfl
= DECL_NAME (found
);
7409 reset_method_name (found
);
7411 /* Can't override a method with the same name and different return
7413 if (TREE_TYPE (TREE_TYPE (found
)) != TREE_TYPE (TREE_TYPE (method
)))
7415 char *t
= xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found
)),
7419 "Method `%s' was defined with return type `%s' in class `%s'",
7420 lang_printable_name (found
, 0), t
,
7422 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7426 aflags
= get_access_flags_from_decl (found
);
7427 /* If the method has default, access in an other package, then
7428 issue a warning that the current method doesn't override the
7429 one that was found elsewhere. Do not issue this warning when
7430 the match was found in java.lang.Object. */
7431 if (DECL_CONTEXT (found
) != object_type_node
7432 && ((aflags
& 0x7) == 0)
7433 && !class_in_current_package (DECL_CONTEXT (found
))
7434 && DECL_NAME (found
) != clinit_identifier_node
7435 && flag_not_overriding
)
7437 parse_warning_context
7438 (method_wfl
, "Method `%s' in class `%s' does not "
7439 "override the corresponding method in class `%s', which is "
7440 "private to a different package",
7441 lang_printable_name (found
, 0),
7442 IDENTIFIER_POINTER (DECL_NAME (class_decl
)),
7443 IDENTIFIER_POINTER (DECL_NAME
7444 (TYPE_NAME (DECL_CONTEXT (found
)))));
7448 /* Can't override final. Can't override static. */
7449 if (METHOD_FINAL (found
) || METHOD_STATIC (found
))
7451 /* Static *can* override static */
7452 if (METHOD_STATIC (found
) && METHOD_STATIC (method
))
7456 "%s methods can't be overriden. Method `%s' is %s in class `%s'",
7457 (METHOD_FINAL (found
) ? "Final" : "Static"),
7458 lang_printable_name (found
, 0),
7459 (METHOD_FINAL (found
) ? "final" : "static"),
7461 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7465 /* Static method can't override instance method. */
7466 if (METHOD_STATIC (method
))
7470 "Instance methods can't be overriden by a static method. Method "
7471 "`%s' is an instance method in class `%s'",
7472 lang_printable_name (found
, 0),
7474 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7478 /* - Overriding/hiding public must be public
7479 - Overriding/hiding protected must be protected or public
7480 - If the overriden or hidden method has default (package)
7481 access, then the overriding or hiding method must not be
7482 private; otherwise, a compile-time error occurs */
7483 if ((METHOD_PUBLIC (found
) && !METHOD_PUBLIC (method
))
7484 || (METHOD_PROTECTED (found
)
7485 && !(METHOD_PUBLIC (method
) || METHOD_PROTECTED (method
)))
7486 || (!(aflags
& (ACC_PUBLIC
| ACC_PRIVATE
| ACC_STATIC
))
7487 && METHOD_PRIVATE (method
)))
7491 "Methods can't be overridden to be more private. Method `%s' is "
7492 "not %s in class `%s'", lang_printable_name (method
, 0),
7493 (METHOD_PUBLIC (method
) ? "public" :
7494 (METHOD_PRIVATE (method
) ? "private" : "protected")),
7495 IDENTIFIER_POINTER (DECL_NAME
7496 (TYPE_NAME (DECL_CONTEXT (found
)))));
7500 /* Overriding methods must have compatible `throws' clauses on checked
7501 exceptions, if any */
7502 check_throws_clauses (method
, method_wfl
, found
);
7504 /* Inheriting multiple methods with the same signature. FIXME */
7507 /* Don't forget eventual pending found and saved_found_wfl. Take
7508 into account that we might have exited because we saw an
7509 artificial method as the last entry. */
7511 if (found
&& !DECL_ARTIFICIAL (found
) && saved_found_wfl
)
7512 DECL_NAME (found
) = saved_found_wfl
;
7514 if (!TYPE_NVIRTUALS (class))
7515 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7517 /* Search for inherited abstract method not yet implemented in this
7519 java_check_abstract_method_definitions (class_decl
);
7521 if (!saw_constructor
)
7523 /* No constructor seen, we craft one, at line 0. Since this
7524 operation takes place after we laid methods out
7525 (layout_class_methods), we prepare the its DECL
7530 /* If the class is declared PUBLIC, the default constructor is
7531 PUBLIC otherwise it has default access implied by no access
7533 flags
= (get_access_flags_from_decl (class_decl
) & ACC_PUBLIC
?
7535 decl
= create_artificial_method (class, flags
, void_type_node
,
7536 init_identifier_node
, end_params_node
);
7537 DECL_CONSTRUCTOR_P (decl
) = 1;
7538 layout_class_method (TREE_TYPE (class_decl
), NULL_TREE
, decl
, NULL_TREE
);
7542 /* Return a non zero value if the `throws' clause of METHOD (if any)
7543 is incompatible with the `throws' clause of FOUND (if any). */
7546 check_throws_clauses (method
, method_wfl
, found
)
7547 tree method
, method_wfl
, found
;
7549 tree mthrows
, fthrows
;
7551 /* Can't check these things with class loaded from bytecode. FIXME */
7552 if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found
)))
7555 for (mthrows
= DECL_FUNCTION_THROWS (method
);
7556 mthrows
; mthrows
= TREE_CHAIN (mthrows
))
7558 /* We don't verify unchecked expressions */
7559 if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows
)))
7561 /* Checked expression must be compatible */
7562 for (fthrows
= DECL_FUNCTION_THROWS (found
);
7563 fthrows
; fthrows
= TREE_CHAIN (fthrows
))
7564 if (inherits_from_p (TREE_VALUE (mthrows
), TREE_VALUE (fthrows
)))
7569 (method_wfl
, "Invalid checked exception class `%s' in "
7570 "`throws' clause. The exception must be a subclass of an "
7571 "exception thrown by `%s' from class `%s'",
7572 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows
)))),
7573 lang_printable_name (found
, 0),
7575 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7580 /* Check abstract method of interface INTERFACE */
7583 java_check_abstract_methods (interface_decl
)
7584 tree interface_decl
;
7587 tree method
, basetype_vec
, found
;
7588 tree interface
= TREE_TYPE (interface_decl
);
7590 for (method
= TYPE_METHODS (interface
); method
; method
= TREE_CHAIN (method
))
7592 tree method_wfl
= DECL_NAME (method
);
7594 /* 2- Check for double definition inside the defining interface */
7595 if (check_method_redefinition (interface
, method
))
7598 /* 3- Overriding is OK as far as we preserve the return type and
7599 the thrown exceptions (FIXME) */
7600 found
= lookup_java_interface_method2 (interface
, method
);
7604 tree saved_found_wfl
= DECL_NAME (found
);
7605 reset_method_name (found
);
7606 t
= xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found
)), 0));
7609 "Method `%s' was defined with return type `%s' in class `%s'",
7610 lang_printable_name (found
, 0), t
,
7612 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7616 DECL_NAME (found
) = saved_found_wfl
;
7620 /* 4- Inherited methods can't differ by their returned types */
7621 if (!(basetype_vec
= TYPE_BINFO_BASETYPES (interface
)))
7623 n
= TREE_VEC_LENGTH (basetype_vec
);
7624 for (i
= 0; i
< n
; i
++)
7626 tree sub_interface_method
, sub_interface
;
7627 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
);
7630 sub_interface
= BINFO_TYPE (vec_elt
);
7631 for (sub_interface_method
= TYPE_METHODS (sub_interface
);
7632 sub_interface_method
;
7633 sub_interface_method
= TREE_CHAIN (sub_interface_method
))
7635 found
= lookup_java_interface_method2 (interface
,
7636 sub_interface_method
);
7637 if (found
&& (found
!= sub_interface_method
))
7639 tree saved_found_wfl
= DECL_NAME (found
);
7640 reset_method_name (found
);
7642 (lookup_cl (sub_interface_method
),
7643 "Interface `%s' inherits method `%s' from interface `%s'. "
7644 "This method is redefined with a different return type in "
7646 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface
))),
7647 lang_printable_name (found
, 0),
7649 (DECL_NAME (TYPE_NAME
7650 (DECL_CONTEXT (sub_interface_method
)))),
7652 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found
)))));
7653 DECL_NAME (found
) = saved_found_wfl
;
7659 /* Lookup methods in interfaces using their name and partial
7660 signature. Return a matching method only if their types differ. */
7663 lookup_java_interface_method2 (class, method_decl
)
7664 tree
class, method_decl
;
7667 tree basetype_vec
= TYPE_BINFO_BASETYPES (class), to_return
;
7672 n
= TREE_VEC_LENGTH (basetype_vec
);
7673 for (i
= 0; i
< n
; i
++)
7675 tree vec_elt
= TREE_VEC_ELT (basetype_vec
, i
), to_return
;
7676 if ((BINFO_TYPE (vec_elt
) != object_type_node
)
7678 lookup_java_method2 (BINFO_TYPE (vec_elt
), method_decl
, 1)))
7681 for (i
= 0; i
< n
; i
++)
7683 to_return
= lookup_java_interface_method2
7684 (BINFO_TYPE (TREE_VEC_ELT (basetype_vec
, i
)), method_decl
);
7692 /* Lookup method using their name and partial signature. Return a
7693 matching method only if their types differ. */
7696 lookup_java_method2 (clas
, method_decl
, do_interface
)
7697 tree clas
, method_decl
;
7700 tree method
, method_signature
, method_name
, method_type
, name
;
7702 method_signature
= build_java_argument_signature (TREE_TYPE (method_decl
));
7703 name
= DECL_NAME (method_decl
);
7704 method_name
= (TREE_CODE (name
) == EXPR_WITH_FILE_LOCATION
?
7705 EXPR_WFL_NODE (name
) : name
);
7706 method_type
= TREE_TYPE (TREE_TYPE (method_decl
));
7708 while (clas
!= NULL_TREE
)
7710 for (method
= TYPE_METHODS (clas
);
7711 method
!= NULL_TREE
; method
= TREE_CHAIN (method
))
7713 tree method_sig
= build_java_argument_signature (TREE_TYPE (method
));
7714 tree name
= DECL_NAME (method
);
7715 if ((TREE_CODE (name
) == EXPR_WITH_FILE_LOCATION
?
7716 EXPR_WFL_NODE (name
) : name
) == method_name
7717 && method_sig
== method_signature
7718 && TREE_TYPE (TREE_TYPE (method
)) != method_type
)
7721 clas
= (do_interface
? NULL_TREE
: CLASSTYPE_SUPER (clas
));
7726 /* Return the line that matches DECL line number, and try its best to
7727 position the column number. Used during error reports. */
7733 static tree cl
= NULL_TREE
;
7739 if (cl
== NULL_TREE
)
7740 cl
= build_expr_wfl (NULL_TREE
, NULL
, 0, 0);
7742 EXPR_WFL_FILENAME_NODE (cl
) = get_identifier (DECL_SOURCE_FILE (decl
));
7743 EXPR_WFL_SET_LINECOL (cl
, DECL_SOURCE_LINE_FIRST (decl
), -1);
7745 line
= java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl
)),
7746 EXPR_WFL_LINENO (cl
), EXPR_WFL_COLNO (cl
));
7748 found
= strstr ((const char *)line
,
7749 (const char *)IDENTIFIER_POINTER (DECL_NAME (decl
)));
7751 EXPR_WFL_SET_LINECOL (cl
, EXPR_WFL_LINENO (cl
), found
- line
);
7756 /* Look for a simple name in the single-type import list */
7759 find_name_in_single_imports (name
)
7764 for (node
= ctxp
->import_list
; node
; node
= TREE_CHAIN (node
))
7765 if (TREE_VALUE (node
) == name
)
7766 return (EXPR_WFL_NODE (TREE_PURPOSE (node
)));
7771 /* Process all single-type import. */
7779 for (import
= ctxp
->import_list
; import
; import
= TREE_CHAIN (import
))
7781 tree to_be_found
= EXPR_WFL_NODE (TREE_PURPOSE (import
));
7783 /* Don't load twice something already defined. */
7784 if (IDENTIFIER_CLASS_VALUE (to_be_found
))
7786 QUALIFIED_P (to_be_found
) = 1;
7787 load_class (to_be_found
, 0);
7789 check_pkg_class_access (to_be_found
, TREE_PURPOSE (import
));
7790 if (!IDENTIFIER_CLASS_VALUE (to_be_found
))
7792 parse_error_context (TREE_PURPOSE (import
),
7793 "Class or interface `%s' not found in import",
7794 IDENTIFIER_POINTER (to_be_found
));
7803 /* Possibly find a class imported by a single-type import statement. Return
7804 1 if an error occured, 0 otherwise. */
7807 find_in_imports (class_type
)
7812 for (import
= ctxp
->import_list
; import
; import
= TREE_CHAIN (import
))
7813 if (TREE_VALUE (import
) == TYPE_NAME (class_type
))
7815 TYPE_NAME (class_type
) = EXPR_WFL_NODE (TREE_PURPOSE (import
));
7816 QUALIFIED_P (TYPE_NAME (class_type
)) = 1;
7822 note_possible_classname (name
, len
)
7827 if (len
> 5 && strncmp (&name
[len
-5], ".java", 5) == 0)
7829 else if (len
> 6 && strncmp (&name
[len
-6], ".class", 6) == 0)
7833 node
= ident_subst (name
, len
, "", '/', '.', "");
7834 IS_A_CLASSFILE_NAME (node
) = 1; /* Or soon to be */
7835 QUALIFIED_P (node
) = strchr (name
, '/') ? 1 : 0;
7839 /* Read a import directory, gathering potential match for further type
7840 references. Indifferently reads a filesystem or a ZIP archive
7844 read_import_dir (wfl
)
7847 tree package_id
= EXPR_WFL_NODE (wfl
);
7848 const char *package_name
= IDENTIFIER_POINTER (package_id
);
7849 int package_length
= IDENTIFIER_LENGTH (package_id
);
7851 JCF
*saved_jcf
= current_jcf
;
7856 struct buffer filename
[1];
7859 if (IS_AN_IMPORT_ON_DEMAND_P (package_id
))
7861 IS_AN_IMPORT_ON_DEMAND_P (package_id
) = 1;
7863 BUFFER_INIT (filename
);
7864 buffer_grow (filename
, package_length
+ 100);
7866 for (entry
= jcf_path_start (); entry
!= NULL
; entry
= jcf_path_next (entry
))
7868 const char *entry_name
= jcf_path_name (entry
);
7869 int entry_length
= strlen (entry_name
);
7870 if (jcf_path_is_zipfile (entry
))
7873 buffer_grow (filename
, entry_length
);
7874 memcpy (filename
->data
, entry_name
, entry_length
- 1);
7875 filename
->data
[entry_length
-1] = '\0';
7876 zipf
= opendir_in_zip (filename
->data
, jcf_path_is_system (entry
));
7878 error ("malformed .zip archive in CLASSPATH: %s", entry_name
);
7881 ZipDirectory
*zipd
= (ZipDirectory
*) zipf
->central_directory
;
7882 BUFFER_RESET (filename
);
7883 for (k
= 0; k
< package_length
; k
++)
7885 char ch
= package_name
[k
];
7886 *filename
->ptr
++ = ch
== '.' ? '/' : ch
;
7888 *filename
->ptr
++ = '/';
7890 for (k
= 0; k
< zipf
->count
; k
++, zipd
= ZIPDIR_NEXT (zipd
))
7892 const char *current_entry
= ZIPDIR_FILENAME (zipd
);
7893 int current_entry_len
= zipd
->filename_length
;
7895 if (current_entry_len
>= BUFFER_LENGTH (filename
)
7896 && strncmp (filename
->data
, current_entry
,
7897 BUFFER_LENGTH (filename
)) != 0)
7899 found
|= note_possible_classname (current_entry
,
7906 BUFFER_RESET (filename
);
7907 buffer_grow (filename
, entry_length
+ package_length
+ 4);
7908 strcpy (filename
->data
, entry_name
);
7909 filename
->ptr
= filename
->data
+ entry_length
;
7910 for (k
= 0; k
< package_length
; k
++)
7912 char ch
= package_name
[k
];
7913 *filename
->ptr
++ = ch
== '.' ? '/' : ch
;
7915 *filename
->ptr
= '\0';
7917 dirp
= opendir (filename
->data
);
7920 *filename
->ptr
++ = '/';
7925 struct dirent
*direntp
= readdir (dirp
);
7928 d_name
= direntp
->d_name
;
7929 len
= strlen (direntp
->d_name
);
7930 buffer_grow (filename
, len
+1);
7931 strcpy (filename
->ptr
, d_name
);
7932 found
|= note_possible_classname (filename
->data
+ entry_length
,
7933 package_length
+len
+1);
7940 free (filename
->data
);
7942 /* Here we should have a unified way of retrieving an entry, to be
7946 static int first
= 1;
7949 error ("Can't find default package `%s'. Check "
7950 "the CLASSPATH environment variable and the access to the "
7951 "archives.", package_name
);
7956 parse_error_context (wfl
, "Package `%s' not found in import",
7958 current_jcf
= saved_jcf
;
7961 current_jcf
= saved_jcf
;
7964 /* Possibly find a type in the import on demands specified
7965 types. Returns 1 if an error occured, 0 otherwise. Run throught the
7966 entire list, to detected potential double definitions. */
7969 find_in_imports_on_demand (class_type
)
7972 tree node
, import
, node_to_use
= NULL_TREE
;
7974 tree cl
= NULL_TREE
;
7976 for (import
= ctxp
->import_demand_list
; import
; import
= TREE_CHAIN (import
))
7978 const char *id_name
;
7979 obstack_grow (&temporary_obstack
,
7980 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import
))),
7981 IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import
))));
7982 obstack_1grow (&temporary_obstack
, '.');
7983 obstack_grow0 (&temporary_obstack
,
7984 IDENTIFIER_POINTER (TYPE_NAME (class_type
)),
7985 IDENTIFIER_LENGTH (TYPE_NAME (class_type
)));
7986 id_name
= obstack_finish (&temporary_obstack
);
7988 node
= maybe_get_identifier (id_name
);
7989 if (node
&& IS_A_CLASSFILE_NAME (node
))
7993 cl
= TREE_PURPOSE (import
);
8001 (import
, "Type `%s' also potentially defined in package `%s'",
8002 IDENTIFIER_POINTER (TYPE_NAME (class_type
)),
8003 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import
))));
8010 /* Setup lineno so that it refers to the line of the import (in
8011 case we parse a class file and encounter errors */
8013 int saved_lineno
= lineno
;
8014 lineno
= EXPR_WFL_LINENO (cl
);
8015 TYPE_NAME (class_type
) = node_to_use
;
8016 QUALIFIED_P (TYPE_NAME (class_type
)) = 1;
8017 decl
= IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type
));
8018 /* If there is no DECL set for the class or if the class isn't
8019 loaded and not seen in source yet, the load */
8020 if (!decl
|| (!CLASS_LOADED_P (TREE_TYPE (decl
))
8021 && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl
))))
8022 load_class (node_to_use
, 0);
8023 lineno
= saved_lineno
;
8024 return check_pkg_class_access (TYPE_NAME (class_type
), cl
);
8027 return (seen_once
< 0 ? 0 : seen_once
); /* It's ok not to have found */
8031 resolve_package (pkg
, next
)
8035 tree type_name
= NULL_TREE
;
8036 const char *name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg
));
8038 /* The trick is to determine when the package name stops and were
8039 the name of something contained in the package starts. Then we
8040 return a fully qualified name of what we want to get. */
8042 /* Do a quick search on well known package names */
8043 if (!strncmp (name
, "java.lang.reflect", 17))
8046 TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg
))));
8047 type_name
= lookup_package_type (name
, 17);
8049 else if (!strncmp (name
, "java.lang", 9))
8051 *next
= TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg
)));
8052 type_name
= lookup_package_type (name
, 9);
8055 /* If we found something here, return */
8059 *next
= EXPR_WFL_QUALIFICATION (pkg
);
8061 /* Try the current package. */
8062 if (ctxp
->package
&& !strncmp (name
, IDENTIFIER_POINTER (ctxp
->package
),
8063 IDENTIFIER_LENGTH (ctxp
->package
)))
8066 lookup_package_type_and_set_next (name
,
8067 IDENTIFIER_LENGTH (ctxp
->package
),
8073 /* Search in imported package */
8074 for (current
= ctxp
->import_list
; current
; current
= TREE_CHAIN (current
))
8076 tree current_pkg_name
= EXPR_WFL_NODE (TREE_PURPOSE (current
));
8077 int len
= IDENTIFIER_LENGTH (current_pkg_name
);
8078 if (!strncmp (name
, IDENTIFIER_POINTER (current_pkg_name
), len
))
8082 breakdown_qualified (&left
, &dummy
, current_pkg_name
);
8083 len
= IDENTIFIER_LENGTH (left
);
8084 type_name
= lookup_package_type_and_set_next (name
, len
, next
);
8094 lookup_package_type_and_set_next (name
, len
, next
)
8100 tree type_name
= lookup_package_type (name
, len
);
8105 ptr
= IDENTIFIER_POINTER (type_name
);
8106 while (ptr
&& (ptr
= strchr (ptr
, '.')))
8108 *next
= TREE_CHAIN (*next
);
8115 lookup_package_type (name
, from
)
8120 const char *sub
= &name
[from
+1];
8121 while (*sub
!= '.' && *sub
)
8123 strncpy (subname
, name
, sub
-name
);
8124 subname
[sub
-name
] = '\0';
8125 return get_identifier (subname
);
8128 /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
8129 access violations were found, 1 otherwise. */
8132 check_pkg_class_access (class_name
, cl
)
8138 if (!QUALIFIED_P (class_name
) || !IDENTIFIER_CLASS_VALUE (class_name
))
8141 if (!(type
= TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name
))))
8144 if (!CLASS_PUBLIC (TYPE_NAME (type
)))
8146 /* Access to a private class within the same package is
8149 breakdown_qualified (&l
, &r
, class_name
);
8150 if (l
== ctxp
->package
)
8154 (cl
, "Can't access %s `%s'. Only public classes and interfaces in "
8155 "other packages can be accessed",
8156 (CLASS_INTERFACE (TYPE_NAME (type
)) ? "interface" : "class"),
8157 IDENTIFIER_POINTER (class_name
));
8163 /* Local variable declaration. */
8166 declare_local_variables (modifier
, type
, vlist
)
8171 tree decl
, current
, saved_type
;
8172 tree type_wfl
= NULL_TREE
;
8175 /* Push a new block if statements were seen between the last time we
8176 pushed a block and now. Keep a cound of block to close */
8177 if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl
)))
8179 tree body
= GET_CURRENT_BLOCK (current_function_decl
);
8180 tree b
= enter_block ();
8181 BLOCK_EXPR_ORIGIN (b
) = body
;
8187 for (i
= 0; i
<= 10; i
++) if (1 << i
& modifier
) break;
8188 if (modifier
== ACC_FINAL
)
8190 if (flag_static_local_jdk1_1
)
8191 parse_warning_context (ctxp
->modifier_ctx
[i
],
8192 "Unsupported JDK1.1 `final' local variable "
8193 "(treated as non final)");
8198 (ctxp
->modifier_ctx
[i
],
8199 "Only `final' is allowed as a local variables modifier");
8204 /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
8205 hold the TYPE value if a new incomplete has to be created (as
8206 opposed to being found already existing and reused). */
8207 SET_TYPE_FOR_RESOLUTION (type
, type_wfl
, must_chain
);
8209 /* If TYPE is fully resolved and we don't have a reference, make one */
8210 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
8212 /* Go through all the declared variables */
8213 for (current
= vlist
, saved_type
= type
; current
;
8214 current
= TREE_CHAIN (current
), type
= saved_type
)
8216 tree other
, real_type
;
8217 tree wfl
= TREE_PURPOSE (current
);
8218 tree name
= EXPR_WFL_NODE (wfl
);
8219 tree init
= TREE_VALUE (current
);
8221 /* Process NAME, as it may specify extra dimension(s) for it */
8222 type
= build_array_from_name (type
, type_wfl
, name
, &name
);
8224 /* Variable redefinition check */
8225 if ((other
= lookup_name_in_blocks (name
)))
8227 variable_redefinition_error (wfl
, name
, TREE_TYPE (other
),
8228 DECL_SOURCE_LINE (other
));
8232 /* Type adjustment. We may have just readjusted TYPE because
8233 the variable specified more dimensions. Make sure we have
8234 a reference if we can and don't have one already. */
8235 PROMOTE_RECORD_IF_COMPLETE (type
, must_chain
);
8237 real_type
= GET_REAL_TYPE (type
);
8238 /* Never layout this decl. This will be done when its scope
8240 decl
= build_decl (VAR_DECL
, name
, real_type
);
8241 BLOCK_CHAIN_DECL (decl
);
8243 /* If doing xreferencing, replace the line number with the WFL
8246 DECL_SOURCE_LINE (decl
) = EXPR_WFL_LINECOL (wfl
);
8248 /* Don't try to use an INIT statement when an error was found */
8249 if (init
&& java_error_count
)
8252 /* Add the initialization function to the current function's code */
8255 /* Name might have been readjusted */
8256 EXPR_WFL_NODE (TREE_OPERAND (init
, 0)) = name
;
8257 MODIFY_EXPR_FROM_INITIALIZATION_P (init
) = 1;
8258 java_method_add_stmt (current_function_decl
,
8259 build_debugable_stmt (EXPR_WFL_LINECOL (init
),
8263 /* Setup dependency the type of the decl */
8267 register_incomplete_type (JDEP_VARIABLE
, type_wfl
, decl
, type
);
8268 dep
= CLASSD_LAST (ctxp
->classd_list
);
8269 JDEP_GET_PATCH (dep
) = &TREE_TYPE (decl
);
8272 SOURCE_FRONTEND_DEBUG (("Defined locals"));
8275 /* Called during parsing. Build decls from argument list. */
8278 source_start_java_method (fndecl
)
8288 current_function_decl
= fndecl
;
8290 /* New scope for the function */
8292 for (tem
= TYPE_ARG_TYPES (TREE_TYPE (fndecl
)), i
= 0;
8293 tem
!= end_params_node
; tem
= TREE_CHAIN (tem
), i
++)
8295 tree type
= TREE_VALUE (tem
);
8296 tree name
= TREE_PURPOSE (tem
);
8298 /* If type is incomplete. Create an incomplete decl and ask for
8299 the decl to be patched later */
8300 if (INCOMPLETE_TYPE_P (type
))
8303 tree real_type
= GET_REAL_TYPE (type
);
8304 parm_decl
= build_decl (PARM_DECL
, name
, real_type
);
8305 type
= obtain_incomplete_type (type
);
8306 register_incomplete_type (JDEP_PARM
, NULL_TREE
, NULL_TREE
, type
);
8307 jdep
= CLASSD_LAST (ctxp
->classd_list
);
8308 JDEP_MISC (jdep
) = name
;
8309 JDEP_GET_PATCH (jdep
) = &TREE_TYPE (parm_decl
);
8312 parm_decl
= build_decl (PARM_DECL
, name
, type
);
8314 BLOCK_CHAIN_DECL (parm_decl
);
8316 tem
= BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
));
8317 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
)) =
8319 DECL_ARG_SLOT_COUNT (current_function_decl
) = i
;
8322 /* Called during parsing. Creates an artificial method declaration. */
8325 create_artificial_method (class, flags
, type
, name
, args
)
8328 tree type
, name
, args
;
8330 int saved_lineno
= lineno
;
8334 mdecl
= make_node (FUNCTION_TYPE
);
8335 TREE_TYPE (mdecl
) = type
;
8336 TYPE_ARG_TYPES (mdecl
) = args
;
8337 mdecl
= add_method (class, flags
, name
, build_java_signature (mdecl
));
8338 lineno
= saved_lineno
;
8339 DECL_ARTIFICIAL (mdecl
) = 1;
8343 /* Starts the body if an artifical method. */
8346 start_artificial_method_body (mdecl
)
8349 DECL_SOURCE_LINE (mdecl
) = 1;
8350 DECL_SOURCE_LINE_MERGE (mdecl
, 1);
8351 source_start_java_method (mdecl
);
8356 end_artificial_method_body (mdecl
)
8359 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl
)) = exit_block ();
8363 /* Called during expansion. Push decls formerly built from argument
8364 list so they're usable during expansion. */
8367 expand_start_java_method (fndecl
)
8372 current_function_decl
= fndecl
;
8374 announce_function (fndecl
);
8375 pushlevel (1); /* Push parameters */
8376 ptr
= &DECL_ARGUMENTS (fndecl
);
8377 tem
= BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl
));
8380 tree next
= TREE_CHAIN (tem
);
8381 tree type
= TREE_TYPE (tem
);
8382 if (PROMOTE_PROTOTYPES
8383 && TYPE_PRECISION (type
) < TYPE_PRECISION (integer_type_node
)
8384 && INTEGRAL_TYPE_P (type
))
8385 type
= integer_type_node
;
8386 DECL_ARG_TYPE (tem
) = type
;
8387 layout_decl (tem
, 0);
8390 ptr
= &TREE_CHAIN (tem
);
8394 pushdecl_force_head (DECL_ARGUMENTS (fndecl
));
8395 lineno
= DECL_SOURCE_LINE_FIRST (fndecl
);
8398 /* Terminate a function and expand its body. */
8401 source_end_java_method ()
8403 tree fndecl
= current_function_decl
;
8404 int flag_asynchronous_exceptions
= asynchronous_exceptions
;
8409 java_parser_context_save_global ();
8410 lineno
= ctxp
->last_ccb_indent1
;
8412 /* Set EH language codes */
8413 java_set_exception_lang_code ();
8415 /* Turn function bodies with only a NOP expr null, so they don't get
8416 generated at all and we won't get warnings when using the -W
8418 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
)) == empty_stmt_node
)
8419 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
)) = NULL_TREE
;
8421 /* Generate function's code */
8422 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
))
8423 && ! flag_emit_class_files
8424 && ! flag_emit_xref
)
8425 expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl
)));
8427 /* pop out of its parameters */
8428 pushdecl_force_head (DECL_ARGUMENTS (fndecl
));
8430 BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl
)) = fndecl
;
8432 /* Generate rtl for function exit. */
8433 if (! flag_emit_class_files
&& ! flag_emit_xref
)
8435 lineno
= DECL_SOURCE_LINE_LAST (fndecl
);
8436 /* Emit catch-finally clauses */
8438 expand_function_end (input_filename
, lineno
, 0);
8440 /* FIXME: If the current method contains any exception handlers,
8441 force asynchronous_exceptions: this is necessary because signal
8442 handlers in libjava may throw exceptions. This is far from being
8443 a perfect solution, but it's better than doing nothing at all.*/
8445 asynchronous_exceptions
= 1;
8447 /* Run the optimizers and output assembler code for this function. */
8448 rest_of_compilation (fndecl
);
8451 current_function_decl
= NULL_TREE
;
8452 permanent_allocation (1);
8453 java_parser_context_restore_global ();
8454 asynchronous_exceptions
= flag_asynchronous_exceptions
;
8457 /* Record EXPR in the current function block. Complements compound
8458 expression second operand if necessary. */
8461 java_method_add_stmt (fndecl
, expr
)
8464 if (!GET_CURRENT_BLOCK (fndecl
))
8466 return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl
), NULL_TREE
, expr
);
8470 add_stmt_to_block (b
, type
, stmt
)
8473 tree body
= BLOCK_EXPR_BODY (b
), c
;
8475 if (java_error_count
)
8478 if ((c
= add_stmt_to_compound (body
, type
, stmt
)) == body
)
8481 BLOCK_EXPR_BODY (b
) = c
;
8482 TREE_SIDE_EFFECTS (c
) = 1;
8486 /* Add STMT to EXISTING if possible, otherwise create a new
8487 COMPOUND_EXPR and add STMT to it. */
8490 add_stmt_to_compound (existing
, type
, stmt
)
8491 tree existing
, type
, stmt
;
8494 return build (COMPOUND_EXPR
, type
, existing
, stmt
);
8499 /* Hold THIS for the scope of the current public method decl. */
8500 static tree current_this
;
8502 void java_layout_seen_class_methods ()
8504 tree previous_list
= all_class_list
;
8505 tree end
= NULL_TREE
;
8510 for (current
= previous_list
;
8511 current
!= end
; current
= TREE_CHAIN (current
))
8512 layout_class_methods (TREE_TYPE (TREE_VALUE (current
)));
8514 if (previous_list
!= all_class_list
)
8516 end
= previous_list
;
8517 previous_list
= all_class_list
;
8524 /* Layout the methods of all classes loaded in one way on an
8525 other. Check methods of source parsed classes. Then reorder the
8526 fields and layout the classes or the type of all source parsed
8530 java_layout_classes ()
8533 int save_error_count
= java_error_count
;
8535 /* Layout the methods of all classes seen so far */
8536 java_layout_seen_class_methods ();
8537 java_parse_abort_on_error ();
8538 all_class_list
= NULL_TREE
;
8540 /* Then check the methods of all parsed classes */
8541 for (current
= ctxp
->gclass_list
; current
; current
= TREE_CHAIN (current
))
8542 if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current
))))
8543 CHECK_METHODS (TREE_VALUE (current
));
8544 java_parse_abort_on_error ();
8546 for (current
= ctxp
->gclass_list
; current
; current
= TREE_CHAIN (current
))
8548 current_class
= TREE_TYPE (TREE_VALUE (current
));
8550 /* Reverse the fields, but leave the dummy field in front.
8551 Fields are already ordered for Object and Class */
8552 if (TYPE_FIELDS (current_class
) && current_class
!= object_type_node
8553 && current_class
!= class_type_node
)
8555 /* If the dummy field is there, reverse the right fields and
8556 just layout the type for proper fields offset */
8557 if (!DECL_NAME (TYPE_FIELDS (current_class
)))
8559 tree fields
= TYPE_FIELDS (current_class
);
8560 TREE_CHAIN (fields
) = nreverse (TREE_CHAIN (fields
));
8561 TYPE_SIZE (current_class
) = NULL_TREE
;
8562 layout_type (current_class
);
8564 /* We don't have a dummy field, we need to layout the class,
8565 after having reversed the fields */
8568 TYPE_FIELDS (current_class
) =
8569 nreverse (TYPE_FIELDS (current_class
));
8570 TYPE_SIZE (current_class
) = NULL_TREE
;
8571 layout_class (current_class
);
8575 layout_class (current_class
);
8577 /* From now on, the class is considered completely loaded */
8578 CLASS_LOADED_P (current_class
) = 1;
8580 /* Error reported by the caller */
8581 if (java_error_count
)
8585 /* We might have reloaded classes durign the process of laying out
8586 classes for code generation. We must layout the methods of those
8587 late additions, as constructor checks might use them */
8588 java_layout_seen_class_methods ();
8589 java_parse_abort_on_error ();
8592 /* Expand all methods in all registered classes. */
8595 java_complete_expand_methods ()
8599 do_not_fold
= flag_emit_xref
;
8601 for (current
= ctxp
->class_list
; current
; current
= TREE_CHAIN (current
))
8604 tree class_type
= CLASS_TO_HANDLE_TYPE (TREE_TYPE (current
));
8607 current_class
= TREE_TYPE (current
);
8608 is_interface
= CLASS_INTERFACE (TYPE_NAME (current_class
));
8610 /* Initialize a new constant pool */
8611 init_outgoing_cpool ();
8613 /* We want <clinit> (if any) to be processed first. */
8614 decl
= tree_last (TYPE_METHODS (class_type
));
8615 if (IS_CLINIT (decl
))
8617 tree fbody
= DECL_FUNCTION_BODY (decl
);
8619 if (fbody
!= NULL_TREE
)
8621 /* First check if we can ignore empty <clinit> */
8622 tree block_body
= BLOCK_EXPR_BODY (fbody
);
8624 current_this
= NULL_TREE
;
8625 current_function_decl
= decl
;
8626 if (block_body
!= NULL_TREE
)
8628 /* Prevent the use of `this' inside <clinit> */
8629 ctxp
->explicit_constructor_p
= 1;
8631 block_body
= java_complete_tree (block_body
);
8632 ctxp
->explicit_constructor_p
= 0;
8633 BLOCK_EXPR_BODY (fbody
) = block_body
;
8634 if (block_body
!= NULL_TREE
8635 && TREE_CODE (block_body
) == BLOCK
8636 && BLOCK_EXPR_BODY (block_body
) == empty_stmt_node
)
8640 list
= nreverse (TREE_CHAIN (nreverse (TYPE_METHODS (class_type
))));
8641 if (decl
!= NULL_TREE
)
8643 TREE_CHAIN (decl
) = list
;
8644 TYPE_METHODS (class_type
) = decl
;
8647 TYPE_METHODS (class_type
) = list
;
8650 for (decl
= TYPE_METHODS (class_type
); decl
; decl
= TREE_CHAIN (decl
))
8652 current_function_decl
= decl
;
8653 /* Don't generate debug info on line zero when expanding a
8654 generated constructor. */
8655 if (DECL_CONSTRUCTOR_P (decl
) && !DECL_FUNCTION_BODY (decl
))
8657 /* If we found errors, it's too dangerous to try to
8658 generate and expand a constructor */
8659 if (!java_error_count
)
8661 restore_line_number_status (1);
8662 java_complete_expand_method (decl
);
8663 restore_line_number_status (0);
8666 else if (METHOD_ABSTRACT (decl
) || METHOD_NATIVE (decl
))
8669 java_complete_expand_method (decl
);
8672 /* Now verify constructor circularity (stop after the first one
8675 for (decl
= TYPE_METHODS (class_type
); decl
; decl
= TREE_CHAIN (decl
))
8676 if (DECL_CONSTRUCTOR_P (decl
) &&
8677 verify_constructor_circularity (decl
, decl
))
8680 /* Make the class data, register it and run the rest of decl
8681 compilation on it */
8682 if (!java_error_count
)
8684 if (flag_emit_class_files
)
8685 write_classfile (current_class
);
8687 expand_xref (current_class
);
8688 else if (! flag_syntax_only
)
8694 /* Hold a list of catch clauses list. The first element of this list is
8695 the list of the catch clauses of the currently analysed try block. */
8696 static tree currently_caught_type_list
;
8698 /* Complete and expand a method. */
8701 java_complete_expand_method (mdecl
)
8704 /* Fix constructors before expanding them */
8705 if (DECL_CONSTRUCTOR_P (mdecl
))
8706 fix_constructors (mdecl
);
8708 /* Expand functions that have a body */
8709 if (DECL_FUNCTION_BODY (mdecl
))
8711 tree fbody
= DECL_FUNCTION_BODY (mdecl
);
8712 tree block_body
= BLOCK_EXPR_BODY (fbody
);
8713 tree exception_copy
= NULL_TREE
;
8714 expand_start_java_method (mdecl
);
8715 build_result_decl (mdecl
);
8718 = (!METHOD_STATIC (mdecl
) ?
8719 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl
)) : NULL_TREE
);
8721 /* Purge the `throws' list of unchecked exceptions. If we're
8722 doing xref, save a copy of the list and re-install it
8725 exception_copy
= copy_list (DECL_FUNCTION_THROWS (mdecl
));
8727 purge_unchecked_exceptions (mdecl
);
8729 /* Install exceptions thrown with `throws' */
8730 PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl
));
8732 if (block_body
!= NULL_TREE
)
8734 block_body
= java_complete_tree (block_body
);
8735 if (!flag_emit_xref
)
8736 check_for_initialization (block_body
);
8737 ctxp
->explicit_constructor_p
= 0;
8739 BLOCK_EXPR_BODY (fbody
) = block_body
;
8741 if ((block_body
== NULL_TREE
|| CAN_COMPLETE_NORMALLY (block_body
))
8742 && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl
))) != VOID_TYPE
8744 missing_return_error (current_function_decl
);
8746 complete_start_java_method (mdecl
);
8748 /* Don't go any further if we've found error(s) during the
8750 if (!java_error_count
)
8751 source_end_java_method ();
8754 pushdecl_force_head (DECL_ARGUMENTS (mdecl
));
8758 /* Pop the exceptions and sanity check */
8760 if (currently_caught_type_list
)
8761 fatal ("Exception list non empty - java_complete_expand_method");
8764 DECL_FUNCTION_THROWS (mdecl
) = exception_copy
;
8768 /* Craft a body for default constructor. Patch existing constructor
8769 bodies with call to super() and field initialization statements if
8773 fix_constructors (mdecl
)
8776 tree body
= DECL_FUNCTION_BODY (mdecl
);
8780 /* The constructor body must be crafted by hand. It's the
8781 constructor we defined when we realize we didn't have the
8782 CLASSNAME() constructor */
8786 /* It is an error for the compiler to generate a default
8787 constructor if the superclass doesn't have a constructor that
8788 takes no argument */
8789 if (verify_constructor_super ())
8791 tree sclass_decl
= TYPE_NAME (CLASSTYPE_SUPER (current_class
));
8792 const char *n
= IDENTIFIER_POINTER (DECL_NAME (sclass_decl
));
8793 parse_error_context (lookup_cl (TYPE_NAME (current_class
)),
8794 "No constructor matching `%s()' found in "
8795 "class `%s'", n
, n
);
8798 start_artificial_method_body (mdecl
);
8800 /* We don't generate a super constructor invocation if we're
8801 compiling java.lang.Object. build_super_invocation takes care
8803 compound
= java_method_add_stmt (mdecl
, build_super_invocation ());
8805 end_artificial_method_body (mdecl
);
8807 /* Search for an explicit constructor invocation */
8811 tree main_block
= BLOCK_EXPR_BODY (body
);
8812 tree compound
= NULL_TREE
;
8815 switch (TREE_CODE (body
))
8818 found
= CALL_EXPLICIT_CONSTRUCTOR_P (body
);
8822 case EXPR_WITH_FILE_LOCATION
:
8823 body
= TREE_OPERAND (body
, 0);
8826 body
= BLOCK_EXPR_BODY (body
);
8832 /* The constructor is missing an invocation of super() */
8834 compound
= add_stmt_to_compound (compound
, NULL_TREE
,
8835 build_super_invocation ());
8837 /* Fix the constructor main block if we're adding extra stmts */
8840 compound
= add_stmt_to_compound (compound
, NULL_TREE
,
8841 BLOCK_EXPR_BODY (main_block
));
8842 BLOCK_EXPR_BODY (main_block
) = compound
;
8847 /* Browse constructors in the super class, searching for a constructor
8848 that doesn't take any argument. Return 0 if one is found, 1
8852 verify_constructor_super ()
8854 tree
class = CLASSTYPE_SUPER (current_class
);
8861 for (mdecl
= TYPE_METHODS (class); mdecl
; mdecl
= TREE_CHAIN (mdecl
))
8863 if (DECL_CONSTRUCTOR_P (mdecl
)
8864 && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl
)))
8872 /* Expand finals. */
8875 java_expand_finals ()
8879 /* Generate code for all context remembered for code generation. */
8882 java_expand_classes ()
8884 int save_error_count
= 0;
8885 java_parse_abort_on_error ();
8886 if (!(ctxp
= ctxp_for_generation
))
8888 java_layout_classes ();
8889 java_parse_abort_on_error ();
8891 for (; ctxp_for_generation
; ctxp_for_generation
= ctxp_for_generation
->next
)
8893 ctxp
= ctxp_for_generation
;
8894 lang_init_source (2); /* Error msgs have method prototypes */
8895 java_complete_expand_methods (); /* Complete and expand method bodies */
8896 java_parse_abort_on_error ();
8897 java_expand_finals (); /* Expand and check the finals */
8898 java_parse_abort_on_error ();
8899 java_check_final (); /* Check unitialized final */
8900 java_parse_abort_on_error ();
8904 /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
8905 a tree list node containing RIGHT. Fore coming RIGHTs will be
8906 chained to this hook. LOCATION contains the location of the
8907 separating `.' operator. */
8910 make_qualified_primary (primary
, right
, location
)
8911 tree primary
, right
;
8916 /* We want to process THIS . xxx symbolicaly, to keep it consistent
8917 with the way we're processing SUPER. A THIS from a primary as a
8918 different form than a SUPER. Turn THIS into something symbolic */
8919 if (TREE_CODE (primary
) == THIS_EXPR
)
8921 wfl
= build_wfl_node (this_identifier_node
);
8922 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (primary
);
8923 wfl
= make_qualified_name (wfl
, right
, location
);
8924 PRIMARY_P (wfl
) = 1;
8927 /* Other non WFL node are wrapped around a WFL */
8928 else if (TREE_CODE (primary
) != EXPR_WITH_FILE_LOCATION
)
8930 wfl
= build_expr_wfl (NULL_TREE
, ctxp
->filename
, 0, 0);
8931 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (primary
);
8932 EXPR_WFL_QUALIFICATION (wfl
) = build_tree_list (primary
, NULL_TREE
);
8937 if (!EXPR_WFL_QUALIFICATION (primary
))
8938 EXPR_WFL_QUALIFICATION (primary
) =
8939 build_tree_list (primary
, NULL_TREE
);
8942 EXPR_WFL_LINECOL (right
) = location
;
8943 chainon (EXPR_WFL_QUALIFICATION (wfl
), build_tree_list (right
, NULL_TREE
));
8944 PRIMARY_P (wfl
) = 1;
8948 /* Simple merge of two name separated by a `.' */
8951 merge_qualified_name (left
, right
)
8955 obstack_grow (&temporary_obstack
, IDENTIFIER_POINTER (left
),
8956 IDENTIFIER_LENGTH (left
));
8957 obstack_1grow (&temporary_obstack
, '.');
8958 obstack_grow0 (&temporary_obstack
, IDENTIFIER_POINTER (right
),
8959 IDENTIFIER_LENGTH (right
));
8960 node
= get_identifier (obstack_base (&temporary_obstack
));
8961 obstack_free (&temporary_obstack
, obstack_base (&temporary_obstack
));
8962 QUALIFIED_P (node
) = 1;
8966 /* Merge the two parts of a qualified name into LEFT. Set the
8967 location information of the resulting node to LOCATION, usually
8968 inherited from the location information of the `.' operator. */
8971 make_qualified_name (left
, right
, location
)
8975 #ifdef USE_COMPONENT_REF
8976 tree node
= build (COMPONENT_REF
, NULL_TREE
, left
, right
);
8977 EXPR_WFL_LINECOL (node
) = location
;
8980 tree left_id
= EXPR_WFL_NODE (left
);
8981 tree right_id
= EXPR_WFL_NODE (right
);
8984 merge
= merge_qualified_name (left_id
, right_id
);
8986 /* Left wasn't qualified and is now qualified */
8987 if (!QUALIFIED_P (left_id
))
8989 tree wfl
= build_expr_wfl (left_id
, ctxp
->filename
, 0, 0);
8990 EXPR_WFL_LINECOL (wfl
) = EXPR_WFL_LINECOL (left
);
8991 EXPR_WFL_QUALIFICATION (left
) = build_tree_list (wfl
, NULL_TREE
);
8994 wfl
= build_expr_wfl (right_id
, ctxp
->filename
, 0, 0);
8995 EXPR_WFL_LINECOL (wfl
) = location
;
8996 chainon (EXPR_WFL_QUALIFICATION (left
), build_tree_list (wfl
, NULL_TREE
));
8998 EXPR_WFL_NODE (left
) = merge
;
9003 /* Extract the last identifier component of the qualified in WFL. The
9004 last identifier is removed from the linked list */
9007 cut_identifier_in_qualified (wfl
)
9011 tree previous
= NULL_TREE
;
9012 for (q
= EXPR_WFL_QUALIFICATION (wfl
); ; previous
= q
, q
= TREE_CHAIN (q
))
9013 if (!TREE_CHAIN (q
))
9016 fatal ("Operating on a non qualified qualified WFL - "
9017 "cut_identifier_in_qualified");
9018 TREE_CHAIN (previous
) = NULL_TREE
;
9019 return TREE_PURPOSE (q
);
9023 /* Resolve the expression name NAME. Return its decl. */
9026 resolve_expression_name (id
, orig
)
9030 tree name
= EXPR_WFL_NODE (id
);
9033 /* 6.5.5.1: Simple expression names */
9034 if (!PRIMARY_P (id
) && !QUALIFIED_P (name
))
9036 /* 15.13.1: NAME can appear within the scope of a local variable
9038 if ((decl
= IDENTIFIER_LOCAL_VALUE (name
)))
9041 /* 15.13.1: NAME can appear within a class declaration */
9044 decl
= lookup_field_wrapper (current_class
, name
);
9047 int fs
= FIELD_STATIC (decl
);
9048 /* Instance variable (8.3.1.1) can't appear within
9049 static method, static initializer or initializer for
9050 a static variable. */
9051 if (!fs
&& METHOD_STATIC (current_function_decl
))
9053 static_ref_err (id
, name
, current_class
);
9054 return error_mark_node
;
9056 /* Instance variables can't appear as an argument of
9057 an explicit constructor invocation */
9058 if (!fs
&& ctxp
->explicit_constructor_p
)
9061 (id
, "Can't reference `%s' before the superclass "
9062 "constructor has been called", IDENTIFIER_POINTER (name
));
9063 return error_mark_node
;
9066 /* Otherwise build what it takes to access the field */
9067 decl
= build_field_ref ((fs
? NULL_TREE
: current_this
),
9068 DECL_CONTEXT (decl
), name
);
9069 if (fs
&& !flag_emit_class_files
&& !flag_emit_xref
)
9070 decl
= build_class_init (DECL_CONTEXT (decl
), decl
);
9071 /* We may be asked to save the real field access node */
9074 /* And we return what we got */
9077 /* Fall down to error report on undefined variable */
9080 /* 6.5.5.2 Qualified Expression Names */
9085 qualify_ambiguous_name (id
);
9086 /* 15.10.1 Field Access Using a Primary and/or Expression Name */
9087 /* 15.10.2: Accessing Superclass Members using super */
9088 return resolve_field_access (id
, NULL
, NULL
);
9091 /* We've got an error here */
9092 parse_error_context (id
, "Undefined variable `%s'",
9093 IDENTIFIER_POINTER (name
));
9095 return error_mark_node
;
9099 static_ref_err (wfl
, field_id
, class_type
)
9100 tree wfl
, field_id
, class_type
;
9104 "Can't make a static reference to nonstatic variable `%s' in class `%s'",
9105 IDENTIFIER_POINTER (field_id
),
9106 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type
))));
9109 /* 15.10.1 Field Acess Using a Primary and/or Expression Name.
9110 We return something suitable to generate the field access. We also
9111 return the field decl in FIELD_DECL and its type in FIELD_TYPE. If
9112 recipient's address can be null. */
9115 resolve_field_access (qual_wfl
, field_decl
, field_type
)
9117 tree
*field_decl
, *field_type
;
9121 tree decl
, where_found
, type_found
;
9123 if (resolve_qualified_expression_name (qual_wfl
, &decl
,
9124 &where_found
, &type_found
))
9125 return error_mark_node
;
9127 /* Resolve the LENGTH field of an array here */
9128 if (DECL_NAME (decl
) == length_identifier_node
&& TYPE_ARRAY_P (type_found
)
9129 && ! flag_emit_class_files
&& ! flag_emit_xref
)
9131 tree length
= build_java_array_length_access (where_found
);
9133 build_java_arraynull_check (type_found
, length
, int_type_node
);
9135 /* We might have been trying to resolve field.method(). In which
9136 case, the resolution is over and decl is the answer */
9137 else if (JDECL_P (decl
) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl
)) == decl
)
9139 else if (JDECL_P (decl
))
9141 int static_final_found
= 0;
9143 type_found
= DECL_CONTEXT (decl
);
9144 is_static
= JDECL_P (decl
) && FIELD_STATIC (decl
);
9145 if (FIELD_FINAL (decl
)
9146 && JPRIMITIVE_TYPE_P (TREE_TYPE (decl
))
9147 && DECL_LANG_SPECIFIC (decl
)
9148 && DECL_INITIAL (decl
))
9150 field_ref
= DECL_INITIAL (decl
);
9151 static_final_found
= 1;
9154 field_ref
= build_field_ref ((is_static
&& !flag_emit_xref
?
9155 NULL_TREE
: where_found
),
9156 type_found
, DECL_NAME (decl
));
9157 if (field_ref
== error_mark_node
)
9158 return error_mark_node
;
9159 if (is_static
&& !static_final_found
9160 && !flag_emit_class_files
&& !flag_emit_xref
)
9162 field_ref
= build_class_init (type_found
, field_ref
);
9163 /* If the static field was identified by an expression that
9164 needs to be generated, make the field access a compound
9165 expression whose first part is the evaluation of the
9166 field selector part. */
9167 if (where_found
&& TREE_CODE (where_found
) != TYPE_DECL
9168 && TREE_CODE (where_found
) != RECORD_TYPE
)
9170 tree type
= QUAL_DECL_TYPE (field_ref
);
9171 if (TREE_CODE (type
) == RECORD_TYPE
)
9172 type
= build_pointer_type (type
);
9173 field_ref
= build (COMPOUND_EXPR
, type
, where_found
, field_ref
);
9183 *field_type
= (QUAL_DECL_TYPE (decl
) ?
9184 QUAL_DECL_TYPE (decl
) : TREE_TYPE (decl
));
9188 /* If NODE is an access to f static field, strip out the class
9189 initialization part and return the field decl, otherwise, return
9193 strip_out_static_field_access_decl (node
)
9196 if (TREE_CODE (node
) == COMPOUND_EXPR
)
9198 tree op1
= TREE_OPERAND (node
, 1);
9199 if (TREE_CODE (op1
) == COMPOUND_EXPR
)
9201 tree call
= TREE_OPERAND (op1
, 0);
9202 if (TREE_CODE (call
) == CALL_EXPR
9203 && TREE_CODE (TREE_OPERAND (call
, 0)) == ADDR_EXPR
9204 && TREE_OPERAND (TREE_OPERAND (call
, 0), 0)
9205 == soft_initclass_node
)
9206 return TREE_OPERAND (op1
, 1);
9208 else if (JDECL_P (op1
))
9214 /* 6.5.5.2: Qualified Expression Names */
9217 resolve_qualified_expression_name (wfl
, found_decl
, where_found
, type_found
)
9219 tree
*found_decl
, *type_found
, *where_found
;
9221 int from_type
= 0; /* Field search initiated from a type */
9222 int from_super
= 0, from_cast
= 0;
9223 int previous_call_static
= 0;
9225 tree decl
= NULL_TREE
, type
= NULL_TREE
, q
;
9226 *type_found
= *where_found
= NULL_TREE
;
9228 for (q
= EXPR_WFL_QUALIFICATION (wfl
); q
; q
= TREE_CHAIN (q
))
9230 tree qual_wfl
= QUAL_WFL (q
);
9231 tree ret_decl
; /* for EH checking */
9232 int location
; /* for EH checking */
9234 /* 15.10.1 Field Access Using a Primary */
9235 switch (TREE_CODE (qual_wfl
))
9238 case NEW_CLASS_EXPR
:
9239 /* If the access to the function call is a non static field,
9240 build the code to access it. */
9241 if (JDECL_P (decl
) && !FIELD_STATIC (decl
))
9243 decl
= maybe_access_field (decl
, *where_found
,
9244 DECL_CONTEXT (decl
));
9245 if (decl
== error_mark_node
)
9248 /* And code for the function call */
9249 if (complete_function_arguments (qual_wfl
))
9252 if (from_super
&& TREE_CODE (qual_wfl
) == CALL_EXPR
)
9253 CALL_USING_SUPER (qual_wfl
) = 1;
9254 location
= (TREE_CODE (qual_wfl
) == CALL_EXPR
?
9255 EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl
, 0)) : 0);
9256 *where_found
= patch_method_invocation (qual_wfl
, decl
, type
,
9257 &is_static
, &ret_decl
);
9258 if (*where_found
== error_mark_node
)
9260 *type_found
= type
= QUAL_DECL_TYPE (*where_found
);
9264 check_thrown_exceptions (location
, ret_decl
);
9266 /* If the previous call was static and this one is too,
9267 build a compound expression to hold the two (because in
9268 that case, previous function calls aren't transported as
9269 forcoming function's argument. */
9270 if (previous_call_static
&& is_static
)
9272 decl
= build (COMPOUND_EXPR
, type
, decl
, *where_found
);
9273 TREE_SIDE_EFFECTS (decl
) = 1;
9277 previous_call_static
= is_static
;
9278 decl
= *where_found
;
9282 case NEW_ARRAY_EXPR
:
9283 *where_found
= decl
= java_complete_tree (qual_wfl
);
9284 if (decl
== error_mark_node
)
9286 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9287 CLASS_LOADED_P (type
) = 1;
9291 *where_found
= decl
= java_complete_tree (qual_wfl
);
9292 if (decl
== error_mark_node
)
9294 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9298 case CONDITIONAL_EXPR
:
9301 *where_found
= decl
= java_complete_tree (qual_wfl
);
9302 if (decl
== error_mark_node
)
9304 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9308 /* If the access to the function call is a non static field,
9309 build the code to access it. */
9310 if (JDECL_P (decl
) && !FIELD_STATIC (decl
))
9312 decl
= maybe_access_field (decl
, *where_found
, type
);
9313 if (decl
== error_mark_node
)
9316 /* And code for the array reference expression */
9317 decl
= java_complete_tree (qual_wfl
);
9318 if (decl
== error_mark_node
)
9320 type
= QUAL_DECL_TYPE (decl
);
9324 if ((decl
= java_complete_tree (qual_wfl
)) == error_mark_node
)
9326 if ((type
= patch_string (decl
)))
9328 *where_found
= QUAL_RESOLUTION (q
) = decl
;
9329 *type_found
= type
= TREE_TYPE (decl
);
9333 /* Fix for -Wall Just go to the next statement. Don't
9338 /* If we fall here, we weren't processing a (static) function call. */
9339 previous_call_static
= 0;
9341 /* It can be the keyword THIS */
9342 if (EXPR_WFL_NODE (qual_wfl
) == this_identifier_node
)
9347 (wfl
, "Keyword `this' used outside allowed context");
9350 if (ctxp
->explicit_constructor_p
)
9352 parse_error_context (wfl
, "Can't reference `this' before the "
9353 "superclass constructor has been called");
9356 /* We have to generate code for intermediate acess */
9357 *where_found
= decl
= current_this
;
9358 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9362 /* 15.10.2 Accessing Superclass Members using SUPER */
9363 if (EXPR_WFL_NODE (qual_wfl
) == super_identifier_node
)
9366 /* Check on the restricted use of SUPER */
9367 if (METHOD_STATIC (current_function_decl
)
9368 || current_class
== object_type_node
)
9371 (wfl
, "Keyword `super' used outside allowed context");
9374 /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
9375 node
= build_cast (EXPR_WFL_LINECOL (qual_wfl
),
9376 CLASSTYPE_SUPER (current_class
),
9377 build_this (EXPR_WFL_LINECOL (qual_wfl
)));
9378 *where_found
= decl
= java_complete_tree (node
);
9379 if (decl
== error_mark_node
)
9381 *type_found
= type
= QUAL_DECL_TYPE (decl
);
9382 from_super
= from_type
= 1;
9386 /* 15.13.1: Can't search for field name in packages, so we
9387 assume a variable/class name was meant. */
9388 if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
9390 tree name
= resolve_package (wfl
, &q
);
9393 *where_found
= decl
= resolve_no_layout (name
, qual_wfl
);
9394 /* We wan't to be absolutely that the class is laid
9395 out. We're going to search something inside it. */
9396 *type_found
= type
= TREE_TYPE (decl
);
9397 layout_class (type
);
9399 /* Should be a list, really. FIXME */
9400 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q
))) = 1;
9401 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q
))) = 0;
9405 if (from_super
|| from_cast
)
9407 ((from_cast
? qual_wfl
: wfl
),
9408 "No variable `%s' defined in class `%s'",
9409 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
9410 lang_printable_name (type
, 0));
9413 (qual_wfl
, "Undefined variable or class name: `%s'",
9414 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)));
9419 /* We have a type name. It's been already resolved when the
9420 expression was qualified. */
9421 else if (RESOLVE_TYPE_NAME_P (qual_wfl
))
9423 if (!(decl
= QUAL_RESOLUTION (q
)))
9424 return 1; /* Error reported already */
9426 if (not_accessible_p (TREE_TYPE (decl
), decl
, 0))
9429 (qual_wfl
, "Can't access %s field `%s.%s' from `%s'",
9430 java_accstring_lookup (get_access_flags_from_decl (decl
)),
9431 GET_TYPE_NAME (type
),
9432 IDENTIFIER_POINTER (DECL_NAME (decl
)),
9433 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))));
9436 check_deprecation (qual_wfl
, decl
);
9438 type
= TREE_TYPE (decl
);
9441 /* We resolve and expression name */
9444 tree field_decl
= NULL_TREE
;
9446 /* If there exists an early resolution, use it. That occurs
9447 only once and we know that there are more things to
9448 come. Don't do that when processing something after SUPER
9449 (we need more thing to be put in place below */
9450 if (!from_super
&& QUAL_RESOLUTION (q
))
9452 decl
= QUAL_RESOLUTION (q
);
9455 if (TREE_CODE (decl
) == FIELD_DECL
&& !FIELD_STATIC (decl
))
9458 *where_found
= current_this
;
9461 static_ref_err (qual_wfl
, DECL_NAME (decl
),
9468 *where_found
= TREE_TYPE (decl
);
9469 if (TREE_CODE (*where_found
) == POINTER_TYPE
)
9470 *where_found
= TREE_TYPE (*where_found
);
9475 /* We have to search for a field, knowing the type of its
9476 container. The flag FROM_TYPE indicates that we resolved
9477 the last member of the expression as a type name, which
9478 means that for the resolution of this field, we'll look
9479 for other errors than if it was resolved as a member of
9484 tree field_decl_type
; /* For layout */
9486 if (!from_type
&& !JREFERENCE_TYPE_P (type
))
9489 (qual_wfl
, "Attempt to reference field `%s' in `%s %s'",
9490 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
9491 lang_printable_name (type
, 0),
9492 IDENTIFIER_POINTER (DECL_NAME (field_decl
)));
9496 field_decl
= lookup_field_wrapper (type
,
9497 EXPR_WFL_NODE (qual_wfl
));
9498 if (field_decl
== NULL_TREE
)
9501 (qual_wfl
, "No variable `%s' defined in type `%s'",
9502 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl
)),
9503 GET_TYPE_NAME (type
));
9506 if (field_decl
== error_mark_node
)
9509 /* Layout the type of field_decl, since we may need
9510 it. Don't do primitive types or loaded classes. The
9511 situation of non primitive arrays may not handled
9512 properly here. FIXME */
9513 if (TREE_CODE (TREE_TYPE (field_decl
)) == POINTER_TYPE
)
9514 field_decl_type
= TREE_TYPE (TREE_TYPE (field_decl
));
9516 field_decl_type
= TREE_TYPE (field_decl
);
9517 if (!JPRIMITIVE_TYPE_P (field_decl_type
)
9518 && !CLASS_LOADED_P (field_decl_type
)
9519 && !TYPE_ARRAY_P (field_decl_type
))
9520 resolve_and_layout (field_decl_type
, NULL_TREE
);
9521 if (TYPE_ARRAY_P (field_decl_type
))
9522 CLASS_LOADED_P (field_decl_type
) = 1;
9524 /* Check on accessibility here */
9525 if (not_accessible_p (type
, field_decl
, from_super
))
9529 "Can't access %s field `%s.%s' from `%s'",
9530 java_accstring_lookup
9531 (get_access_flags_from_decl (field_decl
)),
9532 GET_TYPE_NAME (type
),
9533 IDENTIFIER_POINTER (DECL_NAME (field_decl
)),
9535 (DECL_NAME (TYPE_NAME (current_class
))));
9538 check_deprecation (qual_wfl
, field_decl
);
9540 /* There are things to check when fields are accessed
9541 from type. There are no restrictions on a static
9542 declaration of the field when it is accessed from an
9544 is_static
= FIELD_STATIC (field_decl
);
9545 if (!from_super
&& from_type
9546 && !TYPE_INTERFACE_P (type
) && !is_static
)
9548 static_ref_err (qual_wfl
, EXPR_WFL_NODE (qual_wfl
), type
);
9551 from_cast
= from_super
= 0;
9553 /* If we need to generate something to get a proper
9554 handle on what this field is accessed from, do it
9558 decl
= maybe_access_field (decl
, *where_found
, *type_found
);
9559 if (decl
== error_mark_node
)
9563 /* We want to keep the location were found it, and the type
9565 *where_found
= decl
;
9568 /* This is the decl found and eventually the next one to
9573 type
= QUAL_DECL_TYPE (decl
);
9580 /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
9581 can't be accessed from REFERENCE (a record type). */
9584 not_accessible_p (reference
, member
, from_super
)
9585 tree reference
, member
;
9588 int access_flag
= get_access_flags_from_decl (member
);
9590 /* Access always granted for members declared public */
9591 if (access_flag
& ACC_PUBLIC
)
9594 /* Check access on protected members */
9595 if (access_flag
& ACC_PROTECTED
)
9597 /* Access granted if it occurs from within the package
9598 containing the class in which the protected member is
9600 if (class_in_current_package (DECL_CONTEXT (member
)))
9603 /* If accessed with the form `super.member', then access is granted */
9607 /* Otherwise, access is granted if occuring from the class where
9608 member is declared or a subclass of it */
9609 if (inherits_from_p (reference
, current_class
))
9614 /* Check access on private members. Access is granted only if it
9615 occurs from within the class in witch it is declared */
9616 if (access_flag
& ACC_PRIVATE
)
9617 return (current_class
== DECL_CONTEXT (member
) ? 0 : 1);
9619 /* Default access are permitted only when occuring within the
9620 package in which the type (REFERENCE) is declared. In other words,
9621 REFERENCE is defined in the current package */
9623 return !class_in_current_package (reference
);
9625 /* Otherwise, access is granted */
9629 /* Test deprecated decl access. */
9631 check_deprecation (wfl
, decl
)
9634 const char *file
= DECL_SOURCE_FILE (decl
);
9635 /* Complain if the field is deprecated and the file it was defined
9636 in isn't compiled at the same time the file which contains its
9638 if (DECL_DEPRECATED (decl
)
9639 && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file
)))
9642 switch (TREE_CODE (decl
))
9645 strcpy (the
, "method");
9648 strcpy (the
, "field");
9651 strcpy (the
, "class");
9654 fatal ("unexpected DECL code - check_deprecation");
9656 parse_warning_context
9657 (wfl
, "The %s `%s' in class `%s' has been deprecated",
9658 the
, lang_printable_name (decl
, 0),
9659 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl
)))));
9663 /* Returns 1 if class was declared in the current package, 0 otherwise */
9666 class_in_current_package (class)
9669 static tree cache
= NULL_TREE
;
9676 qualified_flag
= QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
9678 /* If the current package is empty and the name of CLASS is
9679 qualified, class isn't in the current package. If there is a
9680 current package and the name of the CLASS is not qualified, class
9681 isn't in the current package */
9682 if ((!ctxp
->package
&& qualified_flag
) || (ctxp
->package
&& !qualified_flag
))
9685 /* If there is not package and the name of CLASS isn't qualified,
9686 they belong to the same unnamed package */
9687 if (!ctxp
->package
&& !qualified_flag
)
9690 /* Compare the left part of the name of CLASS with the package name */
9691 breakdown_qualified (&left
, NULL
, DECL_NAME (TYPE_NAME (class)));
9692 if (ctxp
->package
== left
)
9700 /* This function may generate code to access DECL from WHERE. This is
9701 done only if certain conditions meet. */
9704 maybe_access_field (decl
, where
, type
)
9705 tree decl
, where
, type
;
9707 if (TREE_CODE (decl
) == FIELD_DECL
&& decl
!= current_this
9708 && !FIELD_STATIC (decl
))
9709 decl
= build_field_ref (where
? where
: current_this
,
9710 (type
? type
: DECL_CONTEXT (decl
)),
9715 /* Build a method invocation, by patching PATCH. If non NULL
9716 and according to the situation, PRIMARY and WHERE may be
9717 used. IS_STATIC is set to 1 if the invoked function is static. */
9720 patch_method_invocation (patch
, primary
, where
, is_static
, ret_decl
)
9721 tree patch
, primary
, where
;
9725 tree wfl
= TREE_OPERAND (patch
, 0);
9726 tree args
= TREE_OPERAND (patch
, 1);
9727 tree name
= EXPR_WFL_NODE (wfl
);
9729 int is_static_flag
= 0;
9730 int is_super_init
= 0;
9731 tree this_arg
= NULL_TREE
;
9733 /* Should be overriden if everything goes well. Otherwise, if
9734 something fails, it should keep this value. It stop the
9735 evaluation of a bogus assignment. See java_complete_tree,
9736 MODIFY_EXPR: for the reasons why we sometimes want to keep on
9737 evaluating an assignment */
9738 TREE_TYPE (patch
) = error_mark_node
;
9740 /* Since lookup functions are messing with line numbers, save the
9742 java_parser_context_save_global ();
9744 /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
9746 /* Resolution of qualified name, excluding constructors */
9747 if (QUALIFIED_P (name
) && !CALL_CONSTRUCTOR_P (patch
))
9749 tree class_decl
, identifier
, identifier_wfl
;
9750 /* Extract the last IDENTIFIER of the qualified
9751 expression. This is a wfl and we will use it's location
9752 data during error report. */
9753 identifier_wfl
= cut_identifier_in_qualified (wfl
);
9754 identifier
= EXPR_WFL_NODE (identifier_wfl
);
9756 /* Given the context, IDENTIFIER is syntactically qualified
9757 as a MethodName. We need to qualify what's before */
9758 qualify_ambiguous_name (wfl
);
9760 /* Package resolution */
9761 if (RESOLVE_PACKAGE_NAME_P (wfl
))
9763 tree next
, decl
, name
= resolve_package (wfl
, &next
);
9768 breakdown_qualified (&remainder
, NULL
, EXPR_WFL_NODE (wfl
));
9769 parse_error_context (wfl
, "Can't search method `%s' in package "
9770 "`%s'",IDENTIFIER_POINTER (identifier
),
9771 IDENTIFIER_POINTER (remainder
));
9772 PATCH_METHOD_RETURN_ERROR ();
9774 RESOLVE_PACKAGE_NAME_P (wfl
) = 0;
9775 if ((decl
= resolve_no_layout (name
, QUAL_WFL (next
))))
9777 QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl
)) = decl
;
9778 RESOLVE_EXPRESSION_NAME_P (wfl
) = 0;
9779 RESOLVE_TYPE_NAME_P (wfl
) = 1;
9783 RESOLVE_EXPRESSION_NAME_P (wfl
) = 1;
9784 RESOLVE_TYPE_NAME_P (wfl
) = 0;
9788 /* We're resolving a call from a type */
9789 if (RESOLVE_TYPE_NAME_P (wfl
))
9791 tree decl
= QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl
));
9792 tree name
= DECL_NAME (decl
);
9795 class_decl
= resolve_and_layout (name
, wfl
);
9796 if (CLASS_INTERFACE (decl
))
9799 (identifier_wfl
, "Can't make static reference to method "
9800 "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier
),
9801 IDENTIFIER_POINTER (name
));
9802 PATCH_METHOD_RETURN_ERROR ();
9804 /* Look the method up in the type selector. The method ought
9806 type
= TREE_TYPE (class_decl
);
9807 list
= lookup_method_invoke (0, wfl
, type
, identifier
, args
);
9808 if (list
&& !METHOD_STATIC (list
))
9810 char *fct_name
= xstrdup (lang_printable_name (list
, 0));
9813 "Can't make static reference to method `%s %s' in class `%s'",
9814 lang_printable_name (TREE_TYPE (TREE_TYPE (list
)), 0),
9815 fct_name
, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type
))));
9817 PATCH_METHOD_RETURN_ERROR ();
9819 args
= nreverse (args
);
9821 /* We're resolving an expression name */
9826 /* 1- Find the field to which the call applies */
9827 field
= resolve_field_access (wfl
, NULL
, &type
);
9828 if (field
== error_mark_node
)
9829 PATCH_METHOD_RETURN_ERROR ();
9830 /* field is used in lieu of a primary. It alows us not to
9831 report errors on erroneous use of `this' in
9835 /* 2- Do the layout of the class where the last field
9836 was found, so we can search it. */
9837 class_decl
= resolve_and_layout (type
, NULL_TREE
);
9838 if (class_decl
!= NULL_TREE
)
9839 type
= TREE_TYPE (class_decl
);
9841 /* 3- Retrieve a filtered list of method matches, Refine
9842 if necessary. In any cases, point out errors. */
9843 list
= lookup_method_invoke (0, identifier_wfl
, type
,
9846 /* 4- Add the field as an argument */
9847 args
= nreverse (args
);
9851 /* IDENTIFIER_WFL will be used to report any problem further */
9852 wfl
= identifier_wfl
;
9854 /* Resolution of simple names, names generated after a primary: or
9858 tree class_to_search
= NULL_TREE
;
9859 int lc
; /* Looking for Constructor */
9861 /* We search constructor in their target class */
9862 if (CALL_CONSTRUCTOR_P (patch
))
9864 if (TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9865 class_to_search
= EXPR_WFL_NODE (wfl
);
9866 else if (EXPR_WFL_NODE (TREE_OPERAND (patch
, 0)) ==
9867 this_identifier_node
)
9868 class_to_search
= NULL_TREE
;
9869 else if (EXPR_WFL_NODE (TREE_OPERAND (patch
, 0)) ==
9870 super_identifier_node
)
9873 if (CLASSTYPE_SUPER (current_class
))
9875 DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class
)));
9878 parse_error_context (wfl
, "Can't invoke super constructor "
9879 "on java.lang.Object");
9880 PATCH_METHOD_RETURN_ERROR ();
9884 /* Class to search is NULL if we're searching the current one */
9885 if (class_to_search
)
9887 class_to_search
= resolve_and_layout (class_to_search
,
9889 if (!class_to_search
)
9892 (wfl
, "Class `%s' not found in type declaration",
9893 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
9894 PATCH_METHOD_RETURN_ERROR ();
9897 /* Can't instantiate an abstract class, but we can
9898 invoke it's constructor. It's use within the `new'
9899 context is denied here. */
9900 if (CLASS_ABSTRACT (class_to_search
)
9901 && TREE_CODE (patch
) == NEW_CLASS_EXPR
)
9904 (wfl
, "Class `%s' is an abstract class. It can't be "
9905 "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
9906 PATCH_METHOD_RETURN_ERROR ();
9908 class_to_search
= TREE_TYPE (class_to_search
);
9911 class_to_search
= current_class
;
9914 /* This is a regular search in the local class, unless an
9915 alternate class is specified. */
9918 class_to_search
= (where
? where
: current_class
);
9922 /* NAME is a simple identifier or comes from a primary. Search
9923 in the class whose declaration contain the method being
9925 resolve_and_layout (class_to_search
, NULL_TREE
);
9926 list
= lookup_method_invoke (lc
, wfl
, class_to_search
, name
, args
);
9928 /* Don't continue if no method were found, as the next statement
9929 can't be executed then. */
9931 PATCH_METHOD_RETURN_ERROR ();
9933 /* Check for static reference if non static methods */
9934 if (check_for_static_method_reference (wfl
, patch
, list
,
9935 class_to_search
, primary
))
9936 PATCH_METHOD_RETURN_ERROR ();
9938 /* Non static methods are called with the current object extra
9939 argument. If patch a `new TYPE()', the argument is the value
9940 returned by the object allocator. If method is resolved as a
9941 primary, use the primary otherwise use the current THIS. */
9942 args
= nreverse (args
);
9943 if (TREE_CODE (patch
) != NEW_CLASS_EXPR
)
9944 this_arg
= primary
? primary
: current_this
;
9947 /* Merge point of all resolution schemes. If we have nothing, this
9948 is an error, already signaled */
9950 PATCH_METHOD_RETURN_ERROR ();
9952 /* Check accessibility, position the is_static flag, build and
9954 if (not_accessible_p (DECL_CONTEXT (current_function_decl
), list
, 0))
9956 char *fct_name
= xstrdup (lang_printable_name (list
, 0));
9958 (wfl
, "Can't access %s method `%s %s.%s' from `%s'",
9959 java_accstring_lookup (get_access_flags_from_decl (list
)),
9960 lang_printable_name (TREE_TYPE (TREE_TYPE (list
)), 0),
9961 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list
)))),
9962 fct_name
, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))));
9964 PATCH_METHOD_RETURN_ERROR ();
9966 check_deprecation (wfl
, list
);
9968 is_static_flag
= METHOD_STATIC (list
);
9969 if (! METHOD_STATIC (list
) && this_arg
!= NULL_TREE
)
9970 args
= tree_cons (NULL_TREE
, this_arg
, args
);
9972 /* In the context of an explicit constructor invocation, we can't
9973 invoke any method relying on `this'. Exceptions are: we're
9974 invoking a static function, primary exists and is not the current
9975 this, we're creating a new object. */
9976 if (ctxp
->explicit_constructor_p
9978 && (!primary
|| primary
== current_this
)
9979 && (TREE_CODE (patch
) != NEW_CLASS_EXPR
))
9982 (wfl
, "Can't reference `this' before the superclass constructor has "
9984 PATCH_METHOD_RETURN_ERROR ();
9986 java_parser_context_restore_global ();
9988 *is_static
= is_static_flag
;
9989 /* Sometimes, we want the decl of the selected method. Such as for
9993 patch
= patch_invoke (patch
, list
, args
);
9994 if (is_super_init
&& CLASS_HAS_FINIT_P (current_class
))
9996 /* Generate the code used to initialize fields declared with an
9997 initialization statement. For now, it returns a call the the
9998 artificial function $finit$, if required. */
10001 build_method_invocation (build_expr_wfl (finit_identifier_node
,
10002 input_filename
, 0, 0),
10004 patch
= build (COMPOUND_EXPR
, void_type_node
, patch
,
10005 java_complete_tree (finit_call
));
10006 CAN_COMPLETE_NORMALLY (patch
) = 1;
10011 /* Check that we're not trying to do a static reference to a method in
10012 non static method. Return 1 if it's the case, 0 otherwise. */
10015 check_for_static_method_reference (wfl
, node
, method
, where
, primary
)
10016 tree wfl
, node
, method
, where
, primary
;
10018 if (METHOD_STATIC (current_function_decl
)
10019 && !METHOD_STATIC (method
) && !primary
&& !CALL_CONSTRUCTOR_P (node
))
10021 char *fct_name
= xstrdup (lang_printable_name (method
, 0));
10022 parse_error_context
10023 (wfl
, "Can't make static reference to method `%s %s' in class `%s'",
10024 lang_printable_name (TREE_TYPE (TREE_TYPE (method
)), 0), fct_name
,
10025 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where
))));
10032 /* Patch an invoke expression METHOD and ARGS, based on its invocation
10036 patch_invoke (patch
, method
, args
)
10037 tree patch
, method
, args
;
10040 tree original_call
, t
, ta
;
10042 /* Last step for args: convert build-in types. If we're dealing with
10043 a new TYPE() type call, the first argument to the constructor
10044 isn't found in the incomming argument list, but delivered by
10046 t
= TYPE_ARG_TYPES (TREE_TYPE (method
));
10047 if (TREE_CODE (patch
) == NEW_CLASS_EXPR
)
10048 t
= TREE_CHAIN (t
);
10049 for (ta
= args
; t
!= end_params_node
&& ta
;
10050 t
= TREE_CHAIN (t
), ta
= TREE_CHAIN (ta
))
10051 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta
))) &&
10052 TREE_TYPE (TREE_VALUE (ta
)) != TREE_VALUE (t
))
10053 TREE_VALUE (ta
) = convert (TREE_VALUE (t
), TREE_VALUE (ta
));
10055 /* Resolve unresolved returned type isses */
10056 t
= TREE_TYPE (TREE_TYPE (method
));
10057 if (TREE_CODE (t
) == POINTER_TYPE
&& !CLASS_LOADED_P (TREE_TYPE (t
)))
10058 resolve_and_layout (TREE_TYPE (t
), NULL
);
10060 if (flag_emit_class_files
|| flag_emit_xref
)
10064 tree signature
= build_java_signature (TREE_TYPE (method
));
10065 switch (invocation_mode (method
, CALL_USING_SUPER (patch
)))
10067 case INVOKE_VIRTUAL
:
10068 dtable
= invoke_build_dtable (0, args
);
10069 func
= build_invokevirtual (dtable
, method
);
10073 case INVOKE_STATIC
:
10074 func
= build_known_method_ref (method
, TREE_TYPE (method
),
10075 DECL_CONTEXT (method
),
10079 case INVOKE_INTERFACE
:
10080 dtable
= invoke_build_dtable (1, args
);
10081 func
= build_invokeinterface (dtable
, DECL_NAME (method
), signature
);
10085 fatal ("internal error - unknown invocation_mode result");
10088 /* Ensure self_type is initialized, (invokestatic). FIXME */
10089 func
= build1 (NOP_EXPR
, build_pointer_type (TREE_TYPE (method
)), func
);
10092 TREE_TYPE (patch
) = TREE_TYPE (TREE_TYPE (method
));
10093 TREE_OPERAND (patch
, 0) = func
;
10094 TREE_OPERAND (patch
, 1) = args
;
10095 original_call
= patch
;
10097 /* We're processing a `new TYPE ()' form. New is called an its
10098 returned value is the first argument to the constructor. We build
10099 a COMPOUND_EXPR and use saved expression so that the overall NEW
10100 expression value is a pointer to a newly created and initialized
10102 if (TREE_CODE (original_call
) == NEW_CLASS_EXPR
)
10104 tree
class = DECL_CONTEXT (method
);
10105 tree c1
, saved_new
, size
, new;
10106 if (flag_emit_class_files
|| flag_emit_xref
)
10108 TREE_TYPE (patch
) = build_pointer_type (class);
10111 if (!TYPE_SIZE (class))
10112 safe_layout_class (class);
10113 size
= size_in_bytes (class);
10114 new = build (CALL_EXPR
, promote_type (class),
10115 build_address_of (alloc_object_node
),
10116 tree_cons (NULL_TREE
, build_class_ref (class),
10117 build_tree_list (NULL_TREE
,
10118 size_in_bytes (class))),
10120 saved_new
= save_expr (new);
10121 c1
= build_tree_list (NULL_TREE
, saved_new
);
10122 TREE_CHAIN (c1
) = TREE_OPERAND (original_call
, 1);
10123 TREE_OPERAND (original_call
, 1) = c1
;
10124 TREE_SET_CODE (original_call
, CALL_EXPR
);
10125 patch
= build (COMPOUND_EXPR
, TREE_TYPE (new), patch
, saved_new
);
10131 invocation_mode (method
, super
)
10135 int access
= get_access_flags_from_decl (method
);
10138 return INVOKE_SUPER
;
10140 if (access
& ACC_STATIC
|| access
& ACC_FINAL
|| access
& ACC_PRIVATE
)
10141 return INVOKE_STATIC
;
10143 if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method
))))
10144 return INVOKE_STATIC
;
10146 if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method
))))
10147 return INVOKE_INTERFACE
;
10149 if (DECL_CONSTRUCTOR_P (method
))
10150 return INVOKE_STATIC
;
10152 return INVOKE_VIRTUAL
;
10155 /* Retrieve a refined list of matching methods. It covers the step
10156 15.11.2 (Compile-Time Step 2) */
10159 lookup_method_invoke (lc
, cl
, class, name
, arg_list
)
10162 tree
class, name
, arg_list
;
10164 tree atl
= end_params_node
; /* Arg Type List */
10165 tree method
, signature
, list
, node
;
10166 const char *candidates
; /* Used for error report */
10169 /* Fix the arguments */
10170 for (node
= arg_list
; node
; node
= TREE_CHAIN (node
))
10172 tree current_arg
= TREE_TYPE (TREE_VALUE (node
));
10173 /* Non primitive type may have to be resolved */
10174 if (!JPRIMITIVE_TYPE_P (current_arg
))
10175 resolve_and_layout (current_arg
, NULL_TREE
);
10177 if (TREE_CODE (current_arg
) == RECORD_TYPE
)
10178 current_arg
= promote_type (current_arg
);
10179 atl
= tree_cons (NULL_TREE
, current_arg
, atl
);
10182 /* Find all candidates and then refine the list, searching for the
10183 most specific method. */
10184 list
= find_applicable_accessible_methods_list (lc
, class, name
, atl
);
10185 list
= find_most_specific_methods_list (list
);
10186 if (list
&& !TREE_CHAIN (list
))
10187 return TREE_VALUE (list
);
10189 /* Issue an error. List candidates if any. Candidates are listed
10190 only if accessible (non accessible methods may end-up here for
10191 the sake of a better error report). */
10196 obstack_grow (&temporary_obstack
, ". Candidates are:\n", 18);
10197 for (current
= list
; current
; current
= TREE_CHAIN (current
))
10199 tree cm
= TREE_VALUE (current
);
10200 char string
[4096];
10201 if (!cm
|| not_accessible_p (class, cm
, 0))
10204 (string
, " `%s' in `%s'%s",
10205 get_printable_method_name (cm
),
10206 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm
)))),
10207 (TREE_CHAIN (current
) ? "\n" : ""));
10208 obstack_grow (&temporary_obstack
, string
, strlen (string
));
10210 obstack_1grow (&temporary_obstack
, '\0');
10211 candidates
= obstack_finish (&temporary_obstack
);
10213 /* Issue the error message */
10214 method
= make_node (FUNCTION_TYPE
);
10215 TYPE_ARG_TYPES (method
) = atl
;
10216 signature
= build_java_argument_signature (method
);
10217 dup
= strdup (lang_printable_name (class, 0));
10218 parse_error_context (cl
, "Can't find %s `%s(%s)' in type `%s'%s",
10219 (lc
? "constructor" : "method"),
10220 (lc
? dup
: IDENTIFIER_POINTER (name
)),
10221 IDENTIFIER_POINTER (signature
), dup
,
10222 (candidates
? candidates
: ""));
10227 /* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
10228 when we're looking for a constructor. */
10231 find_applicable_accessible_methods_list (lc
, class, name
, arglist
)
10233 tree
class, name
, arglist
;
10235 tree list
= NULL_TREE
, all_list
= NULL_TREE
;
10237 /* Search interfaces */
10238 if (CLASS_INTERFACE (TYPE_NAME (class))
10239 || CLASS_ABSTRACT (TYPE_NAME (class)))
10241 static tree searched_interfaces
= NULL_TREE
;
10242 static int search_not_done
= 0;
10244 tree basetype_vec
= TYPE_BINFO_BASETYPES (class);
10246 /* Have we searched this interface already? */
10247 if (searched_interfaces
)
10250 for (current
= searched_interfaces
;
10251 current
; current
= TREE_CHAIN (current
))
10252 if (TREE_VALUE (current
) == class)
10255 searched_interfaces
= tree_cons (NULL_TREE
, class, searched_interfaces
);
10257 search_applicable_methods_list
10258 (lc
, TYPE_METHODS (class), name
, arglist
, &list
, &all_list
);
10260 n
= TREE_VEC_LENGTH (basetype_vec
);
10261 for (i
= 0; i
< n
; i
++)
10263 tree t
= BINFO_TYPE (TREE_VEC_ELT (basetype_vec
, i
));
10266 /* Skip java.lang.Object (we'll search it once later.) */
10267 if (t
== object_type_node
)
10271 rlist
= find_applicable_accessible_methods_list (lc
, t
, name
,
10273 all_list
= chainon (rlist
, (list
? list
: all_list
));
10277 /* We're done. Reset the searched interfaces list and finally search
10278 java.lang.Object */
10279 if (!search_not_done
)
10281 searched_interfaces
= NULL_TREE
;
10282 search_applicable_methods_list (lc
, TYPE_METHODS (object_type_node
),
10283 name
, arglist
, &list
, &all_list
);
10286 /* Search classes */
10288 while (class != NULL_TREE
)
10290 search_applicable_methods_list
10291 (lc
, TYPE_METHODS (class), name
, arglist
, &list
, &all_list
);
10292 class = (lc
? NULL_TREE
: CLASSTYPE_SUPER (class));
10295 /* Either return the list obtained or all selected (but
10296 inaccessible) methods for better error report. */
10297 return (!list
? all_list
: list
);
10300 /* Effectively search for the approriate method in method */
10303 search_applicable_methods_list(lc
, method
, name
, arglist
, list
, all_list
)
10305 tree method
, name
, arglist
;
10306 tree
*list
, *all_list
;
10308 for (; method
; method
= TREE_CHAIN (method
))
10310 /* When dealing with constructor, stop here, otherwise search
10312 if (lc
&& !DECL_CONSTRUCTOR_P (method
))
10314 else if (!lc
&& (DECL_CONSTRUCTOR_P (method
)
10315 || (GET_METHOD_NAME (method
) != name
)))
10318 if (argument_types_convertible (method
, arglist
))
10320 /* Retain accessible methods only */
10321 if (!not_accessible_p (DECL_CONTEXT (current_function_decl
),
10323 *list
= tree_cons (NULL_TREE
, method
, *list
);
10325 /* Also retain all selected method here */
10326 *all_list
= tree_cons (NULL_TREE
, method
, *list
);
10331 /* 15.11.2.2 Choose the Most Specific Method */
10334 find_most_specific_methods_list (list
)
10338 tree current
, new_list
= NULL_TREE
;
10339 for (current
= list
; current
; current
= TREE_CHAIN (current
))
10342 DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) = 0;
10344 for (method
= list
; method
; method
= TREE_CHAIN (method
))
10346 /* Don't test a method against itself */
10347 if (method
== current
)
10350 /* Compare arguments and location where method where declared */
10351 if (argument_types_convertible (TREE_VALUE (method
),
10352 TREE_VALUE (current
))
10353 && valid_method_invocation_conversion_p
10354 (DECL_CONTEXT (TREE_VALUE (method
)),
10355 DECL_CONTEXT (TREE_VALUE (current
))))
10357 int v
= ++DECL_SPECIFIC_COUNT (TREE_VALUE (current
));
10358 max
= (v
> max
? v
: max
);
10363 /* Review the list and select the maximally specific methods */
10364 for (current
= list
; current
; current
= TREE_CHAIN (current
))
10365 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) == max
)
10366 new_list
= tree_cons (NULL_TREE
, TREE_VALUE (current
), new_list
);
10368 /* If we can't find one, lower expectations and try to gather multiple
10369 maximally specific methods */
10374 if (DECL_SPECIFIC_COUNT (TREE_VALUE (current
)) == max
)
10375 new_list
= tree_cons (NULL_TREE
, TREE_VALUE (current
), new_list
);
10383 /* Make sure that the type of each M2_OR_ARGLIST arguments can be
10384 converted by method invocation conversion (5.3) to the type of the
10385 corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
10386 to change less often than M1. */
10389 argument_types_convertible (m1
, m2_or_arglist
)
10390 tree m1
, m2_or_arglist
;
10392 static tree m2_arg_value
= NULL_TREE
;
10393 static tree m2_arg_cache
= NULL_TREE
;
10395 register tree m1_arg
, m2_arg
;
10397 m1_arg
= TYPE_ARG_TYPES (TREE_TYPE (m1
));
10398 if (!METHOD_STATIC (m1
))
10399 m1_arg
= TREE_CHAIN (m1_arg
);
10401 if (m2_arg_value
== m2_or_arglist
)
10402 m2_arg
= m2_arg_cache
;
10405 /* M2_OR_ARGLIST can be a function DECL or a raw list of
10407 if (m2_or_arglist
&& TREE_CODE (m2_or_arglist
) == FUNCTION_DECL
)
10409 m2_arg
= TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist
));
10410 if (!METHOD_STATIC (m2_or_arglist
))
10411 m2_arg
= TREE_CHAIN (m2_arg
);
10414 m2_arg
= m2_or_arglist
;
10416 m2_arg_value
= m2_or_arglist
;
10417 m2_arg_cache
= m2_arg
;
10420 while (m1_arg
!= end_params_node
&& m2_arg
!= end_params_node
)
10422 resolve_and_layout (TREE_VALUE (m1_arg
), NULL_TREE
);
10423 if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg
),
10424 TREE_VALUE (m2_arg
)))
10426 m1_arg
= TREE_CHAIN (m1_arg
);
10427 m2_arg
= TREE_CHAIN (m2_arg
);
10429 return m1_arg
== end_params_node
&& m2_arg
== end_params_node
;
10432 /* Qualification routines */
10435 qualify_ambiguous_name (id
)
10438 tree qual
, qual_wfl
, name
= NULL_TREE
, decl
, ptr_type
= NULL_TREE
,
10439 saved_current_class
;
10440 int again
, super_found
= 0, this_found
= 0, new_array_found
= 0;
10443 /* We first qualify the first element, then derive qualification of
10444 others based on the first one. If the first element is qualified
10445 by a resolution (field or type), this resolution is stored in the
10446 QUAL_RESOLUTION of the qual element being examined. We need to
10447 save the current_class since the use of SUPER might change the
10449 saved_current_class
= current_class
;
10450 qual
= EXPR_WFL_QUALIFICATION (id
);
10453 /* Simple qualified expression feature a qual_wfl that is a
10454 WFL. Expression derived from a primary feature more complicated
10455 things like a CALL_EXPR. Expression from primary need to be
10456 worked out to extract the part on which the qualification will
10458 qual_wfl
= QUAL_WFL (qual
);
10459 switch (TREE_CODE (qual_wfl
))
10462 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
10463 if (TREE_CODE (qual_wfl
) != EXPR_WITH_FILE_LOCATION
)
10465 qual
= EXPR_WFL_QUALIFICATION (qual_wfl
);
10466 qual_wfl
= QUAL_WFL (qual
);
10469 case NEW_ARRAY_EXPR
:
10470 qual
= TREE_CHAIN (qual
);
10471 again
= new_array_found
= 1;
10473 case NEW_CLASS_EXPR
:
10475 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
10478 while (TREE_CODE (qual_wfl
) == ARRAY_REF
)
10479 qual_wfl
= TREE_OPERAND (qual_wfl
, 0);
10482 qual
= TREE_CHAIN (qual
);
10483 qual_wfl
= QUAL_WFL (qual
);
10486 /* Fix for -Wall. Just break doing nothing */
10490 ptr_type
= current_class
;
10492 code
= TREE_CODE (qual_wfl
);
10494 /* Pos evaluation: non WFL leading expression nodes */
10495 if (code
== CONVERT_EXPR
10496 && TREE_CODE (TREE_TYPE (qual_wfl
)) == EXPR_WITH_FILE_LOCATION
)
10497 name
= EXPR_WFL_NODE (TREE_TYPE (qual_wfl
));
10499 else if ((code
== ARRAY_REF
|| code
== CALL_EXPR
|| code
== MODIFY_EXPR
) &&
10500 TREE_CODE (TREE_OPERAND (qual_wfl
, 0)) == EXPR_WITH_FILE_LOCATION
)
10501 name
= EXPR_WFL_NODE (TREE_OPERAND (qual_wfl
, 0));
10503 else if (code
== STRING_CST
|| code
== CONDITIONAL_EXPR
10504 || code
== PLUS_EXPR
)
10506 qual
= TREE_CHAIN (qual
);
10507 qual_wfl
= QUAL_WFL (qual
);
10512 name
= EXPR_WFL_NODE (qual_wfl
);
10515 qual
= EXPR_WFL_QUALIFICATION (qual_wfl
);
10520 /* If we have a THIS (from a primary), we set the context accordingly */
10521 if (name
== this_identifier_node
)
10523 qual
= TREE_CHAIN (qual
);
10524 qual_wfl
= QUAL_WFL (qual
);
10525 if (TREE_CODE (qual_wfl
) == CALL_EXPR
)
10528 name
= EXPR_WFL_NODE (qual_wfl
);
10531 /* If we have a SUPER, we set the context accordingly */
10532 if (name
== super_identifier_node
)
10534 current_class
= CLASSTYPE_SUPER (ptr_type
);
10535 /* Check that there is such a thing as a super class. If not,
10536 return. The error will be caught later on, during the
10538 if (!current_class
)
10540 current_class
= saved_current_class
;
10543 qual
= TREE_CHAIN (qual
);
10544 /* Do one more interation to set things up */
10545 super_found
= again
= 1;
10549 /* If name appears within the scope of a location variable
10550 declaration or parameter declaration, then it is an expression
10551 name. We don't carry this test out if we're in the context of the
10552 use of SUPER or THIS */
10553 if (!this_found
&& !super_found
&&
10554 TREE_CODE (name
) != STRING_CST
&& (decl
= IDENTIFIER_LOCAL_VALUE (name
)))
10556 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
10557 QUAL_RESOLUTION (qual
) = decl
;
10560 /* If within the class/interface NAME was found to be used there
10561 exists a (possibly inherited) field named NAME, then this is an
10562 expression name. If we saw a NEW_ARRAY_EXPR before and want to
10563 address length, it is OK. */
10564 else if ((decl
= lookup_field_wrapper (ptr_type
, name
))
10565 || (new_array_found
&& name
== length_identifier_node
))
10567 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
10568 QUAL_RESOLUTION (qual
) = (new_array_found
? NULL_TREE
: decl
);
10571 /* We reclassify NAME as yielding to a type name resolution if:
10572 - NAME is a class/interface declared within the compilation
10573 unit containing NAME,
10574 - NAME is imported via a single-type-import declaration,
10575 - NAME is declared in an another compilation unit of the package
10576 of the compilation unit containing NAME,
10577 - NAME is declared by exactly on type-import-on-demand declaration
10578 of the compilation unit containing NAME.
10579 - NAME is actually a STRING_CST. */
10580 else if (TREE_CODE (name
) == STRING_CST
||
10581 (decl
= resolve_and_layout (name
, NULL_TREE
)))
10583 RESOLVE_TYPE_NAME_P (qual_wfl
) = 1;
10584 QUAL_RESOLUTION (qual
) = decl
;
10587 /* Method call are expression name */
10588 else if (TREE_CODE (QUAL_WFL (qual
)) == CALL_EXPR
10589 || TREE_CODE (QUAL_WFL (qual
)) == ARRAY_REF
10590 || TREE_CODE (QUAL_WFL (qual
)) == CONVERT_EXPR
)
10591 RESOLVE_EXPRESSION_NAME_P (qual_wfl
) = 1;
10593 /* Check here that NAME isn't declared by more than one
10594 type-import-on-demand declaration of the compilation unit
10595 containing NAME. FIXME */
10597 /* Otherwise, NAME is reclassified as a package name */
10599 RESOLVE_PACKAGE_NAME_P (qual_wfl
) = 1;
10601 /* Propagate the qualification accross other components of the
10603 for (qual
= TREE_CHAIN (qual
); qual
;
10604 qual_wfl
= QUAL_WFL (qual
), qual
= TREE_CHAIN (qual
))
10606 if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
10607 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual
)) = 1;
10609 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual
)) = 1;
10612 /* Store the global qualification for the ambiguous part of ID back
10614 if (RESOLVE_EXPRESSION_NAME_P (qual_wfl
))
10615 RESOLVE_EXPRESSION_NAME_P (id
) = 1;
10616 else if (RESOLVE_TYPE_NAME_P (qual_wfl
))
10617 RESOLVE_TYPE_NAME_P (id
) = 1;
10618 else if (RESOLVE_PACKAGE_NAME_P (qual_wfl
))
10619 RESOLVE_PACKAGE_NAME_P (id
) = 1;
10621 /* Restore the current class */
10622 current_class
= saved_current_class
;
10626 breakdown_qualified (left
, right
, source
)
10627 tree
*left
, *right
, source
;
10629 char *p
= IDENTIFIER_POINTER (source
), *base
;
10630 int l
= IDENTIFIER_LENGTH (source
);
10632 /* Breakdown NAME into REMAINDER . IDENTIFIER */
10635 while (*p
!= '.' && p
!= base
)
10638 /* We didn't find a '.'. Return an error */
10644 *right
= get_identifier (p
+1);
10645 *left
= get_identifier (IDENTIFIER_POINTER (source
));
10651 /* Patch tree nodes in a function body. When a BLOCK is found, push
10652 local variable decls if present.
10653 Same as java_complete_lhs, but does resolve static finals to values. */
10656 java_complete_tree (node
)
10659 node
= java_complete_lhs (node
);
10660 if (TREE_CODE (node
) == VAR_DECL
&& FIELD_STATIC (node
)
10661 && FIELD_FINAL (node
) && DECL_INITIAL (node
) != NULL_TREE
10662 && !flag_emit_xref
)
10664 tree value
= DECL_INITIAL (node
);
10665 DECL_INITIAL (node
) = NULL_TREE
;
10666 push_obstacks (&permanent_obstack
, &permanent_obstack
);
10667 value
= fold_constant_for_init (value
, node
);
10669 DECL_INITIAL (node
) = value
;
10670 if (value
!= NULL_TREE
)
10677 java_stabilize_reference (node
)
10680 if (TREE_CODE (node
) == COMPOUND_EXPR
)
10682 tree op0
= TREE_OPERAND (node
, 0);
10683 tree op1
= TREE_OPERAND (node
, 1);
10684 TREE_OPERAND (node
, 0) = save_expr (op0
);
10685 TREE_OPERAND (node
, 1) = java_stabilize_reference (op1
);
10688 return stabilize_reference (node
);
10691 /* Patch tree nodes in a function body. When a BLOCK is found, push
10692 local variable decls if present.
10693 Same as java_complete_tree, but does not resolve static finals to values. */
10696 java_complete_lhs (node
)
10699 tree nn
, cn
, wfl_op1
, wfl_op2
, wfl_op3
;
10702 /* CONVERT_EXPR always has its type set, even though it needs to be
10704 if (TREE_TYPE (node
) && TREE_CODE (node
) != CONVERT_EXPR
)
10707 /* The switch block implements cases processing container nodes
10708 first. Contained nodes are always written back. Leaves come
10709 next and return a value. */
10710 switch (TREE_CODE (node
))
10714 /* 1- Block section.
10715 Set the local values on decl names so we can identify them
10716 faster when they're referenced. At that stage, identifiers
10717 are legal so we don't check for declaration errors. */
10718 for (cn
= BLOCK_EXPR_DECLS (node
); cn
; cn
= TREE_CHAIN (cn
))
10720 DECL_CONTEXT (cn
) = current_function_decl
;
10721 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn
)) = cn
;
10723 if (BLOCK_EXPR_BODY (node
) == NULL_TREE
)
10724 CAN_COMPLETE_NORMALLY (node
) = 1;
10727 tree stmt
= BLOCK_EXPR_BODY (node
);
10729 int error_seen
= 0;
10730 if (TREE_CODE (stmt
) == COMPOUND_EXPR
)
10732 /* Re-order from (((A; B); C); ...; Z) to
10733 (A; (B; (C ; (...; Z)))).
10734 This makes it easier to scan the statements left-to-right
10735 without using recursion (which might overflow the stack
10736 if the block has many statements. */
10739 tree left
= TREE_OPERAND (stmt
, 0);
10740 if (TREE_CODE (left
) != COMPOUND_EXPR
)
10742 TREE_OPERAND (stmt
, 0) = TREE_OPERAND (left
, 1);
10743 TREE_OPERAND (left
, 1) = stmt
;
10746 BLOCK_EXPR_BODY (node
) = stmt
;
10749 /* Now do the actual complete, without deep recursion for
10751 ptr
= &BLOCK_EXPR_BODY (node
);
10752 while (TREE_CODE (*ptr
) == COMPOUND_EXPR
10753 && TREE_OPERAND (*ptr
, 1) != empty_stmt_node
)
10755 tree cur
= java_complete_tree (TREE_OPERAND (*ptr
, 0));
10756 tree
*next
= &TREE_OPERAND (*ptr
, 1);
10757 TREE_OPERAND (*ptr
, 0) = cur
;
10758 if (cur
== empty_stmt_node
)
10760 /* Optimization; makes it easier to detect empty bodies.
10761 Most useful for <clinit> with all-constant initializer. */
10765 if (TREE_CODE (cur
) == ERROR_MARK
)
10767 else if (! CAN_COMPLETE_NORMALLY (cur
))
10772 if (TREE_CODE (wfl_op2
) == BLOCK
)
10773 wfl_op2
= BLOCK_EXPR_BODY (wfl_op2
);
10774 else if (TREE_CODE (wfl_op2
) == COMPOUND_EXPR
)
10775 wfl_op2
= TREE_OPERAND (wfl_op2
, 0);
10779 if (TREE_CODE (wfl_op2
) != CASE_EXPR
10780 && TREE_CODE (wfl_op2
) != DEFAULT_EXPR
)
10781 unreachable_stmt_error (*ptr
);
10785 *ptr
= java_complete_tree (*ptr
);
10787 if (TREE_CODE (*ptr
) == ERROR_MARK
|| error_seen
> 0)
10788 return error_mark_node
;
10789 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (*ptr
);
10791 /* Turn local bindings to null */
10792 for (cn
= BLOCK_EXPR_DECLS (node
); cn
; cn
= TREE_CHAIN (cn
))
10793 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn
)) = NULL_TREE
;
10795 TREE_TYPE (node
) = void_type_node
;
10798 /* 2- They are expressions but ultimately deal with statements */
10801 wfl_op1
= TREE_OPERAND (node
, 0);
10802 COMPLETE_CHECK_OP_0 (node
);
10803 /* CAN_COMPLETE_NORMALLY (node) = 0; */
10804 return patch_throw_statement (node
, wfl_op1
);
10806 case SYNCHRONIZED_EXPR
:
10807 wfl_op1
= TREE_OPERAND (node
, 0);
10808 return patch_synchronized_statement (node
, wfl_op1
);
10811 return patch_try_statement (node
);
10813 case TRY_FINALLY_EXPR
:
10814 COMPLETE_CHECK_OP_0 (node
);
10815 COMPLETE_CHECK_OP_1 (node
);
10816 CAN_COMPLETE_NORMALLY (node
)
10817 = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 0))
10818 && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1)));
10819 TREE_TYPE (node
) = TREE_TYPE (TREE_OPERAND (node
, 0));
10822 case CLEANUP_POINT_EXPR
:
10823 COMPLETE_CHECK_OP_0 (node
);
10824 TREE_TYPE (node
) = void_type_node
;
10825 CAN_COMPLETE_NORMALLY (node
) =
10826 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 0));
10829 case WITH_CLEANUP_EXPR
:
10830 COMPLETE_CHECK_OP_0 (node
);
10831 COMPLETE_CHECK_OP_2 (node
);
10832 CAN_COMPLETE_NORMALLY (node
) =
10833 CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 0));
10834 TREE_TYPE (node
) = void_type_node
;
10837 case LABELED_BLOCK_EXPR
:
10838 PUSH_LABELED_BLOCK (node
);
10839 if (LABELED_BLOCK_BODY (node
))
10840 COMPLETE_CHECK_OP_1 (node
);
10841 TREE_TYPE (node
) = void_type_node
;
10842 POP_LABELED_BLOCK ();
10844 if (LABELED_BLOCK_BODY (node
) == empty_stmt_node
)
10846 LABELED_BLOCK_BODY (node
) = NULL_TREE
;
10847 CAN_COMPLETE_NORMALLY (node
) = 1;
10849 else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node
)))
10850 CAN_COMPLETE_NORMALLY (node
) = 1;
10853 case EXIT_BLOCK_EXPR
:
10854 /* We don't complete operand 1, because it's the return value of
10855 the EXIT_BLOCK_EXPR which doesn't exist it Java */
10856 return patch_bc_statement (node
);
10859 cn
= java_complete_tree (TREE_OPERAND (node
, 0));
10860 if (cn
== error_mark_node
)
10863 /* First, the case expression must be constant. Values of final
10864 fields are accepted. */
10866 if ((TREE_CODE (cn
) == COMPOUND_EXPR
|| TREE_CODE (cn
) == COMPONENT_REF
)
10867 && JDECL_P (TREE_OPERAND (cn
, 1))
10868 && FIELD_FINAL (TREE_OPERAND (cn
, 1))
10869 && DECL_INITIAL (TREE_OPERAND (cn
, 1)))
10871 push_obstacks (&permanent_obstack
, &permanent_obstack
);
10872 cn
= fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn
, 1)),
10873 TREE_OPERAND (cn
, 1));
10877 if (!TREE_CONSTANT (cn
) && !flag_emit_xref
)
10879 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10880 parse_error_context (node
, "Constant expression required");
10881 return error_mark_node
;
10884 nn
= ctxp
->current_loop
;
10886 /* It must be assignable to the type of the switch expression. */
10887 if (!try_builtin_assignconv (NULL_TREE
,
10888 TREE_TYPE (TREE_OPERAND (nn
, 0)), cn
))
10890 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10891 parse_error_context
10893 "Incompatible type for case. Can't convert `%s' to `int'",
10894 lang_printable_name (TREE_TYPE (cn
), 0));
10895 return error_mark_node
;
10898 cn
= fold (convert (int_type_node
, cn
));
10900 /* Multiple instance of a case label bearing the same
10901 value is checked during code generation. The case
10902 expression is allright so far. */
10903 TREE_OPERAND (node
, 0) = cn
;
10904 TREE_TYPE (node
) = void_type_node
;
10905 CAN_COMPLETE_NORMALLY (node
) = 1;
10906 TREE_SIDE_EFFECTS (node
) = 1;
10910 nn
= ctxp
->current_loop
;
10911 /* Only one default label is allowed per switch statement */
10912 if (SWITCH_HAS_DEFAULT (nn
))
10914 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
10915 parse_error_context (wfl_operator
,
10916 "Duplicate case label: `default'");
10917 return error_mark_node
;
10920 SWITCH_HAS_DEFAULT (nn
) = 1;
10921 TREE_TYPE (node
) = void_type_node
;
10922 TREE_SIDE_EFFECTS (node
) = 1;
10923 CAN_COMPLETE_NORMALLY (node
) = 1;
10929 /* Check whether the loop was enclosed in a labeled
10930 statement. If not, create one, insert the loop in it and
10932 nn
= patch_loop_statement (node
);
10934 /* Anyways, walk the body of the loop */
10935 if (TREE_CODE (node
) == LOOP_EXPR
)
10936 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10937 /* Switch statement: walk the switch expression and the cases */
10939 node
= patch_switch_statement (node
);
10941 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10942 nn
= error_mark_node
;
10945 TREE_TYPE (nn
) = TREE_TYPE (node
) = void_type_node
;
10946 /* If we returned something different, that's because we
10947 inserted a label. Pop the label too. */
10950 if (CAN_COMPLETE_NORMALLY (node
))
10951 CAN_COMPLETE_NORMALLY (nn
) = 1;
10952 POP_LABELED_BLOCK ();
10959 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10960 return patch_exit_expr (node
);
10964 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
10965 if (TREE_OPERAND (node
, 0) == error_mark_node
)
10966 return error_mark_node
;
10967 /* then-else branches */
10968 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
10969 if (TREE_OPERAND (node
, 1) == error_mark_node
)
10970 return error_mark_node
;
10971 TREE_OPERAND (node
, 2) = java_complete_tree (TREE_OPERAND (node
, 2));
10972 if (TREE_OPERAND (node
, 2) == error_mark_node
)
10973 return error_mark_node
;
10974 return patch_if_else_statement (node
);
10977 case CONDITIONAL_EXPR
:
10979 wfl_op1
= TREE_OPERAND (node
, 0);
10980 COMPLETE_CHECK_OP_0 (node
);
10981 wfl_op2
= TREE_OPERAND (node
, 1);
10982 COMPLETE_CHECK_OP_1 (node
);
10983 wfl_op3
= TREE_OPERAND (node
, 2);
10984 COMPLETE_CHECK_OP_2 (node
);
10985 return patch_conditional_expr (node
, wfl_op1
, wfl_op2
);
10987 /* 3- Expression section */
10988 case COMPOUND_EXPR
:
10989 wfl_op2
= TREE_OPERAND (node
, 1);
10990 TREE_OPERAND (node
, 0) = nn
=
10991 java_complete_tree (TREE_OPERAND (node
, 0));
10992 if (wfl_op2
== empty_stmt_node
)
10993 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (nn
);
10996 if (! CAN_COMPLETE_NORMALLY (nn
) && TREE_CODE (nn
) != ERROR_MARK
)
10998 /* An unreachable condition in a do-while statement
10999 is *not* (technically) an unreachable statement. */
11001 if (TREE_CODE (nn
) == EXPR_WITH_FILE_LOCATION
)
11002 nn
= EXPR_WFL_NODE (nn
);
11003 if (TREE_CODE (nn
) != EXIT_EXPR
)
11005 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op2
);
11006 parse_error_context (wfl_operator
, "Unreachable statement");
11009 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
11010 if (TREE_OPERAND (node
, 1) == error_mark_node
)
11011 return error_mark_node
;
11012 CAN_COMPLETE_NORMALLY (node
)
11013 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1));
11015 TREE_TYPE (node
) = TREE_TYPE (TREE_OPERAND (node
, 1));
11019 /* CAN_COMPLETE_NORMALLY (node) = 0; */
11020 return patch_return (node
);
11022 case EXPR_WITH_FILE_LOCATION
:
11023 if (!EXPR_WFL_NODE (node
) /* Or a PRIMARY flag ? */
11024 || TREE_CODE (EXPR_WFL_NODE (node
)) == IDENTIFIER_NODE
)
11027 node
= resolve_expression_name (node
, NULL
);
11028 if (node
== error_mark_node
)
11030 /* Keep line number information somewhere were it doesn't
11031 disrupt the completion process. */
11032 if (flag_emit_xref
&& TREE_CODE (node
) != CALL_EXPR
)
11034 EXPR_WFL_NODE (wfl
) = TREE_OPERAND (node
, 1);
11035 TREE_OPERAND (node
, 1) = wfl
;
11037 CAN_COMPLETE_NORMALLY (node
) = 1;
11042 int save_lineno
= lineno
;
11043 lineno
= EXPR_WFL_LINENO (node
);
11044 body
= java_complete_tree (EXPR_WFL_NODE (node
));
11045 lineno
= save_lineno
;
11046 EXPR_WFL_NODE (node
) = body
;
11047 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (body
);
11048 CAN_COMPLETE_NORMALLY (node
) = CAN_COMPLETE_NORMALLY (body
);
11049 if (body
== empty_stmt_node
)
11051 /* Optimization; makes it easier to detect empty bodies. */
11054 if (body
== error_mark_node
)
11056 /* Its important for the evaluation of assignment that
11057 this mark on the TREE_TYPE is propagated. */
11058 TREE_TYPE (node
) = error_mark_node
;
11059 return error_mark_node
;
11062 TREE_TYPE (node
) = TREE_TYPE (EXPR_WFL_NODE (node
));
11067 case NEW_ARRAY_EXPR
:
11068 /* Patch all the dimensions */
11070 for (cn
= TREE_OPERAND (node
, 1); cn
; cn
= TREE_CHAIN (cn
))
11072 int location
= EXPR_WFL_LINECOL (TREE_VALUE (cn
));
11073 tree dim
= java_complete_tree (TREE_VALUE (cn
));
11074 if (dim
== error_mark_node
)
11081 TREE_VALUE (cn
) = dim
;
11082 /* Setup the location of the current dimension, for
11083 later error report. */
11084 TREE_PURPOSE (cn
) =
11085 build_expr_wfl (NULL_TREE
, input_filename
, 0, 0);
11086 EXPR_WFL_LINECOL (TREE_PURPOSE (cn
)) = location
;
11089 /* They complete the array creation expression, if no errors
11091 CAN_COMPLETE_NORMALLY (node
) = 1;
11092 return (flag
? error_mark_node
11093 : force_evaluation_order (patch_newarray (node
)));
11095 case NEW_CLASS_EXPR
:
11097 /* Complete function's argument(s) first */
11098 if (complete_function_arguments (node
))
11099 return error_mark_node
;
11102 tree decl
, wfl
= TREE_OPERAND (node
, 0);
11103 int in_this
= CALL_THIS_CONSTRUCTOR_P (node
);
11105 node
= patch_method_invocation (node
, NULL_TREE
,
11106 NULL_TREE
, 0, &decl
);
11107 if (node
== error_mark_node
)
11108 return error_mark_node
;
11110 check_thrown_exceptions (EXPR_WFL_LINECOL (node
), decl
);
11111 /* If we call this(...), register signature and positions */
11113 DECL_CONSTRUCTOR_CALLS (current_function_decl
) =
11114 tree_cons (wfl
, decl
,
11115 DECL_CONSTRUCTOR_CALLS (current_function_decl
));
11116 CAN_COMPLETE_NORMALLY (node
) = 1;
11117 return force_evaluation_order (node
);
11121 /* Save potential wfls */
11122 wfl_op1
= TREE_OPERAND (node
, 0);
11123 TREE_OPERAND (node
, 0) = nn
= java_complete_lhs (wfl_op1
);
11124 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node
)
11125 && TREE_CODE (nn
) == VAR_DECL
&& TREE_STATIC (nn
)
11126 && DECL_INITIAL (nn
) != NULL_TREE
)
11130 push_obstacks (&permanent_obstack
, &permanent_obstack
);
11131 value
= fold_constant_for_init (nn
, nn
);
11133 if (value
!= NULL_TREE
)
11135 tree type
= TREE_TYPE (value
);
11136 if (JPRIMITIVE_TYPE_P (type
) || type
== string_ptr_type_node
)
11137 return empty_stmt_node
;
11139 DECL_INITIAL (nn
) = NULL_TREE
;
11141 wfl_op2
= TREE_OPERAND (node
, 1);
11143 if (TREE_OPERAND (node
, 0) == error_mark_node
)
11144 return error_mark_node
;
11146 flag
= COMPOUND_ASSIGN_P (wfl_op2
);
11149 tree lvalue
= java_stabilize_reference (TREE_OPERAND (node
, 0));
11151 /* Hand stablize the lhs on both places */
11152 TREE_OPERAND (node
, 0) = lvalue
;
11153 TREE_OPERAND (TREE_OPERAND (node
, 1), 0) =
11154 (flag_emit_class_files
? lvalue
: save_expr (lvalue
));
11156 /* 15.25.2.a: Left hand is not an array access. FIXME */
11157 /* Now complete the RHS. We write it back later on. */
11158 nn
= java_complete_tree (TREE_OPERAND (node
, 1));
11160 if ((cn
= patch_string (nn
)))
11163 /* The last part of the rewrite for E1 op= E2 is to have
11164 E1 = (T)(E1 op E2), with T being the type of E1. */
11165 nn
= java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2
),
11166 TREE_TYPE (lvalue
), nn
));
11168 /* 15.25.2.b: Left hand is an array access. FIXME */
11171 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
11172 function to complete this RHS */
11173 else if (TREE_CODE (wfl_op2
) == NEW_ARRAY_INIT
)
11174 nn
= patch_new_array_init (TREE_TYPE (TREE_OPERAND (node
, 0)),
11175 TREE_OPERAND (node
, 1));
11176 /* Otherwise we simply complete the RHS */
11178 nn
= java_complete_tree (TREE_OPERAND (node
, 1));
11180 if (nn
== error_mark_node
)
11181 return error_mark_node
;
11183 /* Write back the RHS as we evaluated it. */
11184 TREE_OPERAND (node
, 1) = nn
;
11186 /* In case we're handling = with a String as a RHS, we need to
11187 produce a String out of the RHS (it might still be a
11188 STRING_CST or a StringBuffer at this stage */
11189 if ((nn
= patch_string (TREE_OPERAND (node
, 1))))
11190 TREE_OPERAND (node
, 1) = nn
;
11191 node
= patch_assignment (node
, wfl_op1
, wfl_op2
);
11192 /* Reorganize the tree if necessary. */
11193 if (flag
&& (!JREFERENCE_TYPE_P (TREE_TYPE (node
))
11194 || JSTRING_P (TREE_TYPE (node
))))
11195 node
= java_refold (node
);
11196 CAN_COMPLETE_NORMALLY (node
) = 1;
11208 case TRUNC_MOD_EXPR
:
11210 case TRUTH_ANDIF_EXPR
:
11211 case TRUTH_ORIF_EXPR
:
11218 /* Operands 0 and 1 are WFL in certain cases only. patch_binop
11219 knows how to handle those cases. */
11220 wfl_op1
= TREE_OPERAND (node
, 0);
11221 wfl_op2
= TREE_OPERAND (node
, 1);
11223 CAN_COMPLETE_NORMALLY (node
) = 1;
11224 /* Don't complete string nodes if dealing with the PLUS operand. */
11225 if (TREE_CODE (node
) != PLUS_EXPR
|| !JSTRING_P (wfl_op1
))
11227 nn
= java_complete_tree (wfl_op1
);
11228 if (nn
== error_mark_node
)
11229 return error_mark_node
;
11230 if ((cn
= patch_string (nn
)))
11232 TREE_OPERAND (node
, 0) = nn
;
11234 if (TREE_CODE (node
) != PLUS_EXPR
|| !JSTRING_P (wfl_op2
))
11236 nn
= java_complete_tree (wfl_op2
);
11237 if (nn
== error_mark_node
)
11238 return error_mark_node
;
11239 if ((cn
= patch_string (nn
)))
11241 TREE_OPERAND (node
, 1) = nn
;
11243 return force_evaluation_order (patch_binop (node
, wfl_op1
, wfl_op2
));
11245 case INSTANCEOF_EXPR
:
11246 wfl_op1
= TREE_OPERAND (node
, 0);
11247 COMPLETE_CHECK_OP_0 (node
);
11248 if (flag_emit_xref
)
11250 TREE_TYPE (node
) = boolean_type_node
;
11253 return patch_binop (node
, wfl_op1
, TREE_OPERAND (node
, 1));
11255 case UNARY_PLUS_EXPR
:
11257 case TRUTH_NOT_EXPR
:
11259 case PREDECREMENT_EXPR
:
11260 case PREINCREMENT_EXPR
:
11261 case POSTDECREMENT_EXPR
:
11262 case POSTINCREMENT_EXPR
:
11264 /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
11265 how to handle those cases. */
11266 wfl_op1
= TREE_OPERAND (node
, 0);
11267 CAN_COMPLETE_NORMALLY (node
) = 1;
11268 TREE_OPERAND (node
, 0) = java_complete_tree (wfl_op1
);
11269 if (TREE_OPERAND (node
, 0) == error_mark_node
)
11270 return error_mark_node
;
11271 node
= patch_unaryop (node
, wfl_op1
);
11272 CAN_COMPLETE_NORMALLY (node
) = 1;
11276 /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
11277 how to handle those cases. */
11278 wfl_op1
= TREE_OPERAND (node
, 0);
11279 TREE_OPERAND (node
, 0) = java_complete_tree (wfl_op1
);
11280 if (TREE_OPERAND (node
, 0) == error_mark_node
)
11281 return error_mark_node
;
11282 if (!flag_emit_class_files
&& !flag_emit_xref
)
11283 TREE_OPERAND (node
, 0) = save_expr (TREE_OPERAND (node
, 0));
11284 /* The same applies to wfl_op2 */
11285 wfl_op2
= TREE_OPERAND (node
, 1);
11286 TREE_OPERAND (node
, 1) = java_complete_tree (wfl_op2
);
11287 if (TREE_OPERAND (node
, 1) == error_mark_node
)
11288 return error_mark_node
;
11289 if (!flag_emit_class_files
&& !flag_emit_xref
)
11290 TREE_OPERAND (node
, 1) = save_expr (TREE_OPERAND (node
, 1));
11291 return patch_array_ref (node
);
11296 case COMPONENT_REF
:
11297 /* The first step in the re-write of qualified name handling. FIXME.
11298 So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
11299 TREE_OPERAND (node
, 0) = java_complete_tree (TREE_OPERAND (node
, 0));
11300 if (TREE_CODE (TREE_OPERAND (node
, 0)) == RECORD_TYPE
)
11302 tree name
= TREE_OPERAND (node
, 1);
11303 tree field
= lookup_field_wrapper (TREE_OPERAND (node
, 0), name
);
11304 if (field
== NULL_TREE
)
11306 error ("missing static field `%s'", IDENTIFIER_POINTER (name
));
11307 return error_mark_node
;
11309 if (! FIELD_STATIC (field
))
11311 error ("not a static field `%s'", IDENTIFIER_POINTER (name
));
11312 return error_mark_node
;
11317 fatal ("unimplemented java_complete_tree for COMPONENT_REF");
11321 /* Can't use THIS in a static environment */
11324 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11325 parse_error_context (wfl_operator
, "Keyword `this' used outside "
11326 "allowed context");
11327 TREE_TYPE (node
) = error_mark_node
;
11328 return error_mark_node
;
11330 if (ctxp
->explicit_constructor_p
)
11332 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11333 parse_error_context
11334 (wfl_operator
, "Can't reference `this' or `super' before the "
11335 "superclass constructor has been called");
11336 TREE_TYPE (node
) = error_mark_node
;
11337 return error_mark_node
;
11339 return current_this
;
11342 CAN_COMPLETE_NORMALLY (node
) = 1;
11343 /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
11344 and it's time to turn it into the appropriate String object
11346 if ((node
= patch_string (node
)))
11348 fatal ("No case for tree code `%s' - java_complete_tree\n",
11349 tree_code_name
[TREE_CODE (node
)]);
11354 /* Complete function call's argument. Return a non zero value is an
11355 error was found. */
11358 complete_function_arguments (node
)
11364 ctxp
->explicit_constructor_p
+= (CALL_EXPLICIT_CONSTRUCTOR_P (node
) ? 1 : 0);
11365 for (cn
= TREE_OPERAND (node
, 1); cn
; cn
= TREE_CHAIN (cn
))
11367 tree wfl
= TREE_VALUE (cn
), parm
, temp
;
11368 parm
= java_complete_tree (wfl
);
11369 if (parm
== error_mark_node
)
11374 /* If have a string literal that we haven't transformed yet or a
11375 crafted string buffer, as a result of use of the the String
11376 `+' operator. Build `parm.toString()' and expand it. */
11377 if ((temp
= patch_string (parm
)))
11379 /* Inline PRIMTYPE.TYPE read access */
11380 parm
= maybe_build_primttype_type_ref (parm
, wfl
);
11382 TREE_VALUE (cn
) = parm
;
11384 ctxp
->explicit_constructor_p
-= (CALL_EXPLICIT_CONSTRUCTOR_P (node
) ? 1 : 0);
11388 /* Sometimes (for loops and variable initialized during their
11389 declaration), we want to wrap a statement around a WFL and turn it
11393 build_debugable_stmt (location
, stmt
)
11397 if (TREE_CODE (stmt
) != EXPR_WITH_FILE_LOCATION
)
11399 stmt
= build_expr_wfl (stmt
, input_filename
, 0, 0);
11400 EXPR_WFL_LINECOL (stmt
) = location
;
11402 JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt
);
11407 build_expr_block (body
, decls
)
11410 tree node
= make_node (BLOCK
);
11411 BLOCK_EXPR_DECLS (node
) = decls
;
11412 BLOCK_EXPR_BODY (node
) = body
;
11414 TREE_TYPE (node
) = TREE_TYPE (body
);
11415 TREE_SIDE_EFFECTS (node
) = 1;
11419 /* Create a new function block and link it approriately to current
11420 function block chain */
11425 return (enter_a_block (build_expr_block (NULL_TREE
, NULL_TREE
)));
11428 /* Link block B supercontext to the previous block. The current
11429 function DECL is used as supercontext when enter_a_block is called
11430 for the first time for a given function. The current function body
11431 (DECL_FUNCTION_BODY) is set to be block B. */
11437 tree fndecl
= current_function_decl
;
11440 BLOCK_SUPERCONTEXT (b
) = current_static_block
;
11441 current_static_block
= b
;
11444 else if (!DECL_FUNCTION_BODY (fndecl
))
11446 BLOCK_SUPERCONTEXT (b
) = fndecl
;
11447 DECL_FUNCTION_BODY (fndecl
) = b
;
11451 BLOCK_SUPERCONTEXT (b
) = DECL_FUNCTION_BODY (fndecl
);
11452 DECL_FUNCTION_BODY (fndecl
) = b
;
11457 /* Exit a block by changing the current function body
11458 (DECL_FUNCTION_BODY) to the current block super context, only if
11459 the block being exited isn't the method's top level one. */
11465 if (current_function_decl
)
11467 b
= DECL_FUNCTION_BODY (current_function_decl
);
11468 if (BLOCK_SUPERCONTEXT (b
) != current_function_decl
)
11469 DECL_FUNCTION_BODY (current_function_decl
) = BLOCK_SUPERCONTEXT (b
);
11473 b
= current_static_block
;
11475 if (BLOCK_SUPERCONTEXT (b
))
11476 current_static_block
= BLOCK_SUPERCONTEXT (b
);
11481 /* Lookup for NAME in the nested function's blocks, all the way up to
11482 the current toplevel one. It complies with Java's local variable
11486 lookup_name_in_blocks (name
)
11489 tree b
= GET_CURRENT_BLOCK (current_function_decl
);
11491 while (b
!= current_function_decl
)
11495 /* Paranoid sanity check. To be removed */
11496 if (TREE_CODE (b
) != BLOCK
)
11497 fatal ("non block expr function body - lookup_name_in_blocks");
11499 for (current
= BLOCK_EXPR_DECLS (b
); current
;
11500 current
= TREE_CHAIN (current
))
11501 if (DECL_NAME (current
) == name
)
11503 b
= BLOCK_SUPERCONTEXT (b
);
11509 maybe_absorb_scoping_blocks ()
11511 while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl
)))
11513 tree b
= exit_block ();
11514 java_method_add_stmt (current_function_decl
, b
);
11515 SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno
));
11520 /* This section of the source is reserved to build_* functions that
11521 are building incomplete tree nodes and the patch_* functions that
11522 are completing them. */
11524 /* Build a super() constructor invocation. Returns empty_stmt_node if
11525 we're currently dealing with the class java.lang.Object. */
11528 build_super_invocation ()
11530 if (current_class
== object_type_node
)
11531 return empty_stmt_node
;
11534 tree super_wfl
= build_wfl_node (super_identifier_node
);
11535 return build_method_invocation (super_wfl
, NULL_TREE
);
11539 /* Build a SUPER/THIS qualified method invocation. */
11542 build_this_super_qualified_invocation (use_this
, name
, args
, lloc
, rloc
)
11550 build_wfl_node (use_this
? this_identifier_node
: super_identifier_node
);
11551 EXPR_WFL_LINECOL (wfl
) = lloc
;
11552 invok
= build_method_invocation (name
, args
);
11553 return make_qualified_primary (wfl
, invok
, rloc
);
11556 /* Build an incomplete CALL_EXPR node. */
11559 build_method_invocation (name
, args
)
11563 tree call
= build (CALL_EXPR
, NULL_TREE
, name
, args
, NULL_TREE
);
11564 TREE_SIDE_EFFECTS (call
) = 1;
11565 EXPR_WFL_LINECOL (call
) = EXPR_WFL_LINECOL (name
);
11569 /* Build an incomplete new xxx(...) node. */
11572 build_new_invocation (name
, args
)
11575 tree call
= build (NEW_CLASS_EXPR
, NULL_TREE
, name
, args
, NULL_TREE
);
11576 TREE_SIDE_EFFECTS (call
) = 1;
11577 EXPR_WFL_LINECOL (call
) = EXPR_WFL_LINECOL (name
);
11581 /* Build an incomplete assignment expression. */
11584 build_assignment (op
, op_location
, lhs
, rhs
)
11585 int op
, op_location
;
11589 /* Build the corresponding binop if we deal with a Compound
11590 Assignment operator. Mark the binop sub-tree as part of a
11591 Compound Assignment expression */
11592 if (op
!= ASSIGN_TK
)
11594 rhs
= build_binop (BINOP_LOOKUP (op
), op_location
, lhs
, rhs
);
11595 COMPOUND_ASSIGN_P (rhs
) = 1;
11597 assignment
= build (MODIFY_EXPR
, NULL_TREE
, lhs
, rhs
);
11598 TREE_SIDE_EFFECTS (assignment
) = 1;
11599 EXPR_WFL_LINECOL (assignment
) = op_location
;
11603 /* Print an INTEGER_CST node in a static buffer, and return the buffer. */
11606 print_int_node (node
)
11609 static char buffer
[80];
11610 if (TREE_CONSTANT_OVERFLOW (node
))
11611 sprintf (buffer
, "<overflow>");
11613 if (TREE_INT_CST_HIGH (node
) == 0)
11614 sprintf (buffer
, HOST_WIDE_INT_PRINT_UNSIGNED
,
11615 TREE_INT_CST_LOW (node
));
11616 else if (TREE_INT_CST_HIGH (node
) == -1
11617 && TREE_INT_CST_LOW (node
) != 0)
11620 sprintf (&buffer
[1], HOST_WIDE_INT_PRINT_UNSIGNED
,
11621 -TREE_INT_CST_LOW (node
));
11624 sprintf (buffer
, HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
11625 TREE_INT_CST_HIGH (node
), TREE_INT_CST_LOW (node
));
11630 /* Return 1 if an assignment to a FINAL is attempted in a non suitable
11634 check_final_assignment (lvalue
, wfl
)
11637 if (JDECL_P (lvalue
)
11638 && FIELD_FINAL (lvalue
) && !IS_CLINIT (current_function_decl
))
11640 parse_error_context
11641 (wfl
, "Can't assign a value to the final variable `%s'",
11642 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
)));
11648 /* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
11649 read. This is needed to avoid circularities in the implementation
11650 of these fields in libjava. */
11653 maybe_build_primttype_type_ref (rhs
, wfl
)
11656 tree to_return
= NULL_TREE
;
11657 tree rhs_type
= TREE_TYPE (rhs
);
11658 if (TREE_CODE (rhs
) == COMPOUND_EXPR
)
11660 tree n
= TREE_OPERAND (rhs
, 1);
11661 if (TREE_CODE (n
) == VAR_DECL
11662 && DECL_NAME (n
) == TYPE_identifier_node
11663 && rhs_type
== class_ptr_type
)
11665 const char *self_name
= IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl
));
11666 if (!strncmp (self_name
, "java.lang.", 10))
11667 to_return
= build_primtype_type_ref (self_name
);
11670 return (to_return
? to_return
: rhs
);
11673 /* 15.25 Assignment operators. */
11676 patch_assignment (node
, wfl_op1
, wfl_op2
)
11681 tree rhs
= TREE_OPERAND (node
, 1);
11682 tree lvalue
= TREE_OPERAND (node
, 0), llvalue
;
11683 tree lhs_type
= NULL_TREE
, rhs_type
, new_rhs
= NULL_TREE
;
11684 int error_found
= 0;
11685 int lvalue_from_array
= 0;
11687 /* Can't assign to a final. */
11688 if (check_final_assignment (lvalue
, wfl_op1
))
11691 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
11693 /* Lhs can be a named variable */
11694 if (JDECL_P (lvalue
))
11696 lhs_type
= TREE_TYPE (lvalue
);
11698 /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
11699 comment on reason why */
11700 else if (TREE_CODE (wfl_op1
) == ARRAY_REF
)
11702 lhs_type
= TREE_TYPE (lvalue
);
11703 lvalue_from_array
= 1;
11705 /* Or a field access */
11706 else if (TREE_CODE (lvalue
) == COMPONENT_REF
)
11707 lhs_type
= TREE_TYPE (lvalue
);
11708 /* Or a function return slot */
11709 else if (TREE_CODE (lvalue
) == RESULT_DECL
)
11710 lhs_type
= TREE_TYPE (lvalue
);
11711 /* Otherwise, we might want to try to write into an optimized static
11712 final, this is an of a different nature, reported further on. */
11713 else if (TREE_CODE (wfl_op1
) == EXPR_WITH_FILE_LOCATION
11714 && resolve_expression_name (wfl_op1
, &llvalue
))
11716 if (check_final_assignment (llvalue
, wfl_op1
))
11718 /* What we should do instead is resetting the all the flags
11719 previously set, exchange lvalue for llvalue and continue. */
11721 return error_mark_node
;
11724 lhs_type
= TREE_TYPE (lvalue
);
11728 parse_error_context (wfl_op1
, "Invalid left hand side of assignment");
11732 rhs_type
= TREE_TYPE (rhs
);
11733 /* 5.1 Try the assignment conversion for builtin type. */
11734 new_rhs
= try_builtin_assignconv (wfl_op1
, lhs_type
, rhs
);
11736 /* 5.2 If it failed, try a reference conversion */
11737 if (!new_rhs
&& (new_rhs
= try_reference_assignconv (lhs_type
, rhs
)))
11738 lhs_type
= promote_type (rhs_type
);
11740 /* 15.25.2 If we have a compound assignment, convert RHS into the
11742 else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node
, 1)))
11743 new_rhs
= convert (lhs_type
, rhs
);
11745 /* Explicit cast required. This is an error */
11748 char *t1
= xstrdup (lang_printable_name (TREE_TYPE (rhs
), 0));
11749 char *t2
= xstrdup (lang_printable_name (lhs_type
, 0));
11751 char operation
[32]; /* Max size known */
11753 /* If the assignment is part of a declaration, we use the WFL of
11754 the declared variable to point out the error and call it a
11755 declaration problem. If the assignment is a genuine =
11756 operator, we call is a operator `=' problem, otherwise we
11757 call it an assignment problem. In both of these last cases,
11758 we use the WFL of the operator to indicate the error. */
11760 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node
))
11763 strcpy (operation
, "declaration");
11767 wfl
= wfl_operator
;
11768 if (COMPOUND_ASSIGN_P (TREE_OPERAND (node
, 1)))
11769 strcpy (operation
, "assignment");
11770 else if (TREE_CODE (TREE_OPERAND (node
, 0)) == RESULT_DECL
)
11771 strcpy (operation
, "`return'");
11773 strcpy (operation
, "`='");
11776 if (!valid_cast_to_p (rhs_type
, lhs_type
))
11777 parse_error_context (wfl
, "Incompatible type for %s. "
11778 "Can't convert `%s' to `%s'",
11779 operation
, t1
, t2
);
11781 parse_error_context (wfl
, "Incompatible type for %s. "
11782 "Explicit cast needed to convert `%s' to `%s'",
11783 operation
, t1
, t2
);
11784 free (t1
); free (t2
);
11788 /* Inline read access to java.lang.PRIMTYPE.TYPE */
11790 new_rhs
= maybe_build_primttype_type_ref (new_rhs
, wfl_op2
);
11793 return error_mark_node
;
11795 /* 10.10: Array Store Exception runtime check */
11796 if (!flag_emit_class_files
11798 && lvalue_from_array
11799 && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type
))
11800 && !CLASS_FINAL (TYPE_NAME (GET_SKIP_TYPE (rhs_type
))))
11803 tree base
= lvalue
;
11805 /* We need to retrieve the right argument for _Jv_CheckArrayStore */
11806 if (TREE_CODE (lvalue
) == COMPOUND_EXPR
)
11807 base
= TREE_OPERAND (lvalue
, 0);
11810 if (flag_bounds_check
)
11811 base
= TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (base
, 0), 1), 0);
11813 base
= TREE_OPERAND (TREE_OPERAND (base
, 0), 0);
11816 /* Build the invocation of _Jv_CheckArrayStore */
11817 new_rhs
= save_expr (new_rhs
);
11818 check
= build (CALL_EXPR
, void_type_node
,
11819 build_address_of (soft_checkarraystore_node
),
11820 tree_cons (NULL_TREE
, base
,
11821 build_tree_list (NULL_TREE
, new_rhs
)),
11823 TREE_SIDE_EFFECTS (check
) = 1;
11825 /* We have to decide on an insertion point */
11826 if (TREE_CODE (lvalue
) == COMPOUND_EXPR
)
11829 if (flag_bounds_check
)
11831 t
= TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue
, 1), 0), 0);
11832 TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue
, 1), 0), 0) =
11833 build (COMPOUND_EXPR
, void_type_node
, t
, check
);
11836 TREE_OPERAND (lvalue
, 1) = build (COMPOUND_EXPR
, lhs_type
,
11837 check
, TREE_OPERAND (lvalue
, 1));
11841 /* Make sure the bound check will happen before the store check */
11842 if (flag_bounds_check
)
11843 TREE_OPERAND (TREE_OPERAND (lvalue
, 0), 0) =
11844 build (COMPOUND_EXPR
, void_type_node
,
11845 TREE_OPERAND (TREE_OPERAND (lvalue
, 0), 0), check
);
11847 lvalue
= build (COMPOUND_EXPR
, lhs_type
, check
, lvalue
);
11851 TREE_OPERAND (node
, 0) = lvalue
;
11852 TREE_OPERAND (node
, 1) = new_rhs
;
11853 TREE_TYPE (node
) = lhs_type
;
11857 /* Check that type SOURCE can be cast into type DEST. If the cast
11858 can't occur at all, return 0 otherwise 1. This function is used to
11859 produce accurate error messages on the reasons why an assignment
11863 try_reference_assignconv (lhs_type
, rhs
)
11864 tree lhs_type
, rhs
;
11866 tree new_rhs
= NULL_TREE
;
11867 tree rhs_type
= TREE_TYPE (rhs
);
11869 if (!JPRIMITIVE_TYPE_P (rhs_type
) && JREFERENCE_TYPE_P (lhs_type
))
11871 /* `null' may be assigned to any reference type */
11872 if (rhs
== null_pointer_node
)
11873 new_rhs
= null_pointer_node
;
11874 /* Try the reference assignment conversion */
11875 else if (valid_ref_assignconv_cast_p (rhs_type
, lhs_type
, 0))
11877 /* This is a magic assignment that we process differently */
11878 else if (rhs
== soft_exceptioninfo_call_node
)
11884 /* Check that RHS can be converted into LHS_TYPE by the assignment
11885 conversion (5.2), for the cases of RHS being a builtin type. Return
11886 NULL_TREE if the conversion fails or if because RHS isn't of a
11887 builtin type. Return a converted RHS if the conversion is possible. */
11890 try_builtin_assignconv (wfl_op1
, lhs_type
, rhs
)
11891 tree wfl_op1
, lhs_type
, rhs
;
11893 tree new_rhs
= NULL_TREE
;
11894 tree rhs_type
= TREE_TYPE (rhs
);
11896 /* Zero accepted everywhere */
11897 if (TREE_CODE (rhs
) == INTEGER_CST
11898 && TREE_INT_CST_HIGH (rhs
) == 0 && TREE_INT_CST_LOW (rhs
) == 0
11899 && JPRIMITIVE_TYPE_P (rhs_type
))
11900 new_rhs
= convert (lhs_type
, rhs
);
11902 /* 5.1.1 Try Identity Conversion,
11903 5.1.2 Try Widening Primitive Conversion */
11904 else if (valid_builtin_assignconv_identity_widening_p (lhs_type
, rhs_type
))
11905 new_rhs
= convert (lhs_type
, rhs
);
11907 /* Try a narrowing primitive conversion (5.1.3):
11908 - expression is a constant expression of type int AND
11909 - variable is byte, short or char AND
11910 - The value of the expression is representable in the type of the
11912 else if (rhs_type
== int_type_node
&& TREE_CONSTANT (rhs
)
11913 && (lhs_type
== byte_type_node
|| lhs_type
== char_type_node
11914 || lhs_type
== short_type_node
))
11916 if (int_fits_type_p (rhs
, lhs_type
))
11917 new_rhs
= convert (lhs_type
, rhs
);
11918 else if (wfl_op1
) /* Might be called with a NULL */
11919 parse_warning_context
11920 (wfl_op1
, "Constant expression `%s' to wide for narrowing "
11921 "primitive conversion to `%s'",
11922 print_int_node (rhs
), lang_printable_name (lhs_type
, 0));
11923 /* Reported a warning that will turn into an error further
11924 down, so we don't return */
11930 /* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
11931 conversion (5.1.1) or widening primitve conversion (5.1.2). Return
11932 0 is the conversion test fails. This implements parts the method
11933 invocation convertion (5.3). */
11936 valid_builtin_assignconv_identity_widening_p (lhs_type
, rhs_type
)
11937 tree lhs_type
, rhs_type
;
11939 /* 5.1.1: This is the identity conversion part. */
11940 if (lhs_type
== rhs_type
)
11943 /* Reject non primitive types */
11944 if (!JPRIMITIVE_TYPE_P (lhs_type
) || !JPRIMITIVE_TYPE_P (rhs_type
))
11947 /* 5.1.2: widening primitive conversion. byte, even if it's smaller
11948 than a char can't be converted into a char. Short can't too, but
11949 the < test below takes care of that */
11950 if (lhs_type
== char_type_node
&& rhs_type
== byte_type_node
)
11953 /* Accept all promoted type here. Note, we can't use <= in the test
11954 below, because we still need to bounce out assignments of short
11955 to char and the likes */
11956 if (lhs_type
== int_type_node
11957 && (rhs_type
== promoted_byte_type_node
11958 || rhs_type
== promoted_short_type_node
11959 || rhs_type
== promoted_char_type_node
11960 || rhs_type
== promoted_boolean_type_node
))
11963 /* From here, an integral is widened if its precision is smaller
11964 than the precision of the LHS or if the LHS is a floating point
11965 type, or the RHS is a float and the RHS a double. */
11966 if ((JINTEGRAL_TYPE_P (rhs_type
) && JINTEGRAL_TYPE_P (lhs_type
)
11967 && (TYPE_PRECISION (rhs_type
) < TYPE_PRECISION (lhs_type
)))
11968 || (JINTEGRAL_TYPE_P (rhs_type
) && JFLOAT_TYPE_P (lhs_type
))
11969 || (rhs_type
== float_type_node
&& lhs_type
== double_type_node
))
11975 /* Check that something of SOURCE type can be assigned or cast to
11976 something of DEST type at runtime. Return 1 if the operation is
11977 valid, 0 otherwise. If CAST is set to 1, we're treating the case
11978 were SOURCE is cast into DEST, which borrows a lot of the
11979 assignment check. */
11982 valid_ref_assignconv_cast_p (source
, dest
, cast
)
11987 /* SOURCE or DEST might be null if not from a declared entity. */
11988 if (!source
|| !dest
)
11990 if (JNULLP_TYPE_P (source
))
11992 if (TREE_CODE (source
) == POINTER_TYPE
)
11993 source
= TREE_TYPE (source
);
11994 if (TREE_CODE (dest
) == POINTER_TYPE
)
11995 dest
= TREE_TYPE (dest
);
11996 /* Case where SOURCE is a class type */
11997 if (TYPE_CLASS_P (source
))
11999 if (TYPE_CLASS_P (dest
))
12000 return source
== dest
|| inherits_from_p (source
, dest
)
12001 || (cast
&& inherits_from_p (dest
, source
));
12002 if (TYPE_INTERFACE_P (dest
))
12004 /* If doing a cast and SOURCE is final, the operation is
12005 always correct a compile time (because even if SOURCE
12006 does not implement DEST, a subclass of SOURCE might). */
12007 if (cast
&& !CLASS_FINAL (TYPE_NAME (source
)))
12009 /* Otherwise, SOURCE must implement DEST */
12010 return interface_of_p (dest
, source
);
12012 /* DEST is an array, cast permited if SOURCE is of Object type */
12013 return (cast
&& source
== object_type_node
? 1 : 0);
12015 if (TYPE_INTERFACE_P (source
))
12017 if (TYPE_CLASS_P (dest
))
12019 /* If not casting, DEST must be the Object type */
12021 return dest
== object_type_node
;
12022 /* We're doing a cast. The cast is always valid is class
12023 DEST is not final, otherwise, DEST must implement SOURCE */
12024 else if (!CLASS_FINAL (TYPE_NAME (dest
)))
12027 return interface_of_p (source
, dest
);
12029 if (TYPE_INTERFACE_P (dest
))
12031 /* If doing a cast, then if SOURCE and DEST contain method
12032 with the same signature but different return type, then
12033 this is a (compile time) error */
12036 tree method_source
, method_dest
;
12040 for (method_source
= TYPE_METHODS (source
); method_source
;
12041 method_source
= TREE_CHAIN (method_source
))
12044 build_java_argument_signature (TREE_TYPE (method_source
));
12045 source_type
= TREE_TYPE (TREE_TYPE (method_source
));
12046 source_name
= DECL_NAME (method_source
);
12047 for (method_dest
= TYPE_METHODS (dest
);
12048 method_dest
; method_dest
= TREE_CHAIN (method_dest
))
12050 build_java_argument_signature (TREE_TYPE (method_dest
))
12051 && source_name
== DECL_NAME (method_dest
)
12052 && source_type
!= TREE_TYPE (TREE_TYPE (method_dest
)))
12058 return source
== dest
|| interface_of_p (dest
, source
);
12062 (DECL_NAME (TYPE_NAME (source
)) == java_lang_cloneable
) : 0);
12064 if (TYPE_ARRAY_P (source
))
12066 if (TYPE_CLASS_P (dest
))
12067 return dest
== object_type_node
;
12068 /* Can't cast an array to an interface unless the interface is
12069 java.lang.Cloneable */
12070 if (TYPE_INTERFACE_P (dest
))
12071 return (DECL_NAME (TYPE_NAME (dest
)) == java_lang_cloneable
? 1 : 0);
12074 tree source_element_type
= TYPE_ARRAY_ELEMENT (source
);
12075 tree dest_element_type
= TYPE_ARRAY_ELEMENT (dest
);
12077 /* In case of severe errors, they turn out null */
12078 if (!dest_element_type
|| !source_element_type
)
12080 if (source_element_type
== dest_element_type
)
12082 return valid_ref_assignconv_cast_p (source_element_type
,
12083 dest_element_type
, cast
);
12091 valid_cast_to_p (source
, dest
)
12095 if (TREE_CODE (source
) == POINTER_TYPE
)
12096 source
= TREE_TYPE (source
);
12097 if (TREE_CODE (dest
) == POINTER_TYPE
)
12098 dest
= TREE_TYPE (dest
);
12100 if (TREE_CODE (source
) == RECORD_TYPE
&& TREE_CODE (dest
) == RECORD_TYPE
)
12101 return valid_ref_assignconv_cast_p (source
, dest
, 1);
12103 else if (JNUMERIC_TYPE_P (source
) && JNUMERIC_TYPE_P (dest
))
12109 /* Method invocation conversion test. Return 1 if type SOURCE can be
12110 converted to type DEST through the methond invocation conversion
12114 do_unary_numeric_promotion (arg
)
12117 tree type
= TREE_TYPE (arg
);
12118 if (TREE_CODE (type
) == INTEGER_TYPE
? TYPE_PRECISION (type
) < 32
12119 : TREE_CODE (type
) == CHAR_TYPE
)
12120 arg
= convert (int_type_node
, arg
);
12124 /* Return a non zero value if SOURCE can be converted into DEST using
12125 the method invocation conversion rule (5.3). */
12127 valid_method_invocation_conversion_p (dest
, source
)
12130 return ((JPRIMITIVE_TYPE_P (source
) && JPRIMITIVE_TYPE_P (dest
)
12131 && valid_builtin_assignconv_identity_widening_p (dest
, source
))
12132 || ((JREFERENCE_TYPE_P (source
) || JNULLP_TYPE_P (source
))
12133 && (JREFERENCE_TYPE_P (dest
) || JNULLP_TYPE_P (dest
))
12134 && valid_ref_assignconv_cast_p (source
, dest
, 0)));
12137 /* Build an incomplete binop expression. */
12140 build_binop (op
, op_location
, op1
, op2
)
12145 tree binop
= build (op
, NULL_TREE
, op1
, op2
);
12146 TREE_SIDE_EFFECTS (binop
) = 1;
12147 /* Store the location of the operator, for better error report. The
12148 string of the operator will be rebuild based on the OP value. */
12149 EXPR_WFL_LINECOL (binop
) = op_location
;
12153 /* Build the string of the operator retained by NODE. If NODE is part
12154 of a compound expression, add an '=' at the end of the string. This
12155 function is called when an error needs to be reported on an
12156 operator. The string is returned as a pointer to a static character
12160 operator_string (node
)
12163 #define BUILD_OPERATOR_STRING(S) \
12165 sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
12169 static char buffer
[10];
12170 switch (TREE_CODE (node
))
12172 case MULT_EXPR
: BUILD_OPERATOR_STRING ("*");
12173 case RDIV_EXPR
: BUILD_OPERATOR_STRING ("/");
12174 case TRUNC_MOD_EXPR
: BUILD_OPERATOR_STRING ("%");
12175 case PLUS_EXPR
: BUILD_OPERATOR_STRING ("+");
12176 case MINUS_EXPR
: BUILD_OPERATOR_STRING ("-");
12177 case LSHIFT_EXPR
: BUILD_OPERATOR_STRING ("<<");
12178 case RSHIFT_EXPR
: BUILD_OPERATOR_STRING (">>");
12179 case URSHIFT_EXPR
: BUILD_OPERATOR_STRING (">>>");
12180 case BIT_AND_EXPR
: BUILD_OPERATOR_STRING ("&");
12181 case BIT_XOR_EXPR
: BUILD_OPERATOR_STRING ("^");
12182 case BIT_IOR_EXPR
: BUILD_OPERATOR_STRING ("|");
12183 case TRUTH_ANDIF_EXPR
: BUILD_OPERATOR_STRING ("&&");
12184 case TRUTH_ORIF_EXPR
: BUILD_OPERATOR_STRING ("||");
12185 case EQ_EXPR
: BUILD_OPERATOR_STRING ("==");
12186 case NE_EXPR
: BUILD_OPERATOR_STRING ("!=");
12187 case GT_EXPR
: BUILD_OPERATOR_STRING (">");
12188 case GE_EXPR
: BUILD_OPERATOR_STRING (">=");
12189 case LT_EXPR
: BUILD_OPERATOR_STRING ("<");
12190 case LE_EXPR
: BUILD_OPERATOR_STRING ("<=");
12191 case UNARY_PLUS_EXPR
: BUILD_OPERATOR_STRING ("+");
12192 case NEGATE_EXPR
: BUILD_OPERATOR_STRING ("-");
12193 case TRUTH_NOT_EXPR
: BUILD_OPERATOR_STRING ("!");
12194 case BIT_NOT_EXPR
: BUILD_OPERATOR_STRING ("~");
12195 case PREINCREMENT_EXPR
: /* Fall through */
12196 case POSTINCREMENT_EXPR
: BUILD_OPERATOR_STRING ("++");
12197 case PREDECREMENT_EXPR
: /* Fall through */
12198 case POSTDECREMENT_EXPR
: BUILD_OPERATOR_STRING ("--");
12200 fatal ("unregistered operator %s - operator_string",
12201 tree_code_name
[TREE_CODE (node
)]);
12204 #undef BUILD_OPERATOR_STRING
12207 /* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */
12210 java_decl_equiv (var_acc1
, var_acc2
)
12211 tree var_acc1
, var_acc2
;
12213 if (JDECL_P (var_acc1
))
12214 return (var_acc1
== var_acc2
);
12216 return (TREE_CODE (var_acc1
) == COMPONENT_REF
12217 && TREE_CODE (var_acc2
) == COMPONENT_REF
12218 && TREE_OPERAND (TREE_OPERAND (var_acc1
, 0), 0)
12219 == TREE_OPERAND (TREE_OPERAND (var_acc2
, 0), 0)
12220 && TREE_OPERAND (var_acc1
, 1) == TREE_OPERAND (var_acc2
, 1));
12223 /* Return a non zero value if CODE is one of the operators that can be
12224 used in conjunction with the `=' operator in a compound assignment. */
12227 binop_compound_p (code
)
12228 enum tree_code code
;
12231 for (i
= 0; i
< BINOP_COMPOUND_CANDIDATES
; i
++)
12232 if (binop_lookup
[i
] == code
)
12235 return i
< BINOP_COMPOUND_CANDIDATES
;
12238 /* Reorganize after a fold to get SAVE_EXPR to generate what we want. */
12244 tree c
, b
, ns
, decl
;
12246 if (TREE_CODE (t
) != MODIFY_EXPR
)
12249 c
= TREE_OPERAND (t
, 1);
12250 if (! (c
&& TREE_CODE (c
) == COMPOUND_EXPR
12251 && TREE_CODE (TREE_OPERAND (c
, 0)) == MODIFY_EXPR
12252 && binop_compound_p (TREE_CODE (TREE_OPERAND (c
, 1)))))
12255 /* Now the left branch of the binary operator. */
12256 b
= TREE_OPERAND (TREE_OPERAND (c
, 1), 0);
12257 if (! (b
&& TREE_CODE (b
) == NOP_EXPR
12258 && TREE_CODE (TREE_OPERAND (b
, 0)) == SAVE_EXPR
))
12261 ns
= TREE_OPERAND (TREE_OPERAND (b
, 0), 0);
12262 if (! (ns
&& TREE_CODE (ns
) == NOP_EXPR
12263 && TREE_CODE (TREE_OPERAND (ns
, 0)) == SAVE_EXPR
))
12266 decl
= TREE_OPERAND (TREE_OPERAND (ns
, 0), 0);
12267 if ((JDECL_P (decl
) || TREE_CODE (decl
) == COMPONENT_REF
)
12268 /* It's got to be the an equivalent decl */
12269 && java_decl_equiv (decl
, TREE_OPERAND (TREE_OPERAND (c
, 0), 0)))
12271 /* Shorten the NOP_EXPR/SAVE_EXPR path. */
12272 TREE_OPERAND (TREE_OPERAND (c
, 1), 0) = TREE_OPERAND (ns
, 0);
12273 /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
12274 TREE_OPERAND (t
, 1) = TREE_OPERAND (c
, 1);
12275 /* Change the right part of the BINOP_EXPR */
12276 TREE_OPERAND (TREE_OPERAND (t
, 1), 1) = TREE_OPERAND (c
, 0);
12282 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
12283 errors but we modify NODE so that it contains the type computed
12284 according to the expression, when it's fixed. Otherwise, we write
12285 error_mark_node as the type. It allows us to further the analysis
12286 of remaining nodes and detects more errors in certain cases. */
12289 patch_binop (node
, wfl_op1
, wfl_op2
)
12294 tree op1
= TREE_OPERAND (node
, 0);
12295 tree op2
= TREE_OPERAND (node
, 1);
12296 tree op1_type
= TREE_TYPE (op1
);
12297 tree op2_type
= TREE_TYPE (op2
);
12298 tree prom_type
= NULL_TREE
;
12299 int code
= TREE_CODE (node
);
12301 /* If 1, tell the routine that we have to return error_mark_node
12302 after checking for the initialization of the RHS */
12303 int error_found
= 0;
12305 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
12309 /* 15.16 Multiplicative operators */
12310 case MULT_EXPR
: /* 15.16.1 Multiplication Operator * */
12311 case RDIV_EXPR
: /* 15.16.2 Division Operator / */
12312 case TRUNC_MOD_EXPR
: /* 15.16.3 Remainder operator % */
12313 if (!JPRIMITIVE_TYPE_P (op1_type
) || !JPRIMITIVE_TYPE_P (op2_type
))
12315 if (!JPRIMITIVE_TYPE_P (op1_type
))
12316 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
12317 if (!JPRIMITIVE_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12318 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
12319 TREE_TYPE (node
) = error_mark_node
;
12323 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12324 /* Change the division operator if necessary */
12325 if (code
== RDIV_EXPR
&& TREE_CODE (prom_type
) == INTEGER_TYPE
)
12326 TREE_SET_CODE (node
, TRUNC_DIV_EXPR
);
12328 if (TREE_CODE (prom_type
) == INTEGER_TYPE
12329 && flag_use_divide_subroutine
12330 && ! flag_emit_class_files
12331 && (code
== RDIV_EXPR
|| code
== TRUNC_MOD_EXPR
))
12332 return build_java_soft_divmod (TREE_CODE (node
), prom_type
, op1
, op2
);
12334 /* This one is more complicated. FLOATs are processed by a
12335 function call to soft_fmod. Duplicate the value of the
12336 COMPOUND_ASSIGN_P flag. */
12337 if (code
== TRUNC_MOD_EXPR
)
12339 tree mod
= build_java_binop (TRUNC_MOD_EXPR
, prom_type
, op1
, op2
);
12340 COMPOUND_ASSIGN_P (mod
) = COMPOUND_ASSIGN_P (node
);
12341 TREE_SIDE_EFFECTS (mod
)
12342 = TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12347 /* 15.17 Additive Operators */
12348 case PLUS_EXPR
: /* 15.17.1 String Concatenation Operator + */
12350 /* Operation is valid if either one argument is a string
12351 constant, a String object or a StringBuffer crafted for the
12352 purpose of the a previous usage of the String concatenation
12355 if (TREE_CODE (op1
) == STRING_CST
12356 || TREE_CODE (op2
) == STRING_CST
12357 || JSTRING_TYPE_P (op1_type
)
12358 || JSTRING_TYPE_P (op2_type
)
12359 || IS_CRAFTED_STRING_BUFFER_P (op1
)
12360 || IS_CRAFTED_STRING_BUFFER_P (op2
))
12361 return build_string_concatenation (op1
, op2
);
12363 case MINUS_EXPR
: /* 15.17.2 Additive Operators (+ and -) for
12365 if (!JPRIMITIVE_TYPE_P (op1_type
) || !JPRIMITIVE_TYPE_P (op2_type
))
12367 if (!JPRIMITIVE_TYPE_P (op1_type
))
12368 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
12369 if (!JPRIMITIVE_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12370 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
12371 TREE_TYPE (node
) = error_mark_node
;
12375 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12378 /* 15.18 Shift Operators */
12382 if (!JINTEGRAL_TYPE_P (op1_type
) || !JINTEGRAL_TYPE_P (op2_type
))
12384 if (!JINTEGRAL_TYPE_P (op1_type
))
12385 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op1_type
);
12388 if (JPRIMITIVE_TYPE_P (op2_type
))
12389 parse_error_context (wfl_operator
,
12390 "Incompatible type for `%s'. "
12391 "Explicit cast needed to convert "
12392 "shift distance from `%s' to integral",
12393 operator_string (node
),
12394 lang_printable_name (op2_type
, 0));
12396 parse_error_context (wfl_operator
, "Incompatible type for `%s'."
12397 " Can't convert shift distance from "
12398 "`%s' to integral",
12399 operator_string (node
),
12400 lang_printable_name (op2_type
, 0));
12402 TREE_TYPE (node
) = error_mark_node
;
12407 /* Unary numeric promotion (5.6.1) is performed on each operand
12409 op1
= do_unary_numeric_promotion (op1
);
12410 op2
= do_unary_numeric_promotion (op2
);
12412 /* The type of the shift expression is the type of the promoted
12413 type of the left-hand operand */
12414 prom_type
= TREE_TYPE (op1
);
12416 /* Shift int only up to 0x1f and long up to 0x3f */
12417 if (prom_type
== int_type_node
)
12418 op2
= fold (build (BIT_AND_EXPR
, int_type_node
, op2
,
12419 build_int_2 (0x1f, 0)));
12421 op2
= fold (build (BIT_AND_EXPR
, int_type_node
, op2
,
12422 build_int_2 (0x3f, 0)));
12424 /* The >>> operator is a >> operating on unsigned quantities */
12425 if (code
== URSHIFT_EXPR
&& ! flag_emit_class_files
)
12428 tree utype
= unsigned_type (prom_type
);
12429 op1
= convert (utype
, op1
);
12430 TREE_SET_CODE (node
, RSHIFT_EXPR
);
12431 TREE_OPERAND (node
, 0) = op1
;
12432 TREE_OPERAND (node
, 1) = op2
;
12433 TREE_TYPE (node
) = utype
;
12434 to_return
= convert (prom_type
, node
);
12435 /* Copy the original value of the COMPOUND_ASSIGN_P flag */
12436 COMPOUND_ASSIGN_P (to_return
) = COMPOUND_ASSIGN_P (node
);
12437 TREE_SIDE_EFFECTS (to_return
)
12438 = TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12443 /* 15.19.1 Type Comparison Operator instaceof */
12444 case INSTANCEOF_EXPR
:
12446 TREE_TYPE (node
) = boolean_type_node
;
12448 if (!(op2_type
= resolve_type_during_patch (op2
)))
12449 return error_mark_node
;
12451 /* The first operand must be a reference type or the null type */
12452 if (!JREFERENCE_TYPE_P (op1_type
) && op1
!= null_pointer_node
)
12453 error_found
= 1; /* Error reported further below */
12455 /* The second operand must be a reference type */
12456 if (!JREFERENCE_TYPE_P (op2_type
))
12458 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op2
);
12459 parse_error_context
12460 (wfl_operator
, "Invalid argument `%s' for `instanceof'",
12461 lang_printable_name (op2_type
, 0));
12465 if (!error_found
&& valid_ref_assignconv_cast_p (op1_type
, op2_type
, 1))
12467 /* If the first operand is null, the result is always false */
12468 if (op1
== null_pointer_node
)
12469 return boolean_false_node
;
12470 else if (flag_emit_class_files
)
12472 TREE_OPERAND (node
, 1) = op2_type
;
12473 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (op1
);
12476 /* Otherwise we have to invoke instance of to figure it out */
12480 build (CALL_EXPR
, boolean_type_node
,
12481 build_address_of (soft_instanceof_node
),
12484 build_tree_list (NULL_TREE
,
12485 build_class_ref (op2_type
))),
12487 TREE_SIDE_EFFECTS (call
) = TREE_SIDE_EFFECTS (op1
);
12491 /* There is no way the expression operand can be an instance of
12492 the type operand. This is a compile time error. */
12495 char *t1
= xstrdup (lang_printable_name (op1_type
, 0));
12496 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
12497 parse_error_context
12498 (wfl_operator
, "Impossible for `%s' to be instance of `%s'",
12499 t1
, lang_printable_name (op2_type
, 0));
12506 /* 15.21 Bitwise and Logical Operators */
12510 if (JINTEGRAL_TYPE_P (op1_type
) && JINTEGRAL_TYPE_P (op2_type
))
12511 /* Binary numeric promotion is performed on both operand and the
12512 expression retain that type */
12513 prom_type
= binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12515 else if (TREE_CODE (op1_type
) == BOOLEAN_TYPE
12516 && TREE_CODE (op1_type
) == BOOLEAN_TYPE
)
12517 /* The type of the bitwise operator expression is BOOLEAN */
12518 prom_type
= boolean_type_node
;
12521 if (!JINTEGRAL_TYPE_P (op1_type
))
12522 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op1_type
);
12523 if (!JINTEGRAL_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12524 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op2_type
);
12525 TREE_TYPE (node
) = error_mark_node
;
12527 /* Insert a break here if adding thing before the switch's
12528 break for this case */
12532 /* 15.22 Conditional-And Operator */
12533 case TRUTH_ANDIF_EXPR
:
12534 /* 15.23 Conditional-Or Operator */
12535 case TRUTH_ORIF_EXPR
:
12536 /* Operands must be of BOOLEAN type */
12537 if (TREE_CODE (op1_type
) != BOOLEAN_TYPE
||
12538 TREE_CODE (op2_type
) != BOOLEAN_TYPE
)
12540 if (TREE_CODE (op1_type
) != BOOLEAN_TYPE
)
12541 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op1_type
);
12542 if (TREE_CODE (op2_type
) != BOOLEAN_TYPE
&& (op1_type
!= op2_type
))
12543 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op2_type
);
12544 TREE_TYPE (node
) = boolean_type_node
;
12548 /* The type of the conditional operators is BOOLEAN */
12549 prom_type
= boolean_type_node
;
12552 /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
12557 /* The type of each of the operands must be a primitive numeric
12559 if (!JNUMERIC_TYPE_P (op1_type
) || ! JNUMERIC_TYPE_P (op2_type
))
12561 if (!JNUMERIC_TYPE_P (op1_type
))
12562 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op1_type
);
12563 if (!JNUMERIC_TYPE_P (op2_type
) && (op1_type
!= op2_type
))
12564 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op2_type
);
12565 TREE_TYPE (node
) = boolean_type_node
;
12569 /* Binary numeric promotion is performed on the operands */
12570 binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12571 /* The type of the relation expression is always BOOLEAN */
12572 prom_type
= boolean_type_node
;
12575 /* 15.20 Equality Operator */
12578 /* 15.20.1 Numerical Equality Operators == and != */
12579 /* Binary numeric promotion is performed on the operands */
12580 if (JNUMERIC_TYPE_P (op1_type
) && JNUMERIC_TYPE_P (op2_type
))
12581 binary_numeric_promotion (op1_type
, op2_type
, &op1
, &op2
);
12583 /* 15.20.2 Boolean Equality Operators == and != */
12584 else if (TREE_CODE (op1_type
) == BOOLEAN_TYPE
&&
12585 TREE_CODE (op2_type
) == BOOLEAN_TYPE
)
12586 ; /* Nothing to do here */
12588 /* 15.20.3 Reference Equality Operators == and != */
12589 /* Types have to be either references or the null type. If
12590 they're references, it must be possible to convert either
12591 type to the other by casting conversion. */
12592 else if (op1
== null_pointer_node
|| op2
== null_pointer_node
12593 || (JREFERENCE_TYPE_P (op1_type
) && JREFERENCE_TYPE_P (op2_type
)
12594 && (valid_ref_assignconv_cast_p (op1_type
, op2_type
, 1)
12595 || valid_ref_assignconv_cast_p (op2_type
,
12597 ; /* Nothing to do here */
12599 /* Else we have an error figure what can't be converted into
12600 what and report the error */
12604 t1
= xstrdup (lang_printable_name (op1_type
, 0));
12605 parse_error_context
12606 (wfl_operator
, "Incompatible type for `%s'. Can't convert `%s' "
12607 "to `%s'", operator_string (node
), t1
,
12608 lang_printable_name (op2_type
, 0));
12610 TREE_TYPE (node
) = boolean_type_node
;
12614 prom_type
= boolean_type_node
;
12619 return error_mark_node
;
12621 TREE_OPERAND (node
, 0) = op1
;
12622 TREE_OPERAND (node
, 1) = op2
;
12623 TREE_TYPE (node
) = prom_type
;
12624 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12626 if (flag_emit_xref
)
12629 /* fold does not respect side-effect order as required for Java but not C.
12630 * Also, it sometimes create SAVE_EXPRs which are bad when emitting
12633 if (flag_emit_class_files
? (TREE_CONSTANT (op1
) && TREE_CONSTANT (op2
))
12634 : ! TREE_SIDE_EFFECTS (node
))
12635 node
= fold (node
);
12639 /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
12640 zero value, the value of CSTE comes after the valude of STRING */
12643 do_merge_string_cste (cste
, string
, string_len
, after
)
12645 const char *string
;
12646 int string_len
, after
;
12648 int len
= TREE_STRING_LENGTH (cste
) + string_len
;
12649 const char *old
= TREE_STRING_POINTER (cste
);
12650 TREE_STRING_LENGTH (cste
) = len
;
12651 TREE_STRING_POINTER (cste
) = obstack_alloc (expression_obstack
, len
+1);
12654 strcpy (TREE_STRING_POINTER (cste
), string
);
12655 strcat (TREE_STRING_POINTER (cste
), old
);
12659 strcpy (TREE_STRING_POINTER (cste
), old
);
12660 strcat (TREE_STRING_POINTER (cste
), string
);
12665 /* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
12666 new STRING_CST on success, NULL_TREE on failure */
12669 merge_string_cste (op1
, op2
, after
)
12673 /* Handle two string constants right away */
12674 if (TREE_CODE (op2
) == STRING_CST
)
12675 return do_merge_string_cste (op1
, TREE_STRING_POINTER (op2
),
12676 TREE_STRING_LENGTH (op2
), after
);
12678 /* Reasonable integer constant can be treated right away */
12679 if (TREE_CODE (op2
) == INTEGER_CST
&& !TREE_CONSTANT_OVERFLOW (op2
))
12681 static const char *boolean_true
= "true";
12682 static const char *boolean_false
= "false";
12683 static const char *null_pointer
= "null";
12685 const char *string
;
12687 if (op2
== boolean_true_node
)
12688 string
= boolean_true
;
12689 else if (op2
== boolean_false_node
)
12690 string
= boolean_false
;
12691 else if (op2
== null_pointer_node
)
12692 string
= null_pointer
;
12693 else if (TREE_TYPE (op2
) == char_type_node
)
12695 ch
[0] = (char )TREE_INT_CST_LOW (op2
);
12700 string
= print_int_node (op2
);
12702 return do_merge_string_cste (op1
, string
, strlen (string
), after
);
12707 /* Tries to statically concatenate OP1 and OP2 if possible. Either one
12708 has to be a STRING_CST and the other part must be a STRING_CST or a
12709 INTEGRAL constant. Return a new STRING_CST if the operation
12710 succeed, NULL_TREE otherwise.
12712 If the case we want to optimize for space, we might want to return
12713 NULL_TREE for each invocation of this routine. FIXME */
12716 string_constant_concatenation (op1
, op2
)
12719 if (TREE_CODE (op1
) == STRING_CST
|| (TREE_CODE (op2
) == STRING_CST
))
12724 string
= (TREE_CODE (op1
) == STRING_CST
? op1
: op2
);
12725 rest
= (string
== op1
? op2
: op1
);
12726 invert
= (string
== op1
? 0 : 1 );
12728 /* Walk REST, only if it looks reasonable */
12729 if (TREE_CODE (rest
) != STRING_CST
12730 && !IS_CRAFTED_STRING_BUFFER_P (rest
)
12731 && !JSTRING_TYPE_P (TREE_TYPE (rest
))
12732 && TREE_CODE (rest
) == EXPR_WITH_FILE_LOCATION
)
12734 rest
= java_complete_tree (rest
);
12735 if (rest
== error_mark_node
)
12736 return error_mark_node
;
12737 rest
= fold (rest
);
12739 return merge_string_cste (string
, rest
, invert
);
12744 /* Implement the `+' operator. Does static optimization if possible,
12745 otherwise create (if necessary) and append elements to a
12746 StringBuffer. The StringBuffer will be carried around until it is
12747 used for a function call or an assignment. Then toString() will be
12748 called on it to turn it into a String object. */
12751 build_string_concatenation (op1
, op2
)
12755 int side_effects
= TREE_SIDE_EFFECTS (op1
) | TREE_SIDE_EFFECTS (op2
);
12757 if (flag_emit_xref
)
12758 return build (PLUS_EXPR
, string_type_node
, op1
, op2
);
12760 /* Try to do some static optimization */
12761 if ((result
= string_constant_concatenation (op1
, op2
)))
12764 /* Discard empty strings on either side of the expression */
12765 if (TREE_CODE (op1
) == STRING_CST
&& TREE_STRING_LENGTH (op1
) == 0)
12770 else if (TREE_CODE (op2
) == STRING_CST
&& TREE_STRING_LENGTH (op2
) == 0)
12773 /* If operands are string constant, turn then into object references */
12774 if (TREE_CODE (op1
) == STRING_CST
)
12775 op1
= patch_string_cst (op1
);
12776 if (op2
&& TREE_CODE (op2
) == STRING_CST
)
12777 op2
= patch_string_cst (op2
);
12779 /* If either one of the constant is null and the other non null
12780 operand is a String object, return it. */
12781 if (JSTRING_TYPE_P (TREE_TYPE (op1
)) && !op2
)
12784 /* If OP1 isn't already a StringBuffer, create and
12785 initialize a new one */
12786 if (!IS_CRAFTED_STRING_BUFFER_P (op1
))
12788 /* Two solutions here:
12789 1) OP1 is a string reference, we call new StringBuffer(OP1)
12790 2) OP1 is something else, we call new StringBuffer().append(OP1). */
12791 if (JSTRING_TYPE_P (TREE_TYPE (op1
)))
12792 op1
= BUILD_STRING_BUFFER (op1
);
12795 tree aNew
= BUILD_STRING_BUFFER (NULL_TREE
);
12796 op1
= make_qualified_primary (aNew
, BUILD_APPEND (op1
), 0);
12802 /* OP1 is no longer the last node holding a crafted StringBuffer */
12803 IS_CRAFTED_STRING_BUFFER_P (op1
) = 0;
12804 /* Create a node for `{new...,xxx}.append (op2)' */
12806 op1
= make_qualified_primary (op1
, BUILD_APPEND (op2
), 0);
12809 /* Mark the last node holding a crafted StringBuffer */
12810 IS_CRAFTED_STRING_BUFFER_P (op1
) = 1;
12812 TREE_SIDE_EFFECTS (op1
) = side_effects
;
12816 /* Patch the string node NODE. NODE can be a STRING_CST of a crafted
12817 StringBuffer. If no string were found to be patched, return
12821 patch_string (node
)
12824 if (node
== error_mark_node
)
12825 return error_mark_node
;
12826 if (TREE_CODE (node
) == STRING_CST
)
12827 return patch_string_cst (node
);
12828 else if (IS_CRAFTED_STRING_BUFFER_P (node
))
12830 int saved
= ctxp
->explicit_constructor_p
;
12831 tree invoke
= build_method_invocation (wfl_to_string
, NULL_TREE
);
12833 /* Temporary disable forbid the use of `this'. */
12834 ctxp
->explicit_constructor_p
= 0;
12835 ret
= java_complete_tree (make_qualified_primary (node
, invoke
, 0));
12836 /* Restore it at its previous value */
12837 ctxp
->explicit_constructor_p
= saved
;
12843 /* Build the internal representation of a string constant. */
12846 patch_string_cst (node
)
12850 if (! flag_emit_class_files
)
12852 push_obstacks (&permanent_obstack
, &permanent_obstack
);
12853 node
= get_identifier (TREE_STRING_POINTER (node
));
12854 location
= alloc_name_constant (CONSTANT_String
, node
);
12855 node
= build_ref_from_constant_pool (location
);
12858 TREE_TYPE (node
) = string_ptr_type_node
;
12859 TREE_CONSTANT (node
) = 1;
12863 /* Build an incomplete unary operator expression. */
12866 build_unaryop (op_token
, op_location
, op1
)
12867 int op_token
, op_location
;
12874 case PLUS_TK
: op
= UNARY_PLUS_EXPR
; break;
12875 case MINUS_TK
: op
= NEGATE_EXPR
; break;
12876 case NEG_TK
: op
= TRUTH_NOT_EXPR
; break;
12877 case NOT_TK
: op
= BIT_NOT_EXPR
; break;
12878 default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
12882 unaryop
= build1 (op
, NULL_TREE
, op1
);
12883 TREE_SIDE_EFFECTS (unaryop
) = 1;
12884 /* Store the location of the operator, for better error report. The
12885 string of the operator will be rebuild based on the OP value. */
12886 EXPR_WFL_LINECOL (unaryop
) = op_location
;
12890 /* Special case for the ++/-- operators, since they require an extra
12891 argument to build, which is set to NULL and patched
12892 later. IS_POST_P is 1 if the operator, 0 otherwise. */
12895 build_incdec (op_token
, op_location
, op1
, is_post_p
)
12896 int op_token
, op_location
;
12900 static enum tree_code lookup
[2][2] =
12902 { PREDECREMENT_EXPR
, PREINCREMENT_EXPR
, },
12903 { POSTDECREMENT_EXPR
, POSTINCREMENT_EXPR
, },
12905 tree node
= build (lookup
[is_post_p
][(op_token
- DECR_TK
)],
12906 NULL_TREE
, op1
, NULL_TREE
);
12907 TREE_SIDE_EFFECTS (node
) = 1;
12908 /* Store the location of the operator, for better error report. The
12909 string of the operator will be rebuild based on the OP value. */
12910 EXPR_WFL_LINECOL (node
) = op_location
;
12914 /* Build an incomplete cast operator, based on the use of the
12915 CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
12916 set. java_complete_tree is trained to walk a CONVERT_EXPR even
12917 though its type is already set. */
12920 build_cast (location
, type
, exp
)
12924 tree node
= build1 (CONVERT_EXPR
, type
, exp
);
12925 EXPR_WFL_LINECOL (node
) = location
;
12929 /* 15.14 Unary operators. We return error_mark_node in case of error,
12930 but preserve the type of NODE if the type is fixed. */
12933 patch_unaryop (node
, wfl_op
)
12937 tree op
= TREE_OPERAND (node
, 0);
12938 tree op_type
= TREE_TYPE (op
);
12939 tree prom_type
= NULL_TREE
, value
, decl
;
12940 int code
= TREE_CODE (node
);
12941 int error_found
= 0;
12943 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
12947 /* 15.13.2 Postfix Increment Operator ++ */
12948 case POSTINCREMENT_EXPR
:
12949 /* 15.13.3 Postfix Increment Operator -- */
12950 case POSTDECREMENT_EXPR
:
12951 /* 15.14.1 Prefix Increment Operator ++ */
12952 case PREINCREMENT_EXPR
:
12953 /* 15.14.2 Prefix Decrement Operator -- */
12954 case PREDECREMENT_EXPR
:
12955 op
= decl
= strip_out_static_field_access_decl (op
);
12956 /* We really should have a JAVA_ARRAY_EXPR to avoid this */
12957 if (!JDECL_P (decl
)
12958 && TREE_CODE (decl
) != COMPONENT_REF
12959 && !(flag_emit_class_files
&& TREE_CODE (decl
) == ARRAY_REF
)
12960 && TREE_CODE (decl
) != INDIRECT_REF
12961 && !(TREE_CODE (decl
) == COMPOUND_EXPR
12962 && TREE_OPERAND (decl
, 1)
12963 && (TREE_CODE (TREE_OPERAND (decl
, 1)) == INDIRECT_REF
)))
12966 /* Before screaming, check that we're not in fact trying to
12967 increment a optimized static final access, in which case
12968 we issue an different error message. */
12969 if (!(TREE_CODE (wfl_op
) == EXPR_WITH_FILE_LOCATION
12970 && resolve_expression_name (wfl_op
, &lvalue
)
12971 && check_final_assignment (lvalue
, wfl_op
)))
12972 parse_error_context (wfl_operator
, "Invalid argument to `%s'",
12973 operator_string (node
));
12974 TREE_TYPE (node
) = error_mark_node
;
12977 else if (check_final_assignment (op
, wfl_op
))
12980 /* From now on, we know that op if a variable and that it has a
12981 valid wfl. We use wfl_op to locate errors related to the
12983 else if (!JNUMERIC_TYPE_P (op_type
))
12985 parse_error_context
12986 (wfl_op
, "Invalid argument type `%s' to `%s'",
12987 lang_printable_name (op_type
, 0), operator_string (node
));
12988 TREE_TYPE (node
) = error_mark_node
;
12993 /* Before the addition, binary numeric promotion is performed on
12994 both operands, if really necessary */
12995 if (JINTEGRAL_TYPE_P (op_type
))
12997 value
= build_int_2 (1, 0);
12998 TREE_TYPE (value
) = TREE_TYPE (node
) = op_type
;
13002 value
= build_int_2 (1, 0);
13004 binary_numeric_promotion (op_type
,
13005 TREE_TYPE (value
), &op
, &value
);
13007 /* And write back into the node. */
13008 TREE_OPERAND (node
, 0) = op
;
13009 TREE_OPERAND (node
, 1) = value
;
13010 /* Convert the overall back into its original type, if
13011 necessary, and return */
13012 if (JINTEGRAL_TYPE_P (op_type
))
13013 return fold (node
);
13015 return fold (convert (op_type
, node
));
13019 /* 15.14.3 Unary Plus Operator + */
13020 case UNARY_PLUS_EXPR
:
13021 /* 15.14.4 Unary Minus Operator - */
13023 if (!JNUMERIC_TYPE_P (op_type
))
13025 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator
, node
, op_type
);
13026 TREE_TYPE (node
) = error_mark_node
;
13029 /* Unary numeric promotion is performed on operand */
13032 op
= do_unary_numeric_promotion (op
);
13033 prom_type
= TREE_TYPE (op
);
13034 if (code
== UNARY_PLUS_EXPR
)
13039 /* 15.14.5 Bitwise Complement Operator ~ */
13041 if (!JINTEGRAL_TYPE_P (op_type
))
13043 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator
, node
, op_type
);
13044 TREE_TYPE (node
) = error_mark_node
;
13049 op
= do_unary_numeric_promotion (op
);
13050 prom_type
= TREE_TYPE (op
);
13054 /* 15.14.6 Logical Complement Operator ! */
13055 case TRUTH_NOT_EXPR
:
13056 if (TREE_CODE (op_type
) != BOOLEAN_TYPE
)
13058 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator
, node
, op_type
);
13059 /* But the type is known. We will report an error if further
13060 attempt of a assignment is made with this rhs */
13061 TREE_TYPE (node
) = boolean_type_node
;
13065 prom_type
= boolean_type_node
;
13068 /* 15.15 Cast Expression */
13070 value
= patch_cast (node
, wfl_operator
);
13071 if (value
== error_mark_node
)
13073 /* If this cast is part of an assignment, we tell the code
13074 that deals with it not to complain about a mismatch,
13075 because things have been cast, anyways */
13076 TREE_TYPE (node
) = error_mark_node
;
13081 value
= fold (value
);
13082 TREE_SIDE_EFFECTS (value
) = TREE_SIDE_EFFECTS (op
);
13089 return error_mark_node
;
13091 /* There are cases where node has been replaced by something else
13092 and we don't end up returning here: UNARY_PLUS_EXPR,
13093 CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
13094 TREE_OPERAND (node
, 0) = fold (op
);
13095 TREE_TYPE (node
) = prom_type
;
13096 TREE_SIDE_EFFECTS (node
) = TREE_SIDE_EFFECTS (op
);
13097 return fold (node
);
13100 /* Generic type resolution that sometimes takes place during node
13101 patching. Returned the resolved type or generate an error
13102 message. Return the resolved type or NULL_TREE. */
13105 resolve_type_during_patch (type
)
13108 if (unresolved_type_p (type
, NULL
))
13110 tree type_decl
= resolve_no_layout (EXPR_WFL_NODE (type
), NULL_TREE
);
13113 parse_error_context (type
,
13114 "Class `%s' not found in type declaration",
13115 IDENTIFIER_POINTER (EXPR_WFL_NODE (type
)));
13120 CLASS_LOADED_P (TREE_TYPE (type_decl
)) = 1;
13121 return TREE_TYPE (type_decl
);
13126 /* 5.5 Casting Conversion. error_mark_node is returned if an error is
13127 found. Otherwise NODE or something meant to replace it is returned. */
13130 patch_cast (node
, wfl_operator
)
13134 tree op
= TREE_OPERAND (node
, 0);
13135 tree op_type
= TREE_TYPE (op
);
13136 tree cast_type
= TREE_TYPE (node
);
13139 /* First resolve OP_TYPE if unresolved */
13140 if (!(cast_type
= resolve_type_during_patch (cast_type
)))
13141 return error_mark_node
;
13143 /* Check on cast that are proven correct at compile time */
13144 if (JNUMERIC_TYPE_P (cast_type
) && JNUMERIC_TYPE_P (op_type
))
13147 if (cast_type
== op_type
)
13150 /* float and double type are converted to the original type main
13151 variant and then to the target type. */
13152 if (JFLOAT_TYPE_P (op_type
) && TREE_CODE (cast_type
) == CHAR_TYPE
)
13153 op
= convert (integer_type_node
, op
);
13155 /* Try widening/narowwing convertion. Potentially, things need
13156 to be worked out in gcc so we implement the extreme cases
13157 correctly. fold_convert() needs to be fixed. */
13158 return convert (cast_type
, op
);
13161 /* It's also valid to cast a boolean into a boolean */
13162 if (op_type
== boolean_type_node
&& cast_type
== boolean_type_node
)
13165 /* null can be casted to references */
13166 if (op
== null_pointer_node
&& JREFERENCE_TYPE_P (cast_type
))
13167 return build_null_of_type (cast_type
);
13169 /* The remaining legal casts involve conversion between reference
13170 types. Check for their compile time correctness. */
13171 if (JREFERENCE_TYPE_P (op_type
) && JREFERENCE_TYPE_P (cast_type
)
13172 && valid_ref_assignconv_cast_p (op_type
, cast_type
, 1))
13174 TREE_TYPE (node
) = promote_type (cast_type
);
13175 /* Now, the case can be determined correct at compile time if
13176 OP_TYPE can be converted into CAST_TYPE by assignment
13177 conversion (5.2) */
13179 if (valid_ref_assignconv_cast_p (op_type
, cast_type
, 0))
13181 TREE_SET_CODE (node
, NOP_EXPR
);
13185 if (flag_emit_class_files
)
13187 TREE_SET_CODE (node
, CONVERT_EXPR
);
13191 /* The cast requires a run-time check */
13192 return build (CALL_EXPR
, promote_type (cast_type
),
13193 build_address_of (soft_checkcast_node
),
13194 tree_cons (NULL_TREE
, build_class_ref (cast_type
),
13195 build_tree_list (NULL_TREE
, op
)),
13199 /* Any other casts are proven incorrect at compile time */
13200 t1
= xstrdup (lang_printable_name (op_type
, 0));
13201 parse_error_context (wfl_operator
, "Invalid cast from `%s' to `%s'",
13202 t1
, lang_printable_name (cast_type
, 0));
13204 return error_mark_node
;
13207 /* Build a null constant and give it the type TYPE. */
13210 build_null_of_type (type
)
13213 tree node
= build_int_2 (0, 0);
13214 TREE_TYPE (node
) = promote_type (type
);
13218 /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
13219 a list of indices. */
13221 build_array_ref (location
, array
, index
)
13225 tree node
= build (ARRAY_REF
, NULL_TREE
, array
, index
);
13226 EXPR_WFL_LINECOL (node
) = location
;
13230 /* 15.12 Array Access Expression */
13233 patch_array_ref (node
)
13236 tree array
= TREE_OPERAND (node
, 0);
13237 tree array_type
= TREE_TYPE (array
);
13238 tree index
= TREE_OPERAND (node
, 1);
13239 tree index_type
= TREE_TYPE (index
);
13240 int error_found
= 0;
13242 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13244 if (TREE_CODE (array_type
) == POINTER_TYPE
)
13245 array_type
= TREE_TYPE (array_type
);
13247 /* The array reference must be an array */
13248 if (!TYPE_ARRAY_P (array_type
))
13250 parse_error_context
13251 (wfl_operator
, "`[]' can only be applied to arrays. It can't be "
13252 "applied to `%s'", lang_printable_name (array_type
, 0));
13253 TREE_TYPE (node
) = error_mark_node
;
13257 /* The array index underdoes unary numeric promotion. The promoted
13258 type must be int */
13259 index
= do_unary_numeric_promotion (index
);
13260 if (TREE_TYPE (index
) != int_type_node
)
13262 if (valid_cast_to_p (index_type
, int_type_node
))
13263 parse_error_context (wfl_operator
, "Incompatible type for `[]'. "
13264 "Explicit cast needed to convert `%s' to `int'",
13265 lang_printable_name (index_type
, 0));
13267 parse_error_context (wfl_operator
, "Incompatible type for `[]'. "
13268 "Can't convert `%s' to `int'",
13269 lang_printable_name (index_type
, 0));
13270 TREE_TYPE (node
) = error_mark_node
;
13275 return error_mark_node
;
13277 array_type
= TYPE_ARRAY_ELEMENT (array_type
);
13279 if (flag_emit_class_files
|| flag_emit_xref
)
13281 TREE_OPERAND (node
, 0) = array
;
13282 TREE_OPERAND (node
, 1) = index
;
13286 /* The save_expr is for correct evaluation order. It would be cleaner
13287 to use force_evaluation_order (see comment there), but that is
13288 difficult when we also have to deal with bounds checking. */
13289 if (TREE_SIDE_EFFECTS (index
))
13290 array
= save_expr (array
);
13291 node
= build_java_arrayaccess (array
, array_type
, index
);
13292 if (TREE_SIDE_EFFECTS (index
))
13293 node
= build (COMPOUND_EXPR
, array_type
, array
, node
);
13295 TREE_TYPE (node
) = array_type
;
13299 /* 15.9 Array Creation Expressions */
13302 build_newarray_node (type
, dims
, extra_dims
)
13308 build (NEW_ARRAY_EXPR
, NULL_TREE
, type
, nreverse (dims
),
13309 build_int_2 (extra_dims
, 0));
13314 patch_newarray (node
)
13317 tree type
= TREE_OPERAND (node
, 0);
13318 tree dims
= TREE_OPERAND (node
, 1);
13319 tree cdim
, array_type
;
13320 int error_found
= 0;
13322 int xdims
= TREE_INT_CST_LOW (TREE_OPERAND (node
, 2));
13324 /* Dimension types are verified. It's better for the types to be
13325 verified in order. */
13326 for (cdim
= dims
, ndims
= 0; cdim
; cdim
= TREE_CHAIN (cdim
), ndims
++ )
13329 tree dim
= TREE_VALUE (cdim
);
13331 /* Dim might have been saved during its evaluation */
13332 dim
= (TREE_CODE (dim
) == SAVE_EXPR
? dim
= TREE_OPERAND (dim
, 0) : dim
);
13334 /* The type of each specified dimension must be an integral type. */
13335 if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim
)))
13338 /* Each expression undergoes an unary numeric promotion (5.6.1) and the
13339 promoted type must be int. */
13342 dim
= do_unary_numeric_promotion (dim
);
13343 if (TREE_TYPE (dim
) != int_type_node
)
13347 /* Report errors on types here */
13350 parse_error_context
13351 (TREE_PURPOSE (cdim
),
13352 "Incompatible type for dimension in array creation expression. "
13353 "%s convert `%s' to `int'",
13354 (valid_cast_to_p (TREE_TYPE (dim
), int_type_node
) ?
13355 "Explicit cast needed to" : "Can't"),
13356 lang_printable_name (TREE_TYPE (dim
), 0));
13360 TREE_PURPOSE (cdim
) = NULL_TREE
;
13363 /* Resolve array base type if unresolved */
13364 if (!(type
= resolve_type_during_patch (type
)))
13369 /* We don't want further evaluation of this bogus array creation
13371 TREE_TYPE (node
) = error_mark_node
;
13372 return error_mark_node
;
13375 /* Set array_type to the actual (promoted) array type of the result. */
13376 if (TREE_CODE (type
) == RECORD_TYPE
)
13377 type
= build_pointer_type (type
);
13378 while (--xdims
>= 0)
13380 type
= promote_type (build_java_array_type (type
, -1));
13382 dims
= nreverse (dims
);
13384 for (cdim
= dims
; cdim
; cdim
= TREE_CHAIN (cdim
))
13387 array_type
= build_java_array_type (type
,
13388 TREE_CODE (cdim
) == INTEGER_CST
?
13389 TREE_INT_CST_LOW (cdim
) : -1);
13390 array_type
= promote_type (array_type
);
13392 dims
= nreverse (dims
);
13394 /* The node is transformed into a function call. Things are done
13395 differently according to the number of dimensions. If the number
13396 of dimension is equal to 1, then the nature of the base type
13397 (primitive or not) matters. */
13399 return build_new_array (type
, TREE_VALUE (dims
));
13401 /* Can't reuse what's already written in expr.c because it uses the
13402 JVM stack representation. Provide a build_multianewarray. FIXME */
13403 return build (CALL_EXPR
, array_type
,
13404 build_address_of (soft_multianewarray_node
),
13405 tree_cons (NULL_TREE
, build_class_ref (TREE_TYPE (array_type
)),
13406 tree_cons (NULL_TREE
,
13407 build_int_2 (ndims
, 0), dims
)),
13411 /* 10.6 Array initializer. */
13413 /* Build a wfl for array element that don't have one, so we can
13414 pin-point errors. */
13417 maybe_build_array_element_wfl (node
)
13420 if (TREE_CODE (node
) != EXPR_WITH_FILE_LOCATION
)
13421 return build_expr_wfl (NULL_TREE
, ctxp
->filename
,
13422 ctxp
->elc
.line
, ctxp
->elc
.prev_col
);
13427 /* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
13428 identification of initialized arrays easier to detect during walk
13432 build_new_array_init (location
, values
)
13436 tree constructor
= build (CONSTRUCTOR
, NULL_TREE
, NULL_TREE
, values
);
13437 tree to_return
= build1 (NEW_ARRAY_INIT
, NULL_TREE
, constructor
);
13438 EXPR_WFL_LINECOL (to_return
) = location
;
13442 /* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
13443 occurred. Otherwise return NODE after having set its type
13447 patch_new_array_init (type
, node
)
13450 int error_seen
= 0;
13451 tree current
, element_type
;
13452 HOST_WIDE_INT length
;
13453 int all_constant
= 1;
13454 tree init
= TREE_OPERAND (node
, 0);
13456 if (TREE_CODE (type
) != POINTER_TYPE
|| ! TYPE_ARRAY_P (TREE_TYPE (type
)))
13458 parse_error_context (node
,
13459 "Invalid array initializer for non-array type `%s'",
13460 lang_printable_name (type
, 1));
13461 return error_mark_node
;
13463 type
= TREE_TYPE (type
);
13464 element_type
= TYPE_ARRAY_ELEMENT (type
);
13466 CONSTRUCTOR_ELTS (init
) = nreverse (CONSTRUCTOR_ELTS (init
));
13468 for (length
= 0, current
= CONSTRUCTOR_ELTS (init
);
13469 current
; length
++, current
= TREE_CHAIN (current
))
13471 tree elt
= TREE_VALUE (current
);
13472 if (elt
== NULL_TREE
|| TREE_CODE (elt
) != NEW_ARRAY_INIT
)
13474 error_seen
|= array_constructor_check_entry (element_type
, current
);
13475 elt
= TREE_VALUE (current
);
13476 /* When compiling to native code, STRING_CST is converted to
13477 INDIRECT_REF, but still with a TREE_CONSTANT flag. */
13478 if (! TREE_CONSTANT (elt
) || TREE_CODE (elt
) == INDIRECT_REF
)
13483 TREE_VALUE (current
) = patch_new_array_init (element_type
, elt
);
13484 TREE_PURPOSE (current
) = NULL_TREE
;
13487 if (elt
&& TREE_VALUE (elt
) == error_mark_node
)
13492 return error_mark_node
;
13494 /* Create a new type. We can't reuse the one we have here by
13495 patching its dimension because it originally is of dimension -1
13496 hence reused by gcc. This would prevent triangular arrays. */
13497 type
= build_java_array_type (element_type
, length
);
13498 TREE_TYPE (init
) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type
))));
13499 TREE_TYPE (node
) = promote_type (type
);
13500 TREE_CONSTANT (init
) = all_constant
;
13501 TREE_CONSTANT (node
) = all_constant
;
13505 /* Verify that one entry of the initializer element list can be
13506 assigned to the array base type. Report 1 if an error occurred, 0
13510 array_constructor_check_entry (type
, entry
)
13513 char *array_type_string
= NULL
; /* For error reports */
13514 tree value
, type_value
, new_value
, wfl_value
, patched
;
13515 int error_seen
= 0;
13517 new_value
= NULL_TREE
;
13518 wfl_value
= TREE_VALUE (entry
);
13520 push_obstacks (&permanent_obstack
, &permanent_obstack
);
13521 value
= java_complete_tree (TREE_VALUE (entry
));
13522 /* patch_string return error_mark_node if arg is error_mark_node */
13523 if ((patched
= patch_string (value
)))
13525 if (value
== error_mark_node
)
13528 type_value
= TREE_TYPE (value
);
13530 /* At anytime, try_builtin_assignconv can report a warning on
13531 constant overflow during narrowing. */
13532 SET_WFL_OPERATOR (wfl_operator
, TREE_PURPOSE (entry
), wfl_value
);
13533 new_value
= try_builtin_assignconv (wfl_operator
, type
, value
);
13534 if (!new_value
&& (new_value
= try_reference_assignconv (type
, value
)))
13535 type_value
= promote_type (type
);
13538 /* Check and report errors */
13541 const char *msg
= (!valid_cast_to_p (type_value
, type
) ?
13542 "Can't" : "Explicit cast needed to");
13543 if (!array_type_string
)
13544 array_type_string
= xstrdup (lang_printable_name (type
, 1));
13545 parse_error_context
13546 (wfl_operator
, "Incompatible type for array. %s convert `%s' to `%s'",
13547 msg
, lang_printable_name (type_value
, 1), array_type_string
);
13553 new_value
= maybe_build_primttype_type_ref (new_value
, wfl_operator
);
13554 TREE_VALUE (entry
) = new_value
;
13557 if (array_type_string
)
13558 free (array_type_string
);
13560 TREE_PURPOSE (entry
) = NULL_TREE
;
13565 build_this (location
)
13568 tree node
= build_wfl_node (this_identifier_node
);
13569 TREE_SET_CODE (node
, THIS_EXPR
);
13570 EXPR_WFL_LINECOL (node
) = location
;
13574 /* 14.15 The return statement. It builds a modify expression that
13575 assigns the returned value to the RESULT_DECL that hold the value
13579 build_return (location
, op
)
13583 tree node
= build1 (RETURN_EXPR
, NULL_TREE
, op
);
13584 EXPR_WFL_LINECOL (node
) = location
;
13585 node
= build_debugable_stmt (location
, node
);
13590 patch_return (node
)
13593 tree return_exp
= TREE_OPERAND (node
, 0);
13594 tree meth
= current_function_decl
;
13595 tree mtype
= TREE_TYPE (TREE_TYPE (current_function_decl
));
13596 int error_found
= 0;
13598 TREE_TYPE (node
) = error_mark_node
;
13599 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13601 /* It's invalid to have a return value within a function that is
13602 declared with the keyword void or that is a constructor */
13603 if (return_exp
&& (mtype
== void_type_node
|| DECL_CONSTRUCTOR_P (meth
)))
13606 /* It's invalid to use a return statement in a static block */
13607 if (IS_CLINIT (current_function_decl
))
13610 /* It's invalid to have a no return value within a function that
13611 isn't declared with the keyword `void' */
13612 if (!return_exp
&& (mtype
!= void_type_node
&& !DECL_CONSTRUCTOR_P (meth
)))
13617 if (IS_CLINIT (current_function_decl
))
13618 parse_error_context (wfl_operator
,
13619 "`return' inside static initializer.");
13621 else if (!DECL_CONSTRUCTOR_P (meth
))
13623 char *t
= xstrdup (lang_printable_name (mtype
, 0));
13624 parse_error_context (wfl_operator
,
13625 "`return' with%s value from `%s %s'",
13626 (error_found
== 1 ? "" : "out"),
13627 t
, lang_printable_name (meth
, 0));
13631 parse_error_context (wfl_operator
,
13632 "`return' with value from constructor `%s'",
13633 lang_printable_name (meth
, 0));
13634 return error_mark_node
;
13637 /* If we have a return_exp, build a modify expression and expand
13638 it. Note: at that point, the assignment is declared valid, but we
13639 may want to carry some more hacks */
13642 tree exp
= java_complete_tree (return_exp
);
13643 tree modify
, patched
;
13645 /* If the function returned value and EXP are booleans, EXP has
13646 to be converted into the type of DECL_RESULT, which is integer
13647 (see complete_start_java_method) */
13648 if (TREE_TYPE (exp
) == boolean_type_node
&&
13649 TREE_TYPE (TREE_TYPE (meth
)) == boolean_type_node
)
13650 exp
= convert_to_integer (TREE_TYPE (DECL_RESULT (meth
)), exp
);
13652 /* `null' can be assigned to a function returning a reference */
13653 if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth
))) &&
13654 exp
== null_pointer_node
)
13655 exp
= build_null_of_type (TREE_TYPE (TREE_TYPE (meth
)));
13657 if ((patched
= patch_string (exp
)))
13660 modify
= build (MODIFY_EXPR
, NULL_TREE
, DECL_RESULT (meth
), exp
);
13661 EXPR_WFL_LINECOL (modify
) = EXPR_WFL_LINECOL (node
);
13662 modify
= java_complete_tree (modify
);
13664 if (modify
!= error_mark_node
)
13666 TREE_SIDE_EFFECTS (modify
) = 1;
13667 TREE_OPERAND (node
, 0) = modify
;
13670 return error_mark_node
;
13672 TREE_TYPE (node
) = void_type_node
;
13673 TREE_SIDE_EFFECTS (node
) = 1;
13677 /* 14.8 The if Statement */
13680 build_if_else_statement (location
, expression
, if_body
, else_body
)
13682 tree expression
, if_body
, else_body
;
13686 else_body
= empty_stmt_node
;
13687 node
= build (COND_EXPR
, NULL_TREE
, expression
, if_body
, else_body
);
13688 EXPR_WFL_LINECOL (node
) = location
;
13689 node
= build_debugable_stmt (location
, node
);
13694 patch_if_else_statement (node
)
13697 tree expression
= TREE_OPERAND (node
, 0);
13699 TREE_TYPE (node
) = error_mark_node
;
13700 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13702 /* The type of expression must be boolean */
13703 if (TREE_TYPE (expression
) != boolean_type_node
13704 && TREE_TYPE (expression
) != promoted_boolean_type_node
)
13706 parse_error_context
13708 "Incompatible type for `if'. Can't convert `%s' to `boolean'",
13709 lang_printable_name (TREE_TYPE (expression
), 0));
13710 return error_mark_node
;
13713 TREE_TYPE (node
) = void_type_node
;
13714 TREE_SIDE_EFFECTS (node
) = 1;
13715 CAN_COMPLETE_NORMALLY (node
)
13716 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1))
13717 | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 2));
13721 /* 14.6 Labeled Statements */
13723 /* Action taken when a lableled statement is parsed. a new
13724 LABELED_BLOCK_EXPR is created. No statement is attached to the
13725 label, yet. LABEL can be NULL_TREE for artificially-generated blocks. */
13728 build_labeled_block (location
, label
)
13733 tree label_decl
, node
;
13734 if (label
== NULL_TREE
|| label
== continue_identifier_node
)
13735 label_name
= label
;
13738 label_name
= merge_qualified_name (label_id
, label
);
13739 /* Issue an error if we try to reuse a label that was previously
13741 if (IDENTIFIER_LOCAL_VALUE (label_name
))
13743 EXPR_WFL_LINECOL (wfl_operator
) = location
;
13744 parse_error_context (wfl_operator
, "Declaration of `%s' shadows "
13745 "a previous label declaration",
13746 IDENTIFIER_POINTER (label
));
13747 EXPR_WFL_LINECOL (wfl_operator
) =
13748 EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name
));
13749 parse_error_context (wfl_operator
, "This is the location of the "
13750 "previous declaration of label `%s'",
13751 IDENTIFIER_POINTER (label
));
13752 java_error_count
--;
13756 label_decl
= create_label_decl (label_name
);
13757 node
= build (LABELED_BLOCK_EXPR
, NULL_TREE
, label_decl
, NULL_TREE
);
13758 EXPR_WFL_LINECOL (node
) = location
;
13759 TREE_SIDE_EFFECTS (node
) = 1;
13763 /* A labeled statement LBE is attached a statement. */
13766 finish_labeled_statement (lbe
, statement
)
13767 tree lbe
; /* Labeled block expr */
13770 /* In anyways, tie the loop to its statement */
13771 LABELED_BLOCK_BODY (lbe
) = statement
;
13772 pop_labeled_block ();
13773 POP_LABELED_BLOCK ();
13777 /* 14.10, 14.11, 14.12 Loop Statements */
13779 /* Create an empty LOOP_EXPR and make it the last in the nested loop
13783 build_new_loop (loop_body
)
13786 tree loop
= build (LOOP_EXPR
, NULL_TREE
, loop_body
);
13787 TREE_SIDE_EFFECTS (loop
) = 1;
13792 /* Create a loop body according to the following structure:
13794 COMPOUND_EXPR (loop main body)
13795 EXIT_EXPR (this order is for while/for loops.
13796 LABELED_BLOCK_EXPR the order is reversed for do loops)
13797 LABEL_DECL (a continue occuring here branches at the
13798 BODY end of this labeled block)
13801 REVERSED, if non zero, tells that the loop condition expr comes
13802 after the body, like in the do-while loop.
13804 To obtain a loop, the loop body structure described above is
13805 encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
13808 LABEL_DECL (use this label to exit the loop)
13810 <structure described above> */
13813 build_loop_body (location
, condition
, reversed
)
13818 tree first
, second
, body
;
13820 condition
= build (EXIT_EXPR
, NULL_TREE
, condition
); /* Force walk */
13821 EXPR_WFL_LINECOL (condition
) = location
; /* For accurate error report */
13822 condition
= build_debugable_stmt (location
, condition
);
13823 TREE_SIDE_EFFECTS (condition
) = 1;
13825 body
= build_labeled_block (0, continue_identifier_node
);
13826 first
= (reversed
? body
: condition
);
13827 second
= (reversed
? condition
: body
);
13829 build (COMPOUND_EXPR
, NULL_TREE
,
13830 build (COMPOUND_EXPR
, NULL_TREE
, first
, second
), empty_stmt_node
);
13833 /* Install CONDITION (if any) and loop BODY (using REVERSED to tell
13834 their order) on the current loop. Unlink the current loop from the
13838 finish_loop_body (location
, condition
, body
, reversed
)
13840 tree condition
, body
;
13843 tree to_return
= ctxp
->current_loop
;
13844 tree loop_body
= LOOP_EXPR_BODY (to_return
);
13847 tree cnode
= LOOP_EXPR_BODY_CONDITION_EXPR (loop_body
, reversed
);
13848 /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
13849 The real EXIT_EXPR is one operand further. */
13850 EXPR_WFL_LINECOL (cnode
) = location
;
13851 /* This one is for accurate error reports */
13852 EXPR_WFL_LINECOL (TREE_OPERAND (cnode
, 0)) = location
;
13853 TREE_OPERAND (TREE_OPERAND (cnode
, 0), 0) = condition
;
13855 LOOP_EXPR_BODY_BODY_EXPR (loop_body
, reversed
) = body
;
13860 /* Tailored version of finish_loop_body for FOR loops, when FOR
13861 loops feature the condition part */
13864 finish_for_loop (location
, condition
, update
, body
)
13866 tree condition
, update
, body
;
13868 /* Put the condition and the loop body in place */
13869 tree loop
= finish_loop_body (location
, condition
, body
, 0);
13870 /* LOOP is the current loop which has been now popped of the loop
13871 stack. Install the update block */
13872 LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop
)) = update
;
13876 /* Try to find the loop a block might be related to. This comprises
13877 the case where the LOOP_EXPR is found as the second operand of a
13878 COMPOUND_EXPR, because the loop happens to have an initialization
13879 part, then expressed as the first operand of the COMPOUND_EXPR. If
13880 the search finds something, 1 is returned. Otherwise, 0 is
13881 returned. The search is assumed to start from a
13882 LABELED_BLOCK_EXPR's block. */
13885 search_loop (statement
)
13888 if (TREE_CODE (statement
) == LOOP_EXPR
)
13891 if (TREE_CODE (statement
) == BLOCK
)
13892 statement
= BLOCK_SUBBLOCKS (statement
);
13896 if (statement
&& TREE_CODE (statement
) == COMPOUND_EXPR
)
13897 while (statement
&& TREE_CODE (statement
) == COMPOUND_EXPR
)
13898 statement
= TREE_OPERAND (statement
, 1);
13900 return (TREE_CODE (statement
) == LOOP_EXPR
13901 && IS_FOR_LOOP_P (statement
) ? statement
: NULL_TREE
);
13904 /* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
13905 returned otherwise. */
13908 labeled_block_contains_loop_p (block
, loop
)
13914 if (LABELED_BLOCK_BODY (block
) == loop
)
13917 if (IS_FOR_LOOP_P (loop
)
13918 && search_loop (LABELED_BLOCK_BODY (block
)) == loop
)
13924 /* If the loop isn't surrounded by a labeled statement, create one and
13925 insert LOOP as its body. */
13928 patch_loop_statement (loop
)
13933 TREE_TYPE (loop
) = void_type_node
;
13934 if (labeled_block_contains_loop_p (ctxp
->current_labeled_block
, loop
))
13937 loop_label
= build_labeled_block (0, NULL_TREE
);
13938 /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
13939 that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
13940 LABELED_BLOCK_BODY (loop_label
) = loop
;
13941 PUSH_LABELED_BLOCK (loop_label
);
13945 /* 14.13, 14.14: break and continue Statements */
13947 /* Build a break or a continue statement. a null NAME indicates an
13948 unlabeled break/continue statement. */
13951 build_bc_statement (location
, is_break
, name
)
13952 int location
, is_break
;
13955 tree break_continue
, label_block_expr
= NULL_TREE
;
13959 if (!(label_block_expr
= IDENTIFIER_LOCAL_VALUE
13960 (merge_qualified_name (label_id
, EXPR_WFL_NODE (name
)))))
13961 /* Null means that we don't have a target for this named
13962 break/continue. In this case, we make the target to be the
13963 label name, so that the error can be reported accuratly in
13964 patch_bc_statement. */
13965 label_block_expr
= EXPR_WFL_NODE (name
);
13967 /* Unlabeled break/continue will be handled during the
13968 break/continue patch operation */
13970 = build (EXIT_BLOCK_EXPR
, NULL_TREE
, label_block_expr
, NULL_TREE
);
13972 IS_BREAK_STMT_P (break_continue
) = is_break
;
13973 TREE_SIDE_EFFECTS (break_continue
) = 1;
13974 EXPR_WFL_LINECOL (break_continue
) = location
;
13975 break_continue
= build_debugable_stmt (location
, break_continue
);
13976 return break_continue
;
13979 /* Verification of a break/continue statement. */
13982 patch_bc_statement (node
)
13985 tree bc_label
= EXIT_BLOCK_LABELED_BLOCK (node
), target_stmt
;
13986 tree labeled_block
= ctxp
->current_labeled_block
;
13987 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
13989 /* Having an identifier here means that the target is unknown. */
13990 if (bc_label
!= NULL_TREE
&& TREE_CODE (bc_label
) == IDENTIFIER_NODE
)
13992 parse_error_context (wfl_operator
, "No label definition found for `%s'",
13993 IDENTIFIER_POINTER (bc_label
));
13994 return error_mark_node
;
13996 if (! IS_BREAK_STMT_P (node
))
13998 /* It's a continue statement. */
13999 for (;; labeled_block
= TREE_CHAIN (labeled_block
))
14001 if (labeled_block
== NULL_TREE
)
14003 if (bc_label
== NULL_TREE
)
14004 parse_error_context (wfl_operator
,
14005 "`continue' must be in loop");
14007 parse_error_context
14008 (wfl_operator
, "continue label `%s' does not name a loop",
14009 IDENTIFIER_POINTER (bc_label
));
14010 return error_mark_node
;
14012 if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block
))
14013 == continue_identifier_node
)
14014 && (bc_label
== NULL_TREE
14015 || TREE_CHAIN (labeled_block
) == bc_label
))
14017 bc_label
= labeled_block
;
14022 else if (!bc_label
)
14024 for (;; labeled_block
= TREE_CHAIN (labeled_block
))
14026 if (labeled_block
== NULL_TREE
)
14028 parse_error_context (wfl_operator
,
14029 "`break' must be in loop or switch");
14030 return error_mark_node
;
14032 target_stmt
= LABELED_BLOCK_BODY (labeled_block
);
14033 if (TREE_CODE (target_stmt
) == SWITCH_EXPR
14034 || search_loop (target_stmt
))
14036 bc_label
= labeled_block
;
14042 EXIT_BLOCK_LABELED_BLOCK (node
) = bc_label
;
14043 CAN_COMPLETE_NORMALLY (bc_label
) = 1;
14045 /* Our break/continue don't return values. */
14046 TREE_TYPE (node
) = void_type_node
;
14047 /* Encapsulate the break within a compound statement so that it's
14048 expanded all the times by expand_expr (and not clobbered
14049 sometimes, like after a if statement) */
14050 node
= add_stmt_to_compound (NULL_TREE
, void_type_node
, node
);
14051 TREE_SIDE_EFFECTS (node
) = 1;
14055 /* Process the exit expression belonging to a loop. Its type must be
14059 patch_exit_expr (node
)
14062 tree expression
= TREE_OPERAND (node
, 0);
14063 TREE_TYPE (node
) = error_mark_node
;
14064 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
14066 /* The type of expression must be boolean */
14067 if (TREE_TYPE (expression
) != boolean_type_node
)
14069 parse_error_context
14071 "Incompatible type for loop conditional. Can't convert `%s' to "
14073 lang_printable_name (TREE_TYPE (expression
), 0));
14074 return error_mark_node
;
14076 /* Now we know things are allright, invert the condition, fold and
14078 TREE_OPERAND (node
, 0) =
14079 fold (build1 (TRUTH_NOT_EXPR
, boolean_type_node
, expression
));
14081 if (! integer_zerop (TREE_OPERAND (node
, 0))
14082 && ctxp
->current_loop
!= NULL_TREE
14083 && TREE_CODE (ctxp
->current_loop
) == LOOP_EXPR
)
14084 CAN_COMPLETE_NORMALLY (ctxp
->current_loop
) = 1;
14085 if (! integer_onep (TREE_OPERAND (node
, 0)))
14086 CAN_COMPLETE_NORMALLY (node
) = 1;
14089 TREE_TYPE (node
) = void_type_node
;
14093 /* 14.9 Switch statement */
14096 patch_switch_statement (node
)
14099 tree se
= TREE_OPERAND (node
, 0), se_type
;
14101 /* Complete the switch expression */
14102 se
= TREE_OPERAND (node
, 0) = java_complete_tree (se
);
14103 se_type
= TREE_TYPE (se
);
14104 /* The type of the switch expression must be char, byte, short or
14106 if (!JINTEGRAL_TYPE_P (se_type
))
14108 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (node
);
14109 parse_error_context (wfl_operator
, "Incompatible type for `switch'. "
14110 "Can't convert `%s' to `int'",
14111 lang_printable_name (se_type
, 0));
14112 /* This is what java_complete_tree will check */
14113 TREE_OPERAND (node
, 0) = error_mark_node
;
14114 return error_mark_node
;
14117 TREE_OPERAND (node
, 1) = java_complete_tree (TREE_OPERAND (node
, 1));
14119 /* Ready to return */
14120 if (TREE_CODE (TREE_OPERAND (node
, 1)) == ERROR_MARK
)
14122 TREE_TYPE (node
) = error_mark_node
;
14123 return error_mark_node
;
14125 TREE_TYPE (node
) = void_type_node
;
14126 TREE_SIDE_EFFECTS (node
) = 1;
14127 CAN_COMPLETE_NORMALLY (node
)
14128 = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node
, 1))
14129 || ! SWITCH_HAS_DEFAULT (node
);
14133 /* 14.18 The try statement */
14136 build_try_statement (location
, try_block
, catches
)
14138 tree try_block
, catches
;
14140 tree node
= build (TRY_EXPR
, NULL_TREE
, try_block
, catches
);
14141 EXPR_WFL_LINECOL (node
) = location
;
14146 build_try_finally_statement (location
, try_block
, finally
)
14148 tree try_block
, finally
;
14150 tree node
= build (TRY_FINALLY_EXPR
, NULL_TREE
, try_block
, finally
);
14151 EXPR_WFL_LINECOL (node
) = location
;
14156 patch_try_statement (node
)
14159 int error_found
= 0;
14160 tree
try = TREE_OPERAND (node
, 0);
14161 /* Exception handlers are considered in left to right order */
14162 tree
catch = nreverse (TREE_OPERAND (node
, 1));
14163 tree current
, caught_type_list
= NULL_TREE
;
14165 /* Check catch clauses, if any. Every time we find an error, we try
14166 to process the next catch clause. We process the catch clause before
14167 the try block so that when processing the try block we can check thrown
14168 exceptions againts the caught type list. */
14169 for (current
= catch; current
; current
= TREE_CHAIN (current
))
14171 tree carg_decl
, carg_type
;
14172 tree sub_current
, catch_block
, catch_clause
;
14175 /* At this point, the structure of the catch clause is
14176 CATCH_EXPR (catch node)
14177 BLOCK (with the decl of the parameter)
14179 MODIFY_EXPR (assignment of the catch parameter)
14180 BLOCK (catch clause block)
14182 catch_clause
= TREE_OPERAND (current
, 0);
14183 carg_decl
= BLOCK_EXPR_DECLS (catch_clause
);
14184 carg_type
= TREE_TYPE (TREE_TYPE (carg_decl
));
14186 /* Catch clauses can't have more than one parameter declared,
14187 but it's already enforced by the grammar. Make sure that the
14188 only parameter of the clause statement in of class Throwable
14189 or a subclass of Throwable, but that was done earlier. The
14190 catch clause parameter type has also been resolved. */
14192 /* Just make sure that the catch clause parameter type inherits
14193 from java.lang.Throwable */
14194 if (!inherits_from_p (carg_type
, throwable_type_node
))
14196 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (current
);
14197 parse_error_context (wfl_operator
,
14198 "Can't catch class `%s'. Catch clause "
14199 "parameter type must be a subclass of "
14200 "class `java.lang.Throwable'",
14201 lang_printable_name (carg_type
, 0));
14206 /* Partial check for unreachable catch statement: The catch
14207 clause is reachable iff is no earlier catch block A in
14208 the try statement such that the type of the catch
14209 clause's parameter is the same as or a subclass of the
14210 type of A's parameter */
14212 for (sub_current
= catch;
14213 sub_current
!= current
; sub_current
= TREE_CHAIN (sub_current
))
14215 tree sub_catch_clause
, decl
;
14216 sub_catch_clause
= TREE_OPERAND (sub_current
, 0);
14217 decl
= BLOCK_EXPR_DECLS (sub_catch_clause
);
14219 if (inherits_from_p (carg_type
, TREE_TYPE (TREE_TYPE (decl
))))
14221 EXPR_WFL_LINECOL (wfl_operator
) = EXPR_WFL_LINECOL (current
);
14222 parse_error_context
14223 (wfl_operator
, "`catch' not reached because of the catch "
14224 "clause at line %d", EXPR_WFL_LINENO (sub_current
));
14225 unreachable
= error_found
= 1;
14229 /* Complete the catch clause block */
14230 catch_block
= java_complete_tree (TREE_OPERAND (current
, 0));
14231 if (catch_block
== error_mark_node
)
14236 if (CAN_COMPLETE_NORMALLY (catch_block
))
14237 CAN_COMPLETE_NORMALLY (node
) = 1;
14238 TREE_OPERAND (current
, 0) = catch_block
;
14243 /* Things to do here: the exception must be thrown */
14245 /* Link this type to the caught type list */
14246 caught_type_list
= tree_cons (NULL_TREE
, carg_type
, caught_type_list
);
14249 PUSH_EXCEPTIONS (caught_type_list
);
14250 if ((try = java_complete_tree (try)) == error_mark_node
)
14252 if (CAN_COMPLETE_NORMALLY (try))
14253 CAN_COMPLETE_NORMALLY (node
) = 1;
14256 /* Verification ends here */
14258 return error_mark_node
;
14260 TREE_OPERAND (node
, 0) = try;
14261 TREE_OPERAND (node
, 1) = catch;
14262 TREE_TYPE (node
) = void_type_node
;
14266 /* 14.17 The synchronized Statement */
14269 patch_synchronized_statement (node
, wfl_op1
)
14270 tree node
, wfl_op1
;
14272 tree expr
= java_complete_tree (TREE_OPERAND (node
, 0));
14273 tree block
= TREE_OPERAND (node
, 1);
14275 tree enter
, exit
, expr_decl
, assignment
;
14277 if (expr
== error_mark_node
)
14279 block
= java_complete_tree (block
);
14283 /* The TYPE of expr must be a reference type */
14284 if (!JREFERENCE_TYPE_P (TREE_TYPE (expr
)))
14286 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14287 parse_error_context (wfl_operator
, "Incompatible type for `synchronized'"
14288 ". Can't convert `%s' to `java.lang.Object'",
14289 lang_printable_name (TREE_TYPE (expr
), 0));
14290 return error_mark_node
;
14293 if (flag_emit_xref
)
14295 TREE_OPERAND (node
, 0) = expr
;
14296 TREE_OPERAND (node
, 1) = java_complete_tree (block
);
14297 CAN_COMPLETE_NORMALLY (node
) = 1;
14301 /* Generate a try-finally for the synchronized statement, except
14302 that the handler that catches all throw exception calls
14303 _Jv_MonitorExit and then rethrow the exception.
14304 The synchronized statement is then implemented as:
14307 _Jv_MonitorEnter (expression)
14309 _Jv_MonitorExit (expression)
14313 e = _Jv_exception_info ();
14314 _Jv_MonitorExit (expression)
14318 expr_decl
= build_decl (VAR_DECL
, generate_name (), TREE_TYPE (expr
));
14319 BUILD_MONITOR_ENTER (enter
, expr_decl
);
14320 BUILD_MONITOR_EXIT (exit
, expr_decl
);
14321 CAN_COMPLETE_NORMALLY (enter
) = 1;
14322 CAN_COMPLETE_NORMALLY (exit
) = 1;
14323 assignment
= build (MODIFY_EXPR
, NULL_TREE
, expr_decl
, expr
);
14324 TREE_SIDE_EFFECTS (assignment
) = 1;
14325 node
= build1 (CLEANUP_POINT_EXPR
, NULL_TREE
,
14326 build (COMPOUND_EXPR
, NULL_TREE
,
14327 build (WITH_CLEANUP_EXPR
, NULL_TREE
,
14328 build (COMPOUND_EXPR
, NULL_TREE
,
14329 assignment
, enter
),
14332 node
= build_expr_block (node
, expr_decl
);
14334 return java_complete_tree (node
);
14337 /* 14.16 The throw Statement */
14340 patch_throw_statement (node
, wfl_op1
)
14341 tree node
, wfl_op1
;
14343 tree expr
= TREE_OPERAND (node
, 0);
14344 tree type
= TREE_TYPE (expr
);
14345 int unchecked_ok
= 0, tryblock_throws_ok
= 0;
14347 /* Thrown expression must be assignable to java.lang.Throwable */
14348 if (!try_reference_assignconv (throwable_type_node
, expr
))
14350 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14351 parse_error_context (wfl_operator
, "Can't throw `%s'; it must be a "
14352 "subclass of class `java.lang.Throwable'",
14353 lang_printable_name (type
, 0));
14354 /* If the thrown expression was a reference, we further the
14355 compile-time check. */
14356 if (!JREFERENCE_TYPE_P (type
))
14357 return error_mark_node
;
14360 /* At least one of the following must be true */
14362 /* The type of the throw expression is a not checked exception,
14363 i.e. is a unchecked expression. */
14364 unchecked_ok
= IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type
));
14366 /* Throw is contained in a try statement and at least one catch
14367 clause can receive the thrown expression or the current method is
14368 declared to throw such an exception. Or, the throw statement is
14369 contained in a method or constructor declaration and the type of
14370 the Expression is assignable to at least one type listed in the
14371 throws clause the declaration. */
14372 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14374 tryblock_throws_ok
= check_thrown_exceptions_do (TREE_TYPE (expr
));
14375 if (!(unchecked_ok
|| tryblock_throws_ok
))
14377 /* If there is a surrounding try block that has no matching
14378 clatch clause, report it first. A surrounding try block exits
14379 only if there is something after the list of checked
14380 exception thrown by the current function (if any). */
14381 if (IN_TRY_BLOCK_P ())
14382 parse_error_context (wfl_operator
, "Checked exception `%s' can't be "
14383 "caught by any of the catch clause(s) "
14384 "of the surrounding `try' block",
14385 lang_printable_name (type
, 0));
14386 /* If we have no surrounding try statement and the method doesn't have
14387 any throws, report it now. FIXME */
14389 /* We report that the exception can't be throw from a try block
14390 in all circumstances but when the `throw' is inside a static
14392 else if (!EXCEPTIONS_P (currently_caught_type_list
)
14393 && !tryblock_throws_ok
)
14395 if (IS_CLINIT (current_function_decl
))
14396 parse_error_context (wfl_operator
, "Checked exception `%s' can't "
14397 "be thrown in initializer",
14398 lang_printable_name (type
, 0));
14400 parse_error_context (wfl_operator
, "Checked exception `%s' isn't "
14401 "thrown from a `try' block",
14402 lang_printable_name (type
, 0));
14404 /* Otherwise, the current method doesn't have the appropriate
14405 throws declaration */
14407 parse_error_context (wfl_operator
, "Checked exception `%s' doesn't "
14408 "match any of current method's `throws' "
14410 lang_printable_name (type
, 0));
14411 return error_mark_node
;
14414 if (! flag_emit_class_files
&& ! flag_emit_xref
)
14415 BUILD_THROW (node
, expr
);
14417 /* If doing xrefs, keep the location where the `throw' was seen. */
14418 if (flag_emit_xref
)
14419 EXPR_WFL_LINECOL (node
) = EXPR_WFL_LINECOL (wfl_op1
);
14423 /* Check that exception said to be thrown by method DECL can be
14424 effectively caught from where DECL is invoked. */
14427 check_thrown_exceptions (location
, decl
)
14432 /* For all the unchecked exceptions thrown by DECL */
14433 for (throws
= DECL_FUNCTION_THROWS (decl
); throws
;
14434 throws
= TREE_CHAIN (throws
))
14435 if (!check_thrown_exceptions_do (TREE_VALUE (throws
)))
14438 /* Temporary hack to suppresses errors about cloning arrays. FIXME */
14439 if (DECL_NAME (decl
) == get_identifier ("clone"))
14442 EXPR_WFL_LINECOL (wfl_operator
) = location
;
14443 if (DECL_NAME (current_function_decl
) == finit_identifier_node
)
14444 parse_error_context
14445 (wfl_operator
, "Exception `%s' can't be thrown in initializer",
14446 lang_printable_name (TREE_VALUE (throws
), 0));
14449 parse_error_context
14450 (wfl_operator
, "Exception `%s' must be caught, or it must be "
14451 "declared in the `throws' clause of `%s'",
14452 lang_printable_name (TREE_VALUE (throws
), 0),
14453 (DECL_NAME (current_function_decl
) == init_identifier_node
?
14454 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class
))) :
14455 IDENTIFIER_POINTER (DECL_NAME (current_function_decl
))));
14460 /* Return 1 if checked EXCEPTION is caught at the current nesting level of
14461 try-catch blocks, OR is listed in the `throws' clause of the
14465 check_thrown_exceptions_do (exception
)
14468 tree list
= currently_caught_type_list
;
14469 resolve_and_layout (exception
, NULL_TREE
);
14470 /* First, all the nested try-catch-finally at that stage. The
14471 last element contains `throws' clause exceptions, if any. */
14472 if (IS_UNCHECKED_EXCEPTION_P (exception
))
14477 for (caught
= TREE_VALUE (list
); caught
; caught
= TREE_CHAIN (caught
))
14478 if (valid_ref_assignconv_cast_p (exception
, TREE_VALUE (caught
), 0))
14480 list
= TREE_CHAIN (list
);
14486 purge_unchecked_exceptions (mdecl
)
14489 tree throws
= DECL_FUNCTION_THROWS (mdecl
);
14490 tree
new = NULL_TREE
;
14494 tree next
= TREE_CHAIN (throws
);
14495 if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws
)))
14497 TREE_CHAIN (throws
) = new;
14502 /* List is inverted here, but it doesn't matter */
14503 DECL_FUNCTION_THROWS (mdecl
) = new;
14506 /* 15.24 Conditional Operator ?: */
14509 patch_conditional_expr (node
, wfl_cond
, wfl_op1
)
14510 tree node
, wfl_cond
, wfl_op1
;
14512 tree cond
= TREE_OPERAND (node
, 0);
14513 tree op1
= TREE_OPERAND (node
, 1);
14514 tree op2
= TREE_OPERAND (node
, 2);
14515 tree resulting_type
= NULL_TREE
;
14516 tree t1
, t2
, patched
;
14517 int error_found
= 0;
14519 /* Operands of ?: might be StringBuffers crafted as a result of a
14520 string concatenation. Obtain a descent operand here. */
14521 if ((patched
= patch_string (op1
)))
14522 TREE_OPERAND (node
, 1) = op1
= patched
;
14523 if ((patched
= patch_string (op2
)))
14524 TREE_OPERAND (node
, 2) = op2
= patched
;
14526 t1
= TREE_TYPE (op1
);
14527 t2
= TREE_TYPE (op2
);
14529 /* The first expression must be a boolean */
14530 if (TREE_TYPE (cond
) != boolean_type_node
)
14532 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_cond
);
14533 parse_error_context (wfl_operator
, "Incompatible type for `?:'. Can't "
14534 "convert `%s' to `boolean'",
14535 lang_printable_name (TREE_TYPE (cond
), 0));
14539 /* Second and third can be numeric, boolean (i.e. primitive),
14540 references or null. Anything else results in an error */
14541 if (!((JNUMERIC_TYPE_P (t1
) && JNUMERIC_TYPE_P (t2
))
14542 || ((JREFERENCE_TYPE_P (t1
) || op1
== null_pointer_node
)
14543 && (JREFERENCE_TYPE_P (t2
) || op2
== null_pointer_node
))
14544 || (t1
== boolean_type_node
&& t2
== boolean_type_node
)))
14547 /* Determine the type of the conditional expression. Same types are
14548 easy to deal with */
14550 resulting_type
= t1
;
14552 /* There are different rules for numeric types */
14553 else if (JNUMERIC_TYPE_P (t1
))
14555 /* if byte/short found, the resulting type is short */
14556 if ((t1
== byte_type_node
&& t2
== short_type_node
)
14557 || (t1
== short_type_node
&& t2
== byte_type_node
))
14558 resulting_type
= short_type_node
;
14560 /* If t1 is a constant int and t2 is of type byte, short or char
14561 and t1's value fits in t2, then the resulting type is t2 */
14562 else if ((t1
== int_type_node
&& TREE_CONSTANT (TREE_OPERAND (node
, 1)))
14563 && JBSC_TYPE_P (t2
) && int_fits_type_p (TREE_OPERAND (node
, 1), t2
))
14564 resulting_type
= t2
;
14566 /* If t2 is a constant int and t1 is of type byte, short or char
14567 and t2's value fits in t1, then the resulting type is t1 */
14568 else if ((t2
== int_type_node
&& TREE_CONSTANT (TREE_OPERAND (node
, 2)))
14569 && JBSC_TYPE_P (t1
) && int_fits_type_p (TREE_OPERAND (node
, 2), t1
))
14570 resulting_type
= t1
;
14572 /* Otherwise, binary numeric promotion is applied and the
14573 resulting type is the promoted type of operand 1 and 2 */
14575 resulting_type
= binary_numeric_promotion (t1
, t2
,
14576 &TREE_OPERAND (node
, 1),
14577 &TREE_OPERAND (node
, 2));
14580 /* Cases of a reference and a null type */
14581 else if (JREFERENCE_TYPE_P (t1
) && op2
== null_pointer_node
)
14582 resulting_type
= t1
;
14584 else if (JREFERENCE_TYPE_P (t2
) && op1
== null_pointer_node
)
14585 resulting_type
= t2
;
14587 /* Last case: different reference types. If a type can be converted
14588 into the other one by assignment conversion, the latter
14589 determines the type of the expression */
14590 else if ((resulting_type
= try_reference_assignconv (t1
, op2
)))
14591 resulting_type
= promote_type (t1
);
14593 else if ((resulting_type
= try_reference_assignconv (t2
, op1
)))
14594 resulting_type
= promote_type (t2
);
14596 /* If we don't have any resulting type, we're in trouble */
14597 if (!resulting_type
)
14599 char *t
= xstrdup (lang_printable_name (t1
, 0));
14600 SET_WFL_OPERATOR (wfl_operator
, node
, wfl_op1
);
14601 parse_error_context (wfl_operator
, "Incompatible type for `?:'. Can't "
14602 "convert `%s' to `%s'", t
,
14603 lang_printable_name (t2
, 0));
14610 TREE_TYPE (node
) = error_mark_node
;
14611 return error_mark_node
;
14614 TREE_TYPE (node
) = resulting_type
;
14615 TREE_SET_CODE (node
, COND_EXPR
);
14616 CAN_COMPLETE_NORMALLY (node
) = 1;
14620 /* Try to constant fold NODE.
14621 If NODE is not a constant expression, return NULL_EXPR.
14622 CONTEXT is a static final VAR_DECL whose initializer we are folding. */
14625 fold_constant_for_init (node
, context
)
14629 tree op0
, op1
, val
;
14630 enum tree_code code
= TREE_CODE (node
);
14632 if (code
== STRING_CST
)
14635 if (code
== INTEGER_CST
|| code
== REAL_CST
)
14636 return convert (TREE_TYPE (context
), node
);
14637 if (TREE_TYPE (node
) != NULL_TREE
&& code
!= VAR_DECL
&& code
!= FIELD_DECL
)
14645 case TRUNC_MOD_EXPR
:
14653 case TRUTH_ANDIF_EXPR
:
14654 case TRUTH_ORIF_EXPR
:
14661 op0
= TREE_OPERAND (node
, 0);
14662 op1
= TREE_OPERAND (node
, 1);
14663 val
= fold_constant_for_init (op0
, context
);
14664 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14666 TREE_OPERAND (node
, 0) = val
;
14667 val
= fold_constant_for_init (op1
, context
);
14668 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14670 TREE_OPERAND (node
, 1) = val
;
14671 return patch_binop (node
, op0
, op1
);
14673 case UNARY_PLUS_EXPR
:
14675 case TRUTH_NOT_EXPR
:
14678 op0
= TREE_OPERAND (node
, 0);
14679 val
= fold_constant_for_init (op0
, context
);
14680 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14682 TREE_OPERAND (node
, 0) = val
;
14683 return patch_unaryop (node
, op0
);
14687 val
= fold_constant_for_init (TREE_OPERAND (node
, 0), context
);
14688 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14690 TREE_OPERAND (node
, 0) = val
;
14691 val
= fold_constant_for_init (TREE_OPERAND (node
, 1), context
);
14692 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14694 TREE_OPERAND (node
, 1) = val
;
14695 val
= fold_constant_for_init (TREE_OPERAND (node
, 2), context
);
14696 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14698 TREE_OPERAND (node
, 2) = val
;
14699 return integer_zerop (TREE_OPERAND (node
, 0)) ? TREE_OPERAND (node
, 1)
14700 : TREE_OPERAND (node
, 2);
14704 if (! FIELD_FINAL (node
)
14705 || DECL_INITIAL (node
) == NULL_TREE
)
14707 val
= DECL_INITIAL (node
);
14708 /* Guard against infinite recursion. */
14709 DECL_INITIAL (node
) = NULL_TREE
;
14710 val
= fold_constant_for_init (val
, node
);
14711 DECL_INITIAL (node
) = val
;
14714 case EXPR_WITH_FILE_LOCATION
:
14715 /* Compare java_complete_tree and resolve_expression_name. */
14716 if (!EXPR_WFL_NODE (node
) /* Or a PRIMARY flag ? */
14717 || TREE_CODE (EXPR_WFL_NODE (node
)) == IDENTIFIER_NODE
)
14719 tree name
= EXPR_WFL_NODE (node
);
14721 if (PRIMARY_P (node
))
14723 else if (! QUALIFIED_P (name
))
14725 decl
= lookup_field_wrapper (DECL_CONTEXT (context
), name
);
14726 if (decl
== NULL_TREE
14727 || (! FIELD_STATIC (decl
) && ! FIELD_FINAL (decl
)))
14729 return fold_constant_for_init (decl
, decl
);
14733 /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
14734 qualify_ambiguous_name (node
);
14735 if (resolve_field_access (node
, &decl
, NULL
)
14736 && decl
!= NULL_TREE
)
14737 return fold_constant_for_init (decl
, decl
);
14743 op0
= TREE_OPERAND (node
, 0);
14744 val
= fold_constant_for_init (op0
, context
);
14745 if (val
== NULL_TREE
|| ! TREE_CONSTANT (val
))
14747 TREE_OPERAND (node
, 0) = val
;
14751 #ifdef USE_COMPONENT_REF
14753 case COMPONENT_REF
:
14762 #ifdef USE_COMPONENT_REF
14763 /* Context is 'T' for TypeName, 'P' for PackageName,
14764 'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */
14767 resolve_simple_name (name
, context
)
14774 resolve_qualified_name (name
, context
)