]>
Commit | Line | Data |
---|---|---|
8b27f225 | 1 | |
89004479 | 2 | /* A Bison parser, made from ./parse.y |
518f173d | 3 | by GNU Bison version 1.28 */ |
8b27f225 PB |
4 | |
5 | #define YYBISON 1 /* Identify Bison output. */ | |
6 | ||
2aa11e97 APB |
7 | #define yyparse java_parse |
8 | #define yylex java_lex | |
9 | #define yyerror java_error | |
10 | #define yylval java_lval | |
11 | #define yychar java_char | |
12 | #define yydebug java_debug | |
13 | #define yynerrs java_nerrs | |
518f173d APB |
14 | #define PLUS_TK 257 |
15 | #define MINUS_TK 258 | |
16 | #define MULT_TK 259 | |
17 | #define DIV_TK 260 | |
18 | #define REM_TK 261 | |
19 | #define LS_TK 262 | |
20 | #define SRS_TK 263 | |
21 | #define ZRS_TK 264 | |
22 | #define AND_TK 265 | |
23 | #define XOR_TK 266 | |
24 | #define OR_TK 267 | |
25 | #define BOOL_AND_TK 268 | |
26 | #define BOOL_OR_TK 269 | |
27 | #define EQ_TK 270 | |
28 | #define NEQ_TK 271 | |
29 | #define GT_TK 272 | |
30 | #define GTE_TK 273 | |
31 | #define LT_TK 274 | |
32 | #define LTE_TK 275 | |
33 | #define PLUS_ASSIGN_TK 276 | |
34 | #define MINUS_ASSIGN_TK 277 | |
35 | #define MULT_ASSIGN_TK 278 | |
36 | #define DIV_ASSIGN_TK 279 | |
37 | #define REM_ASSIGN_TK 280 | |
38 | #define LS_ASSIGN_TK 281 | |
39 | #define SRS_ASSIGN_TK 282 | |
40 | #define ZRS_ASSIGN_TK 283 | |
41 | #define AND_ASSIGN_TK 284 | |
42 | #define XOR_ASSIGN_TK 285 | |
43 | #define OR_ASSIGN_TK 286 | |
44 | #define PUBLIC_TK 287 | |
45 | #define PRIVATE_TK 288 | |
46 | #define PROTECTED_TK 289 | |
47 | #define STATIC_TK 290 | |
48 | #define FINAL_TK 291 | |
49 | #define SYNCHRONIZED_TK 292 | |
50 | #define VOLATILE_TK 293 | |
51 | #define TRANSIENT_TK 294 | |
52 | #define NATIVE_TK 295 | |
53 | #define PAD_TK 296 | |
54 | #define ABSTRACT_TK 297 | |
55 | #define MODIFIER_TK 298 | |
56 | #define DECR_TK 299 | |
57 | #define INCR_TK 300 | |
58 | #define DEFAULT_TK 301 | |
59 | #define IF_TK 302 | |
60 | #define THROW_TK 303 | |
61 | #define BOOLEAN_TK 304 | |
62 | #define DO_TK 305 | |
63 | #define IMPLEMENTS_TK 306 | |
64 | #define THROWS_TK 307 | |
65 | #define BREAK_TK 308 | |
66 | #define IMPORT_TK 309 | |
67 | #define ELSE_TK 310 | |
68 | #define INSTANCEOF_TK 311 | |
69 | #define RETURN_TK 312 | |
70 | #define VOID_TK 313 | |
71 | #define CATCH_TK 314 | |
72 | #define INTERFACE_TK 315 | |
73 | #define CASE_TK 316 | |
74 | #define EXTENDS_TK 317 | |
75 | #define FINALLY_TK 318 | |
76 | #define SUPER_TK 319 | |
77 | #define WHILE_TK 320 | |
78 | #define CLASS_TK 321 | |
79 | #define SWITCH_TK 322 | |
80 | #define CONST_TK 323 | |
81 | #define TRY_TK 324 | |
82 | #define FOR_TK 325 | |
83 | #define NEW_TK 326 | |
84 | #define CONTINUE_TK 327 | |
85 | #define GOTO_TK 328 | |
86 | #define PACKAGE_TK 329 | |
87 | #define THIS_TK 330 | |
88 | #define BYTE_TK 331 | |
89 | #define SHORT_TK 332 | |
90 | #define INT_TK 333 | |
91 | #define LONG_TK 334 | |
92 | #define CHAR_TK 335 | |
93 | #define INTEGRAL_TK 336 | |
94 | #define FLOAT_TK 337 | |
95 | #define DOUBLE_TK 338 | |
96 | #define FP_TK 339 | |
97 | #define ID_TK 340 | |
98 | #define REL_QM_TK 341 | |
99 | #define REL_CL_TK 342 | |
100 | #define NOT_TK 343 | |
101 | #define NEG_TK 344 | |
102 | #define ASSIGN_ANY_TK 345 | |
103 | #define ASSIGN_TK 346 | |
104 | #define OP_TK 347 | |
105 | #define CP_TK 348 | |
106 | #define OCB_TK 349 | |
107 | #define CCB_TK 350 | |
108 | #define OSB_TK 351 | |
109 | #define CSB_TK 352 | |
110 | #define SC_TK 353 | |
111 | #define C_TK 354 | |
112 | #define DOT_TK 355 | |
113 | #define STRING_LIT_TK 356 | |
114 | #define CHAR_LIT_TK 357 | |
115 | #define INT_LIT_TK 358 | |
116 | #define FP_LIT_TK 359 | |
117 | #define TRUE_TK 360 | |
118 | #define FALSE_TK 361 | |
119 | #define BOOL_LIT_TK 362 | |
120 | #define NULL_TK 363 | |
8b27f225 | 121 | |
89004479 | 122 | #line 48 "./parse.y" |
8b27f225 | 123 | |
8b27f225 | 124 | #include "config.h" |
bc3ca41b PB |
125 | #include "system.h" |
126 | #include <dirent.h> | |
8b27f225 PB |
127 | #include "tree.h" |
128 | #include "rtl.h" | |
129 | #include "obstack.h" | |
130 | #include "toplev.h" | |
131 | #include "flags.h" | |
132 | #include "java-tree.h" | |
133 | #include "jcf.h" | |
134 | #include "lex.h" | |
135 | #include "parse.h" | |
136 | #include "zipfile.h" | |
5e942c50 | 137 | #include "convert.h" |
63a212ed | 138 | #include "buffer.h" |
f099f336 | 139 | #include "xref.h" |
b384405b | 140 | #include "function.h" |
138657ec | 141 | #include "except.h" |
0ae70c6a | 142 | #include "defaults.h" |
8b27f225 | 143 | |
82371d41 | 144 | /* Local function prototypes */ |
df32d2ce KG |
145 | static char *java_accstring_lookup PARAMS ((int)); |
146 | static void classitf_redefinition_error PARAMS ((const char *,tree, tree, tree)); | |
147 | static void variable_redefinition_error PARAMS ((tree, tree, tree, int)); | |
df32d2ce KG |
148 | static tree create_class PARAMS ((int, tree, tree, tree)); |
149 | static tree create_interface PARAMS ((int, tree, tree)); | |
150 | static tree find_field PARAMS ((tree, tree)); | |
151 | static tree lookup_field_wrapper PARAMS ((tree, tree)); | |
152 | static int duplicate_declaration_error_p PARAMS ((tree, tree, tree)); | |
153 | static void register_fields PARAMS ((int, tree, tree)); | |
154 | static tree parser_qualified_classname PARAMS ((tree)); | |
155 | static int parser_check_super PARAMS ((tree, tree, tree)); | |
156 | static int parser_check_super_interface PARAMS ((tree, tree, tree)); | |
157 | static void check_modifiers_consistency PARAMS ((int)); | |
158 | static tree lookup_cl PARAMS ((tree)); | |
159 | static tree lookup_java_method2 PARAMS ((tree, tree, int)); | |
160 | static tree method_header PARAMS ((int, tree, tree, tree)); | |
161 | static void fix_method_argument_names PARAMS ((tree ,tree)); | |
162 | static tree method_declarator PARAMS ((tree, tree)); | |
163 | static void parse_warning_context PARAMS ((tree cl, const char *msg, ...)) | |
d4476be2 | 164 | ATTRIBUTE_PRINTF_2; |
df32d2ce KG |
165 | static void issue_warning_error_from_context PARAMS ((tree, const char *msg, va_list)); |
166 | static void parse_ctor_invocation_error PARAMS ((void)); | |
167 | static tree parse_jdk1_1_error PARAMS ((const char *)); | |
168 | static void complete_class_report_errors PARAMS ((jdep *)); | |
169 | static int process_imports PARAMS ((void)); | |
170 | static void read_import_dir PARAMS ((tree)); | |
171 | static int find_in_imports_on_demand PARAMS ((tree)); | |
172 | static int find_in_imports PARAMS ((tree)); | |
173 | static int check_pkg_class_access PARAMS ((tree, tree)); | |
174 | static tree resolve_package PARAMS ((tree, tree *)); | |
175 | static tree lookup_package_type PARAMS ((const char *, int)); | |
176 | static tree lookup_package_type_and_set_next PARAMS ((const char *, int, tree *)); | |
177 | static tree resolve_class PARAMS ((tree, tree, tree)); | |
178 | static void declare_local_variables PARAMS ((int, tree, tree)); | |
179 | static void source_start_java_method PARAMS ((tree)); | |
180 | static void source_end_java_method PARAMS ((void)); | |
181 | static void expand_start_java_method PARAMS ((tree)); | |
182 | static tree find_name_in_single_imports PARAMS ((tree)); | |
183 | static void check_abstract_method_header PARAMS ((tree)); | |
184 | static tree lookup_java_interface_method2 PARAMS ((tree, tree)); | |
185 | static tree resolve_expression_name PARAMS ((tree, tree *)); | |
186 | static tree maybe_create_class_interface_decl PARAMS ((tree, tree, tree)); | |
187 | static int check_class_interface_creation PARAMS ((int, int, tree, | |
82371d41 | 188 | tree, tree, tree)); |
df32d2ce | 189 | static tree patch_method_invocation PARAMS ((tree, tree, tree, |
ac825856 | 190 | int *, tree *)); |
df32d2ce KG |
191 | static int breakdown_qualified PARAMS ((tree *, tree *, tree)); |
192 | static tree resolve_and_layout PARAMS ((tree, tree)); | |
193 | static tree resolve_no_layout PARAMS ((tree, tree)); | |
194 | static int invocation_mode PARAMS ((tree, int)); | |
195 | static tree find_applicable_accessible_methods_list PARAMS ((int, tree, | |
82371d41 | 196 | tree, tree)); |
df32d2ce | 197 | static void search_applicable_methods_list PARAMS ((int, tree, tree, tree, |
cc596f8c | 198 | tree *, tree *)); |
df32d2ce KG |
199 | static tree find_most_specific_methods_list PARAMS ((tree)); |
200 | static int argument_types_convertible PARAMS ((tree, tree)); | |
201 | static tree patch_invoke PARAMS ((tree, tree, tree)); | |
202 | static tree lookup_method_invoke PARAMS ((int, tree, tree, tree, tree)); | |
203 | static tree register_incomplete_type PARAMS ((int, tree, tree, tree)); | |
204 | static tree obtain_incomplete_type PARAMS ((tree)); | |
205 | static tree java_complete_lhs PARAMS ((tree)); | |
206 | static tree java_complete_tree PARAMS ((tree)); | |
207 | static int java_pre_expand_clinit PARAMS ((tree)); | |
208 | static void java_complete_expand_method PARAMS ((tree)); | |
209 | static int unresolved_type_p PARAMS ((tree, tree *)); | |
210 | static void create_jdep_list PARAMS ((struct parser_ctxt *)); | |
211 | static tree build_expr_block PARAMS ((tree, tree)); | |
212 | static tree enter_block PARAMS ((void)); | |
213 | static tree enter_a_block PARAMS ((tree)); | |
214 | static tree exit_block PARAMS ((void)); | |
215 | static tree lookup_name_in_blocks PARAMS ((tree)); | |
216 | static void maybe_absorb_scoping_blocks PARAMS ((void)); | |
217 | static tree build_method_invocation PARAMS ((tree, tree)); | |
218 | static tree build_new_invocation PARAMS ((tree, tree)); | |
219 | static tree build_assignment PARAMS ((int, int, tree, tree)); | |
220 | static tree build_binop PARAMS ((enum tree_code, int, tree, tree)); | |
221 | static int check_final_assignment PARAMS ((tree ,tree)); | |
222 | static tree patch_assignment PARAMS ((tree, tree, tree )); | |
223 | static tree patch_binop PARAMS ((tree, tree, tree)); | |
224 | static tree build_unaryop PARAMS ((int, int, tree)); | |
225 | static tree build_incdec PARAMS ((int, int, tree, int)); | |
226 | static tree patch_unaryop PARAMS ((tree, tree)); | |
227 | static tree build_cast PARAMS ((int, tree, tree)); | |
228 | static tree build_null_of_type PARAMS ((tree)); | |
229 | static tree patch_cast PARAMS ((tree, tree)); | |
230 | static int valid_ref_assignconv_cast_p PARAMS ((tree, tree, int)); | |
231 | static int valid_builtin_assignconv_identity_widening_p PARAMS ((tree, tree)); | |
232 | static int valid_cast_to_p PARAMS ((tree, tree)); | |
233 | static int valid_method_invocation_conversion_p PARAMS ((tree, tree)); | |
234 | static tree try_builtin_assignconv PARAMS ((tree, tree, tree)); | |
235 | static tree try_reference_assignconv PARAMS ((tree, tree)); | |
236 | static tree build_unresolved_array_type PARAMS ((tree)); | |
237 | static tree build_array_from_name PARAMS ((tree, tree, tree, tree *)); | |
238 | static tree build_array_ref PARAMS ((int, tree, tree)); | |
239 | static tree patch_array_ref PARAMS ((tree)); | |
240 | static tree make_qualified_name PARAMS ((tree, tree, int)); | |
241 | static tree merge_qualified_name PARAMS ((tree, tree)); | |
242 | static tree make_qualified_primary PARAMS ((tree, tree, int)); | |
243 | static int resolve_qualified_expression_name PARAMS ((tree, tree *, | |
82371d41 | 244 | tree *, tree *)); |
df32d2ce KG |
245 | static void qualify_ambiguous_name PARAMS ((tree)); |
246 | static void maybe_generate_clinit PARAMS ((void)); | |
247 | static tree resolve_field_access PARAMS ((tree, tree *, tree *)); | |
248 | static tree build_newarray_node PARAMS ((tree, tree, int)); | |
249 | static tree patch_newarray PARAMS ((tree)); | |
250 | static tree resolve_type_during_patch PARAMS ((tree)); | |
251 | static tree build_this PARAMS ((int)); | |
252 | static tree build_return PARAMS ((int, tree)); | |
253 | static tree patch_return PARAMS ((tree)); | |
254 | static tree maybe_access_field PARAMS ((tree, tree, tree)); | |
255 | static int complete_function_arguments PARAMS ((tree)); | |
256 | static int check_for_static_method_reference PARAMS ((tree, tree, tree, tree, tree)); | |
257 | static int not_accessible_p PARAMS ((tree, tree, int)); | |
258 | static void check_deprecation PARAMS ((tree, tree)); | |
259 | static int class_in_current_package PARAMS ((tree)); | |
260 | static tree build_if_else_statement PARAMS ((int, tree, tree, tree)); | |
261 | static tree patch_if_else_statement PARAMS ((tree)); | |
262 | static tree add_stmt_to_compound PARAMS ((tree, tree, tree)); | |
263 | static tree add_stmt_to_block PARAMS ((tree, tree, tree)); | |
264 | static tree patch_exit_expr PARAMS ((tree)); | |
265 | static tree build_labeled_block PARAMS ((int, tree)); | |
266 | static tree finish_labeled_statement PARAMS ((tree, tree)); | |
267 | static tree build_bc_statement PARAMS ((int, int, tree)); | |
268 | static tree patch_bc_statement PARAMS ((tree)); | |
269 | static tree patch_loop_statement PARAMS ((tree)); | |
270 | static tree build_new_loop PARAMS ((tree)); | |
271 | static tree build_loop_body PARAMS ((int, tree, int)); | |
272 | static tree finish_loop_body PARAMS ((int, tree, tree, int)); | |
273 | static tree build_debugable_stmt PARAMS ((int, tree)); | |
274 | static tree finish_for_loop PARAMS ((int, tree, tree, tree)); | |
275 | static tree patch_switch_statement PARAMS ((tree)); | |
276 | static tree string_constant_concatenation PARAMS ((tree, tree)); | |
277 | static tree build_string_concatenation PARAMS ((tree, tree)); | |
278 | static tree patch_string_cst PARAMS ((tree)); | |
279 | static tree patch_string PARAMS ((tree)); | |
280 | static tree build_try_statement PARAMS ((int, tree, tree)); | |
281 | static tree build_try_finally_statement PARAMS ((int, tree, tree)); | |
282 | static tree patch_try_statement PARAMS ((tree)); | |
283 | static tree patch_synchronized_statement PARAMS ((tree, tree)); | |
284 | static tree patch_throw_statement PARAMS ((tree, tree)); | |
285 | static void check_thrown_exceptions PARAMS ((int, tree)); | |
286 | static int check_thrown_exceptions_do PARAMS ((tree)); | |
287 | static void purge_unchecked_exceptions PARAMS ((tree)); | |
288 | static void check_throws_clauses PARAMS ((tree, tree, tree)); | |
289 | static void finish_method_declaration PARAMS ((tree)); | |
290 | static tree build_super_invocation PARAMS ((tree)); | |
291 | static int verify_constructor_circularity PARAMS ((tree, tree)); | |
292 | static char *constructor_circularity_msg PARAMS ((tree, tree)); | |
293 | static tree build_this_super_qualified_invocation PARAMS ((int, tree, tree, | |
82371d41 | 294 | int, int)); |
df32d2ce KG |
295 | static const char *get_printable_method_name PARAMS ((tree)); |
296 | static tree patch_conditional_expr PARAMS ((tree, tree, tree)); | |
297 | static void maybe_generate_finit PARAMS ((void)); | |
298 | static void fix_constructors PARAMS ((tree)); | |
299 | static int verify_constructor_super PARAMS ((void)); | |
300 | static tree create_artificial_method PARAMS ((tree, int, tree, tree, tree)); | |
301 | static void start_artificial_method_body PARAMS ((tree)); | |
302 | static void end_artificial_method_body PARAMS ((tree)); | |
303 | static int check_method_redefinition PARAMS ((tree, tree)); | |
304 | static int reset_method_name PARAMS ((tree)); | |
305 | static void java_check_regular_methods PARAMS ((tree)); | |
306 | static void java_check_abstract_methods PARAMS ((tree)); | |
307 | static tree maybe_build_primttype_type_ref PARAMS ((tree, tree)); | |
308 | static void unreachable_stmt_error PARAMS ((tree)); | |
309 | static tree find_expr_with_wfl PARAMS ((tree)); | |
310 | static void missing_return_error PARAMS ((tree)); | |
311 | static tree build_new_array_init PARAMS ((int, tree)); | |
312 | static tree patch_new_array_init PARAMS ((tree, tree)); | |
313 | static tree maybe_build_array_element_wfl PARAMS ((tree)); | |
314 | static int array_constructor_check_entry PARAMS ((tree, tree)); | |
315 | static const char *purify_type_name PARAMS ((const char *)); | |
316 | static tree fold_constant_for_init PARAMS ((tree, tree)); | |
317 | static tree strip_out_static_field_access_decl PARAMS ((tree)); | |
318 | static jdeplist *reverse_jdep_list PARAMS ((struct parser_ctxt *)); | |
319 | static void static_ref_err PARAMS ((tree, tree, tree)); | |
320 | static void parser_add_interface PARAMS ((tree, tree, tree)); | |
321 | static void add_superinterfaces PARAMS ((tree, tree)); | |
322 | static tree jdep_resolve_class PARAMS ((jdep *)); | |
323 | static int note_possible_classname PARAMS ((const char *, int)); | |
324 | static void java_complete_expand_methods PARAMS ((void)); | |
325 | static void java_expand_finals PARAMS ((void)); | |
326 | static tree cut_identifier_in_qualified PARAMS ((tree)); | |
327 | static tree java_stabilize_reference PARAMS ((tree)); | |
328 | static tree do_unary_numeric_promotion PARAMS ((tree)); | |
329 | static char * operator_string PARAMS ((tree)); | |
330 | static tree do_merge_string_cste PARAMS ((tree, const char *, int, int)); | |
331 | static tree merge_string_cste PARAMS ((tree, tree, int)); | |
332 | static tree java_refold PARAMS ((tree)); | |
333 | static int java_decl_equiv PARAMS ((tree, tree)); | |
334 | static int binop_compound_p PARAMS ((enum tree_code)); | |
335 | static tree search_loop PARAMS ((tree)); | |
336 | static int labeled_block_contains_loop_p PARAMS ((tree, tree)); | |
337 | static void check_abstract_method_definitions PARAMS ((int, tree, tree)); | |
338 | static void java_check_abstract_method_definitions PARAMS ((tree)); | |
339 | static void java_debug_context_do PARAMS ((int)); | |
82371d41 | 340 | |
8b27f225 PB |
341 | /* Number of error found so far. */ |
342 | int java_error_count; | |
343 | /* Number of warning found so far. */ | |
344 | int java_warning_count; | |
ce6e9147 APB |
345 | /* Tell when not to fold, when doing xrefs */ |
346 | int do_not_fold; | |
8b27f225 PB |
347 | |
348 | /* The current parser context */ | |
d4370213 | 349 | struct parser_ctxt *ctxp; |
8b27f225 | 350 | |
d4370213 | 351 | /* List of things that were analyzed for which code will be generated */ |
b351b287 APB |
352 | static struct parser_ctxt *ctxp_for_generation = NULL; |
353 | ||
8b27f225 PB |
354 | /* binop_lookup maps token to tree_code. It is used where binary |
355 | operations are involved and required by the parser. RDIV_EXPR | |
356 | covers both integral/floating point division. The code is changed | |
357 | once the type of both operator is worked out. */ | |
358 | ||
359 | static enum tree_code binop_lookup[19] = | |
360 | { | |
361 | PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR, | |
362 | LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR, | |
363 | BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR, | |
364 | TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, | |
365 | EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR, | |
366 | }; | |
367 | #define BINOP_LOOKUP(VALUE) \ | |
368 | binop_lookup [((VALUE) - PLUS_TK)% \ | |
369 | (sizeof (binop_lookup) / sizeof (binop_lookup[0]))] | |
370 | ||
5cbdba64 APB |
371 | /* This is the end index for binary operators that can also be used |
372 | in compound assignements. */ | |
373 | #define BINOP_COMPOUND_CANDIDATES 11 | |
374 | ||
8b27f225 PB |
375 | /* Fake WFL used to report error message. It is initialized once if |
376 | needed and reused with it's location information is overriden. */ | |
12472854 | 377 | tree wfl_operator = NULL_TREE; |
8b27f225 PB |
378 | |
379 | /* The "$L" identifier we use to create labels. */ | |
380 | static tree label_id = NULL_TREE; | |
381 | ||
382 | /* The "StringBuffer" identifier used for the String `+' operator. */ | |
383 | static tree wfl_string_buffer = NULL_TREE; | |
384 | ||
385 | /* The "append" identifier used for String `+' operator. */ | |
386 | static tree wfl_append = NULL_TREE; | |
387 | ||
388 | /* The "toString" identifier used for String `+' operator. */ | |
389 | static tree wfl_to_string = NULL_TREE; | |
390 | ||
ba179f9f APB |
391 | /* The "java.lang" import qualified name. */ |
392 | static tree java_lang_id = NULL_TREE; | |
393 | ||
09ed0f70 APB |
394 | /* The "java.lang.Cloneable" qualified name. */ |
395 | static tree java_lang_cloneable = NULL_TREE; | |
396 | ||
f099f336 APB |
397 | /* Context and flag for static blocks */ |
398 | static tree current_static_block = NULL_TREE; | |
399 | ||
ee07f4f4 APB |
400 | /* The list of all packages we've seen so far */ |
401 | static tree package_list = NULL_TREE; | |
2884c41e KG |
402 | |
403 | /* Check modifiers. If one doesn't fit, retrieve it in its declaration | |
404 | line and point it out. */ | |
405 | /* Should point out the one that don't fit. ASCII/unicode, going | |
406 | backward. FIXME */ | |
407 | ||
408 | #define check_modifiers(__message, __value, __mask) do { \ | |
409 | if ((__value) & ~(__mask)) \ | |
410 | { \ | |
411 | int i, remainder = (__value) & ~(__mask); \ | |
412 | for (i = 0; i <= 10; i++) \ | |
413 | if ((1 << i) & remainder) \ | |
414 | parse_error_context (ctxp->modifier_ctx [i], (__message), \ | |
415 | java_accstring_lookup (1 << i)); \ | |
416 | } \ | |
417 | } while (0) | |
f099f336 | 418 | |
ee07f4f4 | 419 | |
2884c41e | 420 | #line 346 "./parse.y" |
8b27f225 PB |
421 | typedef union { |
422 | tree node; | |
423 | int sub_token; | |
424 | struct { | |
425 | int token; | |
426 | int location; | |
427 | } operator; | |
428 | int value; | |
429 | } YYSTYPE; | |
2884c41e | 430 | #line 356 "./parse.y" |
9ee9b555 KG |
431 | |
432 | #include "lex.c" | |
8b27f225 PB |
433 | #ifndef YYDEBUG |
434 | #define YYDEBUG 1 | |
435 | #endif | |
436 | ||
437 | #include <stdio.h> | |
438 | ||
439 | #ifndef __cplusplus | |
440 | #ifndef __STDC__ | |
441 | #define const | |
442 | #endif | |
443 | #endif | |
444 | ||
445 | ||
446 | ||
2884c41e | 447 | #define YYFINAL 777 |
8b27f225 PB |
448 | #define YYFLAG -32768 |
449 | #define YYNTBASE 110 | |
450 | ||
518f173d | 451 | #define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 267) |
8b27f225 PB |
452 | |
453 | static const char yytranslate[] = { 0, | |
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, 2, 2, 2, 2, 2, | |
465 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
466 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
467 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
468 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
469 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
470 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
471 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
472 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
473 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
474 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
475 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
476 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
477 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
478 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
518f173d APB |
479 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, |
480 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | |
481 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, | |
482 | 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, | |
483 | 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, | |
484 | 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, | |
485 | 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, | |
486 | 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, | |
487 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, | |
488 | 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, | |
489 | 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, | |
490 | 107, 108, 109 | |
8b27f225 PB |
491 | }; |
492 | ||
493 | #if YYDEBUG != 0 | |
494 | static const short yyprhs[] = { 0, | |
495 | 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, | |
496 | 20, 22, 24, 26, 28, 30, 32, 34, 38, 42, | |
497 | 46, 50, 54, 56, 58, 60, 64, 66, 67, 69, | |
498 | 71, 73, 76, 79, 82, 86, 88, 91, 93, 96, | |
499 | 100, 103, 107, 109, 111, 115, 118, 122, 128, 133, | |
500 | 139, 141, 143, 145, 147, 149, 152, 153, 161, 162, | |
501 | 169, 173, 176, 180, 185, 186, 189, 193, 196, 197, | |
502 | 200, 203, 205, 209, 213, 216, 220, 222, 225, 227, | |
0b4d333e APB |
503 | 229, 231, 233, 235, 238, 240, 242, 244, 248, 253, |
504 | 255, 259, 263, 265, 269, 273, 278, 280, 284, 287, | |
505 | 291, 295, 297, 299, 300, 304, 307, 311, 315, 320, | |
506 | 325, 328, 332, 335, 339, 342, 346, 351, 355, 359, | |
2884c41e KG |
507 | 363, 365, 369, 373, 376, 380, 383, 387, 389, 390, |
508 | 393, 396, 398, 402, 406, 408, 411, 413, 416, 420, | |
509 | 422, 423, 427, 430, 434, 438, 443, 446, 450, 454, | |
510 | 459, 461, 464, 469, 475, 483, 490, 492, 494, 495, | |
511 | 500, 501, 507, 508, 514, 515, 522, 526, 531, 534, | |
512 | 538, 541, 545, 548, 552, 554, 557, 559, 561, 563, | |
513 | 565, 567, 570, 573, 576, 580, 585, 587, 591, 595, | |
514 | 598, 602, 604, 606, 608, 611, 613, 615, 617, 620, | |
515 | 623, 627, 629, 631, 633, 635, 637, 639, 641, 643, | |
2e5eb5c5 | 516 | 645, 647, 649, 651, 653, 655, 657, 659, 661, 663, |
2884c41e KG |
517 | 665, 667, 669, 671, 673, 676, 679, 682, 685, 688, |
518 | 691, 694, 697, 701, 706, 711, 717, 722, 728, 735, | |
519 | 743, 750, 752, 754, 756, 758, 760, 762, 764, 770, | |
520 | 773, 777, 782, 790, 798, 799, 803, 808, 811, 815, | |
521 | 821, 824, 828, 832, 837, 839, 842, 845, 847, 850, | |
522 | 854, 857, 860, 864, 867, 872, 875, 878, 882, 887, | |
523 | 890, 892, 900, 908, 915, 919, 925, 930, 938, 945, | |
524 | 948, 951, 955, 958, 959, 961, 963, 966, 967, 969, | |
525 | 971, 975, 979, 982, 986, 989, 993, 996, 1000, 1003, | |
526 | 1007, 1010, 1014, 1017, 1021, 1025, 1028, 1032, 1038, 1044, | |
527 | 1047, 1052, 1056, 1058, 1062, 1066, 1071, 1074, 1076, 1079, | |
528 | 1082, 1087, 1090, 1094, 1099, 1102, 1105, 1107, 1109, 1111, | |
529 | 1113, 1117, 1119, 1121, 1123, 1125, 1129, 1133, 1137, 1141, | |
530 | 1145, 1149, 1153, 1157, 1163, 1168, 1175, 1181, 1186, 1192, | |
531 | 1198, 1205, 1209, 1213, 1218, 1224, 1227, 1231, 1235, 1239, | |
532 | 1241, 1245, 1249, 1253, 1257, 1262, 1267, 1272, 1277, 1281, | |
533 | 1285, 1287, 1290, 1294, 1298, 1301, 1304, 1308, 1312, 1316, | |
534 | 1320, 1323, 1327, 1332, 1338, 1345, 1351, 1358, 1363, 1368, | |
535 | 1373, 1378, 1382, 1387, 1391, 1396, 1398, 1400, 1402, 1404, | |
536 | 1407, 1410, 1412, 1414, 1417, 1420, 1422, 1425, 1428, 1431, | |
537 | 1434, 1437, 1440, 1442, 1445, 1448, 1450, 1453, 1456, 1462, | |
538 | 1467, 1472, 1478, 1483, 1486, 1492, 1497, 1503, 1505, 1509, | |
539 | 1513, 1517, 1521, 1525, 1529, 1531, 1535, 1539, 1543, 1547, | |
540 | 1549, 1553, 1557, 1561, 1565, 1569, 1573, 1575, 1579, 1583, | |
541 | 1587, 1591, 1595, 1599, 1603, 1607, 1611, 1615, 1617, 1621, | |
542 | 1625, 1629, 1633, 1635, 1639, 1643, 1645, 1649, 1653, 1655, | |
543 | 1659, 1663, 1665, 1669, 1673, 1675, 1679, 1683, 1685, 1691, | |
544 | 1696, 1700, 1706, 1708, 1710, 1714, 1718, 1720, 1722, 1724, | |
545 | 1726, 1728, 1730 | |
8b27f225 PB |
546 | }; |
547 | ||
548 | static const short yyrhs[] = { 123, | |
549 | 0, 104, 0, 105, 0, 108, 0, 103, 0, 102, | |
550 | 0, 109, 0, 113, 0, 114, 0, 82, 0, 85, | |
551 | 0, 50, 0, 115, 0, 118, 0, 119, 0, 115, | |
552 | 0, 115, 0, 113, 97, 98, 0, 119, 97, 98, | |
553 | 0, 118, 97, 98, 0, 113, 97, 1, 0, 118, | |
554 | 97, 1, 0, 120, 0, 121, 0, 122, 0, 119, | |
555 | 101, 122, 0, 86, 0, 0, 126, 0, 124, 0, | |
556 | 125, 0, 126, 124, 0, 126, 125, 0, 124, 125, | |
557 | 0, 126, 124, 125, 0, 127, 0, 124, 127, 0, | |
558 | 130, 0, 125, 130, 0, 75, 119, 99, 0, 75, | |
559 | 1, 0, 75, 119, 1, 0, 128, 0, 129, 0, | |
560 | 55, 119, 99, 0, 55, 1, 0, 55, 119, 1, | |
561 | 0, 55, 119, 101, 5, 99, 0, 55, 119, 101, | |
562 | 1, 0, 55, 119, 101, 5, 1, 0, 132, 0, | |
2884c41e | 563 | 167, 0, 99, 0, 1, 0, 44, 0, 131, 44, |
8b27f225 PB |
564 | 0, 0, 131, 67, 122, 135, 136, 133, 138, 0, |
565 | 0, 67, 122, 135, 136, 134, 138, 0, 131, 67, | |
566 | 1, 0, 67, 1, 0, 67, 122, 1, 0, 131, | |
567 | 67, 122, 1, 0, 0, 63, 116, 0, 63, 116, | |
568 | 1, 0, 63, 1, 0, 0, 52, 137, 0, 52, | |
569 | 1, 0, 117, 0, 137, 100, 117, 0, 137, 100, | |
570 | 1, 0, 95, 96, 0, 95, 139, 96, 0, 140, | |
2884c41e KG |
571 | 0, 139, 140, 0, 141, 0, 157, 0, 159, 0, |
572 | 180, 0, 142, 0, 142, 99, 0, 147, 0, 132, | |
573 | 0, 167, 0, 112, 143, 99, 0, 131, 112, 143, | |
0b4d333e APB |
574 | 99, 0, 144, 0, 143, 100, 144, 0, 143, 100, |
575 | 1, 0, 145, 0, 145, 92, 146, 0, 145, 92, | |
576 | 1, 0, 145, 92, 146, 1, 0, 122, 0, 145, | |
577 | 97, 98, 0, 122, 1, 0, 145, 97, 1, 0, | |
2884c41e KG |
578 | 145, 98, 1, 0, 265, 0, 178, 0, 0, 149, |
579 | 148, 156, 0, 149, 1, 0, 112, 150, 154, 0, | |
580 | 59, 150, 154, 0, 131, 112, 150, 154, 0, 131, | |
581 | 59, 150, 154, 0, 112, 1, 0, 131, 112, 1, | |
0b4d333e APB |
582 | 0, 59, 1, 0, 131, 59, 1, 0, 131, 1, |
583 | 0, 122, 93, 94, 0, 122, 93, 151, 94, 0, | |
584 | 150, 97, 98, 0, 122, 93, 1, 0, 150, 97, | |
585 | 1, 0, 152, 0, 151, 100, 152, 0, 151, 100, | |
2884c41e KG |
586 | 1, 0, 112, 145, 0, 153, 112, 145, 0, 112, |
587 | 1, 0, 153, 112, 1, 0, 131, 0, 0, 53, | |
588 | 155, 0, 53, 1, 0, 116, 0, 155, 100, 116, | |
589 | 0, 155, 100, 1, 0, 180, 0, 180, 99, 0, | |
590 | 99, 0, 158, 180, 0, 158, 180, 99, 0, 44, | |
591 | 0, 0, 161, 160, 163, 0, 162, 154, 0, 131, | |
592 | 162, 154, 0, 120, 93, 94, 0, 120, 93, 151, | |
593 | 94, 0, 181, 164, 0, 181, 165, 164, 0, 181, | |
594 | 183, 164, 0, 181, 165, 183, 164, 0, 182, 0, | |
595 | 182, 99, 0, 166, 93, 94, 99, 0, 166, 93, | |
596 | 234, 94, 99, 0, 119, 101, 65, 93, 234, 94, | |
597 | 99, 0, 119, 101, 65, 93, 94, 99, 0, 76, | |
598 | 0, 65, 0, 0, 61, 122, 168, 173, 0, 0, | |
599 | 131, 61, 122, 169, 173, 0, 0, 61, 122, 172, | |
600 | 170, 173, 0, 0, 131, 61, 122, 172, 171, 173, | |
601 | 0, 61, 122, 1, 0, 131, 61, 122, 1, 0, | |
602 | 63, 117, 0, 172, 100, 117, 0, 63, 1, 0, | |
603 | 172, 100, 1, 0, 95, 96, 0, 95, 174, 96, | |
604 | 0, 175, 0, 174, 175, 0, 176, 0, 177, 0, | |
605 | 132, 0, 167, 0, 142, 0, 149, 99, 0, 149, | |
606 | 1, 0, 95, 96, 0, 95, 179, 96, 0, 95, | |
607 | 179, 100, 96, 0, 146, 0, 179, 100, 146, 0, | |
608 | 179, 100, 1, 0, 95, 96, 0, 181, 183, 182, | |
609 | 0, 95, 0, 96, 0, 184, 0, 183, 184, 0, | |
610 | 185, 0, 187, 0, 132, 0, 186, 99, 0, 112, | |
a003f638 | 611 | 143, 0, 153, 112, 143, 0, 189, 0, 192, 0, |
2884c41e KG |
612 | 196, 0, 197, 0, 208, 0, 212, 0, 189, 0, |
613 | 193, 0, 198, 0, 209, 0, 213, 0, 180, 0, | |
614 | 190, 0, 194, 0, 199, 0, 211, 0, 219, 0, | |
615 | 220, 0, 221, 0, 223, 0, 222, 0, 225, 0, | |
616 | 99, 0, 122, 88, 0, 191, 187, 0, 122, 1, | |
617 | 0, 191, 188, 0, 195, 99, 0, 1, 99, 0, | |
618 | 1, 95, 0, 1, 96, 0, 166, 93, 1, 0, | |
619 | 166, 93, 94, 1, 0, 166, 93, 234, 1, 0, | |
620 | 166, 93, 234, 94, 1, 0, 119, 101, 65, 1, | |
621 | 0, 119, 101, 65, 93, 1, 0, 119, 101, 65, | |
622 | 93, 234, 1, 0, 119, 101, 65, 93, 234, 94, | |
623 | 1, 0, 119, 101, 65, 93, 94, 1, 0, 262, | |
624 | 0, 246, 0, 247, 0, 243, 0, 244, 0, 240, | |
625 | 0, 232, 0, 48, 93, 265, 94, 187, 0, 48, | |
626 | 1, 0, 48, 93, 1, 0, 48, 93, 265, 1, | |
627 | 0, 48, 93, 265, 94, 188, 56, 187, 0, 48, | |
628 | 93, 265, 94, 188, 56, 188, 0, 0, 201, 200, | |
629 | 202, 0, 68, 93, 265, 94, 0, 68, 1, 0, | |
630 | 68, 93, 1, 0, 68, 93, 265, 94, 1, 0, | |
631 | 95, 96, 0, 95, 205, 96, 0, 95, 203, 96, | |
632 | 0, 95, 203, 205, 96, 0, 204, 0, 203, 204, | |
633 | 0, 205, 183, 0, 206, 0, 205, 206, 0, 62, | |
634 | 266, 88, 0, 47, 88, 0, 62, 1, 0, 62, | |
635 | 266, 1, 0, 47, 1, 0, 66, 93, 265, 94, | |
636 | 0, 207, 187, 0, 66, 1, 0, 66, 93, 1, | |
637 | 0, 66, 93, 265, 1, 0, 207, 188, 0, 51, | |
638 | 0, 210, 187, 66, 93, 265, 94, 99, 0, 215, | |
639 | 99, 265, 99, 217, 94, 187, 0, 215, 99, 99, | |
640 | 217, 94, 187, 0, 215, 99, 1, 0, 215, 99, | |
641 | 265, 99, 1, 0, 215, 99, 99, 1, 0, 215, | |
642 | 99, 265, 99, 217, 94, 188, 0, 215, 99, 99, | |
643 | 217, 94, 188, 0, 71, 93, 0, 71, 1, 0, | |
644 | 71, 93, 1, 0, 214, 216, 0, 0, 218, 0, | |
645 | 186, 0, 218, 1, 0, 0, 218, 0, 195, 0, | |
646 | 218, 100, 195, 0, 218, 100, 1, 0, 54, 99, | |
647 | 0, 54, 122, 99, 0, 54, 1, 0, 54, 122, | |
648 | 1, 0, 73, 99, 0, 73, 122, 99, 0, 73, | |
649 | 1, 0, 73, 122, 1, 0, 58, 99, 0, 58, | |
650 | 265, 99, 0, 58, 1, 0, 58, 265, 1, 0, | |
651 | 49, 265, 99, 0, 49, 1, 0, 49, 265, 1, | |
652 | 0, 224, 93, 265, 94, 180, 0, 224, 93, 265, | |
653 | 94, 1, 0, 224, 1, 0, 224, 93, 1, 94, | |
654 | 0, 224, 93, 1, 0, 131, 0, 70, 180, 226, | |
655 | 0, 70, 180, 229, 0, 70, 180, 226, 229, 0, | |
656 | 70, 1, 0, 227, 0, 226, 227, 0, 228, 180, | |
657 | 0, 60, 93, 152, 94, 0, 60, 1, 0, 60, | |
658 | 93, 1, 0, 60, 93, 1, 94, 0, 64, 180, | |
659 | 0, 64, 1, 0, 231, 0, 235, 0, 111, 0, | |
660 | 76, 0, 93, 265, 94, 0, 232, 0, 239, 0, | |
661 | 240, 0, 241, 0, 119, 101, 67, 0, 113, 101, | |
662 | 67, 0, 59, 101, 67, 0, 119, 101, 76, 0, | |
663 | 93, 265, 1, 0, 119, 101, 1, 0, 113, 101, | |
664 | 1, 0, 59, 101, 1, 0, 72, 116, 93, 234, | |
665 | 94, 0, 72, 116, 93, 94, 0, 72, 116, 93, | |
666 | 234, 94, 138, 0, 72, 116, 93, 94, 138, 0, | |
667 | 233, 122, 93, 94, 0, 233, 122, 93, 94, 138, | |
668 | 0, 233, 122, 93, 234, 94, 0, 233, 122, 93, | |
669 | 234, 94, 138, 0, 72, 1, 99, 0, 72, 116, | |
670 | 1, 0, 72, 116, 93, 1, 0, 72, 116, 93, | |
671 | 234, 1, 0, 233, 1, 0, 233, 122, 1, 0, | |
672 | 119, 101, 72, 0, 230, 101, 72, 0, 265, 0, | |
673 | 234, 100, 265, 0, 234, 100, 1, 0, 72, 113, | |
674 | 236, 0, 72, 115, 236, 0, 72, 113, 236, 238, | |
675 | 0, 72, 115, 236, 238, 0, 72, 115, 238, 178, | |
676 | 0, 72, 113, 238, 178, 0, 72, 1, 98, 0, | |
677 | 72, 1, 97, 0, 237, 0, 236, 237, 0, 97, | |
678 | 265, 98, 0, 97, 265, 1, 0, 97, 1, 0, | |
679 | 97, 98, 0, 238, 97, 98, 0, 238, 97, 1, | |
680 | 0, 230, 101, 122, 0, 65, 101, 122, 0, 65, | |
681 | 1, 0, 119, 93, 94, 0, 119, 93, 234, 94, | |
682 | 0, 230, 101, 122, 93, 94, 0, 230, 101, 122, | |
683 | 93, 234, 94, 0, 65, 101, 122, 93, 94, 0, | |
684 | 65, 101, 122, 93, 234, 94, 0, 65, 101, 1, | |
685 | 94, 0, 65, 101, 1, 101, 0, 119, 97, 265, | |
686 | 98, 0, 231, 97, 265, 98, 0, 119, 97, 1, | |
687 | 0, 119, 97, 265, 1, 0, 231, 97, 1, 0, | |
688 | 231, 97, 265, 1, 0, 230, 0, 119, 0, 243, | |
689 | 0, 244, 0, 242, 46, 0, 242, 45, 0, 246, | |
690 | 0, 247, 0, 3, 245, 0, 4, 245, 0, 248, | |
691 | 0, 3, 1, 0, 4, 1, 0, 46, 245, 0, | |
692 | 46, 1, 0, 45, 245, 0, 45, 1, 0, 242, | |
693 | 0, 89, 245, 0, 90, 245, 0, 249, 0, 89, | |
694 | 1, 0, 90, 1, 0, 93, 113, 238, 94, 245, | |
695 | 0, 93, 113, 94, 245, 0, 93, 265, 94, 248, | |
696 | 0, 93, 119, 238, 94, 248, 0, 93, 113, 97, | |
697 | 1, 0, 93, 1, 0, 93, 113, 238, 94, 1, | |
698 | 0, 93, 113, 94, 1, 0, 93, 119, 238, 94, | |
699 | 1, 0, 245, 0, 250, 5, 245, 0, 250, 6, | |
700 | 245, 0, 250, 7, 245, 0, 250, 5, 1, 0, | |
701 | 250, 6, 1, 0, 250, 7, 1, 0, 250, 0, | |
702 | 251, 3, 250, 0, 251, 4, 250, 0, 251, 3, | |
703 | 1, 0, 251, 4, 1, 0, 251, 0, 252, 8, | |
704 | 251, 0, 252, 9, 251, 0, 252, 10, 251, 0, | |
705 | 252, 8, 1, 0, 252, 9, 1, 0, 252, 10, | |
706 | 1, 0, 252, 0, 253, 20, 252, 0, 253, 18, | |
707 | 252, 0, 253, 21, 252, 0, 253, 19, 252, 0, | |
708 | 253, 57, 114, 0, 253, 20, 1, 0, 253, 18, | |
709 | 1, 0, 253, 21, 1, 0, 253, 19, 1, 0, | |
710 | 253, 57, 1, 0, 253, 0, 254, 16, 253, 0, | |
711 | 254, 17, 253, 0, 254, 16, 1, 0, 254, 17, | |
712 | 1, 0, 254, 0, 255, 11, 254, 0, 255, 11, | |
713 | 1, 0, 255, 0, 256, 12, 255, 0, 256, 12, | |
714 | 1, 0, 256, 0, 257, 13, 256, 0, 257, 13, | |
715 | 1, 0, 257, 0, 258, 14, 257, 0, 258, 14, | |
716 | 1, 0, 258, 0, 259, 15, 258, 0, 259, 15, | |
717 | 1, 0, 259, 0, 259, 87, 265, 88, 260, 0, | |
718 | 259, 87, 88, 1, 0, 259, 87, 1, 0, 259, | |
719 | 87, 265, 88, 1, 0, 260, 0, 262, 0, 263, | |
720 | 264, 261, 0, 263, 264, 1, 0, 119, 0, 239, | |
721 | 0, 241, 0, 91, 0, 92, 0, 261, 0, 265, | |
722 | 0 | |
8b27f225 PB |
723 | }; |
724 | ||
725 | #endif | |
726 | ||
727 | #if YYDEBUG != 0 | |
728 | static const short yyrline[] = { 0, | |
2884c41e KG |
729 | 500, 506, 508, 509, 510, 511, 512, 516, 518, 521, |
730 | 523, 524, 527, 529, 532, 536, 540, 544, 550, 552, | |
731 | 554, 556, 561, 563, 566, 570, 575, 580, 582, 583, | |
732 | 584, 585, 586, 587, 588, 591, 596, 602, 604, 607, | |
733 | 613, 615, 619, 621, 624, 651, 653, 657, 670, 672, | |
734 | 676, 683, 688, 690, 700, 705, 720, 724, 727, 730, | |
735 | 733, 735, 737, 742, 746, 748, 750, 752, 756, 758, | |
736 | 760, 767, 773, 778, 782, 791, 801, 803, 806, 808, | |
737 | 809, 810, 814, 816, 818, 819, 821, 826, 829, 839, | |
738 | 842, 844, 848, 851, 858, 864, 872, 874, 876, 878, | |
739 | 880, 884, 886, 890, 897, 898, 902, 905, 907, 909, | |
740 | 911, 916, 918, 920, 922, 929, 932, 934, 943, 945, | |
f8989a66 APB |
741 | 949, 954, 959, 963, 968, 973, 978, 985, 995, 997, |
742 | 999, 1003, 1006, 1008, 1012, 1014, 1015, 1020, 1026, 1033, | |
743 | 1041, 1048, 1051, 1054, 1058, 1061, 1065, 1074, 1076, 1078, | |
744 | 1082, 1084, 1087, 1094, 1102, 1104, 1108, 1115, 1125, 1129, | |
745 | 1132, 1135, 1138, 1141, 1144, 1147, 1150, 1152, 1156, 1162, | |
746 | 1167, 1169, 1173, 1176, 1180, 1182, 1185, 1187, 1188, 1190, | |
747 | 1194, 1198, 1204, 1209, 1212, 1214, 1218, 1224, 1228, 1233, | |
748 | 1242, 1246, 1251, 1263, 1265, 1268, 1270, 1272, 1276, 1280, | |
749 | 1283, 1287, 1289, 1290, 1291, 1292, 1293, 1297, 1299, 1300, | |
750 | 1301, 1302, 1306, 1308, 1309, 1310, 1311, 1312, 1313, 1314, | |
751 | 1315, 1316, 1317, 1320, 1325, 1336, 1339, 1343, 1350, 1360, | |
752 | 1366, 1372, 1378, 1380, 1385, 1387, 1392, 1394, 1396, 1398, | |
753 | 1400, 1404, 1406, 1407, 1408, 1409, 1410, 1411, 1414, 1420, | |
754 | 1422, 1424, 1428, 1433, 1438, 1444, 1454, 1460, 1462, 1464, | |
755 | 1471, 1474, 1476, 1478, 1482, 1484, 1487, 1491, 1493, 1496, | |
756 | 1503, 1509, 1511, 1513, 1517, 1525, 1528, 1530, 1532, 1536, | |
757 | 1541, 1550, 1555, 1558, 1565, 1567, 1569, 1573, 1576, 1585, | |
758 | 1592, 1594, 1598, 1611, 1613, 1619, 1625, 1629, 1631, 1635, | |
759 | 1638, 1640, 1644, 1647, 1649, 1651, 1655, 1658, 1660, 1662, | |
760 | 1666, 1669, 1671, 1673, 1677, 1683, 1685, 1689, 1696, 1698, | |
761 | 1700, 1702, 1706, 1718, 1721, 1723, 1728, 1732, 1734, 1741, | |
762 | 1749, 1766, 1768, 1773, 1777, 1780, 1785, 1787, 1790, 1792, | |
763 | 1794, 1796, 1797, 1798, 1799, 1803, 1805, 1807, 1812, 1814, | |
764 | 1816, 1818, 1820, 1824, 1827, 1832, 1834, 1839, 1840, 1841, | |
765 | 1842, 1843, 1845, 1847, 1849, 1851, 1853, 1857, 1859, 1862, | |
766 | 1868, 1873, 1877, 1880, 1882, 1884, 1888, 1890, 1892, 1894, | |
767 | 1898, 1901, 1905, 1911, 1913, 1921, 1948, 1950, 1954, 1959, | |
768 | 1966, 1970, 1973, 1975, 1986, 1997, 2002, 2011, 2013, 2017, | |
769 | 2020, 2022, 2027, 2032, 2037, 2044, 2046, 2047, 2048, 2051, | |
770 | 2056, 2061, 2063, 2064, 2066, 2068, 2069, 2071, 2075, 2078, | |
771 | 2082, 2085, 2089, 2091, 2093, 2095, 2096, 2098, 2102, 2111, | |
772 | 2113, 2115, 2128, 2130, 2136, 2138, 2140, 2144, 2146, 2151, | |
773 | 2156, 2161, 2163, 2165, 2169, 2171, 2176, 2181, 2183, 2187, | |
774 | 2189, 2194, 2199, 2204, 2206, 2208, 2212, 2214, 2219, 2224, | |
775 | 2229, 2234, 2236, 2238, 2240, 2242, 2244, 2248, 2250, 2255, | |
776 | 2260, 2262, 2266, 2268, 2273, 2277, 2279, 2284, 2288, 2290, | |
777 | 2295, 2299, 2301, 2306, 2310, 2312, 2317, 2321, 2323, 2328, | |
778 | 2334, 2336, 2340, 2342, 2345, 2348, 2356, 2358, 2359, 2362, | |
779 | 2364, 2367, 2371 | |
8b27f225 PB |
780 | }; |
781 | #endif | |
782 | ||
783 | ||
784 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) | |
785 | ||
786 | static const char * const yytname[] = { "$","error","$undefined.","PLUS_TK", | |
787 | "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK", | |
788 | "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK", | |
789 | "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK", | |
790 | "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK", | |
791 | "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK", | |
792 | "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK", | |
793 | "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK", | |
794 | "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK", | |
795 | "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK", | |
796 | "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK", | |
797 | "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK", | |
798 | "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK", | |
799 | "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK", | |
800 | "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK", | |
801 | "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK", | |
802 | "goal","literal","type","primitive_type","reference_type","class_or_interface_type", | |
803 | "class_type","interface_type","array_type","name","simple_name","qualified_name", | |
804 | "identifier","compilation_unit","import_declarations","type_declarations","package_declaration", | |
805 | "import_declaration","single_type_import_declaration","type_import_on_demand_declaration", | |
806 | "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces", | |
807 | "interface_type_list","class_body","class_body_declarations","class_body_declaration", | |
808 | "class_member_declaration","field_declaration","variable_declarators","variable_declarator", | |
809 | "variable_declarator_id","variable_initializer","method_declaration","@3","method_header", | |
2884c41e KG |
810 | "method_declarator","formal_parameter_list","formal_parameter","final","throws", |
811 | "class_type_list","method_body","static_initializer","static","constructor_declaration", | |
812 | "@4","constructor_header","constructor_declarator","constructor_body","constructor_block_end", | |
813 | "explicit_constructor_invocation","this_or_super","interface_declaration","@5", | |
814 | "@6","@7","@8","extends_interfaces","interface_body","interface_member_declarations", | |
815 | "interface_member_declaration","constant_declaration","abstract_method_declaration", | |
816 | "array_initializer","variable_initializers","block","block_begin","block_end", | |
817 | "block_statements","block_statement","local_variable_declaration_statement", | |
22eed1e6 APB |
818 | "local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement", |
819 | "empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement", | |
8b27f225 | 820 | "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi", |
12472854 PB |
821 | "switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups", |
822 | "switch_block_statement_group","switch_labels","switch_label","while_expression", | |
823 | "while_statement","while_statement_nsi","do_statement_begin","do_statement", | |
824 | "for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update", | |
825 | "statement_expression_list","break_statement","continue_statement","return_statement", | |
826 | "throw_statement","synchronized_statement","synchronized","try_statement","catches", | |
827 | "catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array", | |
828 | "class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression", | |
829 | "dim_exprs","dim_expr","dims","field_access","method_invocation","array_access", | |
830 | "postfix_expression","post_increment_expression","post_decrement_expression", | |
831 | "unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus", | |
832 | "cast_expression","multiplicative_expression","additive_expression","shift_expression", | |
833 | "relational_expression","equality_expression","and_expression","exclusive_or_expression", | |
834 | "inclusive_or_expression","conditional_and_expression","conditional_or_expression", | |
835 | "conditional_expression","assignment_expression","assignment","left_hand_side", | |
836 | "assignment_operator","expression","constant_expression", NULL | |
8b27f225 PB |
837 | }; |
838 | #endif | |
839 | ||
840 | static const short yyr1[] = { 0, | |
841 | 110, 111, 111, 111, 111, 111, 111, 112, 112, 113, | |
842 | 113, 113, 114, 114, 115, 116, 117, 118, 118, 118, | |
843 | 118, 118, 119, 119, 120, 121, 122, 123, 123, 123, | |
844 | 123, 123, 123, 123, 123, 124, 124, 125, 125, 126, | |
845 | 126, 126, 127, 127, 128, 128, 128, 129, 129, 129, | |
846 | 130, 130, 130, 130, 131, 131, 133, 132, 134, 132, | |
847 | 132, 132, 132, 132, 135, 135, 135, 135, 136, 136, | |
848 | 136, 137, 137, 137, 138, 138, 139, 139, 140, 140, | |
0b4d333e APB |
849 | 140, 140, 141, 141, 141, 141, 141, 142, 142, 143, |
850 | 143, 143, 144, 144, 144, 144, 145, 145, 145, 145, | |
851 | 145, 146, 146, 148, 147, 147, 149, 149, 149, 149, | |
852 | 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, | |
2884c41e KG |
853 | 151, 151, 151, 152, 152, 152, 152, 153, 154, 154, |
854 | 154, 155, 155, 155, 156, 156, 156, 157, 157, 158, | |
855 | 160, 159, 161, 161, 162, 162, 163, 163, 163, 163, | |
856 | 164, 164, 165, 165, 165, 165, 166, 166, 168, 167, | |
857 | 169, 167, 170, 167, 171, 167, 167, 167, 172, 172, | |
858 | 172, 172, 173, 173, 174, 174, 175, 175, 175, 175, | |
859 | 176, 177, 177, 178, 178, 178, 179, 179, 179, 180, | |
860 | 180, 181, 182, 183, 183, 184, 184, 184, 185, 186, | |
861 | 186, 187, 187, 187, 187, 187, 187, 188, 188, 188, | |
862 | 188, 188, 189, 189, 189, 189, 189, 189, 189, 189, | |
863 | 189, 189, 189, 190, 191, 192, 192, 193, 194, 194, | |
864 | 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, | |
865 | 194, 195, 195, 195, 195, 195, 195, 195, 196, 196, | |
866 | 196, 196, 197, 198, 200, 199, 201, 201, 201, 201, | |
867 | 202, 202, 202, 202, 203, 203, 204, 205, 205, 206, | |
868 | 206, 206, 206, 206, 207, 208, 208, 208, 208, 209, | |
869 | 210, 211, 212, 212, 212, 212, 212, 213, 213, 214, | |
870 | 214, 214, 215, 216, 216, 216, 216, 217, 217, 218, | |
871 | 218, 218, 219, 219, 219, 219, 220, 220, 220, 220, | |
872 | 221, 221, 221, 221, 222, 222, 222, 223, 223, 223, | |
873 | 223, 223, 224, 225, 225, 225, 225, 226, 226, 227, | |
874 | 228, 228, 228, 228, 229, 229, 230, 230, 231, 231, | |
875 | 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, | |
876 | 231, 231, 231, 232, 232, 232, 232, 232, 232, 232, | |
877 | 232, 232, 232, 232, 232, 232, 232, 233, 233, 234, | |
878 | 234, 234, 235, 235, 235, 235, 235, 235, 235, 235, | |
879 | 236, 236, 237, 237, 237, 238, 238, 238, 239, 239, | |
880 | 239, 240, 240, 240, 240, 240, 240, 240, 240, 241, | |
881 | 241, 241, 241, 241, 241, 242, 242, 242, 242, 243, | |
882 | 244, 245, 245, 245, 245, 245, 245, 245, 246, 246, | |
883 | 247, 247, 248, 248, 248, 248, 248, 248, 249, 249, | |
884 | 249, 249, 249, 249, 249, 249, 249, 250, 250, 250, | |
885 | 250, 250, 250, 250, 251, 251, 251, 251, 251, 252, | |
2e5eb5c5 | 886 | 252, 252, 252, 252, 252, 252, 253, 253, 253, 253, |
2884c41e KG |
887 | 253, 253, 253, 253, 253, 253, 253, 254, 254, 254, |
888 | 254, 254, 255, 255, 255, 256, 256, 256, 257, 257, | |
889 | 257, 258, 258, 258, 259, 259, 259, 260, 260, 260, | |
890 | 260, 260, 261, 261, 262, 262, 263, 263, 263, 264, | |
891 | 264, 265, 266 | |
8b27f225 PB |
892 | }; |
893 | ||
894 | static const short yyr2[] = { 0, | |
895 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
896 | 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, | |
897 | 3, 3, 1, 1, 1, 3, 1, 0, 1, 1, | |
898 | 1, 2, 2, 2, 3, 1, 2, 1, 2, 3, | |
899 | 2, 3, 1, 1, 3, 2, 3, 5, 4, 5, | |
900 | 1, 1, 1, 1, 1, 2, 0, 7, 0, 6, | |
901 | 3, 2, 3, 4, 0, 2, 3, 2, 0, 2, | |
902 | 2, 1, 3, 3, 2, 3, 1, 2, 1, 1, | |
0b4d333e APB |
903 | 1, 1, 1, 2, 1, 1, 1, 3, 4, 1, |
904 | 3, 3, 1, 3, 3, 4, 1, 3, 2, 3, | |
905 | 3, 1, 1, 0, 3, 2, 3, 3, 4, 4, | |
906 | 2, 3, 2, 3, 2, 3, 4, 3, 3, 3, | |
2884c41e KG |
907 | 1, 3, 3, 2, 3, 2, 3, 1, 0, 2, |
908 | 2, 1, 3, 3, 1, 2, 1, 2, 3, 1, | |
909 | 0, 3, 2, 3, 3, 4, 2, 3, 3, 4, | |
910 | 1, 2, 4, 5, 7, 6, 1, 1, 0, 4, | |
911 | 0, 5, 0, 5, 0, 6, 3, 4, 2, 3, | |
912 | 2, 3, 2, 3, 1, 2, 1, 1, 1, 1, | |
913 | 1, 2, 2, 2, 3, 4, 1, 3, 3, 2, | |
914 | 3, 1, 1, 1, 2, 1, 1, 1, 2, 2, | |
915 | 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
8b27f225 | 916 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
2884c41e KG |
917 | 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, |
918 | 2, 2, 3, 4, 4, 5, 4, 5, 6, 7, | |
919 | 6, 1, 1, 1, 1, 1, 1, 1, 5, 2, | |
920 | 3, 4, 7, 7, 0, 3, 4, 2, 3, 5, | |
921 | 2, 3, 3, 4, 1, 2, 2, 1, 2, 3, | |
922 | 2, 2, 3, 2, 4, 2, 2, 3, 4, 2, | |
923 | 1, 7, 7, 6, 3, 5, 4, 7, 6, 2, | |
924 | 2, 3, 2, 0, 1, 1, 2, 0, 1, 1, | |
925 | 3, 3, 2, 3, 2, 3, 2, 3, 2, 3, | |
926 | 2, 3, 2, 3, 3, 2, 3, 5, 5, 2, | |
927 | 4, 3, 1, 3, 3, 4, 2, 1, 2, 2, | |
928 | 4, 2, 3, 4, 2, 2, 1, 1, 1, 1, | |
929 | 3, 1, 1, 1, 1, 3, 3, 3, 3, 3, | |
930 | 3, 3, 3, 5, 4, 6, 5, 4, 5, 5, | |
931 | 6, 3, 3, 4, 5, 2, 3, 3, 3, 1, | |
932 | 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, | |
933 | 1, 2, 3, 3, 2, 2, 3, 3, 3, 3, | |
934 | 2, 3, 4, 5, 6, 5, 6, 4, 4, 4, | |
935 | 4, 3, 4, 3, 4, 1, 1, 1, 1, 2, | |
936 | 2, 1, 1, 2, 2, 1, 2, 2, 2, 2, | |
937 | 2, 2, 1, 2, 2, 1, 2, 2, 5, 4, | |
938 | 4, 5, 4, 2, 5, 4, 5, 1, 3, 3, | |
939 | 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, | |
2e5eb5c5 | 940 | 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, |
2884c41e KG |
941 | 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, |
942 | 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, | |
943 | 3, 1, 3, 3, 1, 3, 3, 1, 5, 4, | |
944 | 3, 5, 1, 1, 3, 3, 1, 1, 1, 1, | |
945 | 1, 1, 1 | |
8b27f225 PB |
946 | }; |
947 | ||
948 | static const short yydefact[] = { 0, | |
949 | 54, 55, 0, 0, 0, 0, 53, 1, 0, 0, | |
950 | 0, 36, 43, 44, 38, 0, 51, 52, 46, 27, | |
951 | 0, 23, 24, 25, 0, 62, 0, 41, 0, 0, | |
952 | 37, 39, 0, 0, 56, 0, 0, 47, 45, 0, | |
2884c41e KG |
953 | 167, 0, 0, 163, 63, 0, 69, 42, 40, 0, |
954 | 0, 0, 61, 0, 49, 0, 26, 171, 17, 169, | |
955 | 15, 0, 160, 0, 0, 68, 16, 0, 0, 59, | |
956 | 168, 0, 165, 64, 69, 50, 48, 12, 0, 10, | |
957 | 11, 173, 0, 8, 9, 13, 14, 15, 0, 179, | |
958 | 181, 0, 180, 0, 175, 177, 178, 172, 170, 164, | |
959 | 67, 71, 72, 70, 0, 162, 0, 57, 113, 0, | |
960 | 129, 111, 0, 0, 90, 93, 129, 0, 0, 0, | |
961 | 115, 0, 0, 183, 182, 174, 176, 0, 0, 60, | |
962 | 166, 0, 0, 0, 0, 108, 99, 88, 0, 0, | |
963 | 0, 0, 107, 21, 18, 22, 20, 19, 114, 129, | |
964 | 112, 0, 129, 74, 73, 55, 192, 75, 23, 0, | |
0b4d333e | 965 | 86, 0, 77, 79, 83, 85, 0, 80, 0, 81, |
2884c41e KG |
966 | 141, 129, 87, 82, 0, 58, 119, 116, 0, 128, |
967 | 0, 121, 0, 131, 132, 130, 120, 118, 92, 0, | |
968 | 91, 95, 0, 0, 0, 0, 0, 0, 0, 340, | |
969 | 0, 0, 0, 0, 6, 5, 2, 3, 4, 7, | |
970 | 339, 0, 407, 0, 103, 406, 337, 342, 0, 338, | |
971 | 343, 344, 345, 423, 408, 409, 438, 412, 413, 416, | |
972 | 426, 445, 450, 457, 468, 473, 476, 479, 482, 485, | |
973 | 488, 493, 502, 494, 0, 102, 100, 98, 101, 110, | |
974 | 89, 109, 190, 0, 129, 76, 78, 84, 106, 0, | |
975 | 138, 0, 143, 0, 0, 0, 281, 0, 0, 0, | |
976 | 0, 0, 0, 0, 0, 340, 0, 224, 0, 8, | |
a003f638 JB |
977 | 407, 0, 128, 198, 0, 0, 213, 0, 194, 196, |
978 | 0, 197, 202, 214, 0, 203, 215, 0, 204, 205, | |
979 | 216, 255, 0, 206, 0, 217, 207, 294, 0, 218, | |
980 | 219, 220, 222, 221, 0, 223, 248, 247, 0, 245, | |
981 | 246, 243, 244, 242, 126, 124, 117, 0, 0, 0, | |
982 | 417, 407, 343, 345, 414, 418, 415, 422, 421, 420, | |
983 | 419, 0, 391, 0, 0, 0, 16, 0, 427, 424, | |
984 | 428, 425, 434, 0, 407, 0, 184, 187, 0, 0, | |
985 | 0, 0, 0, 96, 0, 0, 366, 0, 411, 410, | |
8b27f225 | 986 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
2884c41e | 987 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
a003f638 JB |
988 | 0, 500, 501, 0, 145, 0, 144, 137, 105, 135, |
989 | 139, 192, 142, 0, 231, 232, 230, 250, 0, 316, | |
990 | 0, 305, 303, 0, 313, 311, 0, 277, 0, 258, | |
991 | 0, 327, 0, 291, 0, 309, 307, 0, 0, 200, | |
992 | 0, 0, 227, 225, 0, 0, 193, 191, 195, 199, | |
993 | 407, 323, 226, 229, 0, 276, 0, 407, 296, 300, | |
2884c41e KG |
994 | 293, 0, 0, 320, 0, 123, 122, 127, 125, 134, |
995 | 133, 353, 348, 0, 390, 380, 379, 362, 0, 373, | |
996 | 381, 0, 374, 0, 363, 0, 0, 0, 0, 0, | |
997 | 0, 350, 341, 185, 0, 352, 347, 392, 0, 370, | |
998 | 402, 0, 351, 346, 368, 349, 369, 389, 404, 0, | |
999 | 367, 0, 442, 439, 443, 440, 444, 441, 448, 446, | |
1000 | 449, 447, 454, 451, 455, 452, 456, 453, 464, 459, | |
1001 | 466, 461, 463, 458, 465, 460, 467, 0, 462, 471, | |
1002 | 469, 472, 470, 475, 474, 478, 477, 481, 480, 484, | |
1003 | 483, 487, 486, 491, 0, 0, 496, 495, 146, 136, | |
1004 | 407, 147, 0, 0, 151, 0, 251, 0, 317, 315, | |
1005 | 306, 304, 314, 312, 278, 0, 259, 0, 0, 0, | |
1006 | 324, 328, 0, 325, 292, 310, 308, 341, 0, 201, | |
1007 | 233, 0, 0, 0, 256, 0, 297, 0, 285, 0, | |
1008 | 0, 322, 0, 398, 399, 0, 385, 386, 0, 382, | |
1009 | 375, 0, 378, 376, 377, 364, 355, 0, 436, 430, | |
1010 | 433, 0, 0, 431, 189, 186, 188, 393, 0, 403, | |
1011 | 400, 0, 405, 401, 358, 0, 490, 0, 0, 148, | |
1012 | 0, 0, 152, 149, 252, 0, 279, 275, 0, 332, | |
1013 | 0, 336, 335, 329, 326, 330, 237, 0, 234, 235, | |
1014 | 0, 0, 0, 261, 0, 265, 0, 268, 0, 302, | |
1015 | 301, 287, 0, 299, 0, 321, 0, 396, 0, 384, | |
1016 | 383, 388, 387, 357, 365, 354, 435, 429, 437, 432, | |
1017 | 372, 371, 394, 0, 359, 360, 492, 489, 0, 150, | |
1018 | 0, 0, 0, 249, 0, 202, 0, 209, 210, 0, | |
1019 | 211, 212, 0, 260, 333, 0, 238, 0, 0, 236, | |
1020 | 274, 271, 272, 503, 0, 263, 266, 0, 262, 0, | |
1021 | 269, 0, 0, 286, 0, 319, 318, 397, 356, 395, | |
1022 | 361, 0, 153, 0, 0, 0, 228, 280, 0, 334, | |
1023 | 331, 241, 239, 0, 273, 270, 264, 0, 284, 0, | |
1024 | 0, 0, 154, 0, 253, 0, 0, 240, 282, 283, | |
1025 | 156, 0, 0, 0, 0, 155, 0, 0, 0, 0, | |
1026 | 289, 0, 254, 288, 0, 0, 0 | |
8b27f225 PB |
1027 | }; |
1028 | ||
2884c41e KG |
1029 | static const short yydefgoto[] = { 775, |
1030 | 211, 279, 212, 85, 86, 68, 60, 87, 213, 22, | |
8b27f225 | 1031 | 23, 24, 8, 9, 10, 11, 12, 13, 14, 15, |
a003f638 | 1032 | 442, 284, 132, 105, 47, 70, 104, 130, 162, 163, |
2884c41e | 1033 | 164, 91, 114, 115, 116, 214, 166, 260, 92, 111, |
a003f638 JB |
1034 | 181, 182, 285, 136, 186, 399, 168, 169, 170, 262, |
1035 | 171, 172, 403, 552, 553, 286, 18, 43, 72, 65, | |
1036 | 107, 44, 63, 94, 95, 96, 97, 215, 359, 287, | |
1037 | 175, 555, 720, 289, 290, 291, 292, 695, 293, 294, | |
1038 | 295, 296, 698, 297, 298, 299, 300, 699, 301, 445, | |
1039 | 302, 585, 655, 656, 657, 658, 303, 304, 701, 305, | |
1040 | 306, 307, 702, 308, 309, 451, 663, 664, 310, 311, | |
1041 | 312, 313, 314, 315, 316, 571, 572, 573, 574, 216, | |
2884c41e | 1042 | 217, 218, 219, 489, 220, 470, 471, 472, 221, 222, |
2e5eb5c5 APB |
1043 | 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, |
1044 | 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, | |
a003f638 | 1045 | 243, 244, 245, 394, 490, 715 |
8b27f225 PB |
1046 | }; |
1047 | ||
a003f638 JB |
1048 | static const short yypact[] = { 262, |
1049 | -32768,-32768, 332, -48, 389, 476,-32768,-32768, 490, 782, | |
1050 | 645,-32768,-32768,-32768,-32768, 735,-32768,-32768,-32768,-32768, | |
1051 | 16,-32768,-32768,-32768, 183,-32768, 343,-32768, 21, 797, | |
1052 | -32768,-32768, 777, 823,-32768, -48, 508,-32768,-32768, 569, | |
1053 | -32768, 518, -47, -25,-32768, 529, 33,-32768,-32768, -48, | |
1054 | 830, 256,-32768, 486,-32768, 25,-32768,-32768,-32768,-32768, | |
1055 | 112, 1261,-32768, 597, -47,-32768,-32768, 246, 618,-32768, | |
1056 | -32768, -47, -25,-32768, 33,-32768,-32768,-32768, 622,-32768, | |
1057 | -32768,-32768, 635, 126,-32768,-32768, 176, 494, 864,-32768, | |
1058 | -32768, 55,-32768, 1403,-32768,-32768,-32768,-32768,-32768,-32768, | |
1059 | -32768,-32768,-32768, 186, 259,-32768, -47,-32768,-32768, 253, | |
1060 | -1,-32768, 429, 204,-32768, 785, -1, 63, 106, 269, | |
1061 | -32768, 638, 643,-32768,-32768,-32768,-32768, 651, 943,-32768, | |
1062 | -32768, 259, 426, 667, 128,-32768,-32768,-32768, 672, 1447, | |
1063 | 154, 390,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -1, | |
1064 | -32768, 478, -1,-32768,-32768, 315, 319,-32768, 335, 864, | |
1065 | -32768, 1076,-32768,-32768, 336,-32768, 17,-32768, 346,-32768, | |
1066 | -32768, 397,-32768,-32768, 1944,-32768,-32768,-32768, 686, 427, | |
1067 | -26,-32768, 904,-32768,-32768, 385,-32768,-32768,-32768, 300, | |
1068 | -32768,-32768, 2848, 2899, 2964, 3015, 415, 26, 616,-32768, | |
1069 | 3080, 3131, 3196, 5179,-32768,-32768,-32768,-32768,-32768,-32768, | |
1070 | -32768, 424, 940, 40,-32768, 443, 463,-32768, 698,-32768, | |
1071 | 761,-32768, 826, 843,-32768,-32768,-32768,-32768,-32768,-32768, | |
1072 | -32768, 887, 923, 893, 1041, 922, 582, 596, 603, 639, | |
1073 | 6,-32768,-32768,-32768, 860,-32768,-32768,-32768,-32768,-32768, | |
1074 | -32768,-32768,-32768, 932, 397,-32768,-32768,-32768,-32768, 535, | |
1075 | 568, 593,-32768, 491, 341, 3247,-32768, 120, 2152, 7, | |
1076 | 344, 351, 231, 402, 149, 602, 5476,-32768, -48, 633, | |
1077 | 972, 718, 466,-32768, 904, 610,-32768, 1876,-32768,-32768, | |
1078 | 644,-32768,-32768,-32768, 2012,-32768,-32768, 663,-32768,-32768, | |
1079 | -32768,-32768, 2012,-32768, 2012,-32768,-32768, 5527, 676,-32768, | |
1080 | -32768,-32768,-32768,-32768, 412,-32768, 867, 874, 843, 917, | |
1081 | 933,-32768,-32768,-32768,-32768, 899,-32768, 884, 706, 713, | |
1082 | -32768, 187,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, | |
1083 | -32768, 22,-32768, 726, 886, 648, 648, 420,-32768,-32768, | |
1084 | -32768,-32768,-32768, 719, 1031, 94,-32768,-32768, 674, 35, | |
1085 | 5244, 3312, 685,-32768, -39, 3363,-32768, 421,-32768,-32768, | |
1086 | 3428, 3479, 3544, 3595, 3660, 3711, 3776, 3827, 3892, 3943, | |
1087 | 4008, 4059, 813, 4124, 4175, 4240, 4291, 4356, 4407, 4472, | |
1088 | 2203,-32768,-32768, 4523,-32768, 121,-32768,-32768,-32768, 694, | |
1089 | -32768,-32768,-32768, 1876,-32768,-32768,-32768,-32768, 4588,-32768, | |
1090 | 57,-32768,-32768, 77,-32768,-32768, 86,-32768, 4639,-32768, | |
1091 | 4704,-32768, 725,-32768, 1129,-32768,-32768, 87, 217, 700, | |
1092 | 2268, 546,-32768,-32768, -48, 2319,-32768,-32768,-32768,-32768, | |
1093 | 1059, 427,-32768,-32768, 712,-32768, 752, 990,-32768,-32768, | |
1094 | -32768, 48, 2384,-32768, 4755,-32768,-32768,-32768, 899,-32768, | |
1095 | -32768,-32768,-32768, -34, 729,-32768,-32768,-32768, 2435, 648, | |
1096 | -32768, 584, 648, 584,-32768, 2500, 4820, 168, 367, 2551, | |
1097 | 662,-32768, 5552,-32768, 646,-32768,-32768,-32768, 134,-32768, | |
1098 | -32768, 209,-32768,-32768,-32768,-32768,-32768, 732,-32768, 211, | |
1099 | -32768, 5295,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 887, | |
1100 | -32768, 887,-32768, 923,-32768, 923,-32768, 923,-32768, 893, | |
1101 | -32768, 893,-32768, 893,-32768, 893,-32768, 126,-32768,-32768, | |
1102 | 1041,-32768, 1041,-32768, 922,-32768, 582,-32768, 596,-32768, | |
1103 | 603,-32768, 639,-32768, 828, 739,-32768,-32768,-32768,-32768, | |
1104 | 1024,-32768, 1876, 742, 746, 1876,-32768, 295,-32768,-32768, | |
1105 | -32768,-32768,-32768,-32768,-32768, 323,-32768, 754, 430, 254, | |
1106 | 725,-32768, 346,-32768,-32768,-32768,-32768,-32768, 438, 700, | |
1107 | -32768, 849, 68, 361,-32768, 778,-32768, 555,-32768, 5103, | |
1108 | 776, 792, 812,-32768,-32768, 5360,-32768,-32768, 236,-32768, | |
1109 | 818, 240,-32768, 818,-32768,-32768, 259, 89,-32768,-32768, | |
1110 | -32768, 4871, 1702,-32768,-32768,-32768,-32768,-32768, 4936,-32768, | |
1111 | -32768, 5411,-32768,-32768, 259, 171,-32768, 4987, 775,-32768, | |
1112 | 1876, 2616,-32768,-32768,-32768, 2078,-32768,-32768, 255,-32768, | |
1113 | 909,-32768,-32768,-32768,-32768,-32768,-32768, 2667,-32768,-32768, | |
1114 | 920, 13, 5052,-32768, 470,-32768, 1597,-32768, 5476,-32768, | |
1115 | -32768,-32768, 838, 824, 5128,-32768, 260,-32768, 360,-32768, | |
1116 | -32768,-32768,-32768,-32768,-32768, 259,-32768,-32768,-32768,-32768, | |
1117 | -32768,-32768,-32768, 378,-32768, 259,-32768,-32768, 446,-32768, | |
1118 | 108, 103, 468,-32768, 880, 891, 2078,-32768,-32768, 2078, | |
1119 | -32768,-32768, 844,-32768, 863, 866,-32768, 973, 131,-32768, | |
1120 | -32768,-32768,-32768,-32768, 244,-32768,-32768, 1677,-32768, 1808, | |
1121 | -32768, 878, 2012,-32768, 894,-32768,-32768,-32768,-32768,-32768, | |
1122 | -32768, 2732,-32768, 151, 4588, 2012,-32768,-32768, 2783,-32768, | |
1123 | -32768,-32768,-32768, 1005,-32768,-32768,-32768, 912,-32768, 2012, | |
1124 | 159, 170,-32768, 339,-32768, 5103, 916,-32768,-32768,-32768, | |
1125 | -32768, 178, 2078, 925, 5128,-32768, 979, 2078, 946, 2078, | |
1126 | -32768, 2078,-32768,-32768, 1027, 1044,-32768 | |
8b27f225 PB |
1127 | }; |
1128 | ||
1129 | static const short yypgoto[] = {-32768, | |
a003f638 JB |
1130 | -32768, -49, 160, 664, 30, -122, 515,-32768, -3, 291, |
1131 | -32768, 137,-32768, 1035, 588,-32768, 235,-32768,-32768, 971, | |
1132 | 20, 473,-32768,-32768, 995, 976,-32768, -121,-32768, 892, | |
1133 | -32768, -83, -114, 931, -163, -198,-32768,-32768, -64, 587, | |
1134 | 801, -323, -126, -80,-32768,-32768,-32768,-32768,-32768,-32768, | |
1135 | -32768, 911,-32768, -528,-32768, 668, -11,-32768,-32768,-32768, | |
1136 | -32768, 1023, 391,-32768, 984,-32768,-32768, 251,-32768, -127, | |
1137 | 817, 796, -165, -284,-32768, 772, -271, 172, -530,-32768, | |
1138 | -473,-32768,-32768,-32768, -307,-32768,-32768,-32768,-32768,-32768, | |
1139 | -32768,-32768,-32768, 434, 437, -613, -406,-32768,-32768,-32768, | |
1140 | -32768,-32768,-32768,-32768, -361,-32768, -646, 786,-32768,-32768, | |
1141 | -32768,-32768,-32768,-32768,-32768,-32768, 514,-32768, 525,-32768, | |
1142 | -32768, -94,-32768, -379,-32768, 755, 317, -292, 1204, 280, | |
1143 | 1237, 377, 500, 551, -58, 653, 704, -468,-32768, 649, | |
1144 | 690, 787, 636, 723, 724, 711, 716, 722,-32768, 501, | |
1145 | 720, 798,-32768,-32768, 127,-32768 | |
8b27f225 PB |
1146 | }; |
1147 | ||
1148 | ||
a003f638 | 1149 | #define YYLAST 5661 |
8b27f225 PB |
1150 | |
1151 | ||
1152 | static const short yytable[] = { 21, | |
a003f638 JB |
1153 | 450, 174, 29, 439, 457, 358, 183, 343, 152, 288, |
1154 | 176, 185, 83, 711, 614, 326, 38, 259, 725, 16, | |
1155 | 390, 48, 462, 443, 630, 76, 343, 634, 16, 16, | |
1156 | 16, 446, 497, 447, 174, 486, 143, 20, 61, 123, | |
1157 | 364, 261, 61, 721, 83, 165, 20, 62, 587, 16, | |
1158 | 93, 134, 16, 16, 474, 124, 583, 559, 88, 594, | |
1159 | 61, 479, 481, 144, 167, 61, 595, 327, 650, 250, | |
1160 | 16, 59, 252, 328, 64, 67, 348, 561, 165, 83, | |
1161 | 317, 89, 93, 179, 69, 88, 563, 576, 463, 675, | |
1162 | 88, 263, 391, 59, 482, 135, 608, 167, 59, -158, | |
1163 | 712, 487, 690, 650, 721, 696, 146, 344, 649, 764, | |
1164 | 123, -104, 83, 89, 39, -104, 40, 173, 769, 49, | |
1165 | 412, 50, 626, 77, 61, 88, 344, 183, 187, 88, | |
1166 | 61, 743, 400, 329, 335, 337, 339, 341, -94, -94, | |
1167 | 25, 27, 350, 352, 680, 423, -295, 588, 160, 426, | |
1168 | 173, 710, 180, 125, 247, 560, 88, 59, 88, 742, | |
1169 | 145, 651, 697, 67, 430, 459, 696, 619, 611, 696, | |
1170 | 743, 281, 52, 54, 397, 562, 57, 601, 758, 88, | |
1171 | 604, 160, 676, 41, 564, 577, 57, 483, 619, 332, | |
1172 | 332, 332, 332, 317, 283, 61, 734, 332, 332, 355, | |
1173 | 317, 183, 619, 147, 179, 20, 733, 461, 317, 620, | |
1174 | 317, 623, 50, 317, 549, 110, 669, 482, 413, 113, | |
1175 | 328, 84, 118, 697, 744, 188, 697, 618, 347, 700, | |
1176 | 619, 422, 696, 619, 20, 435, 670, 696, 556, 696, | |
1177 | 672, 696, 684, 31, 745, 42, 101, 427, 84, 753, | |
1178 | 88, 248, 692, 84, 642, 704, 71, 761, 110, 113, | |
1179 | 726, -28, 1, 762, 686, 598, 246, 31, 709, 619, | |
1180 | 619, 439, 119, 180, 703, 190, 766, -159, 179, 361, | |
1181 | 661, 88, 450, 362, 281, 128, 617, 363, 84, 697, | |
1182 | 700, 441, 84, 700, 697, 635, 697, -66, 697, 441, | |
1183 | 137, 441, 138, 139, 448, 2, 621, 283, 624, 317, | |
1184 | 578, 282, 504, 506, 508, 190, 3, 706, 42, 84, | |
1185 | 580, 84, 4, 637, 88, 157, 61, 180, 5, 356, | |
1186 | 246, 746, 19, 671, 280, 703, 6, 673, 703, 635, | |
1187 | -66, 408, 84, 45, 418, 133, 439, 180, 157, -257, | |
1188 | -161, 420, 752, 129, 157, 368, 700, 450, 346, 67, | |
1189 | 7, 700, 354, 700, 694, 700, 148, 332, 332, 332, | |
1190 | 332, 332, 332, 332, 332, 332, 332, 332, 332, 88, | |
1191 | 332, 332, 332, 332, 332, 332, 332, 631, 636, 26, | |
1192 | 249, -97, 411, -97, -65, 417, -97, -97, -97, -97, | |
1193 | 551, 703, 424, 429, 414, 46, 703, 652, 703, -140, | |
1194 | 703, 428, 454, 84, 253, 190, 638, 20, 610, 159, | |
1195 | 475, 501, 653, 283, 282, 443, 177, 254, 446, 137, | |
1196 | 640, 282, 763, 409, 258, 439, 419, -65, 647, 282, | |
1197 | 157, 282, 643, 421, 84, 646, 647, 280, 450, 134, | |
1198 | 159, 749, 159, 728, 318, 100, 654, 450, 317, 619, | |
1199 | 612, 317, 106, 602, 755, 190, -323, 280, 408, 2, | |
1200 | 35, 730, 17, 332, 20, 78, 28, 619, 760, 332, | |
1201 | 465, 17, 17, 17, 330, 674, 74, 84, 492, -30, | |
1202 | 1, 694, 500, 317, 425, 317, 749, 131, 755, 57, | |
1203 | 760, 498, 17, 685, 455, 17, 17, 80, 53, 35, | |
1204 | 81, 20, 476, 502, 183, 342, 652, 546, 58, 178, | |
1205 | -97, 133, 641, 17, 360, -97, -97, -97, -97, 66, | |
1206 | 648, 653, 37, 2, 90, 558, 317, -65, 732, 727, | |
1207 | 282, 317, 528, 365, 3, 566, 493, 568, 46, 281, | |
1208 | 4, 319, 281, 678, 729, 660, 5, 492, -323, 366, | |
1209 | 735, 20, 317, 280, 731, 716, 90, 318, 57, 55, | |
1210 | 317, 190, 283, 56, 318, 283, 251, 139, 99, 591, | |
1211 | -65, 593, 318, 103, 318, 405, 406, 318, 7, 407, | |
1212 | 120, 179, 386, 20, 50, 599, 30, 98, 34, 195, | |
1213 | 196, 161, 317, 20, 78, 317, 492, 387, 332, 332, | |
1214 | 579, 246, 494, 197, 20, 388, 345, 495, 102, 198, | |
1215 | 51, 496, 109, 317, 332, 317, 199, 281, 317, 157, | |
1216 | 200, 20, 441, 398, 161, 112, 80, 88, 149, 81, | |
1217 | 20, 317, 155, 151, -29, 1, 615, 277, 193, 194, | |
1218 | 283, 154, 389, 281, 20, 317, 205, 206, 207, 208, | |
1219 | 180, 317, 209, 210, 319, 78, 401, 184, 317, 117, | |
1220 | 317, 319, 189, 317, 320, 317, 283, 317, 204, 319, | |
1221 | 602, 319, 20, 318, 319, 493, 325, 402, 2, 282, | |
1222 | 195, 196, 282, 441, -157, 78, 441, 80, 367, 3, | |
1223 | 81, 20, 436, 20, 197, 4, 458, 20, 150, 153, | |
1224 | 198, 5, 280, 460, 281, 280, 281, 199, 433, 441, | |
1225 | 20, 200, 603, 20, 605, 321, 464, 80, 20, 118, | |
1226 | 81, 20, 441, 360, 201, 202, 20, 283, 203, 283, | |
1227 | 204, 616, 440, 7, 469, 682, 441, 205, 206, 207, | |
1228 | 208, 494, 20, 209, 210, 613, 495, 20, 602, 441, | |
1229 | 496, 444, -25, -25, 441, 57, 441, 282, 441, 484, | |
1230 | 20, 20, 282, 485, 453, 493, -32, 1, 35, 714, | |
1231 | 319, -31, 1, 20, 569, 722, 600, 320, 570, 600, | |
1232 | 280, 20, 550, 282, 320, 36, -34, 1, 20, 139, | |
1233 | 84, 37, 320, -25, 320, 434, 584, 320, -25, -25, | |
1234 | -25, 20, 477, 527, -25, 478, 280, 586, -25, 360, | |
1235 | 2, 596, -33, 1, 622, 2, 628, 322, 627, -35, | |
1236 | 1, 3, 318, 282, 632, 318, 282, 4, 321, 689, | |
1237 | 2, 494, 4, 5, 633, 321, 495, 639, 5, 649, | |
1238 | 496, -498, -498, 321, 282, 321, 282, 4, 321, 282, | |
1239 | 20, 754, 78, 5, 121, 757, 2, 318, 737, 318, | |
1240 | 659, 738, 282, 2, 665, 7, 140, 280, 323, 280, | |
1241 | 7, 141, 142, 4, 456, 666, 282, 369, 370, 5, | |
1242 | 4, 371, 372, 373, 80, 7, 5, 81, 20, 282, | |
1243 | 376, 377, 378, 320, 282, 667, 282, 35, 282, 705, | |
1244 | 318, -342, -342, 78, 602, 318, -499, -499, -344, -344, | |
1245 | 710, 7, 122, 588, 36, 374, 375, 2, 7, 319, | |
1246 | 37, 723, 319, 78, 767, 736, 318, 384, 385, 771, | |
1247 | 322, 773, 739, 774, 318, 80, -208, 322, 81, 20, | |
1248 | 392, 393, 2, 78, 321, 322, 740, 322, 78, 741, | |
1249 | 322, -408, -408, -342, 319, 80, 319, -342, 81, 20, | |
1250 | -344, 748, 324, 742, -344, 2, 318, -409, -409, 318, | |
1251 | 32, 78, 466, 467, 468, 80, 156, 750, 81, 20, | |
1252 | 80, 323, 78, 81, 20, 141, 142, 318, 323, 318, | |
1253 | 32, 79, 318, 4, 32, 758, 323, 319, 323, 5, | |
1254 | 759, 323, 319, 80, 765, 318, 81, 20, 768, 531, | |
1255 | 533, 32, 510, 512, 80, 395, 776, 81, 20, 318, | |
1256 | -497, -497, 361, 319, 770, 318, 362, 157, 158, 772, | |
1257 | 363, 319, 318, 777, 318, 33, 529, 318, 75, 318, | |
1258 | 108, 318, 320, 257, 396, 320, 322, -15, 379, 380, | |
1259 | 381, 382, -497, -497, 361, 514, 516, 518, 431, 191, | |
1260 | 255, 554, 432, 319, 73, -15, 319, 127, 404, 449, | |
1261 | -497, -497, 361, 438, 644, 324, 431, 320, 717, 320, | |
1262 | 363, 718, 324, 452, 319, 645, 319, 383, 539, 319, | |
1263 | 324, 473, 324, 321, 541, 324, 321, 323, 535, -15, | |
1264 | 537, 543, 319, 548, -497, -497, 361, 0, 0, 156, | |
1265 | 431, -497, -497, 361, 629, 78, 319, 480, 688, 575, | |
1266 | 320, 363, 319, 0, 79, 320, 4, 0, 321, 319, | |
1267 | 321, 319, 5, 0, 319, 0, 319, 0, 319, -497, | |
1268 | -497, 361, 0, 0, 0, 362, 320, 80, 0, 432, | |
1269 | 81, 20, 0, 0, 320, 520, 522, 524, 526, 0, | |
1270 | 157, 256, -290, -290, -290, 0, 0, 0, -290, 0, | |
1271 | 0, 321, 0, 0, 0, 0, 321, -290, 0, 0, | |
1272 | 0, 0, 0, -290, 0, 0, 320, 0, 0, 320, | |
1273 | -290, 324, 0, 0, -290, 322, 0, 321, 322, 0, | |
1274 | -290, 0, 0, -290, -290, 321, 0, 320, 0, 320, | |
1275 | 0, -290, 320, 0, 0, 0, 0, -290, 0, 0, | |
1276 | -290, -290, -290, -290, 0, 320, -290, -290, 0, 0, | |
1277 | 322, 0, 322, 0, 0, 0, 0, 321, 0, 320, | |
1278 | 321, 0, 0, 0, 0, 320, 323, 0, 0, 323, | |
1279 | 0, 0, 320, 0, 320, 0, 0, 320, 321, 320, | |
1280 | 321, 320, 0, 321, 0, 0, 0, 0, 0, 0, | |
1281 | 0, 0, 0, 322, 0, 0, 321, 0, 322, 0, | |
1282 | 0, 323, 0, 323, 0, 0, 0, 0, 0, 0, | |
1283 | 321, 0, 0, 0, 2, 0, 321, 0, 0, 322, | |
1284 | 78, 0, 0, 321, 0, 321, 0, 322, 321, 79, | |
1285 | 321, 4, 321, 0, 0, 0, 0, 5, 0, 0, | |
1286 | 0, 0, 0, 0, 323, 0, 0, 0, 0, 323, | |
1287 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 322, | |
1288 | 324, 0, 322, 324, 0, 0, 82, 0, 0, 0, | |
1289 | 323, 0, 0, 0, 0, 0, 0, 0, 323, 0, | |
1290 | 322, 0, 322, 0, 0, 322, 0, 0, 0, 0, | |
1291 | 0, 0, 0, 0, 0, 324, 0, 324, 322, 0, | |
1292 | 0, 0, 0, 0, 0, 0, 333, 333, 333, 333, | |
1293 | 323, 0, 322, 323, 333, 333, 0, 0, 322, 0, | |
1294 | 0, 0, 0, 0, 0, 322, 0, 322, 0, 0, | |
1295 | 322, 323, 322, 323, 322, 0, 323, 0, 324, 334, | |
1296 | 334, 334, 334, 324, 0, 0, 0, 334, 334, 323, | |
1297 | 0, 0, 0, 0, 0, 0, 2, 192, 0, 193, | |
1298 | 194, 0, 78, 323, 324, 0, 0, 0, 0, 323, | |
1299 | 0, 79, 324, 4, 0, 0, 323, 0, 323, 5, | |
1300 | 0, 323, 0, 323, 0, 323, 0, 0, 0, 0, | |
2884c41e | 1301 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, |
a003f638 JB |
1302 | 0, 195, 196, 0, 324, 0, 78, 324, 126, 0, |
1303 | 0, 0, 0, 0, 0, 197, 0, 0, 0, 0, | |
1304 | 0, 198, 0, 0, 0, 324, 0, 324, 199, 0, | |
1305 | 324, 0, 200, 0, 0, 0, 0, 0, 80, 0, | |
1306 | 0, 81, 20, 324, 0, 201, 202, 0, 0, 203, | |
1307 | 0, 204, 0, 0, 0, 0, 0, 324, 205, 206, | |
1308 | 207, 208, 0, 324, 209, 210, 0, 0, 0, 0, | |
1309 | 324, 0, 324, 0, 0, 324, 0, 324, 0, 324, | |
1310 | 0, 0, 0, 0, 333, 333, 333, 333, 333, 333, | |
1311 | 333, 333, 333, 333, 333, 333, 0, 333, 333, 333, | |
1312 | 333, 333, 333, 333, 0, 0, 0, 264, 0, 0, | |
1313 | 0, 0, 0, 0, 0, 0, 0, 334, 334, 334, | |
1314 | 334, 334, 334, 334, 334, 334, 334, 334, 334, 0, | |
1315 | 334, 334, 334, 334, 334, 334, 334, 0, 0, 0, | |
2884c41e | 1316 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
a003f638 JB |
1317 | 2, 195, 196, 652, 265, 266, 78, 267, 0, 0, |
1318 | 268, 0, 0, 0, 269, 197, 0, 0, 653, 0, | |
1319 | 0, 270, 271, 5, 272, 0, 273, 274, 199, 275, | |
1320 | 0, 0, 276, 0, 0, 0, 0, 264, 80, 0, | |
1321 | 333, 81, 20, 0, 0, 0, 333, 0, 0, 277, | |
1322 | 0, 157, 719, 0, 0, 278, 0, 0, 205, 206, | |
1323 | 207, 208, 679, 0, 209, 210, 0, 0, 0, 0, | |
1324 | 0, 0, 0, 334, 0, 0, 0, 0, 0, 334, | |
1325 | 2, 195, 196, 652, 265, 266, 78, 267, 0, 0, | |
1326 | 268, 0, 0, 0, 269, 197, 0, 0, 653, 0, | |
1327 | 0, 270, 271, 5, 272, 0, 273, 274, 199, 275, | |
1328 | 0, 78, 276, 0, 0, 0, 0, 0, 80, 0, | |
1329 | 197, 81, 20, 0, 0, 0, 198, 0, 0, 277, | |
1330 | 0, 157, 747, 199, 0, 278, 0, 200, 205, 206, | |
1331 | 207, 208, 0, 80, 209, 210, 81, 20, 0, 0, | |
1332 | 201, 202, 0, 0, 203, 0, 0, 0, 0, 0, | |
1333 | 0, 0, 0, 205, 206, 207, 208, 0, 264, 209, | |
1334 | 210, 0, 0, 0, 0, 333, 333, 0, 0, 0, | |
1335 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
1336 | 0, 333, 0, 0, 0, 0, 0, 0, 0, 0, | |
1337 | 0, 0, 0, 0, 0, 0, 0, 0, 334, 334, | |
1338 | 0, 2, 195, 196, -267, 265, 266, 78, 267, 0, | |
1339 | 0, 268, 0, 0, 334, 269, 197, 0, 0, -267, | |
1340 | 0, 0, 270, 271, 5, 272, 264, 273, 274, 199, | |
1341 | 275, 0, 0, 276, 0, 0, 0, 0, 0, 80, | |
1342 | 0, 0, 81, 20, 0, 0, 0, 0, 0, 0, | |
1343 | 277, 0, 157, -267, 0, 0, 278, 0, 0, 205, | |
1344 | 206, 207, 208, 0, 0, 209, 210, 0, 0, 2, | |
1345 | 195, 196, 0, 265, 266, 78, 267, 0, 0, 268, | |
1346 | 0, 0, 0, 269, 197, 0, 0, 0, 0, 0, | |
1347 | 270, 271, 5, 272, 264, 273, 274, 199, 275, 0, | |
1348 | 0, 276, 0, 0, 0, 0, 0, 80, 0, 0, | |
2884c41e | 1349 | 81, 20, 0, 0, 0, 0, 0, 0, 277, 0, |
a003f638 JB |
1350 | 157, 437, 0, 0, 278, 0, 0, 205, 206, 207, |
1351 | 208, 0, 0, 209, 210, 0, 0, 2, 195, 196, | |
1352 | 0, 265, 266, 78, 267, 0, 0, 268, 0, 0, | |
1353 | 0, 269, 197, 0, 0, 0, 0, 0, 270, 271, | |
1354 | 5, 272, 264, 273, 274, 199, 275, 0, 0, 276, | |
1355 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, | |
1356 | 0, 0, 0, 0, 0, 0, 277, 0, 157, 0, | |
1357 | 0, 0, 278, 0, 0, 205, 206, 207, 208, 0, | |
1358 | 0, 209, 210, 0, 0, 2, 195, 196, 0, 265, | |
1359 | 266, 78, 267, 0, 0, 268, 0, 0, 0, 269, | |
1360 | 197, 0, 0, 0, 0, 0, 270, 271, 264, 272, | |
1361 | 0, 273, 274, 199, 275, 0, 0, 276, 0, 0, | |
1362 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, | |
1363 | 0, 0, 0, 0, 277, 0, 157, 0, 0, 0, | |
1364 | 278, 0, 0, 205, 206, 207, 208, 0, 0, 209, | |
1365 | 210, 2, 195, 196, 0, 693, 266, 78, 267, 0, | |
2884c41e | 1366 | 0, 268, 0, 0, 0, 269, 197, 0, 0, 0, |
a003f638 JB |
1367 | 0, 0, 270, 271, 0, 272, 0, 273, 274, 199, |
1368 | 275, 0, 415, 276, 193, 194, 0, 0, 0, 80, | |
1369 | 0, 0, 81, 20, 0, 0, 0, 0, 0, 0, | |
1370 | 277, 0, 157, 0, 0, 0, 278, 0, 0, 205, | |
2884c41e | 1371 | 206, 207, 208, 0, 0, 209, 210, 0, 0, 0, |
a003f638 JB |
1372 | 0, 0, 0, 0, 0, 0, 195, 196, 0, 0, |
1373 | 0, 78, 0, 544, 0, 193, 194, 0, 0, 0, | |
1374 | 197, 0, 0, 0, 0, 0, 198, 0, 0, 0, | |
1375 | 0, 0, 0, 199, 0, 0, 0, 200, 0, 0, | |
1376 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, | |
1377 | 201, 202, 0, 0, 203, 0, 0, 195, 196, 0, | |
1378 | 416, 0, 78, 205, 206, 207, 208, 0, 0, 209, | |
1379 | 210, 197, 0, 0, 0, 0, 0, 198, 491, 0, | |
1380 | 193, 194, 0, 0, 199, 0, 0, 0, 200, 0, | |
1381 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, | |
1382 | 545, 201, 202, 0, 0, 203, 0, 0, 0, 0, | |
1383 | 0, 0, 0, 0, 205, 206, 207, 208, 0, 0, | |
1384 | 209, 210, 195, 196, 0, 0, 0, 78, 0, 581, | |
1385 | 0, 193, 194, 0, 0, 0, 197, 0, 0, 0, | |
1386 | 0, 0, 198, 0, 0, 0, 0, 0, 0, 199, | |
1387 | 0, 0, 0, 200, 0, 0, 0, 0, 0, 80, | |
1388 | 0, 0, 81, 20, 0, 0, 201, 202, 0, 0, | |
1389 | 203, 0, 0, 195, 196, 148, 0, 0, 78, 205, | |
1390 | 206, 207, 208, 0, 0, 209, 210, 197, 0, 0, | |
1391 | 0, 0, 0, 198, 589, 0, 193, 194, 0, 0, | |
2884c41e KG |
1392 | 199, 0, 0, 0, 200, 0, 0, 0, 0, 0, |
1393 | 80, 0, 0, 81, 20, 0, 0, 201, 202, 0, | |
a003f638 | 1394 | 0, 203, 582, 0, 0, 0, 0, 0, 0, 0, |
2884c41e | 1395 | 205, 206, 207, 208, 0, 0, 209, 210, 195, 196, |
a003f638 | 1396 | 0, 0, 0, 78, 0, 597, 0, 193, 194, 0, |
2884c41e KG |
1397 | 0, 0, 197, 0, 0, 0, 0, 0, 198, 0, |
1398 | 0, 0, 0, 0, 0, 199, 0, 0, 0, 200, | |
efa0a23f | 1399 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, |
2884c41e | 1400 | 0, 0, 201, 202, 0, 0, 203, 0, 0, 195, |
a003f638 | 1401 | 196, 0, 590, 0, 78, 205, 206, 207, 208, 0, |
2884c41e | 1402 | 0, 209, 210, 197, 0, 0, 0, 0, 0, 198, |
a003f638 | 1403 | 606, 0, 193, 194, 0, 0, 199, 0, 0, 0, |
2884c41e | 1404 | 200, 0, 0, 0, 0, 0, 80, 0, 0, 81, |
a003f638 JB |
1405 | 20, 0, 0, 201, 202, 0, 0, 203, 0, 0, |
1406 | 0, 0, 598, 0, 0, 0, 205, 206, 207, 208, | |
2884c41e | 1407 | 0, 0, 209, 210, 195, 196, 0, 0, 0, 78, |
a003f638 | 1408 | 0, 491, 0, 193, 194, 0, 0, 0, 197, 0, |
2884c41e KG |
1409 | 0, 0, 0, 0, 198, 0, 0, 0, 0, 0, |
1410 | 0, 199, 0, 0, 0, 200, 0, 0, 0, 0, | |
1411 | 0, 80, 0, 0, 81, 20, 0, 0, 201, 202, | |
a003f638 | 1412 | 0, 0, 203, 607, 0, 195, 196, 0, 0, 0, |
2884c41e | 1413 | 78, 205, 206, 207, 208, 0, 0, 209, 210, 197, |
a003f638 | 1414 | 0, 0, 0, 0, 0, 198, 581, 0, 193, 194, |
2884c41e KG |
1415 | 0, 0, 199, 0, 0, 0, 200, 0, 0, 0, |
1416 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 201, | |
a003f638 | 1417 | 202, 0, 0, 203, 0, 0, 0, 0, 598, 0, |
2884c41e | 1418 | 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, |
a003f638 | 1419 | 195, 196, 0, 0, 0, 78, 0, 707, 0, 193, |
2884c41e KG |
1420 | 194, 0, 0, 0, 197, 0, 0, 0, 0, 0, |
1421 | 198, 0, 0, 0, 0, 0, 0, 199, 0, 0, | |
1422 | 0, 200, 0, 0, 0, 0, 0, 80, 0, 0, | |
a003f638 JB |
1423 | 81, 20, 0, 0, 201, 202, 0, 0, 203, 691, |
1424 | 0, 195, 196, 0, 0, 0, 78, 205, 206, 207, | |
2884c41e | 1425 | 208, 0, 0, 209, 210, 197, 0, 0, 0, 0, |
a003f638 | 1426 | 0, 198, 707, 0, 193, 194, 0, 0, 199, 0, |
2884c41e KG |
1427 | 0, 0, 200, 0, 0, 0, 0, 0, 80, 0, |
1428 | 0, 81, 20, 0, 0, 201, 202, 0, 0, 203, | |
a003f638 | 1429 | 708, 0, 0, 0, 0, 0, 0, 0, 205, 206, |
2884c41e | 1430 | 207, 208, 0, 0, 209, 210, 195, 196, 0, 0, |
a003f638 | 1431 | 0, 78, 0, 589, 0, 193, 194, 0, 0, 0, |
2884c41e KG |
1432 | 197, 0, 0, 0, 0, 0, 198, 0, 0, 0, |
1433 | 0, 0, 0, 199, 0, 0, 0, 200, 0, 0, | |
efa0a23f | 1434 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, |
a003f638 | 1435 | 201, 202, 0, 0, 203, 751, 0, 195, 196, 0, |
2884c41e | 1436 | 0, 0, 78, 205, 206, 207, 208, 0, 0, 209, |
a003f638 | 1437 | 210, 197, 0, 0, 0, 0, 0, 198, 331, 0, |
2884c41e | 1438 | 193, 194, 0, 0, 199, 0, 0, 0, 200, 0, |
efa0a23f | 1439 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, |
2884c41e | 1440 | 0, 201, 202, 0, 0, 203, 0, 0, 0, 0, |
a003f638 JB |
1441 | 0, 756, 0, 0, 205, 206, 207, 208, 0, 0, |
1442 | 209, 210, 195, 196, 0, 0, 0, 78, 0, 336, | |
2884c41e KG |
1443 | 0, 193, 194, 0, 0, 0, 197, 0, 0, 0, |
1444 | 0, 0, 198, 0, 0, 0, 0, 0, 0, 199, | |
1445 | 0, 0, 0, 200, 0, 0, 0, 0, 0, 80, | |
1446 | 0, 0, 81, 20, 0, 0, 201, 202, 0, 0, | |
a003f638 | 1447 | 203, 0, 0, 195, 196, 0, 0, 0, 78, 205, |
2884c41e | 1448 | 206, 207, 208, 0, 0, 209, 210, 197, 0, 0, |
a003f638 | 1449 | 0, 0, 0, 198, 338, 0, 193, 194, 0, 0, |
2884c41e KG |
1450 | 199, 0, 0, 0, 200, 0, 0, 0, 0, 0, |
1451 | 80, 0, 0, 81, 20, 0, 0, 201, 202, 0, | |
a003f638 | 1452 | 0, 203, 0, 0, 0, 0, 0, 0, 0, 0, |
2884c41e | 1453 | 205, 206, 207, 208, 0, 0, 209, 210, 195, 196, |
a003f638 | 1454 | 0, 0, 0, 78, 0, 340, 0, 193, 194, 0, |
2884c41e KG |
1455 | 0, 0, 197, 0, 0, 0, 0, 0, 198, 0, |
1456 | 0, 0, 0, 0, 0, 199, 0, 0, 0, 200, | |
efa0a23f | 1457 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, |
a003f638 | 1458 | 0, 0, 201, 202, 0, 0, 203, 0, 0, 195, |
2884c41e KG |
1459 | 196, 0, 0, 0, 78, 205, 206, 207, 208, 0, |
1460 | 0, 209, 210, 197, 0, 0, 0, 0, 0, 198, | |
a003f638 | 1461 | 349, 0, 193, 194, 0, 0, 199, 0, 0, 0, |
2884c41e KG |
1462 | 200, 0, 0, 0, 0, 0, 80, 0, 0, 81, |
1463 | 20, 0, 0, 201, 202, 0, 0, 203, 0, 0, | |
a003f638 | 1464 | 0, 0, 0, 0, 0, 0, 205, 206, 207, 208, |
2884c41e | 1465 | 0, 0, 209, 210, 195, 196, 0, 0, 0, 78, |
a003f638 | 1466 | 0, 351, 0, 193, 194, 0, 0, 0, 197, 0, |
2884c41e KG |
1467 | 0, 0, 0, 0, 198, 0, 0, 0, 0, 0, |
1468 | 0, 199, 0, 0, 0, 200, 0, 0, 0, 0, | |
1469 | 0, 80, 0, 0, 81, 20, 0, 0, 201, 202, | |
1470 | 0, 0, 203, 0, 0, 195, 196, 0, 0, 0, | |
1471 | 78, 205, 206, 207, 208, 0, 0, 209, 210, 197, | |
a003f638 | 1472 | 0, 0, 0, 0, 0, 198, 353, 0, 193, 194, |
2884c41e KG |
1473 | 0, 0, 199, 0, 0, 0, 200, 0, 0, 0, |
1474 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 201, | |
1475 | 202, 0, 0, 203, 0, 0, 0, 0, 0, 0, | |
1476 | 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, | |
a003f638 | 1477 | 195, 196, 0, 0, 0, 78, 0, 410, 0, 193, |
2884c41e KG |
1478 | 194, 0, 0, 0, 197, 0, 0, 0, 0, 0, |
1479 | 198, 0, 0, 0, 0, 0, 0, 199, 0, 0, | |
1480 | 0, 200, 0, 0, 0, 0, 0, 80, 0, 0, | |
1481 | 81, 20, 0, 0, 201, 202, 0, 0, 203, 0, | |
1482 | 0, 195, 196, 0, 0, 0, 78, 205, 206, 207, | |
1483 | 208, 0, 0, 209, 210, 197, 0, 0, 0, 0, | |
a003f638 | 1484 | 0, 198, 491, 0, 193, 194, 0, 0, 199, 0, |
2884c41e KG |
1485 | 0, 0, 200, 0, 0, 0, 0, 0, 80, 0, |
1486 | 0, 81, 20, 0, 0, 201, 202, 0, 0, 203, | |
1487 | 0, 0, 0, 0, 0, 0, 0, 0, 205, 206, | |
1488 | 207, 208, 0, 0, 209, 210, 195, 196, 0, 0, | |
a003f638 | 1489 | 0, 78, 0, 499, 0, 193, 194, 0, 0, 0, |
2884c41e KG |
1490 | 197, 0, 0, 0, 0, 0, 198, 0, 0, 0, |
1491 | 0, 0, 0, 199, 0, 0, 0, 200, 0, 0, | |
efa0a23f | 1492 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, |
2884c41e KG |
1493 | 201, 202, 0, 0, 203, 0, 0, 195, 196, 0, |
1494 | 0, 0, 78, 205, 206, 207, 208, 0, 0, 209, | |
a003f638 | 1495 | 210, 197, 0, 0, 0, 0, 0, 198, 503, 0, |
2884c41e | 1496 | 193, 194, 0, 0, 199, 0, 0, 0, 200, 0, |
efa0a23f | 1497 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, |
2884c41e KG |
1498 | 0, 201, 202, 0, 0, 203, 0, 0, 0, 0, |
1499 | 0, 0, 0, 0, 205, 206, 207, 208, 0, 0, | |
a003f638 | 1500 | 209, 210, 195, 196, 0, 0, 0, 78, 0, 505, |
2884c41e KG |
1501 | 0, 193, 194, 0, 0, 0, 197, 0, 0, 0, |
1502 | 0, 0, 198, 0, 0, 0, 0, 0, 0, 199, | |
1503 | 0, 0, 0, 200, 0, 0, 0, 0, 0, 80, | |
1504 | 0, 0, 81, 20, 0, 0, 201, 202, 0, 0, | |
1505 | 203, 0, 0, 195, 196, 0, 0, 0, 78, 205, | |
1506 | 206, 207, 208, 0, 0, 209, 210, 197, 0, 0, | |
a003f638 | 1507 | 0, 0, 0, 198, 507, 0, 193, 194, 0, 0, |
2884c41e KG |
1508 | 199, 0, 0, 0, 200, 0, 0, 0, 0, 0, |
1509 | 80, 0, 0, 81, 20, 0, 0, 201, 202, 0, | |
1510 | 0, 203, 0, 0, 0, 0, 0, 0, 0, 0, | |
1511 | 205, 206, 207, 208, 0, 0, 209, 210, 195, 196, | |
a003f638 | 1512 | 0, 0, 0, 78, 0, 509, 0, 193, 194, 0, |
2884c41e KG |
1513 | 0, 0, 197, 0, 0, 0, 0, 0, 198, 0, |
1514 | 0, 0, 0, 0, 0, 199, 0, 0, 0, 200, | |
efa0a23f | 1515 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, |
2884c41e KG |
1516 | 0, 0, 201, 202, 0, 0, 203, 0, 0, 195, |
1517 | 196, 0, 0, 0, 78, 205, 206, 207, 208, 0, | |
1518 | 0, 209, 210, 197, 0, 0, 0, 0, 0, 198, | |
a003f638 | 1519 | 511, 0, 193, 194, 0, 0, 199, 0, 0, 0, |
2884c41e KG |
1520 | 200, 0, 0, 0, 0, 0, 80, 0, 0, 81, |
1521 | 20, 0, 0, 201, 202, 0, 0, 203, 0, 0, | |
1522 | 0, 0, 0, 0, 0, 0, 205, 206, 207, 208, | |
1523 | 0, 0, 209, 210, 195, 196, 0, 0, 0, 78, | |
a003f638 | 1524 | 0, 513, 0, 193, 194, 0, 0, 0, 197, 0, |
2884c41e KG |
1525 | 0, 0, 0, 0, 198, 0, 0, 0, 0, 0, |
1526 | 0, 199, 0, 0, 0, 200, 0, 0, 0, 0, | |
1527 | 0, 80, 0, 0, 81, 20, 0, 0, 201, 202, | |
1528 | 0, 0, 203, 0, 0, 195, 196, 0, 0, 0, | |
1529 | 78, 205, 206, 207, 208, 0, 0, 209, 210, 197, | |
a003f638 | 1530 | 0, 0, 0, 0, 0, 198, 515, 0, 193, 194, |
2884c41e KG |
1531 | 0, 0, 199, 0, 0, 0, 200, 0, 0, 0, |
1532 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 201, | |
1533 | 202, 0, 0, 203, 0, 0, 0, 0, 0, 0, | |
1534 | 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, | |
a003f638 | 1535 | 195, 196, 0, 0, 0, 78, 0, 517, 0, 193, |
2884c41e KG |
1536 | 194, 0, 0, 0, 197, 0, 0, 0, 0, 0, |
1537 | 198, 0, 0, 0, 0, 0, 0, 199, 0, 0, | |
1538 | 0, 200, 0, 0, 0, 0, 0, 80, 0, 0, | |
1539 | 81, 20, 0, 0, 201, 202, 0, 0, 203, 0, | |
1540 | 0, 195, 196, 0, 0, 0, 78, 205, 206, 207, | |
1541 | 208, 0, 0, 209, 210, 197, 0, 0, 0, 0, | |
a003f638 | 1542 | 0, 198, 519, 0, 193, 194, 0, 0, 199, 0, |
2884c41e KG |
1543 | 0, 0, 200, 0, 0, 0, 0, 0, 80, 0, |
1544 | 0, 81, 20, 0, 0, 201, 202, 0, 0, 203, | |
1545 | 0, 0, 0, 0, 0, 0, 0, 0, 205, 206, | |
1546 | 207, 208, 0, 0, 209, 210, 195, 196, 0, 0, | |
a003f638 | 1547 | 0, 78, 0, 521, 0, 193, 194, 0, 0, 0, |
2884c41e KG |
1548 | 197, 0, 0, 0, 0, 0, 198, 0, 0, 0, |
1549 | 0, 0, 0, 199, 0, 0, 0, 200, 0, 0, | |
efa0a23f | 1550 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, |
2884c41e KG |
1551 | 201, 202, 0, 0, 203, 0, 0, 195, 196, 0, |
1552 | 0, 0, 78, 205, 206, 207, 208, 0, 0, 209, | |
a003f638 | 1553 | 210, 197, 0, 0, 0, 0, 0, 198, 523, 0, |
2884c41e | 1554 | 193, 194, 0, 0, 199, 0, 0, 0, 200, 0, |
efa0a23f | 1555 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, |
2884c41e KG |
1556 | 0, 201, 202, 0, 0, 203, 0, 0, 0, 0, |
1557 | 0, 0, 0, 0, 205, 206, 207, 208, 0, 0, | |
a003f638 | 1558 | 209, 210, 195, 196, 0, 0, 0, 78, 0, 525, |
2884c41e KG |
1559 | 0, 193, 194, 0, 0, 0, 197, 0, 0, 0, |
1560 | 0, 0, 198, 0, 0, 0, 0, 0, 0, 199, | |
1561 | 0, 0, 0, 200, 0, 0, 0, 0, 0, 80, | |
1562 | 0, 0, 81, 20, 0, 0, 201, 202, 0, 0, | |
1563 | 203, 0, 0, 195, 196, 0, 0, 0, 78, 205, | |
1564 | 206, 207, 208, 0, 0, 209, 210, 197, 0, 0, | |
a003f638 | 1565 | 0, 0, 0, 198, 530, 0, 193, 194, 0, 0, |
2884c41e KG |
1566 | 199, 0, 0, 0, 200, 0, 0, 0, 0, 0, |
1567 | 80, 0, 0, 81, 20, 0, 0, 201, 202, 0, | |
1568 | 0, 203, 0, 0, 0, 0, 0, 0, 0, 0, | |
1569 | 205, 206, 207, 208, 0, 0, 209, 210, 195, 196, | |
a003f638 | 1570 | 0, 0, 0, 78, 0, 532, 0, 193, 194, 0, |
2884c41e KG |
1571 | 0, 0, 197, 0, 0, 0, 0, 0, 198, 0, |
1572 | 0, 0, 0, 0, 0, 199, 0, 0, 0, 200, | |
efa0a23f | 1573 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, |
2884c41e KG |
1574 | 0, 0, 201, 202, 0, 0, 203, 0, 0, 195, |
1575 | 196, 0, 0, 0, 78, 205, 206, 207, 208, 0, | |
1576 | 0, 209, 210, 197, 0, 0, 0, 0, 0, 198, | |
a003f638 | 1577 | 534, 0, 193, 194, 0, 0, 199, 0, 0, 0, |
2884c41e KG |
1578 | 200, 0, 0, 0, 0, 0, 80, 0, 0, 81, |
1579 | 20, 0, 0, 201, 202, 0, 0, 203, 0, 0, | |
1580 | 0, 0, 0, 0, 0, 0, 205, 206, 207, 208, | |
1581 | 0, 0, 209, 210, 195, 196, 0, 0, 0, 78, | |
a003f638 | 1582 | 0, 536, 0, 193, 194, 0, 0, 0, 197, 0, |
2884c41e KG |
1583 | 0, 0, 0, 0, 198, 0, 0, 0, 0, 0, |
1584 | 0, 199, 0, 0, 0, 200, 0, 0, 0, 0, | |
1585 | 0, 80, 0, 0, 81, 20, 0, 0, 201, 202, | |
1586 | 0, 0, 203, 0, 0, 195, 196, 0, 0, 0, | |
1587 | 78, 205, 206, 207, 208, 0, 0, 209, 210, 197, | |
a003f638 | 1588 | 0, 0, 0, 0, 0, 198, 538, 0, 193, 194, |
2884c41e KG |
1589 | 0, 0, 199, 0, 0, 0, 200, 0, 0, 0, |
1590 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 201, | |
1591 | 202, 0, 0, 203, 0, 0, 0, 0, 0, 0, | |
1592 | 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, | |
a003f638 | 1593 | 195, 196, 0, 0, 0, 78, 0, 540, 0, 193, |
2884c41e KG |
1594 | 194, 0, 0, 0, 197, 0, 0, 0, 0, 0, |
1595 | 198, 0, 0, 0, 0, 0, 0, 199, 0, 0, | |
1596 | 0, 200, 0, 0, 0, 0, 0, 80, 0, 0, | |
1597 | 81, 20, 0, 0, 201, 202, 0, 0, 203, 0, | |
1598 | 0, 195, 196, 0, 0, 0, 78, 205, 206, 207, | |
1599 | 208, 0, 0, 209, 210, 197, 0, 0, 0, 0, | |
a003f638 | 1600 | 0, 198, 542, 0, 193, 194, 0, 0, 199, 0, |
2884c41e KG |
1601 | 0, 0, 200, 0, 0, 0, 0, 0, 80, 0, |
1602 | 0, 81, 20, 0, 0, 201, 202, 0, 0, 203, | |
1603 | 0, 0, 0, 0, 0, 0, 0, 0, 205, 206, | |
1604 | 207, 208, 0, 0, 209, 210, 195, 196, 0, 0, | |
a003f638 | 1605 | 0, 78, 0, 547, 0, 193, 194, 0, 0, 0, |
2884c41e KG |
1606 | 197, 0, 0, 0, 0, 0, 198, 0, 0, 0, |
1607 | 0, 0, 0, 199, 0, 0, 0, 200, 0, 0, | |
efa0a23f | 1608 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, |
2884c41e KG |
1609 | 201, 202, 0, 0, 203, 0, 0, 195, 196, 0, |
1610 | 0, 0, 78, 205, 206, 207, 208, 0, 0, 209, | |
a003f638 | 1611 | 210, 197, 0, 0, 0, 0, 0, 198, 557, 0, |
2884c41e | 1612 | 193, 194, 0, 0, 199, 0, 0, 0, 200, 0, |
efa0a23f | 1613 | 0, 0, 0, 0, 80, 0, 0, 81, 20, 0, |
2884c41e KG |
1614 | 0, 201, 202, 0, 0, 203, 0, 0, 0, 0, |
1615 | 0, 0, 0, 0, 205, 206, 207, 208, 0, 0, | |
a003f638 | 1616 | 209, 210, 195, 196, 0, 0, 0, 78, 0, 565, |
2884c41e KG |
1617 | 0, 193, 194, 0, 0, 0, 197, 0, 0, 0, |
1618 | 0, 0, 198, 0, 0, 0, 0, 0, 0, 199, | |
1619 | 0, 0, 0, 200, 0, 0, 0, 0, 0, 80, | |
1620 | 0, 0, 81, 20, 0, 0, 201, 202, 0, 0, | |
1621 | 203, 0, 0, 195, 196, 0, 0, 0, 78, 205, | |
1622 | 206, 207, 208, 0, 0, 209, 210, 197, 0, 0, | |
a003f638 | 1623 | 0, 0, 0, 198, 567, 0, 193, 194, 0, 0, |
2884c41e KG |
1624 | 199, 0, 0, 0, 200, 0, 0, 0, 0, 0, |
1625 | 80, 0, 0, 81, 20, 0, 0, 201, 202, 0, | |
1626 | 0, 203, 0, 0, 0, 0, 0, 0, 0, 0, | |
1627 | 205, 206, 207, 208, 0, 0, 209, 210, 195, 196, | |
a003f638 | 1628 | 0, 0, 0, 78, 0, 592, 0, 193, 194, 0, |
2884c41e KG |
1629 | 0, 0, 197, 0, 0, 0, 0, 0, 198, 0, |
1630 | 0, 0, 0, 0, 0, 199, 0, 0, 0, 200, | |
efa0a23f | 1631 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, |
2884c41e KG |
1632 | 0, 0, 201, 202, 0, 0, 203, 0, 0, 195, |
1633 | 196, 0, 0, 0, 78, 205, 206, 207, 208, 0, | |
1634 | 0, 209, 210, 197, 0, 0, 0, 0, 0, 198, | |
a003f638 | 1635 | 609, 0, 193, 194, 0, 0, 199, 0, 0, 0, |
2884c41e KG |
1636 | 200, 0, 0, 0, 0, 0, 80, 0, 0, 81, |
1637 | 20, 0, 0, 201, 202, 0, 0, 203, 0, 0, | |
1638 | 0, 0, 0, 0, 0, 0, 205, 206, 207, 208, | |
1639 | 0, 0, 209, 210, 195, 196, 0, 0, 0, 78, | |
a003f638 | 1640 | 0, 677, 0, 193, 194, 0, 0, 0, 197, 0, |
2884c41e KG |
1641 | 0, 0, 0, 0, 198, 0, 0, 0, 0, 0, |
1642 | 0, 199, 0, 0, 0, 200, 0, 0, 0, 0, | |
1643 | 0, 80, 0, 0, 81, 20, 0, 0, 201, 202, | |
1644 | 0, 0, 203, 0, 0, 195, 196, 0, 0, 0, | |
1645 | 78, 205, 206, 207, 208, 0, 0, 209, 210, 197, | |
a003f638 | 1646 | 0, 0, 0, 0, 0, 198, 681, 0, 193, 194, |
2884c41e KG |
1647 | 0, 0, 199, 0, 0, 0, 200, 0, 0, 0, |
1648 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 201, | |
1649 | 202, 0, 0, 203, 0, 0, 0, 0, 0, 0, | |
1650 | 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, | |
a003f638 | 1651 | 195, 196, 0, 0, 0, 78, 0, 687, 0, 193, |
2884c41e KG |
1652 | 194, 0, 0, 0, 197, 0, 0, 0, 0, 0, |
1653 | 198, 0, 0, 0, 0, 0, 0, 199, 0, 0, | |
1654 | 0, 200, 0, 0, 0, 0, 0, 80, 0, 0, | |
1655 | 81, 20, 0, 0, 201, 202, 0, 0, 203, 0, | |
1656 | 0, 195, 196, 0, 0, 0, 78, 205, 206, 207, | |
1657 | 208, 0, 0, 209, 210, 197, 0, 0, 0, 0, | |
a003f638 | 1658 | 0, 198, 713, 0, 193, 194, 0, 0, 199, 0, |
2884c41e KG |
1659 | 0, 0, 200, 0, 0, 0, 0, 0, 80, 0, |
1660 | 0, 81, 20, 0, 0, 201, 202, 0, 0, 203, | |
1661 | 0, 0, 0, 0, 0, 0, 0, 0, 205, 206, | |
1662 | 207, 208, 0, 0, 209, 210, 195, 196, 0, 0, | |
a003f638 | 1663 | 0, 78, 0, 662, 0, 0, 0, 0, 0, 0, |
2884c41e | 1664 | 197, 0, 0, 0, 0, 0, 198, 0, 0, 0, |
a003f638 | 1665 | 0, 0, 0, 199, 0, 0, 0, 200, 724, 0, |
efa0a23f | 1666 | 0, 0, 0, 80, 0, 0, 81, 20, 0, 0, |
2884c41e KG |
1667 | 201, 202, 0, 0, 203, 0, 0, 195, 196, 0, |
1668 | 0, 0, 78, 205, 206, 207, 208, 0, 0, 209, | |
a003f638 JB |
1669 | 210, 197, 0, 0, 0, 0, 0, 198, 0, 0, |
1670 | 0, 0, 195, 196, 199, 0, 0, 78, 200, 0, | |
1671 | 0, 193, 194, 0, 80, 0, 197, 81, 20, 0, | |
1672 | 0, 0, 198, 0, 0, 277, -298, 0, 0, 199, | |
1673 | 0, 0, 0, 200, 205, 206, 207, 208, 0, 80, | |
1674 | 209, 210, 81, 20, 0, 0, 0, 0, 0, 0, | |
1675 | 277, -298, 0, 195, 196, 0, 0, 0, 78, 205, | |
2884c41e | 1676 | 206, 207, 208, 0, 0, 209, 210, 197, 0, 0, |
a003f638 | 1677 | 0, 0, 0, 198, 0, 0, 193, 194, 0, 0, |
2884c41e KG |
1678 | 199, 0, 0, 0, 200, 0, 0, 0, 0, 0, |
1679 | 80, 0, 0, 81, 20, 0, 0, 201, 202, 0, | |
a003f638 | 1680 | 0, 203, 0, 204, 357, 0, 0, 0, 0, 0, |
2884c41e | 1681 | 205, 206, 207, 208, 0, 0, 209, 210, 195, 196, |
a003f638 | 1682 | 0, 0, 0, 78, 0, 0, 0, 193, 194, 0, |
2884c41e KG |
1683 | 0, 0, 197, 0, 0, 0, 0, 0, 198, 0, |
1684 | 0, 0, 0, 0, 0, 199, 0, 0, 0, 200, | |
a003f638 | 1685 | 0, 0, 0, 0, 0, 80, 0, 0, 81, 20, |
2884c41e KG |
1686 | 0, 0, 201, 202, 0, 0, 203, 488, 0, 195, |
1687 | 196, 0, 0, 0, 78, 205, 206, 207, 208, 0, | |
1688 | 0, 209, 210, 197, 0, 0, 0, 0, 0, 198, | |
1689 | 0, 0, 193, 194, 0, 0, 199, 0, 0, 0, | |
1690 | 200, 0, 0, 0, 0, 0, 80, 0, 0, 81, | |
1691 | 20, 0, 0, 201, 202, 0, 0, 203, 625, 0, | |
1692 | 0, 0, 0, 0, 0, 0, 205, 206, 207, 208, | |
1693 | 0, 0, 209, 210, 195, 196, 0, 0, 0, 78, | |
1694 | 0, 0, 0, 193, 194, 0, 0, 0, 197, 0, | |
1695 | 0, 0, 0, 0, 198, 0, 0, 0, 0, 0, | |
1696 | 0, 199, 0, 0, 0, 200, 0, 0, 0, 0, | |
1697 | 0, 80, 0, 0, 81, 20, 0, 0, 201, 202, | |
1698 | 0, 0, 203, 668, 0, 195, 196, 0, 0, 0, | |
1699 | 78, 205, 206, 207, 208, 0, 0, 209, 210, 197, | |
1700 | 0, 0, 0, 0, 0, 198, 0, 0, 193, 194, | |
1701 | 0, 0, 199, 0, 0, 0, 200, 0, 0, 0, | |
1702 | 0, 0, 80, 0, 0, 81, 20, 0, 0, 201, | |
1703 | 202, 0, 0, 203, 683, 0, 0, 0, 0, 0, | |
1704 | 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, | |
1705 | 195, 196, 0, 0, 0, 78, 0, 0, 0, 0, | |
1706 | 0, 0, 0, 0, 197, 0, 0, 0, 0, 0, | |
1707 | 198, 0, 0, 0, 0, 0, 0, 199, 0, 0, | |
1708 | 0, 200, 0, 0, 0, 0, 0, 80, 0, 0, | |
a003f638 JB |
1709 | 81, 20, 0, 0, 201, 202, 0, 0, 203, 0, |
1710 | 2, 195, 196, 0, 0, 0, 78, 205, 206, 207, | |
1711 | 208, 0, 0, 209, 210, 197, 0, 0, 0, 0, | |
1712 | 0, 198, 0, 0, 0, 0, 0, 0, 199, 0, | |
1713 | 0, 78, 200, 0, 0, 0, 0, 0, 80, 0, | |
1714 | 197, 81, 20, 0, 0, 0, 198, 0, 0, 277, | |
1715 | 0, 0, 0, 199, 0, 0, 0, 200, 205, 206, | |
1716 | 207, 208, 0, 80, 209, 210, 81, 20, 0, 0, | |
1717 | 201, 202, 0, 0, 203, 0, 0, 0, 0, 0, | |
1718 | 0, 0, 0, 205, 206, 207, 208, 0, 0, 209, | |
1719 | 210 | |
8b27f225 PB |
1720 | }; |
1721 | ||
1722 | static const short yycheck[] = { 3, | |
a003f638 JB |
1723 | 308, 129, 6, 288, 328, 204, 133, 1, 123, 175, |
1724 | 132, 134, 62, 1, 483, 179, 1, 1, 665, 0, | |
1725 | 15, 1, 1, 295, 553, 1, 1, 556, 9, 10, | |
1726 | 11, 303, 72, 305, 162, 1, 117, 86, 42, 89, | |
1727 | 1, 169, 46, 657, 94, 129, 86, 95, 1, 30, | |
1728 | 62, 53, 33, 34, 347, 1, 436, 1, 62, 94, | |
1729 | 64, 354, 355, 1, 129, 69, 101, 94, 1, 150, | |
1730 | 51, 42, 153, 100, 100, 46, 199, 1, 162, 129, | |
1731 | 175, 62, 94, 133, 52, 89, 1, 1, 67, 1, | |
1732 | 94, 172, 87, 64, 1, 97, 476, 162, 69, 93, | |
1733 | 88, 67, 631, 1, 718, 636, 1, 101, 1, 756, | |
1734 | 160, 95, 162, 94, 99, 99, 101, 129, 765, 99, | |
1735 | 1, 101, 502, 99, 128, 129, 101, 254, 1, 133, | |
1736 | 134, 1, 260, 183, 193, 194, 195, 196, 99, 100, | |
1737 | 4, 5, 201, 202, 613, 273, 99, 100, 129, 1, | |
1738 | 162, 1, 133, 99, 1, 99, 160, 128, 162, 1, | |
1739 | 98, 94, 636, 134, 279, 329, 697, 100, 1, 700, | |
1740 | 1, 175, 36, 37, 255, 99, 40, 470, 1, 183, | |
1741 | 473, 162, 94, 1, 99, 99, 50, 94, 100, 193, | |
1742 | 194, 195, 196, 288, 175, 199, 94, 201, 202, 203, | |
1743 | 295, 328, 100, 98, 254, 86, 99, 330, 303, 1, | |
1744 | 305, 1, 101, 308, 94, 79, 596, 1, 99, 83, | |
1745 | 100, 62, 97, 697, 94, 98, 700, 94, 199, 636, | |
1746 | 100, 1, 763, 100, 86, 285, 1, 768, 404, 770, | |
1747 | 1, 772, 622, 9, 1, 63, 1, 99, 89, 99, | |
1748 | 254, 98, 632, 94, 1, 1, 1, 99, 122, 123, | |
1749 | 1, 0, 1, 94, 94, 98, 140, 33, 648, 100, | |
1750 | 100, 556, 97, 254, 636, 139, 99, 95, 328, 93, | |
1751 | 588, 285, 590, 97, 288, 100, 485, 101, 129, 763, | |
1752 | 697, 295, 133, 700, 768, 1, 770, 52, 772, 303, | |
1753 | 1, 305, 99, 100, 308, 44, 98, 288, 98, 404, | |
1754 | 94, 175, 371, 372, 373, 179, 55, 641, 63, 160, | |
1755 | 435, 162, 61, 1, 328, 95, 330, 308, 67, 203, | |
1756 | 204, 88, 1, 98, 175, 697, 75, 98, 700, 1, | |
1757 | 95, 1, 183, 1, 1, 93, 631, 328, 95, 95, | |
1758 | 95, 1, 732, 95, 95, 219, 763, 665, 199, 330, | |
1759 | 99, 768, 203, 770, 636, 772, 98, 371, 372, 373, | |
22eed1e6 | 1760 | 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, |
a003f638 JB |
1761 | 384, 385, 386, 387, 388, 389, 390, 553, 94, 1, |
1762 | 1, 92, 266, 94, 52, 269, 97, 98, 99, 100, | |
1763 | 404, 763, 1, 277, 268, 63, 768, 47, 770, 95, | |
1764 | 772, 275, 1, 254, 96, 279, 94, 86, 477, 129, | |
1765 | 1, 1, 62, 404, 288, 697, 1, 93, 700, 1, | |
1766 | 1, 295, 94, 93, 99, 720, 93, 95, 1, 303, | |
1767 | 95, 305, 570, 93, 285, 573, 1, 288, 756, 53, | |
1768 | 160, 723, 162, 94, 175, 65, 96, 765, 553, 100, | |
1769 | 94, 556, 72, 97, 736, 329, 1, 308, 1, 44, | |
1770 | 44, 94, 0, 477, 86, 50, 1, 100, 750, 483, | |
1771 | 344, 9, 10, 11, 100, 607, 1, 328, 362, 0, | |
1772 | 1, 763, 366, 588, 93, 590, 768, 107, 770, 363, | |
1773 | 772, 365, 30, 625, 93, 33, 34, 82, 1, 44, | |
1774 | 85, 86, 93, 93, 641, 101, 47, 391, 1, 94, | |
1775 | 92, 93, 93, 51, 101, 97, 98, 99, 100, 1, | |
1776 | 93, 62, 67, 44, 62, 409, 631, 52, 93, 667, | |
1777 | 404, 636, 383, 101, 55, 419, 1, 421, 63, 553, | |
1778 | 61, 175, 556, 612, 676, 1, 67, 431, 93, 97, | |
1779 | 93, 86, 657, 404, 686, 96, 94, 288, 432, 1, | |
1780 | 665, 435, 553, 5, 295, 556, 99, 100, 64, 453, | |
1781 | 95, 455, 303, 69, 305, 95, 96, 308, 99, 99, | |
1782 | 97, 641, 11, 86, 101, 469, 9, 1, 11, 45, | |
1783 | 46, 129, 697, 86, 50, 700, 480, 12, 612, 613, | |
1784 | 65, 485, 67, 59, 86, 13, 1, 72, 1, 65, | |
1785 | 33, 76, 1, 718, 628, 720, 72, 631, 723, 95, | |
1786 | 76, 86, 636, 99, 162, 1, 82, 641, 1, 85, | |
1787 | 86, 736, 128, 1, 0, 1, 1, 93, 3, 4, | |
1788 | 631, 1, 14, 657, 86, 750, 102, 103, 104, 105, | |
1789 | 641, 756, 108, 109, 288, 50, 99, 1, 763, 83, | |
1790 | 765, 295, 1, 768, 175, 770, 657, 772, 95, 303, | |
1791 | 97, 305, 86, 404, 308, 1, 1, 95, 44, 553, | |
1792 | 45, 46, 556, 697, 93, 50, 700, 82, 1, 55, | |
1793 | 85, 86, 93, 86, 59, 61, 1, 86, 122, 123, | |
1794 | 65, 67, 553, 1, 718, 556, 720, 72, 1, 723, | |
1795 | 86, 76, 472, 86, 474, 175, 1, 82, 86, 97, | |
1796 | 85, 86, 736, 101, 89, 90, 86, 718, 93, 720, | |
1797 | 95, 96, 99, 99, 97, 619, 750, 102, 103, 104, | |
1798 | 105, 67, 86, 108, 109, 94, 72, 86, 97, 763, | |
1799 | 76, 99, 45, 46, 768, 629, 770, 631, 772, 96, | |
1800 | 86, 86, 636, 100, 99, 1, 0, 1, 44, 653, | |
1801 | 404, 0, 1, 86, 60, 659, 470, 288, 64, 473, | |
1802 | 631, 86, 99, 657, 295, 61, 0, 1, 86, 100, | |
1803 | 641, 67, 303, 86, 305, 88, 95, 308, 91, 92, | |
1804 | 93, 86, 94, 1, 97, 97, 657, 66, 101, 101, | |
1805 | 44, 93, 0, 1, 93, 44, 88, 175, 1, 0, | |
1806 | 1, 55, 553, 697, 93, 556, 700, 61, 288, 65, | |
1807 | 44, 67, 61, 67, 99, 295, 72, 94, 67, 1, | |
1808 | 76, 91, 92, 303, 718, 305, 720, 61, 308, 723, | |
1809 | 86, 735, 50, 67, 1, 739, 44, 588, 697, 590, | |
1810 | 93, 700, 736, 44, 99, 99, 92, 718, 175, 720, | |
1811 | 99, 97, 98, 61, 1, 94, 750, 45, 46, 67, | |
1812 | 61, 5, 6, 7, 82, 99, 67, 85, 86, 763, | |
1813 | 8, 9, 10, 404, 768, 94, 770, 44, 772, 1, | |
1814 | 631, 45, 46, 50, 97, 636, 91, 92, 45, 46, | |
1815 | 1, 99, 59, 100, 61, 3, 4, 44, 99, 553, | |
1816 | 67, 94, 556, 50, 763, 56, 657, 16, 17, 768, | |
1817 | 288, 770, 99, 772, 665, 82, 56, 295, 85, 86, | |
1818 | 91, 92, 44, 50, 404, 303, 94, 305, 50, 94, | |
1819 | 308, 45, 46, 97, 588, 82, 590, 101, 85, 86, | |
1820 | 97, 94, 175, 1, 101, 44, 697, 45, 46, 700, | |
1821 | 10, 50, 97, 98, 99, 82, 44, 94, 85, 86, | |
1822 | 82, 288, 50, 85, 86, 97, 98, 718, 295, 720, | |
1823 | 30, 59, 723, 61, 34, 1, 303, 631, 305, 67, | |
1824 | 99, 308, 636, 82, 99, 736, 85, 86, 94, 384, | |
1825 | 385, 51, 374, 375, 82, 94, 0, 85, 86, 750, | |
1826 | 91, 92, 93, 657, 56, 756, 97, 95, 96, 94, | |
1827 | 101, 665, 763, 0, 765, 11, 383, 768, 54, 770, | |
1828 | 75, 772, 553, 162, 254, 556, 404, 86, 18, 19, | |
1829 | 20, 21, 91, 92, 93, 376, 377, 378, 97, 139, | |
1830 | 160, 404, 101, 697, 52, 86, 700, 94, 262, 308, | |
1831 | 91, 92, 93, 288, 571, 288, 97, 588, 655, 590, | |
1832 | 101, 655, 295, 308, 718, 571, 720, 57, 388, 723, | |
1833 | 303, 347, 305, 553, 389, 308, 556, 404, 386, 86, | |
1834 | 387, 390, 736, 394, 91, 92, 93, -1, -1, 44, | |
1835 | 97, 91, 92, 93, 101, 50, 750, 97, 628, 1, | |
1836 | 631, 101, 756, -1, 59, 636, 61, -1, 588, 763, | |
1837 | 590, 765, 67, -1, 768, -1, 770, -1, 772, 91, | |
1838 | 92, 93, -1, -1, -1, 97, 657, 82, -1, 101, | |
1839 | 85, 86, -1, -1, 665, 379, 380, 381, 382, -1, | |
1840 | 95, 96, 44, 45, 46, -1, -1, -1, 50, -1, | |
1841 | -1, 631, -1, -1, -1, -1, 636, 59, -1, -1, | |
1842 | -1, -1, -1, 65, -1, -1, 697, -1, -1, 700, | |
1843 | 72, 404, -1, -1, 76, 553, -1, 657, 556, -1, | |
1844 | 82, -1, -1, 85, 86, 665, -1, 718, -1, 720, | |
1845 | -1, 93, 723, -1, -1, -1, -1, 99, -1, -1, | |
1846 | 102, 103, 104, 105, -1, 736, 108, 109, -1, -1, | |
1847 | 588, -1, 590, -1, -1, -1, -1, 697, -1, 750, | |
1848 | 700, -1, -1, -1, -1, 756, 553, -1, -1, 556, | |
1849 | -1, -1, 763, -1, 765, -1, -1, 768, 718, 770, | |
1850 | 720, 772, -1, 723, -1, -1, -1, -1, -1, -1, | |
1851 | -1, -1, -1, 631, -1, -1, 736, -1, 636, -1, | |
1852 | -1, 588, -1, 590, -1, -1, -1, -1, -1, -1, | |
1853 | 750, -1, -1, -1, 44, -1, 756, -1, -1, 657, | |
1854 | 50, -1, -1, 763, -1, 765, -1, 665, 768, 59, | |
1855 | 770, 61, 772, -1, -1, -1, -1, 67, -1, -1, | |
1856 | -1, -1, -1, -1, 631, -1, -1, -1, -1, 636, | |
1857 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 697, | |
1858 | 553, -1, 700, 556, -1, -1, 96, -1, -1, -1, | |
1859 | 657, -1, -1, -1, -1, -1, -1, -1, 665, -1, | |
2884c41e | 1860 | 718, -1, 720, -1, -1, 723, -1, -1, -1, -1, |
a003f638 JB |
1861 | -1, -1, -1, -1, -1, 588, -1, 590, 736, -1, |
1862 | -1, -1, -1, -1, -1, -1, 193, 194, 195, 196, | |
1863 | 697, -1, 750, 700, 201, 202, -1, -1, 756, -1, | |
1864 | -1, -1, -1, -1, -1, 763, -1, 765, -1, -1, | |
1865 | 768, 718, 770, 720, 772, -1, 723, -1, 631, 193, | |
1866 | 194, 195, 196, 636, -1, -1, -1, 201, 202, 736, | |
1867 | -1, -1, -1, -1, -1, -1, 44, 1, -1, 3, | |
1868 | 4, -1, 50, 750, 657, -1, -1, -1, -1, 756, | |
1869 | -1, 59, 665, 61, -1, -1, 763, -1, 765, 67, | |
1870 | -1, 768, -1, 770, -1, 772, -1, -1, -1, -1, | |
1871 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
1872 | -1, 45, 46, -1, 697, -1, 50, 700, 96, -1, | |
1873 | -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, | |
1874 | -1, 65, -1, -1, -1, 718, -1, 720, 72, -1, | |
1875 | 723, -1, 76, -1, -1, -1, -1, -1, 82, -1, | |
1876 | -1, 85, 86, 736, -1, 89, 90, -1, -1, 93, | |
1877 | -1, 95, -1, -1, -1, -1, -1, 750, 102, 103, | |
1878 | 104, 105, -1, 756, 108, 109, -1, -1, -1, -1, | |
1879 | 763, -1, 765, -1, -1, 768, -1, 770, -1, 772, | |
1880 | -1, -1, -1, -1, 371, 372, 373, 374, 375, 376, | |
1881 | 377, 378, 379, 380, 381, 382, -1, 384, 385, 386, | |
1882 | 387, 388, 389, 390, -1, -1, -1, 1, -1, -1, | |
1883 | -1, -1, -1, -1, -1, -1, -1, 371, 372, 373, | |
1884 | 374, 375, 376, 377, 378, 379, 380, 381, 382, -1, | |
1885 | 384, 385, 386, 387, 388, 389, 390, -1, -1, -1, | |
efa0a23f | 1886 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
a003f638 JB |
1887 | 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, |
1888 | 54, -1, -1, -1, 58, 59, -1, -1, 62, -1, | |
1889 | -1, 65, 66, 67, 68, -1, 70, 71, 72, 73, | |
1890 | -1, -1, 76, -1, -1, -1, -1, 1, 82, -1, | |
1891 | 477, 85, 86, -1, -1, -1, 483, -1, -1, 93, | |
1892 | -1, 95, 96, -1, -1, 99, -1, -1, 102, 103, | |
1893 | 104, 105, 1, -1, 108, 109, -1, -1, -1, -1, | |
1894 | -1, -1, -1, 477, -1, -1, -1, -1, -1, 483, | |
1895 | 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, | |
1896 | 54, -1, -1, -1, 58, 59, -1, -1, 62, -1, | |
1897 | -1, 65, 66, 67, 68, -1, 70, 71, 72, 73, | |
1898 | -1, 50, 76, -1, -1, -1, -1, -1, 82, -1, | |
1899 | 59, 85, 86, -1, -1, -1, 65, -1, -1, 93, | |
1900 | -1, 95, 96, 72, -1, 99, -1, 76, 102, 103, | |
1901 | 104, 105, -1, 82, 108, 109, 85, 86, -1, -1, | |
1902 | 89, 90, -1, -1, 93, -1, -1, -1, -1, -1, | |
1903 | -1, -1, -1, 102, 103, 104, 105, -1, 1, 108, | |
1904 | 109, -1, -1, -1, -1, 612, 613, -1, -1, -1, | |
1905 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
1906 | -1, 628, -1, -1, -1, -1, -1, -1, -1, -1, | |
1907 | -1, -1, -1, -1, -1, -1, -1, -1, 612, 613, | |
1908 | -1, 44, 45, 46, 47, 48, 49, 50, 51, -1, | |
1909 | -1, 54, -1, -1, 628, 58, 59, -1, -1, 62, | |
1910 | -1, -1, 65, 66, 67, 68, 1, 70, 71, 72, | |
1911 | 73, -1, -1, 76, -1, -1, -1, -1, -1, 82, | |
1912 | -1, -1, 85, 86, -1, -1, -1, -1, -1, -1, | |
1913 | 93, -1, 95, 96, -1, -1, 99, -1, -1, 102, | |
1914 | 103, 104, 105, -1, -1, 108, 109, -1, -1, 44, | |
1915 | 45, 46, -1, 48, 49, 50, 51, -1, -1, 54, | |
1916 | -1, -1, -1, 58, 59, -1, -1, -1, -1, -1, | |
1917 | 65, 66, 67, 68, 1, 70, 71, 72, 73, -1, | |
1918 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
efa0a23f APB |
1919 | 85, 86, -1, -1, -1, -1, -1, -1, 93, -1, |
1920 | 95, 96, -1, -1, 99, -1, -1, 102, 103, 104, | |
a003f638 JB |
1921 | 105, -1, -1, 108, 109, -1, -1, 44, 45, 46, |
1922 | -1, 48, 49, 50, 51, -1, -1, 54, -1, -1, | |
1923 | -1, 58, 59, -1, -1, -1, -1, -1, 65, 66, | |
1924 | 67, 68, 1, 70, 71, 72, 73, -1, -1, 76, | |
1925 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
1926 | -1, -1, -1, -1, -1, -1, 93, -1, 95, -1, | |
1927 | -1, -1, 99, -1, -1, 102, 103, 104, 105, -1, | |
1928 | -1, 108, 109, -1, -1, 44, 45, 46, -1, 48, | |
1929 | 49, 50, 51, -1, -1, 54, -1, -1, -1, 58, | |
1930 | 59, -1, -1, -1, -1, -1, 65, 66, 1, 68, | |
1931 | -1, 70, 71, 72, 73, -1, -1, 76, -1, -1, | |
1932 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
1933 | -1, -1, -1, -1, 93, -1, 95, -1, -1, -1, | |
1934 | 99, -1, -1, 102, 103, 104, 105, -1, -1, 108, | |
1935 | 109, 44, 45, 46, -1, 48, 49, 50, 51, -1, | |
2884c41e | 1936 | -1, 54, -1, -1, -1, 58, 59, -1, -1, -1, |
a003f638 JB |
1937 | -1, -1, 65, 66, -1, 68, -1, 70, 71, 72, |
1938 | 73, -1, 1, 76, 3, 4, -1, -1, -1, 82, | |
1939 | -1, -1, 85, 86, -1, -1, -1, -1, -1, -1, | |
1940 | 93, -1, 95, -1, -1, -1, 99, -1, -1, 102, | |
2884c41e | 1941 | 103, 104, 105, -1, -1, 108, 109, -1, -1, -1, |
a003f638 JB |
1942 | -1, -1, -1, -1, -1, -1, 45, 46, -1, -1, |
1943 | -1, 50, -1, 1, -1, 3, 4, -1, -1, -1, | |
1944 | 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, | |
1945 | -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
1946 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
1947 | 89, 90, -1, -1, 93, -1, -1, 45, 46, -1, | |
1948 | 99, -1, 50, 102, 103, 104, 105, -1, -1, 108, | |
1949 | 109, 59, -1, -1, -1, -1, -1, 65, 1, -1, | |
1950 | 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, | |
1951 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
1952 | 88, 89, 90, -1, -1, 93, -1, -1, -1, -1, | |
1953 | -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, | |
1954 | 108, 109, 45, 46, -1, -1, -1, 50, -1, 1, | |
1955 | -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, | |
1956 | -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, | |
1957 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, | |
1958 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
1959 | 93, -1, -1, 45, 46, 98, -1, -1, 50, 102, | |
1960 | 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, | |
2884c41e KG |
1961 | -1, -1, -1, 65, 1, -1, 3, 4, -1, -1, |
1962 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, | |
1963 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
a003f638 | 1964 | -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, |
2884c41e KG |
1965 | 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, |
1966 | -1, -1, -1, 50, -1, 1, -1, 3, 4, -1, | |
1967 | -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, | |
1968 | -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, | |
1969 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
1970 | -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, | |
1971 | 46, -1, 99, -1, 50, 102, 103, 104, 105, -1, | |
1972 | -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, | |
1973 | 1, -1, 3, 4, -1, -1, 72, -1, -1, -1, | |
efa0a23f | 1974 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, |
a003f638 JB |
1975 | 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, |
1976 | -1, -1, 98, -1, -1, -1, 102, 103, 104, 105, | |
2884c41e KG |
1977 | -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, |
1978 | -1, 1, -1, 3, 4, -1, -1, -1, 59, -1, | |
1979 | -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, | |
1980 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, | |
1981 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
a003f638 | 1982 | -1, -1, 93, 94, -1, 45, 46, -1, -1, -1, |
2884c41e KG |
1983 | 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, |
1984 | -1, -1, -1, -1, -1, 65, 1, -1, 3, 4, | |
efa0a23f APB |
1985 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, |
1986 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
a003f638 | 1987 | 90, -1, -1, 93, -1, -1, -1, -1, 98, -1, |
2884c41e KG |
1988 | -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, |
1989 | 45, 46, -1, -1, -1, 50, -1, 1, -1, 3, | |
1990 | 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, | |
1991 | 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, | |
1992 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
a003f638 JB |
1993 | 85, 86, -1, -1, 89, 90, -1, -1, 93, 94, |
1994 | -1, 45, 46, -1, -1, -1, 50, 102, 103, 104, | |
2884c41e KG |
1995 | 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, |
1996 | -1, 65, 1, -1, 3, 4, -1, -1, 72, -1, | |
12472854 | 1997 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, |
0b4d333e | 1998 | -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, |
a003f638 | 1999 | 94, -1, -1, -1, -1, -1, -1, -1, 102, 103, |
2884c41e KG |
2000 | 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, |
2001 | -1, 50, -1, 1, -1, 3, 4, -1, -1, -1, | |
2002 | 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, | |
2003 | -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
2004 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
2005 | 89, 90, -1, -1, 93, 94, -1, 45, 46, -1, | |
2006 | -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, | |
2007 | 109, 59, -1, -1, -1, -1, -1, 65, 1, -1, | |
2008 | 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, | |
2009 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
2010 | -1, 89, 90, -1, -1, 93, -1, -1, -1, -1, | |
a003f638 | 2011 | -1, 99, -1, -1, 102, 103, 104, 105, -1, -1, |
2884c41e KG |
2012 | 108, 109, 45, 46, -1, -1, -1, 50, -1, 1, |
2013 | -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, | |
2014 | -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, | |
22eed1e6 APB |
2015 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, |
2016 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
a003f638 | 2017 | 93, -1, -1, 45, 46, -1, -1, -1, 50, 102, |
2884c41e KG |
2018 | 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, |
2019 | -1, -1, -1, 65, 1, -1, 3, 4, -1, -1, | |
8b27f225 PB |
2020 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
2021 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
a003f638 | 2022 | -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, |
2884c41e KG |
2023 | 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, |
2024 | -1, -1, -1, 50, -1, 1, -1, 3, 4, -1, | |
2025 | -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, | |
2026 | -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, | |
2027 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
a003f638 | 2028 | -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, |
2884c41e KG |
2029 | 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, |
2030 | -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, | |
2031 | 1, -1, 3, 4, -1, -1, 72, -1, -1, -1, | |
2032 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, | |
2033 | 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, | |
a003f638 | 2034 | -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, |
2884c41e KG |
2035 | -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, |
2036 | -1, 1, -1, 3, 4, -1, -1, -1, 59, -1, | |
2037 | -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, | |
2e5eb5c5 APB |
2038 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, |
2039 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
2884c41e KG |
2040 | -1, -1, 93, -1, -1, 45, 46, -1, -1, -1, |
2041 | 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, | |
2042 | -1, -1, -1, -1, -1, 65, 1, -1, 3, 4, | |
8b27f225 PB |
2043 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, |
2044 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
2884c41e KG |
2045 | 90, -1, -1, 93, -1, -1, -1, -1, -1, -1, |
2046 | -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, | |
2047 | 45, 46, -1, -1, -1, 50, -1, 1, -1, 3, | |
2048 | 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, | |
2049 | 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, | |
2050 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
2051 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, | |
2052 | -1, 45, 46, -1, -1, -1, 50, 102, 103, 104, | |
2053 | 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, | |
2054 | -1, 65, 1, -1, 3, 4, -1, -1, 72, -1, | |
8b27f225 PB |
2055 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, |
2056 | -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, | |
2884c41e KG |
2057 | -1, -1, -1, -1, -1, -1, -1, -1, 102, 103, |
2058 | 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, | |
2059 | -1, 50, -1, 1, -1, 3, 4, -1, -1, -1, | |
2060 | 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, | |
2061 | -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
2062 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
2063 | 89, 90, -1, -1, 93, -1, -1, 45, 46, -1, | |
2064 | -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, | |
2065 | 109, 59, -1, -1, -1, -1, -1, 65, 1, -1, | |
2066 | 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, | |
2067 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
2068 | -1, 89, 90, -1, -1, 93, -1, -1, -1, -1, | |
2069 | -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, | |
2070 | 108, 109, 45, 46, -1, -1, -1, 50, -1, 1, | |
2071 | -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, | |
2072 | -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, | |
8b27f225 PB |
2073 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, |
2074 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
2884c41e KG |
2075 | 93, -1, -1, 45, 46, -1, -1, -1, 50, 102, |
2076 | 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, | |
2077 | -1, -1, -1, 65, 1, -1, 3, 4, -1, -1, | |
8b27f225 PB |
2078 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
2079 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
2884c41e KG |
2080 | -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, |
2081 | 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, | |
2082 | -1, -1, -1, 50, -1, 1, -1, 3, 4, -1, | |
2083 | -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, | |
2084 | -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, | |
2085 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
2086 | -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, | |
2087 | 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, | |
2088 | -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, | |
2089 | 1, -1, 3, 4, -1, -1, 72, -1, -1, -1, | |
efa0a23f APB |
2090 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, |
2091 | 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, | |
2884c41e KG |
2092 | -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, |
2093 | -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, | |
2094 | -1, 1, -1, 3, 4, -1, -1, -1, 59, -1, | |
2095 | -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, | |
2096 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, | |
2097 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
2098 | -1, -1, 93, -1, -1, 45, 46, -1, -1, -1, | |
2099 | 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, | |
2100 | -1, -1, -1, -1, -1, 65, 1, -1, 3, 4, | |
efa0a23f APB |
2101 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, |
2102 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
2884c41e KG |
2103 | 90, -1, -1, 93, -1, -1, -1, -1, -1, -1, |
2104 | -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, | |
2105 | 45, 46, -1, -1, -1, 50, -1, 1, -1, 3, | |
2106 | 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, | |
2107 | 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, | |
2108 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
2109 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, | |
2110 | -1, 45, 46, -1, -1, -1, 50, 102, 103, 104, | |
2111 | 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, | |
2112 | -1, 65, 1, -1, 3, 4, -1, -1, 72, -1, | |
8b27f225 PB |
2113 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, |
2114 | -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, | |
2884c41e KG |
2115 | -1, -1, -1, -1, -1, -1, -1, -1, 102, 103, |
2116 | 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, | |
2117 | -1, 50, -1, 1, -1, 3, 4, -1, -1, -1, | |
2118 | 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, | |
2119 | -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
2120 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
2121 | 89, 90, -1, -1, 93, -1, -1, 45, 46, -1, | |
2122 | -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, | |
2123 | 109, 59, -1, -1, -1, -1, -1, 65, 1, -1, | |
2124 | 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, | |
2125 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
2126 | -1, 89, 90, -1, -1, 93, -1, -1, -1, -1, | |
2127 | -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, | |
2128 | 108, 109, 45, 46, -1, -1, -1, 50, -1, 1, | |
2129 | -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, | |
2130 | -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, | |
8b27f225 PB |
2131 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, |
2132 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
2884c41e KG |
2133 | 93, -1, -1, 45, 46, -1, -1, -1, 50, 102, |
2134 | 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, | |
2135 | -1, -1, -1, 65, 1, -1, 3, 4, -1, -1, | |
8b27f225 PB |
2136 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
2137 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
2884c41e KG |
2138 | -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, |
2139 | 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, | |
2140 | -1, -1, -1, 50, -1, 1, -1, 3, 4, -1, | |
2141 | -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, | |
2142 | -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, | |
2143 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
2144 | -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, | |
2145 | 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, | |
2146 | -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, | |
2147 | 1, -1, 3, 4, -1, -1, 72, -1, -1, -1, | |
efa0a23f APB |
2148 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, |
2149 | 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, | |
2884c41e KG |
2150 | -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, |
2151 | -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, | |
2152 | -1, 1, -1, 3, 4, -1, -1, -1, 59, -1, | |
2153 | -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, | |
2154 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, | |
2155 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
2156 | -1, -1, 93, -1, -1, 45, 46, -1, -1, -1, | |
2157 | 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, | |
2158 | -1, -1, -1, -1, -1, 65, 1, -1, 3, 4, | |
efa0a23f APB |
2159 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, |
2160 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
2884c41e KG |
2161 | 90, -1, -1, 93, -1, -1, -1, -1, -1, -1, |
2162 | -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, | |
2163 | 45, 46, -1, -1, -1, 50, -1, 1, -1, 3, | |
2164 | 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, | |
2165 | 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, | |
2166 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
2167 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, | |
2168 | -1, 45, 46, -1, -1, -1, 50, 102, 103, 104, | |
2169 | 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, | |
2170 | -1, 65, 1, -1, 3, 4, -1, -1, 72, -1, | |
8b27f225 PB |
2171 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, |
2172 | -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, | |
2884c41e KG |
2173 | -1, -1, -1, -1, -1, -1, -1, -1, 102, 103, |
2174 | 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, | |
2175 | -1, 50, -1, 1, -1, 3, 4, -1, -1, -1, | |
2176 | 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, | |
2177 | -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, | |
2178 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, | |
2179 | 89, 90, -1, -1, 93, -1, -1, 45, 46, -1, | |
2180 | -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, | |
2181 | 109, 59, -1, -1, -1, -1, -1, 65, 1, -1, | |
2182 | 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, | |
2183 | -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, | |
2184 | -1, 89, 90, -1, -1, 93, -1, -1, -1, -1, | |
2185 | -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, | |
2186 | 108, 109, 45, 46, -1, -1, -1, 50, -1, 1, | |
2187 | -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, | |
2188 | -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, | |
8b27f225 PB |
2189 | -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, |
2190 | -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, | |
2884c41e KG |
2191 | 93, -1, -1, 45, 46, -1, -1, -1, 50, 102, |
2192 | 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, | |
2193 | -1, -1, -1, 65, 1, -1, 3, 4, -1, -1, | |
8b27f225 PB |
2194 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
2195 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
2884c41e KG |
2196 | -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, |
2197 | 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, | |
2198 | -1, -1, -1, 50, -1, 1, -1, 3, 4, -1, | |
2199 | -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, | |
2200 | -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, | |
2201 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, | |
2202 | -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, | |
2203 | 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, | |
2204 | -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, | |
2205 | 1, -1, 3, 4, -1, -1, 72, -1, -1, -1, | |
efa0a23f APB |
2206 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, |
2207 | 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, | |
2884c41e KG |
2208 | -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, |
2209 | -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, | |
2210 | -1, 1, -1, 3, 4, -1, -1, -1, 59, -1, | |
2211 | -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, | |
2212 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, | |
2213 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
2214 | -1, -1, 93, -1, -1, 45, 46, -1, -1, -1, | |
2215 | 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, | |
2216 | -1, -1, -1, -1, -1, 65, 1, -1, 3, 4, | |
efa0a23f APB |
2217 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, |
2218 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
2884c41e KG |
2219 | 90, -1, -1, 93, -1, -1, -1, -1, -1, -1, |
2220 | -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, | |
2221 | 45, 46, -1, -1, -1, 50, -1, 1, -1, 3, | |
2222 | 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, | |
2223 | 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, | |
2224 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
2225 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, | |
2226 | -1, 45, 46, -1, -1, -1, 50, 102, 103, 104, | |
2227 | 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, | |
2228 | -1, 65, 1, -1, 3, 4, -1, -1, 72, -1, | |
8b27f225 PB |
2229 | -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, |
2230 | -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, | |
2884c41e KG |
2231 | -1, -1, -1, -1, -1, -1, -1, -1, 102, 103, |
2232 | 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, | |
a003f638 | 2233 | -1, 50, -1, 1, -1, -1, -1, -1, -1, -1, |
2884c41e | 2234 | 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, |
a003f638 | 2235 | -1, -1, -1, 72, -1, -1, -1, 76, 1, -1, |
2884c41e KG |
2236 | -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, |
2237 | 89, 90, -1, -1, 93, -1, -1, 45, 46, -1, | |
2238 | -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, | |
a003f638 JB |
2239 | 109, 59, -1, -1, -1, -1, -1, 65, -1, -1, |
2240 | -1, -1, 45, 46, 72, -1, -1, 50, 76, -1, | |
2241 | -1, 3, 4, -1, 82, -1, 59, 85, 86, -1, | |
2242 | -1, -1, 65, -1, -1, 93, 94, -1, -1, 72, | |
2243 | -1, -1, -1, 76, 102, 103, 104, 105, -1, 82, | |
2244 | 108, 109, 85, 86, -1, -1, -1, -1, -1, -1, | |
2245 | 93, 94, -1, 45, 46, -1, -1, -1, 50, 102, | |
2884c41e | 2246 | 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, |
a003f638 | 2247 | -1, -1, -1, 65, -1, -1, 3, 4, -1, -1, |
8b27f225 PB |
2248 | 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
2249 | 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, | |
a003f638 | 2250 | -1, 93, -1, 95, 96, -1, -1, -1, -1, -1, |
2884c41e | 2251 | 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, |
a003f638 | 2252 | -1, -1, -1, 50, -1, -1, -1, 3, 4, -1, |
2884c41e KG |
2253 | -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, |
2254 | -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, | |
a003f638 | 2255 | -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, |
2884c41e KG |
2256 | -1, -1, 89, 90, -1, -1, 93, 94, -1, 45, |
2257 | 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, | |
2258 | -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, | |
2259 | -1, -1, 3, 4, -1, -1, 72, -1, -1, -1, | |
2260 | 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, | |
2261 | 86, -1, -1, 89, 90, -1, -1, 93, 94, -1, | |
2262 | -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, | |
2263 | -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, | |
2264 | -1, -1, -1, 3, 4, -1, -1, -1, 59, -1, | |
2265 | -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, | |
2e5eb5c5 APB |
2266 | -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, |
2267 | -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, | |
2884c41e KG |
2268 | -1, -1, 93, 94, -1, 45, 46, -1, -1, -1, |
2269 | 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, | |
2270 | -1, -1, -1, -1, -1, 65, -1, -1, 3, 4, | |
efa0a23f APB |
2271 | -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, |
2272 | -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, | |
2884c41e KG |
2273 | 90, -1, -1, 93, 94, -1, -1, -1, -1, -1, |
2274 | -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, | |
2275 | 45, 46, -1, -1, -1, 50, -1, -1, -1, -1, | |
2276 | -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, | |
2277 | 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, | |
2278 | -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, | |
a003f638 JB |
2279 | 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, |
2280 | 44, 45, 46, -1, -1, -1, 50, 102, 103, 104, | |
2281 | 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, | |
2282 | -1, 65, -1, -1, -1, -1, -1, -1, 72, -1, | |
2283 | -1, 50, 76, -1, -1, -1, -1, -1, 82, -1, | |
2284 | 59, 85, 86, -1, -1, -1, 65, -1, -1, 93, | |
2285 | -1, -1, -1, 72, -1, -1, -1, 76, 102, 103, | |
2286 | 104, 105, -1, 82, 108, 109, 85, 86, -1, -1, | |
2287 | 89, 90, -1, -1, 93, -1, -1, -1, -1, -1, | |
2288 | -1, -1, -1, 102, 103, 104, 105, -1, -1, 108, | |
2289 | 109 | |
8b27f225 PB |
2290 | }; |
2291 | #define YYPURE 1 | |
2292 | ||
2293 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ | |
518f173d APB |
2294 | #line 3 "/usr/lib/bison.simple" |
2295 | /* This file comes from bison-1.28. */ | |
8b27f225 PB |
2296 | |
2297 | /* Skeleton output parser for bison, | |
2298 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. | |
2299 | ||
2300 | This program is free software; you can redistribute it and/or modify | |
2301 | it under the terms of the GNU General Public License as published by | |
2302 | the Free Software Foundation; either version 2, or (at your option) | |
2303 | any later version. | |
2304 | ||
2305 | This program is distributed in the hope that it will be useful, | |
2306 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
2307 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
2308 | GNU General Public License for more details. | |
2309 | ||
2310 | You should have received a copy of the GNU General Public License | |
2311 | along with this program; if not, write to the Free Software | |
518f173d APB |
2312 | Foundation, Inc., 59 Temple Place - Suite 330, |
2313 | Boston, MA 02111-1307, USA. */ | |
8b27f225 PB |
2314 | |
2315 | /* As a special exception, when this file is copied by Bison into a | |
2316 | Bison output file, you may use that output file without restriction. | |
2317 | This special exception was added by the Free Software Foundation | |
2318 | in version 1.24 of Bison. */ | |
2319 | ||
518f173d APB |
2320 | /* This is the parser code that is written into each bison parser |
2321 | when the %semantic_parser declaration is not specified in the grammar. | |
2322 | It was written by Richard Stallman by simplifying the hairy parser | |
2323 | used when %semantic_parser is specified. */ | |
2324 | ||
2325 | #ifndef YYSTACK_USE_ALLOCA | |
2326 | #ifdef alloca | |
2327 | #define YYSTACK_USE_ALLOCA | |
2328 | #else /* alloca not defined */ | |
8b27f225 | 2329 | #ifdef __GNUC__ |
518f173d | 2330 | #define YYSTACK_USE_ALLOCA |
8b27f225 PB |
2331 | #define alloca __builtin_alloca |
2332 | #else /* not GNU C. */ | |
518f173d APB |
2333 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) |
2334 | #define YYSTACK_USE_ALLOCA | |
8b27f225 PB |
2335 | #include <alloca.h> |
2336 | #else /* not sparc */ | |
518f173d APB |
2337 | /* We think this test detects Watcom and Microsoft C. */ |
2338 | /* This used to test MSDOS, but that is a bad idea | |
2339 | since that symbol is in the user namespace. */ | |
2340 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) | |
2341 | #if 0 /* No need for malloc.h, which pollutes the namespace; | |
2342 | instead, just don't use alloca. */ | |
8b27f225 | 2343 | #include <malloc.h> |
518f173d | 2344 | #endif |
8b27f225 PB |
2345 | #else /* not MSDOS, or __TURBOC__ */ |
2346 | #if defined(_AIX) | |
518f173d APB |
2347 | /* I don't know what this was needed for, but it pollutes the namespace. |
2348 | So I turned it off. rms, 2 May 1997. */ | |
2349 | /* #include <malloc.h> */ | |
8b27f225 | 2350 | #pragma alloca |
518f173d APB |
2351 | #define YYSTACK_USE_ALLOCA |
2352 | #else /* not MSDOS, or __TURBOC__, or _AIX */ | |
2353 | #if 0 | |
2354 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, | |
2355 | and on HPUX 10. Eventually we can turn this on. */ | |
2356 | #define YYSTACK_USE_ALLOCA | |
2357 | #define alloca __builtin_alloca | |
8b27f225 | 2358 | #endif /* __hpux */ |
518f173d | 2359 | #endif |
8b27f225 PB |
2360 | #endif /* not _AIX */ |
2361 | #endif /* not MSDOS, or __TURBOC__ */ | |
518f173d APB |
2362 | #endif /* not sparc */ |
2363 | #endif /* not GNU C */ | |
2364 | #endif /* alloca not defined */ | |
2365 | #endif /* YYSTACK_USE_ALLOCA not defined */ | |
8b27f225 | 2366 | |
518f173d APB |
2367 | #ifdef YYSTACK_USE_ALLOCA |
2368 | #define YYSTACK_ALLOC alloca | |
2369 | #else | |
2370 | #define YYSTACK_ALLOC malloc | |
2371 | #endif | |
8b27f225 PB |
2372 | |
2373 | /* Note: there must be only one dollar sign in this file. | |
2374 | It is replaced by the list of actions, each action | |
2375 | as one case of the switch. */ | |
2376 | ||
2377 | #define yyerrok (yyerrstatus = 0) | |
2378 | #define yyclearin (yychar = YYEMPTY) | |
2379 | #define YYEMPTY -2 | |
2380 | #define YYEOF 0 | |
518f173d APB |
2381 | #define YYACCEPT goto yyacceptlab |
2382 | #define YYABORT goto yyabortlab | |
8b27f225 PB |
2383 | #define YYERROR goto yyerrlab1 |
2384 | /* Like YYERROR except do call yyerror. | |
2385 | This remains here temporarily to ease the | |
2386 | transition to the new meaning of YYERROR, for GCC. | |
2387 | Once GCC version 2 has supplanted version 1, this can go. */ | |
2388 | #define YYFAIL goto yyerrlab | |
2389 | #define YYRECOVERING() (!!yyerrstatus) | |
2390 | #define YYBACKUP(token, value) \ | |
2391 | do \ | |
2392 | if (yychar == YYEMPTY && yylen == 1) \ | |
2393 | { yychar = (token), yylval = (value); \ | |
2394 | yychar1 = YYTRANSLATE (yychar); \ | |
2395 | YYPOPSTACK; \ | |
2396 | goto yybackup; \ | |
2397 | } \ | |
2398 | else \ | |
2399 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ | |
2400 | while (0) | |
2401 | ||
2402 | #define YYTERROR 1 | |
2403 | #define YYERRCODE 256 | |
2404 | ||
2405 | #ifndef YYPURE | |
2406 | #define YYLEX yylex() | |
2407 | #endif | |
2408 | ||
2409 | #ifdef YYPURE | |
2410 | #ifdef YYLSP_NEEDED | |
2411 | #ifdef YYLEX_PARAM | |
2412 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) | |
2413 | #else | |
2414 | #define YYLEX yylex(&yylval, &yylloc) | |
2415 | #endif | |
2416 | #else /* not YYLSP_NEEDED */ | |
2417 | #ifdef YYLEX_PARAM | |
2418 | #define YYLEX yylex(&yylval, YYLEX_PARAM) | |
2419 | #else | |
2420 | #define YYLEX yylex(&yylval) | |
2421 | #endif | |
2422 | #endif /* not YYLSP_NEEDED */ | |
2423 | #endif | |
2424 | ||
2425 | /* If nonreentrant, generate the variables here */ | |
2426 | ||
2427 | #ifndef YYPURE | |
2428 | ||
2429 | int yychar; /* the lookahead symbol */ | |
2430 | YYSTYPE yylval; /* the semantic value of the */ | |
2431 | /* lookahead symbol */ | |
2432 | ||
2433 | #ifdef YYLSP_NEEDED | |
2434 | YYLTYPE yylloc; /* location data for the lookahead */ | |
2435 | /* symbol */ | |
2436 | #endif | |
2437 | ||
2438 | int yynerrs; /* number of parse errors so far */ | |
2439 | #endif /* not YYPURE */ | |
2440 | ||
2441 | #if YYDEBUG != 0 | |
2442 | int yydebug; /* nonzero means print parse trace */ | |
2443 | /* Since this is uninitialized, it does not stop multiple parsers | |
2444 | from coexisting. */ | |
2445 | #endif | |
2446 | ||
2447 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ | |
2448 | ||
2449 | #ifndef YYINITDEPTH | |
2450 | #define YYINITDEPTH 200 | |
2451 | #endif | |
2452 | ||
2453 | /* YYMAXDEPTH is the maximum size the stacks can grow to | |
2454 | (effective only if the built-in stack extension method is used). */ | |
2455 | ||
2456 | #if YYMAXDEPTH == 0 | |
2457 | #undef YYMAXDEPTH | |
2458 | #endif | |
2459 | ||
2460 | #ifndef YYMAXDEPTH | |
2461 | #define YYMAXDEPTH 10000 | |
2462 | #endif | |
3ff9925c | 2463 | \f |
518f173d APB |
2464 | /* Define __yy_memcpy. Note that the size argument |
2465 | should be passed with type unsigned int, because that is what the non-GCC | |
2466 | definitions require. With GCC, __builtin_memcpy takes an arg | |
2467 | of type size_t, but it can handle unsigned int. */ | |
2468 | ||
8b27f225 PB |
2469 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ |
2470 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) | |
2471 | #else /* not GNU C or C++ */ | |
2472 | #ifndef __cplusplus | |
2473 | ||
2474 | /* This is the most reliable way to avoid incompatibilities | |
2475 | in available built-in functions on various systems. */ | |
2476 | static void | |
2477 | __yy_memcpy (to, from, count) | |
2478 | char *to; | |
2479 | char *from; | |
518f173d | 2480 | unsigned int count; |
8b27f225 PB |
2481 | { |
2482 | register char *f = from; | |
2483 | register char *t = to; | |
2484 | register int i = count; | |
2485 | ||
2486 | while (i-- > 0) | |
2487 | *t++ = *f++; | |
2488 | } | |
2489 | ||
2490 | #else /* __cplusplus */ | |
2491 | ||
2492 | /* This is the most reliable way to avoid incompatibilities | |
2493 | in available built-in functions on various systems. */ | |
2494 | static void | |
518f173d | 2495 | __yy_memcpy (char *to, char *from, unsigned int count) |
8b27f225 | 2496 | { |
3ff9925c | 2497 | register char *t = to; |
518f173d | 2498 | register char *f = from; |
8b27f225 PB |
2499 | register int i = count; |
2500 | ||
2501 | while (i-- > 0) | |
2502 | *t++ = *f++; | |
2503 | } | |
2504 | ||
2505 | #endif | |
2506 | #endif | |
2507 | \f | |
518f173d | 2508 | #line 217 "/usr/lib/bison.simple" |
8b27f225 PB |
2509 | |
2510 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
2511 | into yyparse. The argument should have type void *. | |
2512 | It should actually point to an object. | |
2513 | Grammar actions can access the variable by casting it | |
2514 | to the proper pointer type. */ | |
2515 | ||
2516 | #ifdef YYPARSE_PARAM | |
2517 | #ifdef __cplusplus | |
2518 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | |
2519 | #define YYPARSE_PARAM_DECL | |
2520 | #else /* not __cplusplus */ | |
2521 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM | |
2522 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | |
2523 | #endif /* not __cplusplus */ | |
2524 | #else /* not YYPARSE_PARAM */ | |
2525 | #define YYPARSE_PARAM_ARG | |
2526 | #define YYPARSE_PARAM_DECL | |
2527 | #endif /* not YYPARSE_PARAM */ | |
2528 | ||
518f173d APB |
2529 | /* Prevent warning if -Wstrict-prototypes. */ |
2530 | #ifdef __GNUC__ | |
2531 | #ifdef YYPARSE_PARAM | |
2532 | int yyparse (void *); | |
2533 | #else | |
2534 | int yyparse (void); | |
2535 | #endif | |
2536 | #endif | |
2537 | ||
8b27f225 PB |
2538 | int |
2539 | yyparse(YYPARSE_PARAM_ARG) | |
2540 | YYPARSE_PARAM_DECL | |
2541 | { | |
2542 | register int yystate; | |
2543 | register int yyn; | |
2544 | register short *yyssp; | |
2545 | register YYSTYPE *yyvsp; | |
2546 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ | |
2547 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ | |
2548 | ||
2549 | short yyssa[YYINITDEPTH]; /* the state stack */ | |
2550 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ | |
2551 | ||
2552 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ | |
2553 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ | |
2554 | ||
2555 | #ifdef YYLSP_NEEDED | |
2556 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ | |
2557 | YYLTYPE *yyls = yylsa; | |
2558 | YYLTYPE *yylsp; | |
2559 | ||
2560 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) | |
2561 | #else | |
2562 | #define YYPOPSTACK (yyvsp--, yyssp--) | |
2563 | #endif | |
2564 | ||
2565 | int yystacksize = YYINITDEPTH; | |
518f173d | 2566 | int yyfree_stacks = 0; |
8b27f225 PB |
2567 | |
2568 | #ifdef YYPURE | |
2569 | int yychar; | |
2570 | YYSTYPE yylval; | |
2571 | int yynerrs; | |
2572 | #ifdef YYLSP_NEEDED | |
2573 | YYLTYPE yylloc; | |
2574 | #endif | |
2575 | #endif | |
2576 | ||
2577 | YYSTYPE yyval; /* the variable used to return */ | |
2578 | /* semantic values from the action */ | |
2579 | /* routines */ | |
2580 | ||
2581 | int yylen; | |
2582 | ||
2583 | #if YYDEBUG != 0 | |
2584 | if (yydebug) | |
2585 | fprintf(stderr, "Starting parse\n"); | |
2586 | #endif | |
2587 | ||
2588 | yystate = 0; | |
2589 | yyerrstatus = 0; | |
2590 | yynerrs = 0; | |
2591 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
2592 | ||
2593 | /* Initialize stack pointers. | |
2594 | Waste one element of value and location stack | |
2595 | so that they stay on the same level as the state stack. | |
2596 | The wasted elements are never initialized. */ | |
2597 | ||
2598 | yyssp = yyss - 1; | |
2599 | yyvsp = yyvs; | |
2600 | #ifdef YYLSP_NEEDED | |
2601 | yylsp = yyls; | |
2602 | #endif | |
2603 | ||
2604 | /* Push a new state, which is found in yystate . */ | |
2605 | /* In all cases, when you get here, the value and location stacks | |
2606 | have just been pushed. so pushing a state here evens the stacks. */ | |
2607 | yynewstate: | |
2608 | ||
2609 | *++yyssp = yystate; | |
2610 | ||
2611 | if (yyssp >= yyss + yystacksize - 1) | |
2612 | { | |
2613 | /* Give user a chance to reallocate the stack */ | |
2614 | /* Use copies of these so that the &'s don't force the real ones into memory. */ | |
2615 | YYSTYPE *yyvs1 = yyvs; | |
2616 | short *yyss1 = yyss; | |
2617 | #ifdef YYLSP_NEEDED | |
2618 | YYLTYPE *yyls1 = yyls; | |
2619 | #endif | |
2620 | ||
2621 | /* Get the current used size of the three stacks, in elements. */ | |
2622 | int size = yyssp - yyss + 1; | |
2623 | ||
2624 | #ifdef yyoverflow | |
2625 | /* Each stack pointer address is followed by the size of | |
2626 | the data in use in that stack, in bytes. */ | |
2627 | #ifdef YYLSP_NEEDED | |
2628 | /* This used to be a conditional around just the two extra args, | |
2629 | but that might be undefined if yyoverflow is a macro. */ | |
2630 | yyoverflow("parser stack overflow", | |
2631 | &yyss1, size * sizeof (*yyssp), | |
2632 | &yyvs1, size * sizeof (*yyvsp), | |
2633 | &yyls1, size * sizeof (*yylsp), | |
2634 | &yystacksize); | |
2635 | #else | |
2636 | yyoverflow("parser stack overflow", | |
2637 | &yyss1, size * sizeof (*yyssp), | |
2638 | &yyvs1, size * sizeof (*yyvsp), | |
2639 | &yystacksize); | |
2640 | #endif | |
2641 | ||
2642 | yyss = yyss1; yyvs = yyvs1; | |
2643 | #ifdef YYLSP_NEEDED | |
2644 | yyls = yyls1; | |
2645 | #endif | |
2646 | #else /* no yyoverflow */ | |
2647 | /* Extend the stack our own way. */ | |
2648 | if (yystacksize >= YYMAXDEPTH) | |
2649 | { | |
2650 | yyerror("parser stack overflow"); | |
518f173d APB |
2651 | if (yyfree_stacks) |
2652 | { | |
2653 | free (yyss); | |
2654 | free (yyvs); | |
2655 | #ifdef YYLSP_NEEDED | |
2656 | free (yyls); | |
2657 | #endif | |
2658 | } | |
8b27f225 PB |
2659 | return 2; |
2660 | } | |
2661 | yystacksize *= 2; | |
2662 | if (yystacksize > YYMAXDEPTH) | |
2663 | yystacksize = YYMAXDEPTH; | |
518f173d APB |
2664 | #ifndef YYSTACK_USE_ALLOCA |
2665 | yyfree_stacks = 1; | |
2666 | #endif | |
2667 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); | |
2668 | __yy_memcpy ((char *)yyss, (char *)yyss1, | |
2669 | size * (unsigned int) sizeof (*yyssp)); | |
2670 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); | |
2671 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, | |
2672 | size * (unsigned int) sizeof (*yyvsp)); | |
8b27f225 | 2673 | #ifdef YYLSP_NEEDED |
518f173d APB |
2674 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); |
2675 | __yy_memcpy ((char *)yyls, (char *)yyls1, | |
2676 | size * (unsigned int) sizeof (*yylsp)); | |
8b27f225 PB |
2677 | #endif |
2678 | #endif /* no yyoverflow */ | |
2679 | ||
2680 | yyssp = yyss + size - 1; | |
2681 | yyvsp = yyvs + size - 1; | |
2682 | #ifdef YYLSP_NEEDED | |
2683 | yylsp = yyls + size - 1; | |
2684 | #endif | |
2685 | ||
2686 | #if YYDEBUG != 0 | |
2687 | if (yydebug) | |
2688 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); | |
2689 | #endif | |
2690 | ||
2691 | if (yyssp >= yyss + yystacksize - 1) | |
2692 | YYABORT; | |
2693 | } | |
2694 | ||
2695 | #if YYDEBUG != 0 | |
2696 | if (yydebug) | |
2697 | fprintf(stderr, "Entering state %d\n", yystate); | |
2698 | #endif | |
2699 | ||
2700 | goto yybackup; | |
2701 | yybackup: | |
2702 | ||
2703 | /* Do appropriate processing given the current state. */ | |
2704 | /* Read a lookahead token if we need one and don't already have one. */ | |
2705 | /* yyresume: */ | |
2706 | ||
2707 | /* First try to decide what to do without reference to lookahead token. */ | |
2708 | ||
2709 | yyn = yypact[yystate]; | |
2710 | if (yyn == YYFLAG) | |
2711 | goto yydefault; | |
2712 | ||
2713 | /* Not known => get a lookahead token if don't already have one. */ | |
2714 | ||
2715 | /* yychar is either YYEMPTY or YYEOF | |
2716 | or a valid token in external form. */ | |
2717 | ||
2718 | if (yychar == YYEMPTY) | |
2719 | { | |
2720 | #if YYDEBUG != 0 | |
2721 | if (yydebug) | |
2722 | fprintf(stderr, "Reading a token: "); | |
2723 | #endif | |
2724 | yychar = YYLEX; | |
2725 | } | |
2726 | ||
2727 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
2728 | ||
2729 | if (yychar <= 0) /* This means end of input. */ | |
2730 | { | |
2731 | yychar1 = 0; | |
2732 | yychar = YYEOF; /* Don't call YYLEX any more */ | |
2733 | ||
2734 | #if YYDEBUG != 0 | |
2735 | if (yydebug) | |
2736 | fprintf(stderr, "Now at end of input.\n"); | |
2737 | #endif | |
2738 | } | |
2739 | else | |
2740 | { | |
2741 | yychar1 = YYTRANSLATE(yychar); | |
2742 | ||
2743 | #if YYDEBUG != 0 | |
2744 | if (yydebug) | |
2745 | { | |
2746 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | |
2747 | /* Give the individual parser a way to print the precise meaning | |
2748 | of a token, for further debugging info. */ | |
2749 | #ifdef YYPRINT | |
2750 | YYPRINT (stderr, yychar, yylval); | |
2751 | #endif | |
2752 | fprintf (stderr, ")\n"); | |
2753 | } | |
2754 | #endif | |
2755 | } | |
2756 | ||
2757 | yyn += yychar1; | |
2758 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
2759 | goto yydefault; | |
2760 | ||
2761 | yyn = yytable[yyn]; | |
2762 | ||
2763 | /* yyn is what to do for this token type in this state. | |
2764 | Negative => reduce, -yyn is rule number. | |
2765 | Positive => shift, yyn is new state. | |
2766 | New state is final state => don't bother to shift, | |
2767 | just return success. | |
2768 | 0, or most negative number => error. */ | |
2769 | ||
2770 | if (yyn < 0) | |
2771 | { | |
2772 | if (yyn == YYFLAG) | |
2773 | goto yyerrlab; | |
2774 | yyn = -yyn; | |
2775 | goto yyreduce; | |
2776 | } | |
2777 | else if (yyn == 0) | |
2778 | goto yyerrlab; | |
2779 | ||
2780 | if (yyn == YYFINAL) | |
2781 | YYACCEPT; | |
2782 | ||
2783 | /* Shift the lookahead token. */ | |
2784 | ||
2785 | #if YYDEBUG != 0 | |
2786 | if (yydebug) | |
2787 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); | |
2788 | #endif | |
2789 | ||
2790 | /* Discard the token being shifted unless it is eof. */ | |
2791 | if (yychar != YYEOF) | |
2792 | yychar = YYEMPTY; | |
2793 | ||
2794 | *++yyvsp = yylval; | |
2795 | #ifdef YYLSP_NEEDED | |
2796 | *++yylsp = yylloc; | |
2797 | #endif | |
2798 | ||
2799 | /* count tokens shifted since error; after three, turn off error status. */ | |
2800 | if (yyerrstatus) yyerrstatus--; | |
2801 | ||
2802 | yystate = yyn; | |
2803 | goto yynewstate; | |
2804 | ||
2805 | /* Do the default action for the current state. */ | |
2806 | yydefault: | |
2807 | ||
2808 | yyn = yydefact[yystate]; | |
2809 | if (yyn == 0) | |
2810 | goto yyerrlab; | |
2811 | ||
2812 | /* Do a reduction. yyn is the number of a rule to reduce with. */ | |
2813 | yyreduce: | |
2814 | yylen = yyr2[yyn]; | |
2815 | if (yylen > 0) | |
2816 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ | |
2817 | ||
2818 | #if YYDEBUG != 0 | |
2819 | if (yydebug) | |
2820 | { | |
2821 | int i; | |
2822 | ||
2823 | fprintf (stderr, "Reducing via rule %d (line %d), ", | |
2824 | yyn, yyrline[yyn]); | |
2825 | ||
2826 | /* Print the symbols being reduced, and their result. */ | |
2827 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | |
2828 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | |
2829 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
2830 | } | |
2831 | #endif | |
2832 | ||
2833 | ||
2834 | switch (yyn) { | |
2835 | ||
2836 | case 1: | |
2884c41e | 2837 | #line 502 "./parse.y" |
8b27f225 PB |
2838 | {; |
2839 | break;} | |
2840 | case 18: | |
2884c41e | 2841 | #line 546 "./parse.y" |
8b27f225 PB |
2842 | { |
2843 | yyval.node = build_java_array_type (yyvsp[-2].node, -1); | |
2844 | CLASS_LOADED_P (yyval.node) = 1; | |
2845 | ; | |
2846 | break;} | |
2847 | case 19: | |
2884c41e | 2848 | #line 551 "./parse.y" |
8b27f225 PB |
2849 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; |
2850 | break;} | |
2851 | case 20: | |
2884c41e | 2852 | #line 553 "./parse.y" |
8b27f225 PB |
2853 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; |
2854 | break;} | |
2855 | case 21: | |
2884c41e | 2856 | #line 555 "./parse.y" |
8b27f225 PB |
2857 | {RULE ("']' expected"); RECOVER;; |
2858 | break;} | |
2859 | case 22: | |
2884c41e | 2860 | #line 557 "./parse.y" |
8b27f225 PB |
2861 | {RULE ("']' expected"); RECOVER;; |
2862 | break;} | |
2863 | case 26: | |
2884c41e | 2864 | #line 572 "./parse.y" |
8b27f225 PB |
2865 | { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ; |
2866 | break;} | |
2867 | case 28: | |
2884c41e | 2868 | #line 581 "./parse.y" |
8b27f225 PB |
2869 | {yyval.node = NULL;; |
2870 | break;} | |
2871 | case 36: | |
2884c41e | 2872 | #line 593 "./parse.y" |
8b27f225 PB |
2873 | { |
2874 | yyval.node = NULL; | |
2875 | ; | |
2876 | break;} | |
2877 | case 37: | |
2884c41e | 2878 | #line 597 "./parse.y" |
8b27f225 PB |
2879 | { |
2880 | yyval.node = NULL; | |
2881 | ; | |
2882 | break;} | |
2883 | case 40: | |
2884c41e | 2884 | #line 609 "./parse.y" |
ee07f4f4 APB |
2885 | { |
2886 | ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); | |
2887 | package_list = tree_cons (ctxp->package, NULL, package_list); | |
2888 | ; | |
8b27f225 PB |
2889 | break;} |
2890 | case 41: | |
2884c41e | 2891 | #line 614 "./parse.y" |
8b27f225 PB |
2892 | {yyerror ("Missing name"); RECOVER;; |
2893 | break;} | |
2894 | case 42: | |
2884c41e | 2895 | #line 616 "./parse.y" |
8b27f225 PB |
2896 | {yyerror ("';' expected"); RECOVER;; |
2897 | break;} | |
2898 | case 45: | |
2884c41e | 2899 | #line 626 "./parse.y" |
8b27f225 PB |
2900 | { |
2901 | tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name; | |
2902 | int i = IDENTIFIER_LENGTH (name)-1; | |
49f48c71 | 2903 | const char *last = &IDENTIFIER_POINTER (name)[i]; |
8b27f225 PB |
2904 | while (last != IDENTIFIER_POINTER (name)) |
2905 | { | |
2906 | if (last [0] == '.') | |
2907 | break; | |
2908 | last--; | |
2909 | } | |
2910 | last_name = get_identifier (++last); | |
2911 | if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name)) | |
2912 | { | |
2913 | tree err = find_name_in_single_imports (last_name); | |
2914 | if (err && err != name) | |
2915 | parse_error_context | |
2916 | (yyvsp[-1].node, "Ambiguous class: `%s' and `%s'", | |
2917 | IDENTIFIER_POINTER (name), | |
2918 | IDENTIFIER_POINTER (err)); | |
5e942c50 APB |
2919 | else |
2920 | REGISTER_IMPORT (yyvsp[-1].node, last_name) | |
8b27f225 PB |
2921 | } |
2922 | else | |
5e942c50 | 2923 | REGISTER_IMPORT (yyvsp[-1].node, last_name); |
8b27f225 PB |
2924 | ; |
2925 | break;} | |
2926 | case 46: | |
2884c41e | 2927 | #line 652 "./parse.y" |
8b27f225 PB |
2928 | {yyerror ("Missing name"); RECOVER;; |
2929 | break;} | |
2930 | case 47: | |
2884c41e | 2931 | #line 654 "./parse.y" |
8b27f225 PB |
2932 | {yyerror ("';' expected"); RECOVER;; |
2933 | break;} | |
2934 | case 48: | |
2884c41e | 2935 | #line 659 "./parse.y" |
8b27f225 PB |
2936 | { |
2937 | tree name = EXPR_WFL_NODE (yyvsp[-3].node); | |
ba179f9f APB |
2938 | /* Don't import java.lang.* twice. */ |
2939 | if (name != java_lang_id) | |
2940 | { | |
2941 | tree node = build_tree_list (yyvsp[-3].node, NULL_TREE); | |
2942 | read_import_dir (yyvsp[-3].node); | |
2943 | TREE_CHAIN (node) = ctxp->import_demand_list; | |
2944 | ctxp->import_demand_list = node; | |
2945 | } | |
8b27f225 PB |
2946 | ; |
2947 | break;} | |
2948 | case 49: | |
2884c41e | 2949 | #line 671 "./parse.y" |
8b27f225 PB |
2950 | {yyerror ("'*' expected"); RECOVER;; |
2951 | break;} | |
2952 | case 50: | |
2884c41e | 2953 | #line 673 "./parse.y" |
8b27f225 PB |
2954 | {yyerror ("';' expected"); RECOVER;; |
2955 | break;} | |
2956 | case 51: | |
2884c41e | 2957 | #line 678 "./parse.y" |
8b27f225 | 2958 | { |
22eed1e6 | 2959 | maybe_generate_finit (); |
63a212ed | 2960 | maybe_generate_clinit (); |
8b27f225 PB |
2961 | yyval.node = yyvsp[0].node; |
2962 | ; | |
2963 | break;} | |
7f1d4866 | 2964 | case 52: |
2884c41e | 2965 | #line 684 "./parse.y" |
7f1d4866 APB |
2966 | { |
2967 | maybe_generate_clinit (); | |
2968 | yyval.node = yyvsp[0].node; | |
2969 | ; | |
2970 | break;} | |
8b27f225 | 2971 | case 53: |
2884c41e | 2972 | #line 689 "./parse.y" |
8b27f225 PB |
2973 | { yyval.node = NULL; ; |
2974 | break;} | |
2975 | case 54: | |
2884c41e | 2976 | #line 691 "./parse.y" |
8b27f225 PB |
2977 | { |
2978 | YYERROR_NOW; | |
2979 | yyerror ("Class or interface declaration expected"); | |
2980 | ; | |
2981 | break;} | |
2982 | case 55: | |
2884c41e | 2983 | #line 702 "./parse.y" |
8b27f225 PB |
2984 | { |
2985 | yyval.value = (1 << yyvsp[0].value); | |
2986 | ; | |
2987 | break;} | |
2988 | case 56: | |
2884c41e | 2989 | #line 706 "./parse.y" |
8b27f225 PB |
2990 | { |
2991 | int acc = (1 << yyvsp[0].value); | |
2992 | if (yyval.value & acc) | |
2993 | parse_error_context | |
2994 | (ctxp->modifier_ctx [yyvsp[0].value], "Modifier `%s' declared twice", | |
2995 | java_accstring_lookup (acc)); | |
2996 | else | |
2997 | { | |
2998 | yyval.value |= acc; | |
2999 | } | |
3000 | ; | |
3001 | break;} | |
3002 | case 57: | |
2884c41e | 3003 | #line 722 "./parse.y" |
8b27f225 PB |
3004 | { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; |
3005 | break;} | |
3006 | case 58: | |
2884c41e | 3007 | #line 724 "./parse.y" |
8b27f225 PB |
3008 | { |
3009 | yyval.node = yyvsp[0].node; | |
3010 | ; | |
3011 | break;} | |
3012 | case 59: | |
2884c41e | 3013 | #line 728 "./parse.y" |
8b27f225 PB |
3014 | { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; |
3015 | break;} | |
3016 | case 60: | |
2884c41e | 3017 | #line 730 "./parse.y" |
8b27f225 PB |
3018 | { |
3019 | yyval.node = yyvsp[0].node; | |
3020 | ; | |
3021 | break;} | |
3022 | case 61: | |
2884c41e | 3023 | #line 734 "./parse.y" |
8b27f225 PB |
3024 | {yyerror ("Missing class name"); RECOVER;; |
3025 | break;} | |
3026 | case 62: | |
2884c41e | 3027 | #line 736 "./parse.y" |
8b27f225 PB |
3028 | {yyerror ("Missing class name"); RECOVER;; |
3029 | break;} | |
3030 | case 63: | |
2884c41e | 3031 | #line 738 "./parse.y" |
0b4d333e APB |
3032 | { |
3033 | if (!ctxp->class_err) yyerror ("'{' expected"); | |
3034 | DRECOVER(class1); | |
3035 | ; | |
8b27f225 PB |
3036 | break;} |
3037 | case 64: | |
2884c41e | 3038 | #line 743 "./parse.y" |
8b27f225 PB |
3039 | {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;; |
3040 | break;} | |
3041 | case 65: | |
2884c41e | 3042 | #line 747 "./parse.y" |
8b27f225 PB |
3043 | { yyval.node = NULL; ; |
3044 | break;} | |
3045 | case 66: | |
2884c41e | 3046 | #line 749 "./parse.y" |
8b27f225 PB |
3047 | { yyval.node = yyvsp[0].node; ; |
3048 | break;} | |
3049 | case 67: | |
2884c41e | 3050 | #line 751 "./parse.y" |
8b27f225 PB |
3051 | {yyerror ("'{' expected"); ctxp->class_err=1;; |
3052 | break;} | |
3053 | case 68: | |
2884c41e | 3054 | #line 753 "./parse.y" |
8b27f225 PB |
3055 | {yyerror ("Missing super class name"); ctxp->class_err=1;; |
3056 | break;} | |
3057 | case 69: | |
2884c41e | 3058 | #line 757 "./parse.y" |
8b27f225 PB |
3059 | { yyval.node = NULL_TREE; ; |
3060 | break;} | |
3061 | case 70: | |
2884c41e | 3062 | #line 759 "./parse.y" |
8b27f225 PB |
3063 | { yyval.node = yyvsp[0].node; ; |
3064 | break;} | |
3065 | case 71: | |
2884c41e | 3066 | #line 761 "./parse.y" |
8b27f225 PB |
3067 | { |
3068 | ctxp->class_err=1; | |
3069 | yyerror ("Missing interface name"); | |
3070 | ; | |
3071 | break;} | |
3072 | case 72: | |
2884c41e | 3073 | #line 769 "./parse.y" |
8b27f225 PB |
3074 | { |
3075 | ctxp->interface_number = 1; | |
3076 | yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); | |
3077 | ; | |
3078 | break;} | |
3079 | case 73: | |
2884c41e | 3080 | #line 774 "./parse.y" |
8b27f225 PB |
3081 | { |
3082 | ctxp->interface_number++; | |
3083 | yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE)); | |
3084 | ; | |
3085 | break;} | |
3086 | case 74: | |
2884c41e | 3087 | #line 779 "./parse.y" |
8b27f225 PB |
3088 | {yyerror ("Missing interface name"); RECOVER;; |
3089 | break;} | |
3090 | case 75: | |
2884c41e | 3091 | #line 784 "./parse.y" |
7f10c2e2 APB |
3092 | { |
3093 | /* Store the location of the `}' when doing xrefs */ | |
3094 | if (flag_emit_xref) | |
3095 | DECL_END_SOURCE_LINE (ctxp->current_parsed_class) = | |
3096 | EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1); | |
3097 | yyval.node = ctxp->current_parsed_class; | |
3098 | ; | |
8b27f225 PB |
3099 | break;} |
3100 | case 76: | |
2884c41e | 3101 | #line 792 "./parse.y" |
7f10c2e2 APB |
3102 | { |
3103 | /* Store the location of the `}' when doing xrefs */ | |
3104 | if (flag_emit_xref) | |
3105 | DECL_END_SOURCE_LINE (ctxp->current_parsed_class) = | |
3106 | EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1); | |
3107 | yyval.node = ctxp->current_parsed_class; | |
3108 | ; | |
8b27f225 PB |
3109 | break;} |
3110 | case 82: | |
2884c41e | 3111 | #line 811 "./parse.y" |
8b27f225 PB |
3112 | { yyval.node = parse_jdk1_1_error ("instance initializer"); ; |
3113 | break;} | |
0b4d333e | 3114 | case 84: |
2884c41e | 3115 | #line 817 "./parse.y" |
0b4d333e | 3116 | { yyval.node = yyvsp[-1].node; ; |
8b27f225 PB |
3117 | break;} |
3118 | case 86: | |
2884c41e | 3119 | #line 820 "./parse.y" |
0b4d333e | 3120 | { yyval.node = parse_jdk1_1_error ("inner classe declaration"); ; |
8b27f225 PB |
3121 | break;} |
3122 | case 87: | |
2884c41e | 3123 | #line 822 "./parse.y" |
0b4d333e | 3124 | { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ; |
8b27f225 PB |
3125 | break;} |
3126 | case 88: | |
2884c41e | 3127 | #line 828 "./parse.y" |
0b4d333e APB |
3128 | { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ; |
3129 | break;} | |
3130 | case 89: | |
2884c41e | 3131 | #line 830 "./parse.y" |
8b27f225 PB |
3132 | { |
3133 | check_modifiers | |
3134 | ("Illegal modifier `%s' for field declaration", | |
3135 | yyvsp[-3].value, FIELD_MODIFIERS); | |
3136 | check_modifiers_consistency (yyvsp[-3].value); | |
3137 | register_fields (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node); | |
3138 | ; | |
3139 | break;} | |
8b27f225 | 3140 | case 91: |
2884c41e | 3141 | #line 843 "./parse.y" |
0b4d333e | 3142 | { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ; |
8b27f225 PB |
3143 | break;} |
3144 | case 92: | |
2884c41e | 3145 | #line 845 "./parse.y" |
0b4d333e | 3146 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 PB |
3147 | break;} |
3148 | case 93: | |
2884c41e | 3149 | #line 850 "./parse.y" |
0b4d333e APB |
3150 | { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ; |
3151 | break;} | |
3152 | case 94: | |
2884c41e | 3153 | #line 852 "./parse.y" |
8b27f225 PB |
3154 | { |
3155 | if (java_error_count) | |
3156 | yyvsp[0].node = NULL_TREE; | |
3157 | yyval.node = build_tree_list | |
3158 | (yyvsp[-2].node, build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node)); | |
3159 | ; | |
3160 | break;} | |
0b4d333e | 3161 | case 95: |
2884c41e | 3162 | #line 859 "./parse.y" |
8b27f225 PB |
3163 | { |
3164 | yyerror ("Missing variable initializer"); | |
3165 | yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE); | |
3166 | RECOVER; | |
3167 | ; | |
3168 | break;} | |
0b4d333e | 3169 | case 96: |
2884c41e | 3170 | #line 865 "./parse.y" |
8b27f225 PB |
3171 | { |
3172 | yyerror ("';' expected"); | |
3173 | yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE); | |
3174 | RECOVER; | |
3175 | ; | |
3176 | break;} | |
0b4d333e | 3177 | case 98: |
2884c41e | 3178 | #line 875 "./parse.y" |
8b27f225 PB |
3179 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; |
3180 | break;} | |
0b4d333e | 3181 | case 99: |
2884c41e | 3182 | #line 877 "./parse.y" |
8b27f225 PB |
3183 | {yyerror ("Invalid declaration"); DRECOVER(vdi);; |
3184 | break;} | |
0b4d333e | 3185 | case 100: |
2884c41e | 3186 | #line 879 "./parse.y" |
8b27f225 PB |
3187 | {yyerror ("']' expected"); DRECOVER(vdi);; |
3188 | break;} | |
0b4d333e | 3189 | case 101: |
2884c41e | 3190 | #line 881 "./parse.y" |
8b27f225 PB |
3191 | {yyerror ("Unbalanced ']'"); DRECOVER(vdi);; |
3192 | break;} | |
0b4d333e | 3193 | case 104: |
2884c41e | 3194 | #line 892 "./parse.y" |
8b27f225 PB |
3195 | { |
3196 | current_function_decl = yyvsp[0].node; | |
3197 | source_start_java_method (current_function_decl); | |
3198 | ; | |
3199 | break;} | |
8b27f225 | 3200 | case 105: |
2884c41e | 3201 | #line 897 "./parse.y" |
e85ac860 | 3202 | { finish_method_declaration (yyvsp[0].node); ; |
8b27f225 PB |
3203 | break;} |
3204 | case 106: | |
2884c41e | 3205 | #line 899 "./parse.y" |
0b4d333e | 3206 | {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;; |
8b27f225 PB |
3207 | break;} |
3208 | case 107: | |
2884c41e | 3209 | #line 904 "./parse.y" |
0b4d333e | 3210 | { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; |
8b27f225 PB |
3211 | break;} |
3212 | case 108: | |
2884c41e | 3213 | #line 906 "./parse.y" |
0b4d333e | 3214 | { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ; |
8b27f225 PB |
3215 | break;} |
3216 | case 109: | |
2884c41e | 3217 | #line 908 "./parse.y" |
0b4d333e | 3218 | { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; |
8b27f225 PB |
3219 | break;} |
3220 | case 110: | |
2884c41e | 3221 | #line 910 "./parse.y" |
0b4d333e | 3222 | { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ; |
8b27f225 PB |
3223 | break;} |
3224 | case 111: | |
2884c41e | 3225 | #line 912 "./parse.y" |
efa0a23f APB |
3226 | { |
3227 | yyerror ("Invalid method declaration, method name required"); | |
3228 | RECOVER; | |
3229 | ; | |
8b27f225 PB |
3230 | break;} |
3231 | case 112: | |
2884c41e | 3232 | #line 917 "./parse.y" |
0b4d333e | 3233 | {RECOVER;; |
8b27f225 PB |
3234 | break;} |
3235 | case 113: | |
2884c41e | 3236 | #line 919 "./parse.y" |
8b27f225 PB |
3237 | {yyerror ("Identifier expected"); RECOVER;; |
3238 | break;} | |
3239 | case 114: | |
2884c41e | 3240 | #line 921 "./parse.y" |
0b4d333e APB |
3241 | {yyerror ("Identifier expected"); RECOVER;; |
3242 | break;} | |
3243 | case 115: | |
2884c41e | 3244 | #line 923 "./parse.y" |
8b27f225 PB |
3245 | { |
3246 | yyerror ("Invalid method declaration, return type required"); | |
3247 | RECOVER; | |
3248 | ; | |
3249 | break;} | |
0b4d333e | 3250 | case 116: |
2884c41e | 3251 | #line 931 "./parse.y" |
8b27f225 PB |
3252 | { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ; |
3253 | break;} | |
0b4d333e | 3254 | case 117: |
2884c41e | 3255 | #line 933 "./parse.y" |
8b27f225 PB |
3256 | { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ; |
3257 | break;} | |
0b4d333e | 3258 | case 118: |
2884c41e | 3259 | #line 935 "./parse.y" |
8b27f225 | 3260 | { |
1886c9d8 APB |
3261 | EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location; |
3262 | TREE_PURPOSE (yyvsp[-2].node) = | |
3263 | build_unresolved_array_type (TREE_PURPOSE (yyvsp[-2].node)); | |
3264 | parse_warning_context | |
3265 | (wfl_operator, | |
3266 | "Discouraged form of returned type specification"); | |
8b27f225 PB |
3267 | ; |
3268 | break;} | |
8b27f225 | 3269 | case 119: |
2884c41e | 3270 | #line 944 "./parse.y" |
0b4d333e | 3271 | {yyerror ("')' expected"); DRECOVER(method_declarator);; |
8b27f225 PB |
3272 | break;} |
3273 | case 120: | |
2884c41e | 3274 | #line 946 "./parse.y" |
0b4d333e APB |
3275 | {yyerror ("']' expected"); RECOVER;; |
3276 | break;} | |
3277 | case 121: | |
2884c41e | 3278 | #line 951 "./parse.y" |
8b27f225 PB |
3279 | { |
3280 | ctxp->formal_parameter_number = 1; | |
3281 | ; | |
3282 | break;} | |
0b4d333e | 3283 | case 122: |
2884c41e | 3284 | #line 955 "./parse.y" |
8b27f225 PB |
3285 | { |
3286 | ctxp->formal_parameter_number += 1; | |
3287 | yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); | |
3288 | ; | |
3289 | break;} | |
8b27f225 | 3290 | case 123: |
2884c41e | 3291 | #line 960 "./parse.y" |
0b4d333e APB |
3292 | {yyerror ("Missing formal parameter term"); RECOVER;; |
3293 | break;} | |
3294 | case 124: | |
2884c41e | 3295 | #line 965 "./parse.y" |
8b27f225 PB |
3296 | { |
3297 | yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node); | |
3298 | ; | |
3299 | break;} | |
0b4d333e | 3300 | case 125: |
2884c41e | 3301 | #line 969 "./parse.y" |
5256aa37 APB |
3302 | { |
3303 | parse_jdk1_1_error ("final parameters"); | |
3304 | yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node); | |
3305 | ; | |
8b27f225 | 3306 | break;} |
0b4d333e | 3307 | case 126: |
2884c41e | 3308 | #line 974 "./parse.y" |
f8989a66 APB |
3309 | { |
3310 | yyerror ("Missing identifier"); RECOVER; | |
3311 | yyval.node = NULL_TREE; | |
3312 | ; | |
8b27f225 | 3313 | break;} |
0b4d333e | 3314 | case 127: |
f8989a66 | 3315 | #line 979 "./parse.y" |
8b27f225 | 3316 | { |
8b27f225 | 3317 | yyerror ("Missing identifier"); RECOVER; |
f8989a66 | 3318 | yyval.node = NULL_TREE; |
8b27f225 PB |
3319 | ; |
3320 | break;} | |
8b27f225 | 3321 | case 128: |
f8989a66 | 3322 | #line 987 "./parse.y" |
2884c41e KG |
3323 | { |
3324 | check_modifiers ("Illegal modifier `%s'. Only `final' was expected here", | |
3325 | yyvsp[0].value, ACC_FINAL); | |
3326 | if (yyvsp[0].value != ACC_FINAL) | |
3327 | MODIFIER_WFL (FINAL_TK) = build_wfl_node (NULL_TREE); | |
3328 | ; | |
8b27f225 PB |
3329 | break;} |
3330 | case 129: | |
f8989a66 | 3331 | #line 996 "./parse.y" |
2884c41e | 3332 | { yyval.node = NULL_TREE; ; |
8b27f225 PB |
3333 | break;} |
3334 | case 130: | |
f8989a66 | 3335 | #line 998 "./parse.y" |
2884c41e | 3336 | { yyval.node = yyvsp[0].node; ; |
8b27f225 PB |
3337 | break;} |
3338 | case 131: | |
f8989a66 | 3339 | #line 1000 "./parse.y" |
2884c41e | 3340 | {yyerror ("Missing class type term"); RECOVER;; |
8b27f225 PB |
3341 | break;} |
3342 | case 132: | |
f8989a66 | 3343 | #line 1005 "./parse.y" |
2884c41e | 3344 | { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ; |
0b4d333e APB |
3345 | break;} |
3346 | case 133: | |
f8989a66 | 3347 | #line 1007 "./parse.y" |
2884c41e KG |
3348 | { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ; |
3349 | break;} | |
3350 | case 134: | |
f8989a66 | 3351 | #line 1009 "./parse.y" |
8b27f225 PB |
3352 | {yyerror ("Missing class type term"); RECOVER;; |
3353 | break;} | |
2884c41e | 3354 | case 137: |
f8989a66 | 3355 | #line 1016 "./parse.y" |
8b27f225 PB |
3356 | { yyval.node = NULL_TREE; ; |
3357 | break;} | |
2884c41e | 3358 | case 138: |
f8989a66 | 3359 | #line 1022 "./parse.y" |
8b27f225 | 3360 | { |
f099f336 APB |
3361 | TREE_CHAIN (yyvsp[0].node) = ctxp->static_initialized; |
3362 | ctxp->static_initialized = yyvsp[0].node; | |
8b27f225 PB |
3363 | ; |
3364 | break;} | |
2884c41e | 3365 | case 139: |
f8989a66 | 3366 | #line 1027 "./parse.y" |
8b27f225 | 3367 | { |
f099f336 APB |
3368 | TREE_CHAIN (yyvsp[-1].node) = ctxp->static_initialized; |
3369 | ctxp->static_initialized = yyvsp[-1].node; | |
8b27f225 PB |
3370 | ; |
3371 | break;} | |
2884c41e | 3372 | case 140: |
f8989a66 | 3373 | #line 1035 "./parse.y" |
8b27f225 PB |
3374 | { |
3375 | SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value)); | |
3376 | ; | |
3377 | break;} | |
2884c41e | 3378 | case 141: |
f8989a66 | 3379 | #line 1043 "./parse.y" |
8b27f225 | 3380 | { |
22eed1e6 APB |
3381 | current_function_decl = yyvsp[0].node; |
3382 | source_start_java_method (current_function_decl); | |
8b27f225 PB |
3383 | ; |
3384 | break;} | |
2884c41e | 3385 | case 142: |
f8989a66 | 3386 | #line 1048 "./parse.y" |
e85ac860 | 3387 | { finish_method_declaration (yyvsp[0].node); ; |
22eed1e6 | 3388 | break;} |
2884c41e | 3389 | case 143: |
f8989a66 | 3390 | #line 1053 "./parse.y" |
0b4d333e | 3391 | { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ; |
22eed1e6 | 3392 | break;} |
2884c41e | 3393 | case 144: |
f8989a66 | 3394 | #line 1055 "./parse.y" |
0b4d333e | 3395 | { yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ; |
22eed1e6 | 3396 | break;} |
2884c41e | 3397 | case 145: |
f8989a66 | 3398 | #line 1060 "./parse.y" |
0b4d333e | 3399 | { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ; |
22eed1e6 | 3400 | break;} |
2884c41e | 3401 | case 146: |
f8989a66 | 3402 | #line 1062 "./parse.y" |
0b4d333e APB |
3403 | { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ; |
3404 | break;} | |
2884c41e | 3405 | case 147: |
f8989a66 | 3406 | #line 1070 "./parse.y" |
22eed1e6 | 3407 | { |
c877974e | 3408 | BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node; |
22eed1e6 | 3409 | yyval.node = yyvsp[0].node; |
8b27f225 PB |
3410 | ; |
3411 | break;} | |
22eed1e6 | 3412 | case 148: |
f8989a66 | 3413 | #line 1075 "./parse.y" |
22eed1e6 APB |
3414 | { yyval.node = yyvsp[0].node; ; |
3415 | break;} | |
3416 | case 149: | |
f8989a66 | 3417 | #line 1077 "./parse.y" |
2884c41e KG |
3418 | { yyval.node = yyvsp[0].node; ; |
3419 | break;} | |
3420 | case 150: | |
f8989a66 | 3421 | #line 1079 "./parse.y" |
0b4d333e APB |
3422 | { yyval.node = yyvsp[0].node; ; |
3423 | break;} | |
2884c41e | 3424 | case 153: |
f8989a66 | 3425 | #line 1089 "./parse.y" |
22eed1e6 APB |
3426 | { |
3427 | yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE); | |
3428 | yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node); | |
3429 | yyval.node = java_method_add_stmt (current_function_decl, yyval.node); | |
8b27f225 PB |
3430 | ; |
3431 | break;} | |
2884c41e | 3432 | case 154: |
f8989a66 | 3433 | #line 1095 "./parse.y" |
22eed1e6 APB |
3434 | { |
3435 | yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node); | |
3436 | yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node); | |
3437 | yyval.node = java_method_add_stmt (current_function_decl, yyval.node); | |
8b27f225 PB |
3438 | ; |
3439 | break;} | |
2e5eb5c5 | 3440 | case 155: |
f8989a66 | 3441 | #line 1103 "./parse.y" |
0b4d333e APB |
3442 | {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ; |
3443 | break;} | |
2e5eb5c5 | 3444 | case 156: |
f8989a66 | 3445 | #line 1105 "./parse.y" |
2884c41e KG |
3446 | {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ; |
3447 | break;} | |
3448 | case 157: | |
f8989a66 | 3449 | #line 1110 "./parse.y" |
8b27f225 | 3450 | { |
9ee9b555 | 3451 | tree wfl = build_wfl_node (this_identifier_node); |
8b27f225 PB |
3452 | EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location; |
3453 | yyval.node = wfl; | |
3454 | ; | |
3455 | break;} | |
2884c41e | 3456 | case 158: |
f8989a66 | 3457 | #line 1116 "./parse.y" |
8b27f225 | 3458 | { |
9ee9b555 | 3459 | tree wfl = build_wfl_node (super_identifier_node); |
8b27f225 PB |
3460 | EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location; |
3461 | yyval.node = wfl; | |
3462 | ; | |
3463 | break;} | |
2884c41e | 3464 | case 159: |
f8989a66 | 3465 | #line 1127 "./parse.y" |
8b27f225 PB |
3466 | { create_interface (0, yyvsp[0].node, NULL_TREE); ; |
3467 | break;} | |
2884c41e | 3468 | case 160: |
f8989a66 | 3469 | #line 1129 "./parse.y" |
8b27f225 PB |
3470 | { |
3471 | yyval.node = yyvsp[0].node; | |
3472 | ; | |
3473 | break;} | |
2884c41e | 3474 | case 161: |
f8989a66 | 3475 | #line 1133 "./parse.y" |
8b27f225 PB |
3476 | { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ; |
3477 | break;} | |
2884c41e | 3478 | case 162: |
f8989a66 | 3479 | #line 1135 "./parse.y" |
2e5eb5c5 | 3480 | { |
8b27f225 PB |
3481 | yyval.node = yyvsp[0].node; |
3482 | ; | |
3483 | break;} | |
2884c41e | 3484 | case 163: |
f8989a66 | 3485 | #line 1139 "./parse.y" |
8b27f225 PB |
3486 | { create_interface (0, yyvsp[-1].node, yyvsp[0].node); ; |
3487 | break;} | |
2884c41e | 3488 | case 164: |
f8989a66 | 3489 | #line 1141 "./parse.y" |
8b27f225 PB |
3490 | { |
3491 | yyval.node = yyvsp[0].node; | |
3492 | ; | |
3493 | break;} | |
2884c41e | 3494 | case 165: |
f8989a66 | 3495 | #line 1145 "./parse.y" |
8b27f225 PB |
3496 | { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ; |
3497 | break;} | |
2884c41e | 3498 | case 166: |
f8989a66 | 3499 | #line 1147 "./parse.y" |
8b27f225 PB |
3500 | { |
3501 | yyval.node = yyvsp[0].node; | |
3502 | ; | |
3503 | break;} | |
2e5eb5c5 | 3504 | case 167: |
f8989a66 | 3505 | #line 1151 "./parse.y" |
0b4d333e APB |
3506 | {yyerror ("'{' expected"); RECOVER;; |
3507 | break;} | |
2e5eb5c5 | 3508 | case 168: |
f8989a66 | 3509 | #line 1153 "./parse.y" |
2884c41e KG |
3510 | {yyerror ("'{' expected"); RECOVER;; |
3511 | break;} | |
3512 | case 169: | |
f8989a66 | 3513 | #line 1158 "./parse.y" |
8b27f225 PB |
3514 | { |
3515 | ctxp->interface_number = 1; | |
3516 | yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); | |
3517 | ; | |
3518 | break;} | |
2884c41e | 3519 | case 170: |
f8989a66 | 3520 | #line 1163 "./parse.y" |
8b27f225 PB |
3521 | { |
3522 | ctxp->interface_number++; | |
3523 | yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE)); | |
3524 | ; | |
3525 | break;} | |
2884c41e | 3526 | case 171: |
f8989a66 | 3527 | #line 1168 "./parse.y" |
0b4d333e | 3528 | {yyerror ("Invalid interface type"); RECOVER;; |
8b27f225 | 3529 | break;} |
2884c41e | 3530 | case 172: |
f8989a66 | 3531 | #line 1170 "./parse.y" |
0b4d333e | 3532 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 3533 | break;} |
2884c41e | 3534 | case 173: |
f8989a66 | 3535 | #line 1175 "./parse.y" |
8b27f225 PB |
3536 | { yyval.node = NULL_TREE; ; |
3537 | break;} | |
2884c41e | 3538 | case 174: |
f8989a66 | 3539 | #line 1177 "./parse.y" |
0b4d333e | 3540 | { yyval.node = NULL_TREE; ; |
8b27f225 | 3541 | break;} |
2884c41e | 3542 | case 179: |
f8989a66 | 3543 | #line 1189 "./parse.y" |
0b4d333e APB |
3544 | { yyval.node = parse_jdk1_1_error ("inner class declaration"); ; |
3545 | break;} | |
2884c41e | 3546 | case 180: |
f8989a66 | 3547 | #line 1191 "./parse.y" |
8b27f225 PB |
3548 | { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ; |
3549 | break;} | |
2884c41e | 3550 | case 182: |
f8989a66 | 3551 | #line 1200 "./parse.y" |
8b27f225 PB |
3552 | { |
3553 | check_abstract_method_header (yyvsp[-1].node); | |
3554 | current_function_decl = NULL_TREE; /* FIXME ? */ | |
3555 | ; | |
3556 | break;} | |
2884c41e | 3557 | case 183: |
f8989a66 | 3558 | #line 1205 "./parse.y" |
0b4d333e | 3559 | {yyerror ("';' expected"); RECOVER;; |
8b27f225 | 3560 | break;} |
2884c41e | 3561 | case 184: |
f8989a66 | 3562 | #line 1211 "./parse.y" |
0b4d333e | 3563 | { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ; |
8b27f225 | 3564 | break;} |
2884c41e | 3565 | case 185: |
f8989a66 | 3566 | #line 1213 "./parse.y" |
0b4d333e | 3567 | { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ; |
ac825856 | 3568 | break;} |
2884c41e | 3569 | case 186: |
f8989a66 | 3570 | #line 1215 "./parse.y" |
0b4d333e APB |
3571 | { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ; |
3572 | break;} | |
2884c41e | 3573 | case 187: |
f8989a66 | 3574 | #line 1220 "./parse.y" |
f8976021 APB |
3575 | { |
3576 | yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), | |
3577 | yyvsp[0].node, NULL_TREE); | |
3578 | ; | |
ac825856 | 3579 | break;} |
2884c41e | 3580 | case 188: |
f8989a66 | 3581 | #line 1225 "./parse.y" |
1179ebc2 APB |
3582 | { |
3583 | yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node); | |
3584 | ; | |
8b27f225 | 3585 | break;} |
2884c41e | 3586 | case 189: |
f8989a66 | 3587 | #line 1229 "./parse.y" |
0b4d333e | 3588 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 3589 | break;} |
2884c41e | 3590 | case 190: |
f8989a66 | 3591 | #line 1235 "./parse.y" |
7f10c2e2 APB |
3592 | { |
3593 | /* Store the location of the `}' when doing xrefs */ | |
3594 | if (current_function_decl && flag_emit_xref) | |
3595 | DECL_END_SOURCE_LINE (current_function_decl) = | |
3596 | EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1); | |
3597 | yyval.node = empty_stmt_node; | |
3598 | ; | |
8b27f225 | 3599 | break;} |
2884c41e | 3600 | case 191: |
f8989a66 | 3601 | #line 1243 "./parse.y" |
0b4d333e | 3602 | { yyval.node = yyvsp[0].node; ; |
22eed1e6 | 3603 | break;} |
2884c41e | 3604 | case 192: |
f8989a66 | 3605 | #line 1248 "./parse.y" |
0b4d333e APB |
3606 | { enter_block (); ; |
3607 | break;} | |
2884c41e | 3608 | case 193: |
f8989a66 | 3609 | #line 1253 "./parse.y" |
8b27f225 PB |
3610 | { |
3611 | maybe_absorb_scoping_blocks (); | |
7f10c2e2 APB |
3612 | /* Store the location of the `}' when doing xrefs */ |
3613 | if (current_function_decl && flag_emit_xref) | |
3614 | DECL_END_SOURCE_LINE (current_function_decl) = | |
3615 | EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1); | |
8b27f225 PB |
3616 | yyval.node = exit_block (); |
3617 | ; | |
3618 | break;} | |
2884c41e | 3619 | case 197: |
f8989a66 | 3620 | #line 1271 "./parse.y" |
12472854 | 3621 | { java_method_add_stmt (current_function_decl, yyvsp[0].node); ; |
8b27f225 | 3622 | break;} |
2884c41e | 3623 | case 198: |
f8989a66 | 3624 | #line 1273 "./parse.y" |
12472854 | 3625 | { parse_jdk1_1_error ("inner class declaration"); ; |
8b27f225 | 3626 | break;} |
2884c41e | 3627 | case 200: |
f8989a66 | 3628 | #line 1282 "./parse.y" |
8b27f225 PB |
3629 | { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ; |
3630 | break;} | |
2884c41e | 3631 | case 201: |
f8989a66 | 3632 | #line 1284 "./parse.y" |
8b27f225 PB |
3633 | { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ; |
3634 | break;} | |
2884c41e | 3635 | case 207: |
f8989a66 | 3636 | #line 1294 "./parse.y" |
6efa1cc2 APB |
3637 | { yyval.node = exit_block (); ; |
3638 | break;} | |
2884c41e | 3639 | case 212: |
f8989a66 | 3640 | #line 1303 "./parse.y" |
cd9643f7 | 3641 | { yyval.node = exit_block (); ; |
8b27f225 | 3642 | break;} |
2884c41e | 3643 | case 224: |
f8989a66 | 3644 | #line 1322 "./parse.y" |
0b4d333e APB |
3645 | { yyval.node = empty_stmt_node; ; |
3646 | break;} | |
2884c41e | 3647 | case 225: |
f8989a66 | 3648 | #line 1327 "./parse.y" |
8b27f225 PB |
3649 | { |
3650 | yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node), | |
3651 | EXPR_WFL_NODE (yyvsp[-1].node)); | |
3652 | pushlevel (2); | |
3653 | push_labeled_block (yyval.node); | |
3654 | PUSH_LABELED_BLOCK (yyval.node); | |
3655 | ; | |
3656 | break;} | |
2884c41e | 3657 | case 226: |
f8989a66 | 3658 | #line 1338 "./parse.y" |
e85ac860 | 3659 | { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ; |
8b27f225 | 3660 | break;} |
2884c41e | 3661 | case 227: |
f8989a66 | 3662 | #line 1340 "./parse.y" |
0b4d333e APB |
3663 | {yyerror ("':' expected"); RECOVER;; |
3664 | break;} | |
2884c41e | 3665 | case 228: |
f8989a66 | 3666 | #line 1345 "./parse.y" |
e85ac860 | 3667 | { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ; |
8b27f225 | 3668 | break;} |
2884c41e | 3669 | case 229: |
f8989a66 | 3670 | #line 1352 "./parse.y" |
8b27f225 PB |
3671 | { |
3672 | /* We have a statement. Generate a WFL around it so | |
3673 | we can debug it */ | |
3674 | yyval.node = build_expr_wfl (yyvsp[-1].node, input_filename, lineno, 0); | |
3675 | /* We know we have a statement, so set the debug | |
3676 | info to be eventually generate here. */ | |
3677 | yyval.node = JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval.node); | |
3678 | ; | |
3679 | break;} | |
2884c41e | 3680 | case 230: |
f8989a66 | 3681 | #line 1361 "./parse.y" |
8b27f225 PB |
3682 | { |
3683 | if (ctxp->prevent_ese != lineno) | |
3684 | yyerror ("Invalid expression statement"); | |
3685 | DRECOVER (expr_stmt); | |
3686 | ; | |
3687 | break;} | |
2884c41e | 3688 | case 231: |
f8989a66 | 3689 | #line 1367 "./parse.y" |
8b27f225 PB |
3690 | { |
3691 | if (ctxp->prevent_ese != lineno) | |
3692 | yyerror ("Invalid expression statement"); | |
3693 | DRECOVER (expr_stmt); | |
3694 | ; | |
3695 | break;} | |
2884c41e | 3696 | case 232: |
f8989a66 | 3697 | #line 1373 "./parse.y" |
22eed1e6 APB |
3698 | { |
3699 | if (ctxp->prevent_ese != lineno) | |
3700 | yyerror ("Invalid expression statement"); | |
3701 | DRECOVER (expr_stmt); | |
3702 | ; | |
8b27f225 | 3703 | break;} |
2884c41e | 3704 | case 233: |
f8989a66 | 3705 | #line 1379 "./parse.y" |
22eed1e6 | 3706 | {yyerror ("')' expected"); RECOVER;; |
8b27f225 | 3707 | break;} |
2884c41e | 3708 | case 234: |
f8989a66 | 3709 | #line 1381 "./parse.y" |
22eed1e6 | 3710 | { |
8119c720 | 3711 | parse_ctor_invocation_error (); |
22eed1e6 APB |
3712 | RECOVER; |
3713 | ; | |
8b27f225 | 3714 | break;} |
2884c41e | 3715 | case 235: |
f8989a66 | 3716 | #line 1386 "./parse.y" |
22eed1e6 | 3717 | {yyerror ("')' expected"); RECOVER;; |
8b27f225 | 3718 | break;} |
2884c41e | 3719 | case 236: |
f8989a66 | 3720 | #line 1388 "./parse.y" |
22eed1e6 | 3721 | { |
8119c720 | 3722 | parse_ctor_invocation_error (); |
22eed1e6 APB |
3723 | RECOVER; |
3724 | ; | |
8b27f225 | 3725 | break;} |
8b27f225 | 3726 | case 237: |
f8989a66 | 3727 | #line 1393 "./parse.y" |
2884c41e | 3728 | {yyerror ("'(' expected"); RECOVER;; |
8b27f225 | 3729 | break;} |
0b4d333e | 3730 | case 238: |
f8989a66 | 3731 | #line 1395 "./parse.y" |
2e5eb5c5 APB |
3732 | {yyerror ("')' expected"); RECOVER;; |
3733 | break;} | |
3734 | case 239: | |
f8989a66 | 3735 | #line 1397 "./parse.y" |
2884c41e | 3736 | {yyerror ("')' expected"); RECOVER;; |
2e5eb5c5 APB |
3737 | break;} |
3738 | case 240: | |
f8989a66 | 3739 | #line 1399 "./parse.y" |
0b4d333e | 3740 | {yyerror ("';' expected"); RECOVER;; |
8b27f225 | 3741 | break;} |
2884c41e | 3742 | case 241: |
f8989a66 | 3743 | #line 1401 "./parse.y" |
2884c41e KG |
3744 | {yyerror ("';' expected"); RECOVER;; |
3745 | break;} | |
3746 | case 249: | |
f8989a66 | 3747 | #line 1416 "./parse.y" |
2aa11e97 APB |
3748 | { |
3749 | yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node, | |
3750 | yyvsp[0].node, NULL_TREE); | |
3751 | ; | |
8b27f225 | 3752 | break;} |
2e5eb5c5 | 3753 | case 250: |
f8989a66 | 3754 | #line 1421 "./parse.y" |
2884c41e | 3755 | {yyerror ("'(' expected"); RECOVER;; |
8b27f225 | 3756 | break;} |
2e5eb5c5 | 3757 | case 251: |
f8989a66 | 3758 | #line 1423 "./parse.y" |
2884c41e | 3759 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 3760 | break;} |
2e5eb5c5 | 3761 | case 252: |
f8989a66 | 3762 | #line 1425 "./parse.y" |
2884c41e | 3763 | {yyerror ("')' expected"); RECOVER;; |
8b27f225 | 3764 | break;} |
2e5eb5c5 | 3765 | case 253: |
f8989a66 | 3766 | #line 1430 "./parse.y" |
0b4d333e APB |
3767 | { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; |
3768 | break;} | |
2e5eb5c5 | 3769 | case 254: |
f8989a66 | 3770 | #line 1435 "./parse.y" |
2884c41e KG |
3771 | { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; |
3772 | break;} | |
3773 | case 255: | |
f8989a66 | 3774 | #line 1440 "./parse.y" |
12472854 PB |
3775 | { |
3776 | enter_block (); | |
8b27f225 PB |
3777 | ; |
3778 | break;} | |
2884c41e | 3779 | case 256: |
f8989a66 | 3780 | #line 1444 "./parse.y" |
8b27f225 | 3781 | { |
12472854 | 3782 | /* Make into "proper list" of COMPOUND_EXPRs. |
f8976021 APB |
3783 | I.e. make the last statment also have its own |
3784 | COMPOUND_EXPR. */ | |
12472854 PB |
3785 | maybe_absorb_scoping_blocks (); |
3786 | TREE_OPERAND (yyvsp[-2].node, 1) = exit_block (); | |
3787 | yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-2].node), yyvsp[-2].node); | |
8b27f225 PB |
3788 | ; |
3789 | break;} | |
2884c41e | 3790 | case 257: |
f8989a66 | 3791 | #line 1456 "./parse.y" |
12472854 PB |
3792 | { |
3793 | yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE); | |
3794 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location; | |
3795 | ; | |
8b27f225 | 3796 | break;} |
f8976021 | 3797 | case 258: |
f8989a66 | 3798 | #line 1461 "./parse.y" |
2884c41e | 3799 | {yyerror ("'(' expected"); RECOVER;; |
f8976021 APB |
3800 | break;} |
3801 | case 259: | |
f8989a66 | 3802 | #line 1463 "./parse.y" |
2884c41e | 3803 | {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);; |
f8976021 APB |
3804 | break;} |
3805 | case 260: | |
f8989a66 | 3806 | #line 1465 "./parse.y" |
2884c41e | 3807 | {yyerror ("'{' expected"); RECOVER;; |
0b4d333e APB |
3808 | break;} |
3809 | case 261: | |
f8989a66 | 3810 | #line 1473 "./parse.y" |
f8976021 APB |
3811 | { yyval.node = NULL_TREE; ; |
3812 | break;} | |
2e5eb5c5 | 3813 | case 262: |
f8989a66 | 3814 | #line 1475 "./parse.y" |
2e5eb5c5 APB |
3815 | { yyval.node = NULL_TREE; ; |
3816 | break;} | |
3817 | case 263: | |
f8989a66 | 3818 | #line 1477 "./parse.y" |
2884c41e KG |
3819 | { yyval.node = NULL_TREE; ; |
3820 | break;} | |
3821 | case 264: | |
f8989a66 | 3822 | #line 1479 "./parse.y" |
2e5eb5c5 APB |
3823 | { yyval.node = NULL_TREE; ; |
3824 | break;} | |
2884c41e | 3825 | case 270: |
f8989a66 | 3826 | #line 1498 "./parse.y" |
8b27f225 | 3827 | { |
12472854 PB |
3828 | tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node); |
3829 | EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location; | |
3830 | java_method_add_stmt (current_function_decl, lab); | |
8b27f225 PB |
3831 | ; |
3832 | break;} | |
2884c41e | 3833 | case 271: |
f8989a66 | 3834 | #line 1504 "./parse.y" |
8b27f225 | 3835 | { |
12472854 PB |
3836 | tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE); |
3837 | EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location; | |
3838 | java_method_add_stmt (current_function_decl, lab); | |
8b27f225 PB |
3839 | ; |
3840 | break;} | |
2e5eb5c5 | 3841 | case 272: |
f8989a66 | 3842 | #line 1510 "./parse.y" |
2884c41e | 3843 | {yyerror ("Missing or invalid constant expression"); RECOVER;; |
22eed1e6 | 3844 | break;} |
2e5eb5c5 | 3845 | case 273: |
f8989a66 | 3846 | #line 1512 "./parse.y" |
0b4d333e APB |
3847 | {yyerror ("':' expected"); RECOVER;; |
3848 | break;} | |
2e5eb5c5 | 3849 | case 274: |
f8989a66 | 3850 | #line 1514 "./parse.y" |
2884c41e KG |
3851 | {yyerror ("':' expected"); RECOVER;; |
3852 | break;} | |
3853 | case 275: | |
f8989a66 | 3854 | #line 1519 "./parse.y" |
8b27f225 PB |
3855 | { |
3856 | tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0); | |
3857 | yyval.node = build_new_loop (body); | |
3858 | ; | |
3859 | break;} | |
2884c41e | 3860 | case 276: |
f8989a66 | 3861 | #line 1527 "./parse.y" |
e85ac860 | 3862 | { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ; |
8b27f225 | 3863 | break;} |
2884c41e | 3864 | case 277: |
f8989a66 | 3865 | #line 1529 "./parse.y" |
0b4d333e | 3866 | {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;; |
8b27f225 | 3867 | break;} |
2884c41e | 3868 | case 278: |
f8989a66 | 3869 | #line 1531 "./parse.y" |
0b4d333e | 3870 | {yyerror ("Missing term and ')' expected"); RECOVER;; |
8b27f225 | 3871 | break;} |
2884c41e | 3872 | case 279: |
f8989a66 | 3873 | #line 1533 "./parse.y" |
0b4d333e | 3874 | {yyerror ("')' expected"); RECOVER;; |
8b27f225 | 3875 | break;} |
2884c41e | 3876 | case 280: |
f8989a66 | 3877 | #line 1538 "./parse.y" |
e85ac860 | 3878 | { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ; |
0b4d333e | 3879 | break;} |
2884c41e | 3880 | case 281: |
f8989a66 | 3881 | #line 1543 "./parse.y" |
8b27f225 PB |
3882 | { |
3883 | tree body = build_loop_body (0, NULL_TREE, 1); | |
3884 | yyval.node = build_new_loop (body); | |
3885 | ; | |
3886 | break;} | |
2884c41e | 3887 | case 282: |
f8989a66 | 3888 | #line 1552 "./parse.y" |
e85ac860 | 3889 | { yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ; |
8b27f225 | 3890 | break;} |
2884c41e | 3891 | case 283: |
f8989a66 | 3892 | #line 1557 "./parse.y" |
e85ac860 | 3893 | { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; |
0b4d333e | 3894 | break;} |
2884c41e | 3895 | case 284: |
f8989a66 | 3896 | #line 1559 "./parse.y" |
8b27f225 | 3897 | { |
e85ac860 | 3898 | yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); |
8b27f225 PB |
3899 | /* We have not condition, so we get rid of the EXIT_EXPR */ |
3900 | LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) = | |
c877974e | 3901 | empty_stmt_node; |
8b27f225 PB |
3902 | ; |
3903 | break;} | |
2e5eb5c5 | 3904 | case 285: |
f8989a66 | 3905 | #line 1566 "./parse.y" |
2884c41e | 3906 | {yyerror ("Invalid control expression"); RECOVER;; |
8b27f225 | 3907 | break;} |
2e5eb5c5 | 3908 | case 286: |
f8989a66 | 3909 | #line 1568 "./parse.y" |
0b4d333e | 3910 | {yyerror ("Invalid update expression"); RECOVER;; |
22eed1e6 | 3911 | break;} |
2e5eb5c5 | 3912 | case 287: |
f8989a66 | 3913 | #line 1570 "./parse.y" |
2884c41e | 3914 | {yyerror ("Invalid update expression"); RECOVER;; |
0b4d333e | 3915 | break;} |
2e5eb5c5 | 3916 | case 288: |
f8989a66 | 3917 | #line 1575 "./parse.y" |
2884c41e KG |
3918 | { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);; |
3919 | break;} | |
3920 | case 289: | |
f8989a66 | 3921 | #line 1577 "./parse.y" |
8b27f225 | 3922 | { |
e85ac860 | 3923 | yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); |
8b27f225 PB |
3924 | /* We have not condition, so we get rid of the EXIT_EXPR */ |
3925 | LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) = | |
c877974e | 3926 | empty_stmt_node; |
8b27f225 PB |
3927 | ; |
3928 | break;} | |
2884c41e | 3929 | case 290: |
f8989a66 | 3930 | #line 1587 "./parse.y" |
8b27f225 PB |
3931 | { |
3932 | /* This scope defined for local variable that may be | |
3933 | defined within the scope of the for loop */ | |
3934 | enter_block (); | |
3935 | ; | |
3936 | break;} | |
2884c41e | 3937 | case 291: |
f8989a66 | 3938 | #line 1593 "./parse.y" |
0b4d333e | 3939 | {yyerror ("'(' expected"); DRECOVER(for_1);; |
8b27f225 | 3940 | break;} |
2884c41e | 3941 | case 292: |
f8989a66 | 3942 | #line 1595 "./parse.y" |
0b4d333e APB |
3943 | {yyerror ("Invalid init statement"); RECOVER;; |
3944 | break;} | |
2884c41e | 3945 | case 293: |
f8989a66 | 3946 | #line 1600 "./parse.y" |
8b27f225 PB |
3947 | { |
3948 | /* We now declare the loop body. The loop is | |
3949 | declared as a for loop. */ | |
3950 | tree body = build_loop_body (0, NULL_TREE, 0); | |
3951 | yyval.node = build_new_loop (body); | |
3952 | IS_FOR_LOOP_P (yyval.node) = 1; | |
3953 | /* The loop is added to the current block the for | |
3954 | statement is defined within */ | |
3955 | java_method_add_stmt (current_function_decl, yyval.node); | |
3956 | ; | |
3957 | break;} | |
2884c41e | 3958 | case 294: |
f8989a66 | 3959 | #line 1612 "./parse.y" |
c877974e | 3960 | { yyval.node = empty_stmt_node; ; |
8b27f225 | 3961 | break;} |
2884c41e | 3962 | case 295: |
f8989a66 | 3963 | #line 1614 "./parse.y" |
8b27f225 PB |
3964 | { |
3965 | /* Init statement recorded within the previously | |
3966 | defined block scope */ | |
3967 | yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node); | |
3968 | ; | |
3969 | break;} | |
2884c41e | 3970 | case 296: |
f8989a66 | 3971 | #line 1620 "./parse.y" |
8b27f225 PB |
3972 | { |
3973 | /* Local variable are recorded within the previously | |
3974 | defined block scope */ | |
3975 | yyval.node = NULL_TREE; | |
3976 | ; | |
3977 | break;} | |
2884c41e | 3978 | case 297: |
f8989a66 | 3979 | #line 1626 "./parse.y" |
2e5eb5c5 | 3980 | {yyerror ("';' expected"); DRECOVER(for_init_1);; |
8b27f225 | 3981 | break;} |
2884c41e | 3982 | case 298: |
f8989a66 | 3983 | #line 1630 "./parse.y" |
2e5eb5c5 | 3984 | {yyval.node = empty_stmt_node;; |
8b27f225 | 3985 | break;} |
2884c41e | 3986 | case 299: |
f8989a66 | 3987 | #line 1632 "./parse.y" |
2e5eb5c5 | 3988 | { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ; |
8b27f225 | 3989 | break;} |
2884c41e | 3990 | case 300: |
f8989a66 | 3991 | #line 1637 "./parse.y" |
2e5eb5c5 | 3992 | { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ; |
8b27f225 | 3993 | break;} |
2884c41e | 3994 | case 301: |
f8989a66 | 3995 | #line 1639 "./parse.y" |
2e5eb5c5 | 3996 | { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ; |
8b27f225 | 3997 | break;} |
2884c41e | 3998 | case 302: |
f8989a66 | 3999 | #line 1641 "./parse.y" |
2e5eb5c5 | 4000 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 4001 | break;} |
2884c41e | 4002 | case 303: |
f8989a66 | 4003 | #line 1646 "./parse.y" |
2e5eb5c5 | 4004 | { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ; |
8b27f225 | 4005 | break;} |
2884c41e | 4006 | case 304: |
f8989a66 | 4007 | #line 1648 "./parse.y" |
2e5eb5c5 | 4008 | { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ; |
8b27f225 | 4009 | break;} |
2884c41e | 4010 | case 305: |
f8989a66 | 4011 | #line 1650 "./parse.y" |
2e5eb5c5 | 4012 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 4013 | break;} |
2884c41e | 4014 | case 306: |
f8989a66 | 4015 | #line 1652 "./parse.y" |
2e5eb5c5 | 4016 | {yyerror ("';' expected"); RECOVER;; |
8b27f225 | 4017 | break;} |
2884c41e | 4018 | case 307: |
f8989a66 | 4019 | #line 1657 "./parse.y" |
2e5eb5c5 | 4020 | { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ; |
8b27f225 | 4021 | break;} |
2884c41e | 4022 | case 308: |
f8989a66 | 4023 | #line 1659 "./parse.y" |
2e5eb5c5 | 4024 | { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ; |
8b27f225 | 4025 | break;} |
2884c41e | 4026 | case 309: |
f8989a66 | 4027 | #line 1661 "./parse.y" |
2e5eb5c5 | 4028 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 4029 | break;} |
2884c41e | 4030 | case 310: |
f8989a66 | 4031 | #line 1663 "./parse.y" |
2e5eb5c5 | 4032 | {yyerror ("';' expected"); RECOVER;; |
8b27f225 | 4033 | break;} |
2884c41e | 4034 | case 311: |
f8989a66 | 4035 | #line 1668 "./parse.y" |
2e5eb5c5 | 4036 | { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ; |
8b27f225 | 4037 | break;} |
2884c41e | 4038 | case 312: |
f8989a66 | 4039 | #line 1670 "./parse.y" |
2e5eb5c5 | 4040 | { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ; |
0b4d333e | 4041 | break;} |
2884c41e | 4042 | case 313: |
f8989a66 | 4043 | #line 1672 "./parse.y" |
2e5eb5c5 APB |
4044 | {yyerror ("Missing term"); RECOVER;; |
4045 | break;} | |
2884c41e | 4046 | case 314: |
f8989a66 | 4047 | #line 1674 "./parse.y" |
2e5eb5c5 APB |
4048 | {yyerror ("';' expected"); RECOVER;; |
4049 | break;} | |
2884c41e | 4050 | case 315: |
f8989a66 | 4051 | #line 1679 "./parse.y" |
8b27f225 PB |
4052 | { |
4053 | yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node); | |
4054 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location; | |
4055 | ; | |
4056 | break;} | |
2884c41e | 4057 | case 316: |
f8989a66 | 4058 | #line 1684 "./parse.y" |
0b4d333e | 4059 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 4060 | break;} |
2884c41e | 4061 | case 317: |
f8989a66 | 4062 | #line 1686 "./parse.y" |
0b4d333e APB |
4063 | {yyerror ("';' expected"); RECOVER;; |
4064 | break;} | |
2884c41e | 4065 | case 318: |
f8989a66 | 4066 | #line 1691 "./parse.y" |
8b27f225 PB |
4067 | { |
4068 | yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); | |
4069 | EXPR_WFL_LINECOL (yyval.node) = | |
4070 | EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK)); | |
4071 | ; | |
4072 | break;} | |
2e5eb5c5 | 4073 | case 319: |
f8989a66 | 4074 | #line 1697 "./parse.y" |
2884c41e | 4075 | {yyerror ("'{' expected"); RECOVER;; |
8b27f225 | 4076 | break;} |
2e5eb5c5 | 4077 | case 320: |
f8989a66 | 4078 | #line 1699 "./parse.y" |
2884c41e | 4079 | {yyerror ("'(' expected"); RECOVER;; |
22eed1e6 | 4080 | break;} |
2e5eb5c5 | 4081 | case 321: |
f8989a66 | 4082 | #line 1701 "./parse.y" |
0b4d333e APB |
4083 | {yyerror ("Missing term"); RECOVER;; |
4084 | break;} | |
2e5eb5c5 | 4085 | case 322: |
f8989a66 | 4086 | #line 1703 "./parse.y" |
2884c41e KG |
4087 | {yyerror ("Missing term"); RECOVER;; |
4088 | break;} | |
4089 | case 323: | |
f8989a66 | 4090 | #line 1708 "./parse.y" |
8b27f225 | 4091 | { |
781b0558 KG |
4092 | check_modifiers ( |
4093 | "Illegal modifier `%s'. Only `synchronized' was expected here", | |
efa0a23f APB |
4094 | yyvsp[0].value, ACC_SYNCHRONIZED); |
4095 | if (yyvsp[0].value != ACC_SYNCHRONIZED) | |
4096 | MODIFIER_WFL (SYNCHRONIZED_TK) = | |
4097 | build_wfl_node (NULL_TREE); | |
8b27f225 PB |
4098 | ; |
4099 | break;} | |
2884c41e | 4100 | case 324: |
f8989a66 | 4101 | #line 1720 "./parse.y" |
a7d8d81f | 4102 | { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ; |
8b27f225 | 4103 | break;} |
2884c41e | 4104 | case 325: |
f8989a66 | 4105 | #line 1722 "./parse.y" |
a7d8d81f | 4106 | { yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ; |
8b27f225 | 4107 | break;} |
2884c41e | 4108 | case 326: |
f8989a66 | 4109 | #line 1724 "./parse.y" |
2aa11e97 APB |
4110 | { yyval.node = build_try_finally_statement |
4111 | (yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location, | |
4112 | yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node); | |
4113 | ; | |
8b27f225 | 4114 | break;} |
2884c41e | 4115 | case 327: |
f8989a66 | 4116 | #line 1729 "./parse.y" |
8b27f225 PB |
4117 | {yyerror ("'{' expected"); DRECOVER (try_statement);; |
4118 | break;} | |
2884c41e | 4119 | case 329: |
f8989a66 | 4120 | #line 1735 "./parse.y" |
8b27f225 PB |
4121 | { |
4122 | TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node; | |
4123 | yyval.node = yyvsp[0].node; | |
4124 | ; | |
4125 | break;} | |
2884c41e | 4126 | case 330: |
f8989a66 | 4127 | #line 1743 "./parse.y" |
8b27f225 PB |
4128 | { |
4129 | java_method_add_stmt (current_function_decl, yyvsp[0].node); | |
4130 | exit_block (); | |
4131 | yyval.node = yyvsp[-1].node; | |
4132 | ; | |
4133 | break;} | |
2884c41e | 4134 | case 331: |
f8989a66 | 4135 | #line 1751 "./parse.y" |
8b27f225 PB |
4136 | { |
4137 | /* We add a block to define a scope for | |
4138 | formal_parameter (CCBP). The formal parameter is | |
4139 | declared initialized by the appropriate function | |
4140 | call */ | |
4141 | tree ccpb = enter_block (); | |
c877974e APB |
4142 | tree init = build_assignment (ASSIGN_TK, yyvsp[-2].operator.location, |
4143 | TREE_PURPOSE (yyvsp[-1].node), | |
4144 | soft_exceptioninfo_call_node); | |
8b27f225 PB |
4145 | declare_local_variables (0, TREE_VALUE (yyvsp[-1].node), |
4146 | build_tree_list (TREE_PURPOSE (yyvsp[-1].node), | |
4147 | init)); | |
4148 | yyval.node = build1 (CATCH_EXPR, NULL_TREE, ccpb); | |
4149 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location; | |
4150 | ; | |
4151 | break;} | |
2e5eb5c5 | 4152 | case 332: |
f8989a66 | 4153 | #line 1767 "./parse.y" |
2884c41e KG |
4154 | {yyerror ("'(' expected"); RECOVER; yyval.node = NULL_TREE;; |
4155 | break;} | |
4156 | case 333: | |
f8989a66 | 4157 | #line 1769 "./parse.y" |
b5b8a0e7 APB |
4158 | { |
4159 | yyerror ("Missing term or ')' expected"); | |
4160 | RECOVER; yyval.node = NULL_TREE; | |
4161 | ; | |
8b27f225 | 4162 | break;} |
2884c41e | 4163 | case 334: |
f8989a66 | 4164 | #line 1774 "./parse.y" |
b5b8a0e7 | 4165 | {yyerror ("Missing term"); RECOVER; yyval.node = NULL_TREE;; |
0b4d333e | 4166 | break;} |
2884c41e | 4167 | case 335: |
f8989a66 | 4168 | #line 1779 "./parse.y" |
a7d8d81f | 4169 | { yyval.node = yyvsp[0].node; ; |
8b27f225 | 4170 | break;} |
2884c41e | 4171 | case 336: |
f8989a66 | 4172 | #line 1781 "./parse.y" |
8b27f225 PB |
4173 | {yyerror ("'{' expected"); RECOVER; ; |
4174 | break;} | |
2884c41e | 4175 | case 340: |
f8989a66 | 4176 | #line 1793 "./parse.y" |
8b27f225 PB |
4177 | { yyval.node = build_this (yyvsp[0].operator.location); ; |
4178 | break;} | |
2884c41e | 4179 | case 341: |
f8989a66 | 4180 | #line 1795 "./parse.y" |
8b27f225 PB |
4181 | {yyval.node = yyvsp[-1].node;; |
4182 | break;} | |
1179ebc2 | 4183 | case 346: |
f8989a66 | 4184 | #line 1804 "./parse.y" |
2884c41e | 4185 | { yyval.node = parse_jdk1_1_error ("named class literals"); ; |
8b27f225 | 4186 | break;} |
1179ebc2 | 4187 | case 347: |
f8989a66 | 4188 | #line 1806 "./parse.y" |
2884c41e | 4189 | { yyval.node = build_class_ref (yyvsp[-2].node); ; |
8b27f225 | 4190 | break;} |
1179ebc2 | 4191 | case 348: |
f8989a66 | 4192 | #line 1808 "./parse.y" |
2884c41e | 4193 | { yyval.node = build_class_ref (void_type_node); ; |
8b27f225 | 4194 | break;} |
1179ebc2 | 4195 | case 349: |
f8989a66 | 4196 | #line 1813 "./parse.y" |
2884c41e | 4197 | { yyval.node = parse_jdk1_1_error ("class literals"); ; |
8b27f225 | 4198 | break;} |
1179ebc2 | 4199 | case 350: |
f8989a66 | 4200 | #line 1815 "./parse.y" |
2884c41e | 4201 | {yyerror ("')' expected"); RECOVER;; |
8b27f225 | 4202 | break;} |
1179ebc2 | 4203 | case 351: |
f8989a66 | 4204 | #line 1817 "./parse.y" |
2884c41e | 4205 | {yyerror ("'class' or 'this' expected" ); RECOVER;; |
8b27f225 | 4206 | break;} |
1179ebc2 | 4207 | case 352: |
f8989a66 | 4208 | #line 1819 "./parse.y" |
2e5eb5c5 | 4209 | {yyerror ("'class' expected" ); RECOVER;; |
8b27f225 | 4210 | break;} |
1179ebc2 | 4211 | case 353: |
f8989a66 | 4212 | #line 1821 "./parse.y" |
2884c41e | 4213 | {yyerror ("'class' expected" ); RECOVER;; |
8b27f225 | 4214 | break;} |
0b4d333e | 4215 | case 354: |
f8989a66 | 4216 | #line 1826 "./parse.y" |
2884c41e | 4217 | { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ; |
8b27f225 | 4218 | break;} |
2e5eb5c5 | 4219 | case 355: |
f8989a66 | 4220 | #line 1828 "./parse.y" |
2884c41e | 4221 | { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ; |
8b27f225 | 4222 | break;} |
2e5eb5c5 | 4223 | case 356: |
f8989a66 | 4224 | #line 1833 "./parse.y" |
2e5eb5c5 | 4225 | { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ; |
8b27f225 | 4226 | break;} |
2884c41e | 4227 | case 357: |
f8989a66 | 4228 | #line 1835 "./parse.y" |
2884c41e | 4229 | { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ; |
8b27f225 | 4230 | break;} |
1179ebc2 | 4231 | case 362: |
f8989a66 | 4232 | #line 1844 "./parse.y" |
2884c41e | 4233 | {yyerror ("'(' expected"); DRECOVER(new_1);; |
22eed1e6 | 4234 | break;} |
1179ebc2 | 4235 | case 363: |
f8989a66 | 4236 | #line 1846 "./parse.y" |
2884c41e | 4237 | {yyerror ("'(' expected"); RECOVER;; |
0b4d333e APB |
4238 | break;} |
4239 | case 364: | |
f8989a66 | 4240 | #line 1848 "./parse.y" |
2884c41e | 4241 | {yyerror ("')' or term expected"); RECOVER;; |
2e5eb5c5 APB |
4242 | break;} |
4243 | case 365: | |
f8989a66 | 4244 | #line 1850 "./parse.y" |
2884c41e | 4245 | {yyerror ("')' expected"); RECOVER;; |
2e5eb5c5 APB |
4246 | break;} |
4247 | case 366: | |
f8989a66 | 4248 | #line 1852 "./parse.y" |
2884c41e KG |
4249 | {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;; |
4250 | break;} | |
4251 | case 367: | |
f8989a66 | 4252 | #line 1854 "./parse.y" |
8b27f225 PB |
4253 | {yyerror ("'(' expected"); RECOVER;; |
4254 | break;} | |
2884c41e | 4255 | case 370: |
f8989a66 | 4256 | #line 1864 "./parse.y" |
8b27f225 PB |
4257 | { |
4258 | yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE); | |
4259 | ctxp->formal_parameter_number = 1; | |
4260 | ; | |
4261 | break;} | |
2884c41e | 4262 | case 371: |
f8989a66 | 4263 | #line 1869 "./parse.y" |
8b27f225 PB |
4264 | { |
4265 | ctxp->formal_parameter_number += 1; | |
4266 | yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node); | |
4267 | ; | |
4268 | break;} | |
8b27f225 | 4269 | case 372: |
f8989a66 | 4270 | #line 1874 "./parse.y" |
2884c41e | 4271 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 PB |
4272 | break;} |
4273 | case 373: | |
f8989a66 | 4274 | #line 1879 "./parse.y" |
2e5eb5c5 | 4275 | { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ; |
8b27f225 PB |
4276 | break;} |
4277 | case 374: | |
f8989a66 | 4278 | #line 1881 "./parse.y" |
2884c41e | 4279 | { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ; |
8b27f225 PB |
4280 | break;} |
4281 | case 375: | |
f8989a66 | 4282 | #line 1883 "./parse.y" |
2e5eb5c5 | 4283 | { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));; |
8b27f225 | 4284 | break;} |
1179ebc2 | 4285 | case 376: |
f8989a66 | 4286 | #line 1885 "./parse.y" |
2884c41e | 4287 | { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));; |
8b27f225 | 4288 | break;} |
1179ebc2 | 4289 | case 377: |
f8989a66 | 4290 | #line 1889 "./parse.y" |
2e5eb5c5 | 4291 | { yyval.node = parse_jdk1_1_error ("anonymous array"); ; |
8b27f225 | 4292 | break;} |
1179ebc2 | 4293 | case 378: |
f8989a66 | 4294 | #line 1891 "./parse.y" |
2884c41e | 4295 | { yyval.node = parse_jdk1_1_error ("anonymous array"); ; |
22eed1e6 | 4296 | break;} |
1179ebc2 | 4297 | case 379: |
f8989a66 | 4298 | #line 1893 "./parse.y" |
2884c41e | 4299 | {yyerror ("'[' expected"); DRECOVER ("]");; |
0b4d333e APB |
4300 | break;} |
4301 | case 380: | |
f8989a66 | 4302 | #line 1895 "./parse.y" |
2884c41e | 4303 | {yyerror ("']' expected"); RECOVER;; |
2e5eb5c5 APB |
4304 | break;} |
4305 | case 381: | |
f8989a66 | 4306 | #line 1900 "./parse.y" |
2884c41e | 4307 | { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ; |
2e5eb5c5 APB |
4308 | break;} |
4309 | case 382: | |
f8989a66 | 4310 | #line 1902 "./parse.y" |
2884c41e KG |
4311 | { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ; |
4312 | break;} | |
4313 | case 383: | |
f8989a66 | 4314 | #line 1907 "./parse.y" |
8b27f225 PB |
4315 | { |
4316 | EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location; | |
4317 | yyval.node = yyvsp[-1].node; | |
4318 | ; | |
4319 | break;} | |
2884c41e | 4320 | case 384: |
f8989a66 | 4321 | #line 1912 "./parse.y" |
8b27f225 PB |
4322 | {yyerror ("']' expected"); RECOVER;; |
4323 | break;} | |
2884c41e | 4324 | case 385: |
f8989a66 | 4325 | #line 1914 "./parse.y" |
8b27f225 PB |
4326 | { |
4327 | yyerror ("Missing term"); | |
4328 | yyerror ("']' expected"); | |
4329 | RECOVER; | |
4330 | ; | |
4331 | break;} | |
2884c41e | 4332 | case 386: |
f8989a66 | 4333 | #line 1923 "./parse.y" |
ba179f9f APB |
4334 | { |
4335 | int allocate = 0; | |
4336 | /* If not initialized, allocate memory for the osb | |
4337 | numbers stack */ | |
4338 | if (!ctxp->osb_limit) | |
4339 | { | |
4340 | allocate = ctxp->osb_limit = 32; | |
4341 | ctxp->osb_depth = -1; | |
4342 | } | |
4343 | /* If capacity overflown, reallocate a bigger chuck */ | |
4344 | else if (ctxp->osb_depth+1 == ctxp->osb_limit) | |
4345 | allocate = ctxp->osb_limit << 1; | |
4346 | ||
4347 | if (allocate) | |
4348 | { | |
4349 | allocate *= sizeof (int); | |
4350 | if (ctxp->osb_number) | |
4351 | ctxp->osb_number = (int *)xrealloc (ctxp->osb_number, | |
4352 | allocate); | |
4353 | else | |
4354 | ctxp->osb_number = (int *)xmalloc (allocate); | |
4355 | } | |
4356 | ctxp->osb_depth++; | |
4357 | CURRENT_OSB (ctxp) = 1; | |
4358 | ; | |
8b27f225 | 4359 | break;} |
2884c41e | 4360 | case 387: |
f8989a66 | 4361 | #line 1949 "./parse.y" |
0b4d333e | 4362 | { CURRENT_OSB (ctxp)++; ; |
8b27f225 | 4363 | break;} |
2884c41e | 4364 | case 388: |
f8989a66 | 4365 | #line 1951 "./parse.y" |
0b4d333e | 4366 | { yyerror ("']' expected"); RECOVER;; |
8b27f225 | 4367 | break;} |
2884c41e | 4368 | case 389: |
f8989a66 | 4369 | #line 1956 "./parse.y" |
0b4d333e APB |
4370 | { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ; |
4371 | break;} | |
2884c41e | 4372 | case 390: |
f8989a66 | 4373 | #line 1960 "./parse.y" |
8b27f225 PB |
4374 | { |
4375 | tree super_wfl = | |
9ee9b555 | 4376 | build_wfl_node (super_identifier_node); |
8b27f225 | 4377 | EXPR_WFL_LINECOL (super_wfl) = yyvsp[-2].operator.location; |
22eed1e6 APB |
4378 | yyval.node = make_qualified_name (super_wfl, yyvsp[0].node, yyvsp[-1].operator.location); |
4379 | ; | |
8b27f225 | 4380 | break;} |
2884c41e | 4381 | case 391: |
f8989a66 | 4382 | #line 1967 "./parse.y" |
0b4d333e | 4383 | {yyerror ("Field expected"); DRECOVER (super_field_acces);; |
8b27f225 | 4384 | break;} |
2884c41e | 4385 | case 392: |
f8989a66 | 4386 | #line 1972 "./parse.y" |
0b4d333e | 4387 | { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ; |
8b27f225 | 4388 | break;} |
2884c41e | 4389 | case 393: |
f8989a66 | 4390 | #line 1974 "./parse.y" |
0b4d333e APB |
4391 | { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ; |
4392 | break;} | |
2884c41e | 4393 | case 394: |
f8989a66 | 4394 | #line 1976 "./parse.y" |
8b27f225 | 4395 | { |
22eed1e6 APB |
4396 | if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR) |
4397 | yyval.node = build_this_super_qualified_invocation | |
4398 | (1, yyvsp[-2].node, NULL_TREE, 0, yyvsp[-3].operator.location); | |
4399 | else | |
4400 | { | |
4401 | tree invok = build_method_invocation (yyvsp[-2].node, NULL_TREE); | |
4402 | yyval.node = make_qualified_primary (yyvsp[-4].node, invok, yyvsp[-3].operator.location); | |
4403 | } | |
8b27f225 PB |
4404 | ; |
4405 | break;} | |
2884c41e | 4406 | case 395: |
f8989a66 | 4407 | #line 1987 "./parse.y" |
22eed1e6 APB |
4408 | { |
4409 | if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR) | |
4410 | yyval.node = build_this_super_qualified_invocation | |
4411 | (1, yyvsp[-3].node, yyvsp[-1].node, 0, yyvsp[-4].operator.location); | |
4412 | else | |
4413 | { | |
4414 | tree invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); | |
4415 | yyval.node = make_qualified_primary (yyvsp[-5].node, invok, yyvsp[-4].operator.location); | |
4416 | } | |
8b27f225 PB |
4417 | ; |
4418 | break;} | |
2884c41e | 4419 | case 396: |
f8989a66 | 4420 | #line 1998 "./parse.y" |
22eed1e6 APB |
4421 | { |
4422 | yyval.node = build_this_super_qualified_invocation | |
4423 | (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location); | |
8b27f225 PB |
4424 | ; |
4425 | break;} | |
2884c41e | 4426 | case 397: |
f8989a66 | 4427 | #line 2003 "./parse.y" |
22eed1e6 APB |
4428 | { |
4429 | yyval.node = build_this_super_qualified_invocation | |
4430 | (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location); | |
4431 | ; | |
8b27f225 | 4432 | break;} |
2e5eb5c5 | 4433 | case 398: |
f8989a66 | 4434 | #line 2012 "./parse.y" |
0b4d333e | 4435 | { yyerror ("'(' expected"); DRECOVER (method_invocation); ; |
8b27f225 | 4436 | break;} |
2e5eb5c5 | 4437 | case 399: |
f8989a66 | 4438 | #line 2014 "./parse.y" |
2884c41e | 4439 | { yyerror ("'(' expected"); DRECOVER (method_invocation); ; |
8b27f225 | 4440 | break;} |
2e5eb5c5 | 4441 | case 400: |
f8989a66 | 4442 | #line 2019 "./parse.y" |
0b4d333e | 4443 | { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ; |
8b27f225 | 4444 | break;} |
2e5eb5c5 | 4445 | case 401: |
f8989a66 | 4446 | #line 2021 "./parse.y" |
2884c41e KG |
4447 | { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ; |
4448 | break;} | |
4449 | case 402: | |
f8989a66 | 4450 | #line 2023 "./parse.y" |
8b27f225 | 4451 | { |
0b4d333e | 4452 | yyerror ("Missing term and ']' expected"); |
8b27f225 PB |
4453 | DRECOVER(array_access); |
4454 | ; | |
4455 | break;} | |
2884c41e | 4456 | case 403: |
f8989a66 | 4457 | #line 2028 "./parse.y" |
8b27f225 | 4458 | { |
0b4d333e | 4459 | yyerror ("']' expected"); |
8b27f225 PB |
4460 | DRECOVER(array_access); |
4461 | ; | |
4462 | break;} | |
2884c41e | 4463 | case 404: |
f8989a66 | 4464 | #line 2033 "./parse.y" |
8b27f225 | 4465 | { |
0b4d333e | 4466 | yyerror ("Missing term and ']' expected"); |
8b27f225 PB |
4467 | DRECOVER(array_access); |
4468 | ; | |
4469 | break;} | |
2884c41e | 4470 | case 405: |
f8989a66 | 4471 | #line 2038 "./parse.y" |
0b4d333e APB |
4472 | { |
4473 | yyerror ("']' expected"); | |
4474 | DRECOVER(array_access); | |
4475 | ; | |
8b27f225 | 4476 | break;} |
2e5eb5c5 | 4477 | case 410: |
f8989a66 | 4478 | #line 2053 "./parse.y" |
0b4d333e | 4479 | { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ; |
8b27f225 | 4480 | break;} |
2884c41e | 4481 | case 411: |
f8989a66 | 4482 | #line 2058 "./parse.y" |
2884c41e | 4483 | { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ; |
8b27f225 | 4484 | break;} |
1179ebc2 | 4485 | case 414: |
f8989a66 | 4486 | #line 2065 "./parse.y" |
2e5eb5c5 | 4487 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; |
8b27f225 | 4488 | break;} |
2884c41e | 4489 | case 415: |
f8989a66 | 4490 | #line 2067 "./parse.y" |
2884c41e | 4491 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; |
8b27f225 | 4492 | break;} |
1179ebc2 | 4493 | case 417: |
f8989a66 | 4494 | #line 2070 "./parse.y" |
0b4d333e | 4495 | {yyerror ("Missing term"); RECOVER; |
8b27f225 | 4496 | break;} |
1179ebc2 | 4497 | case 418: |
f8989a66 | 4498 | #line 2072 "./parse.y" |
2884c41e | 4499 | {yyerror ("Missing term"); RECOVER; |
8b27f225 | 4500 | break;} |
0b4d333e | 4501 | case 419: |
f8989a66 | 4502 | #line 2077 "./parse.y" |
2884c41e | 4503 | {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ; |
8b27f225 | 4504 | break;} |
2e5eb5c5 | 4505 | case 420: |
f8989a66 | 4506 | #line 2079 "./parse.y" |
2884c41e | 4507 | {yyerror ("Missing term"); RECOVER; |
2e5eb5c5 | 4508 | break;} |
1179ebc2 | 4509 | case 421: |
f8989a66 | 4510 | #line 2084 "./parse.y" |
2884c41e | 4511 | {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ; |
8b27f225 | 4512 | break;} |
2884c41e | 4513 | case 422: |
f8989a66 | 4514 | #line 2086 "./parse.y" |
2884c41e | 4515 | {yyerror ("Missing term"); RECOVER; |
8b27f225 | 4516 | break;} |
1179ebc2 | 4517 | case 424: |
f8989a66 | 4518 | #line 2092 "./parse.y" |
2e5eb5c5 APB |
4519 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; |
4520 | break;} | |
2884c41e | 4521 | case 425: |
f8989a66 | 4522 | #line 2094 "./parse.y" |
2884c41e | 4523 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; |
22eed1e6 | 4524 | break;} |
2e5eb5c5 | 4525 | case 427: |
f8989a66 | 4526 | #line 2097 "./parse.y" |
0b4d333e APB |
4527 | {yyerror ("Missing term"); RECOVER; |
4528 | break;} | |
2e5eb5c5 | 4529 | case 428: |
f8989a66 | 4530 | #line 2099 "./parse.y" |
2884c41e KG |
4531 | {yyerror ("Missing term"); RECOVER; |
4532 | break;} | |
4533 | case 429: | |
f8989a66 | 4534 | #line 2104 "./parse.y" |
8b27f225 PB |
4535 | { |
4536 | tree type = yyvsp[-3].node; | |
ba179f9f | 4537 | while (CURRENT_OSB (ctxp)--) |
8b27f225 | 4538 | type = build_java_array_type (type, -1); |
ba179f9f | 4539 | ctxp->osb_depth--; |
8b27f225 PB |
4540 | yyval.node = build_cast (yyvsp[-4].operator.location, type, yyvsp[0].node); |
4541 | ; | |
4542 | break;} | |
2e5eb5c5 | 4543 | case 430: |
f8989a66 | 4544 | #line 2112 "./parse.y" |
0b4d333e APB |
4545 | { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ; |
4546 | break;} | |
2e5eb5c5 | 4547 | case 431: |
f8989a66 | 4548 | #line 2114 "./parse.y" |
2884c41e KG |
4549 | { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ; |
4550 | break;} | |
4551 | case 432: | |
f8989a66 | 4552 | #line 2116 "./parse.y" |
8b27f225 | 4553 | { |
49f48c71 | 4554 | const char *ptr; |
ba179f9f | 4555 | while (CURRENT_OSB (ctxp)--) |
8b27f225 | 4556 | obstack_1grow (&temporary_obstack, '['); |
ba179f9f | 4557 | ctxp->osb_depth--; |
8b27f225 PB |
4558 | obstack_grow0 (&temporary_obstack, |
4559 | IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp[-3].node)), | |
4560 | IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp[-3].node))); | |
4561 | ptr = obstack_finish (&temporary_obstack); | |
4562 | EXPR_WFL_NODE (yyvsp[-3].node) = get_identifier (ptr); | |
4563 | yyval.node = build_cast (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[0].node); | |
4564 | ; | |
4565 | break;} | |
2884c41e | 4566 | case 433: |
f8989a66 | 4567 | #line 2129 "./parse.y" |
8b27f225 PB |
4568 | {yyerror ("']' expected, invalid type expression");; |
4569 | break;} | |
2884c41e | 4570 | case 434: |
f8989a66 | 4571 | #line 2131 "./parse.y" |
8b27f225 PB |
4572 | { |
4573 | if (ctxp->prevent_ese != lineno) | |
4574 | yyerror ("Invalid type expression"); RECOVER; | |
4575 | RECOVER; | |
4576 | ; | |
4577 | break;} | |
2e5eb5c5 | 4578 | case 435: |
f8989a66 | 4579 | #line 2137 "./parse.y" |
22eed1e6 APB |
4580 | {yyerror ("Missing term"); RECOVER;; |
4581 | break;} | |
2e5eb5c5 | 4582 | case 436: |
f8989a66 | 4583 | #line 2139 "./parse.y" |
0b4d333e | 4584 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 4585 | break;} |
2884c41e | 4586 | case 437: |
f8989a66 | 4587 | #line 2141 "./parse.y" |
2884c41e KG |
4588 | {yyerror ("Missing term"); RECOVER;; |
4589 | break;} | |
4590 | case 439: | |
f8989a66 | 4591 | #line 2147 "./parse.y" |
0b4d333e APB |
4592 | { |
4593 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), | |
4594 | yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); | |
8b27f225 PB |
4595 | ; |
4596 | break;} | |
2884c41e | 4597 | case 440: |
f8989a66 | 4598 | #line 2152 "./parse.y" |
8b27f225 PB |
4599 | { |
4600 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4601 | yyvsp[-2].node, yyvsp[0].node); | |
4602 | ; | |
4603 | break;} | |
2884c41e | 4604 | case 441: |
f8989a66 | 4605 | #line 2157 "./parse.y" |
0b4d333e APB |
4606 | { |
4607 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4608 | yyvsp[-2].node, yyvsp[0].node); | |
4609 | ; | |
8b27f225 | 4610 | break;} |
2e5eb5c5 | 4611 | case 442: |
f8989a66 | 4612 | #line 2162 "./parse.y" |
8b27f225 PB |
4613 | {yyerror ("Missing term"); RECOVER;; |
4614 | break;} | |
2e5eb5c5 | 4615 | case 443: |
f8989a66 | 4616 | #line 2164 "./parse.y" |
2884c41e KG |
4617 | {yyerror ("Missing term"); RECOVER;; |
4618 | break;} | |
4619 | case 444: | |
f8989a66 | 4620 | #line 2166 "./parse.y" |
0b4d333e | 4621 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 4622 | break;} |
2884c41e | 4623 | case 446: |
f8989a66 | 4624 | #line 2172 "./parse.y" |
8b27f225 PB |
4625 | { |
4626 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4627 | yyvsp[-2].node, yyvsp[0].node); | |
4628 | ; | |
4629 | break;} | |
2884c41e | 4630 | case 447: |
f8989a66 | 4631 | #line 2177 "./parse.y" |
8b27f225 PB |
4632 | { |
4633 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4634 | yyvsp[-2].node, yyvsp[0].node); | |
4635 | ; | |
4636 | break;} | |
2884c41e | 4637 | case 448: |
f8989a66 | 4638 | #line 2182 "./parse.y" |
0b4d333e APB |
4639 | {yyerror ("Missing term"); RECOVER;; |
4640 | break;} | |
2884c41e | 4641 | case 449: |
f8989a66 | 4642 | #line 2184 "./parse.y" |
0b4d333e APB |
4643 | {yyerror ("Missing term"); RECOVER;; |
4644 | break;} | |
2884c41e | 4645 | case 451: |
f8989a66 | 4646 | #line 2190 "./parse.y" |
8b27f225 PB |
4647 | { |
4648 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4649 | yyvsp[-2].node, yyvsp[0].node); | |
4650 | ; | |
4651 | break;} | |
2884c41e | 4652 | case 452: |
f8989a66 | 4653 | #line 2195 "./parse.y" |
8b27f225 PB |
4654 | { |
4655 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4656 | yyvsp[-2].node, yyvsp[0].node); | |
4657 | ; | |
4658 | break;} | |
2884c41e | 4659 | case 453: |
f8989a66 | 4660 | #line 2200 "./parse.y" |
0b4d333e APB |
4661 | { |
4662 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4663 | yyvsp[-2].node, yyvsp[0].node); | |
4664 | ; | |
1179ebc2 | 4665 | break;} |
2e5eb5c5 | 4666 | case 454: |
f8989a66 | 4667 | #line 2205 "./parse.y" |
8b27f225 PB |
4668 | {yyerror ("Missing term"); RECOVER;; |
4669 | break;} | |
2e5eb5c5 | 4670 | case 455: |
f8989a66 | 4671 | #line 2207 "./parse.y" |
0b4d333e | 4672 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 4673 | break;} |
2884c41e | 4674 | case 456: |
f8989a66 | 4675 | #line 2209 "./parse.y" |
2884c41e | 4676 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 4677 | break;} |
2e5eb5c5 | 4678 | case 458: |
f8989a66 | 4679 | #line 2215 "./parse.y" |
8b27f225 PB |
4680 | { |
4681 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4682 | yyvsp[-2].node, yyvsp[0].node); | |
4683 | ; | |
4684 | break;} | |
2e5eb5c5 | 4685 | case 459: |
f8989a66 | 4686 | #line 2220 "./parse.y" |
8b27f225 PB |
4687 | { |
4688 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4689 | yyvsp[-2].node, yyvsp[0].node); | |
4690 | ; | |
4691 | break;} | |
2e5eb5c5 | 4692 | case 460: |
f8989a66 | 4693 | #line 2225 "./parse.y" |
0b4d333e APB |
4694 | { |
4695 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4696 | yyvsp[-2].node, yyvsp[0].node); | |
4697 | ; | |
8b27f225 | 4698 | break;} |
8b27f225 | 4699 | case 461: |
f8989a66 | 4700 | #line 2230 "./parse.y" |
2884c41e KG |
4701 | { |
4702 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4703 | yyvsp[-2].node, yyvsp[0].node); | |
4704 | ; | |
8b27f225 PB |
4705 | break;} |
4706 | case 462: | |
f8989a66 | 4707 | #line 2235 "./parse.y" |
2884c41e | 4708 | { yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ; |
8b27f225 PB |
4709 | break;} |
4710 | case 463: | |
f8989a66 | 4711 | #line 2237 "./parse.y" |
0b4d333e APB |
4712 | {yyerror ("Missing term"); RECOVER;; |
4713 | break;} | |
4714 | case 464: | |
f8989a66 | 4715 | #line 2239 "./parse.y" |
2e5eb5c5 APB |
4716 | {yyerror ("Missing term"); RECOVER;; |
4717 | break;} | |
4718 | case 465: | |
f8989a66 | 4719 | #line 2241 "./parse.y" |
2e5eb5c5 | 4720 | {yyerror ("Missing term"); RECOVER;; |
8b27f225 | 4721 | break;} |
0b4d333e | 4722 | case 466: |
f8989a66 | 4723 | #line 2243 "./parse.y" |
2884c41e KG |
4724 | {yyerror ("Missing term"); RECOVER;; |
4725 | break;} | |
4726 | case 467: | |
f8989a66 | 4727 | #line 2245 "./parse.y" |
2e5eb5c5 APB |
4728 | {yyerror ("Invalid reference type"); RECOVER;; |
4729 | break;} | |
2884c41e | 4730 | case 469: |
f8989a66 | 4731 | #line 2251 "./parse.y" |
8b27f225 PB |
4732 | { |
4733 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4734 | yyvsp[-2].node, yyvsp[0].node); | |
4735 | ; | |
4736 | break;} | |
2884c41e | 4737 | case 470: |
f8989a66 | 4738 | #line 2256 "./parse.y" |
8b27f225 PB |
4739 | { |
4740 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4741 | yyvsp[-2].node, yyvsp[0].node); | |
4742 | ; | |
4743 | break;} | |
2884c41e | 4744 | case 471: |
f8989a66 | 4745 | #line 2261 "./parse.y" |
8b27f225 PB |
4746 | {yyerror ("Missing term"); RECOVER;; |
4747 | break;} | |
2884c41e | 4748 | case 472: |
f8989a66 | 4749 | #line 2263 "./parse.y" |
8b27f225 PB |
4750 | {yyerror ("Missing term"); RECOVER;; |
4751 | break;} | |
2884c41e | 4752 | case 474: |
f8989a66 | 4753 | #line 2269 "./parse.y" |
8b27f225 PB |
4754 | { |
4755 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4756 | yyvsp[-2].node, yyvsp[0].node); | |
4757 | ; | |
4758 | break;} | |
2884c41e | 4759 | case 475: |
f8989a66 | 4760 | #line 2274 "./parse.y" |
8b27f225 PB |
4761 | {yyerror ("Missing term"); RECOVER;; |
4762 | break;} | |
2884c41e | 4763 | case 477: |
f8989a66 | 4764 | #line 2280 "./parse.y" |
8b27f225 PB |
4765 | { |
4766 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4767 | yyvsp[-2].node, yyvsp[0].node); | |
4768 | ; | |
4769 | break;} | |
2884c41e | 4770 | case 478: |
f8989a66 | 4771 | #line 2285 "./parse.y" |
8b27f225 PB |
4772 | {yyerror ("Missing term"); RECOVER;; |
4773 | break;} | |
2884c41e | 4774 | case 480: |
f8989a66 | 4775 | #line 2291 "./parse.y" |
8b27f225 PB |
4776 | { |
4777 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4778 | yyvsp[-2].node, yyvsp[0].node); | |
4779 | ; | |
4780 | break;} | |
2884c41e | 4781 | case 481: |
f8989a66 | 4782 | #line 2296 "./parse.y" |
8b27f225 PB |
4783 | {yyerror ("Missing term"); RECOVER;; |
4784 | break;} | |
2884c41e | 4785 | case 483: |
f8989a66 | 4786 | #line 2302 "./parse.y" |
8b27f225 PB |
4787 | { |
4788 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4789 | yyvsp[-2].node, yyvsp[0].node); | |
4790 | ; | |
4791 | break;} | |
2884c41e | 4792 | case 484: |
f8989a66 | 4793 | #line 2307 "./parse.y" |
8b27f225 PB |
4794 | {yyerror ("Missing term"); RECOVER;; |
4795 | break;} | |
2884c41e | 4796 | case 486: |
f8989a66 | 4797 | #line 2313 "./parse.y" |
8b27f225 PB |
4798 | { |
4799 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4800 | yyvsp[-2].node, yyvsp[0].node); | |
4801 | ; | |
4802 | break;} | |
2884c41e | 4803 | case 487: |
f8989a66 | 4804 | #line 2318 "./parse.y" |
8b27f225 PB |
4805 | {yyerror ("Missing term"); RECOVER;; |
4806 | break;} | |
2884c41e | 4807 | case 489: |
f8989a66 | 4808 | #line 2324 "./parse.y" |
22eed1e6 APB |
4809 | { |
4810 | yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); | |
4811 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location; | |
4812 | ; | |
4813 | break;} | |
2884c41e | 4814 | case 490: |
f8989a66 | 4815 | #line 2329 "./parse.y" |
8b27f225 PB |
4816 | { |
4817 | YYERROR_NOW; | |
4818 | yyerror ("Missing term"); | |
4819 | DRECOVER (1); | |
4820 | ; | |
4821 | break;} | |
2884c41e | 4822 | case 491: |
f8989a66 | 4823 | #line 2335 "./parse.y" |
8b27f225 PB |
4824 | {yyerror ("Missing term"); DRECOVER (2);; |
4825 | break;} | |
2884c41e | 4826 | case 492: |
f8989a66 | 4827 | #line 2337 "./parse.y" |
8b27f225 PB |
4828 | {yyerror ("Missing term"); DRECOVER (3);; |
4829 | break;} | |
2884c41e | 4830 | case 495: |
f8989a66 | 4831 | #line 2347 "./parse.y" |
8b27f225 PB |
4832 | { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ; |
4833 | break;} | |
2884c41e | 4834 | case 496: |
f8989a66 | 4835 | #line 2349 "./parse.y" |
8b27f225 PB |
4836 | { |
4837 | if (ctxp->prevent_ese != lineno) | |
4838 | yyerror ("Missing term"); | |
4839 | DRECOVER (assign); | |
4840 | ; | |
4841 | break;} | |
4842 | } | |
4843 | /* the action file gets copied in in place of this dollarsign */ | |
518f173d | 4844 | #line 543 "/usr/lib/bison.simple" |
8b27f225 PB |
4845 | \f |
4846 | yyvsp -= yylen; | |
4847 | yyssp -= yylen; | |
4848 | #ifdef YYLSP_NEEDED | |
4849 | yylsp -= yylen; | |
4850 | #endif | |
4851 | ||
4852 | #if YYDEBUG != 0 | |
4853 | if (yydebug) | |
4854 | { | |
4855 | short *ssp1 = yyss - 1; | |
4856 | fprintf (stderr, "state stack now"); | |
4857 | while (ssp1 != yyssp) | |
4858 | fprintf (stderr, " %d", *++ssp1); | |
4859 | fprintf (stderr, "\n"); | |
4860 | } | |
4861 | #endif | |
4862 | ||
4863 | *++yyvsp = yyval; | |
4864 | ||
4865 | #ifdef YYLSP_NEEDED | |
4866 | yylsp++; | |
4867 | if (yylen == 0) | |
4868 | { | |
4869 | yylsp->first_line = yylloc.first_line; | |
4870 | yylsp->first_column = yylloc.first_column; | |
4871 | yylsp->last_line = (yylsp-1)->last_line; | |
4872 | yylsp->last_column = (yylsp-1)->last_column; | |
4873 | yylsp->text = 0; | |
4874 | } | |
4875 | else | |
4876 | { | |
4877 | yylsp->last_line = (yylsp+yylen-1)->last_line; | |
4878 | yylsp->last_column = (yylsp+yylen-1)->last_column; | |
4879 | } | |
4880 | #endif | |
4881 | ||
4882 | /* Now "shift" the result of the reduction. | |
4883 | Determine what state that goes to, | |
4884 | based on the state we popped back to | |
4885 | and the rule number reduced by. */ | |
4886 | ||
4887 | yyn = yyr1[yyn]; | |
4888 | ||
4889 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
4890 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
4891 | yystate = yytable[yystate]; | |
4892 | else | |
4893 | yystate = yydefgoto[yyn - YYNTBASE]; | |
4894 | ||
4895 | goto yynewstate; | |
4896 | ||
4897 | yyerrlab: /* here on detecting error */ | |
4898 | ||
4899 | if (! yyerrstatus) | |
4900 | /* If not already recovering from an error, report this error. */ | |
4901 | { | |
4902 | ++yynerrs; | |
4903 | ||
4904 | #ifdef YYERROR_VERBOSE | |
4905 | yyn = yypact[yystate]; | |
4906 | ||
4907 | if (yyn > YYFLAG && yyn < YYLAST) | |
4908 | { | |
4909 | int size = 0; | |
4910 | char *msg; | |
4911 | int x, count; | |
4912 | ||
4913 | count = 0; | |
4914 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | |
4915 | for (x = (yyn < 0 ? -yyn : 0); | |
4916 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
4917 | if (yycheck[x + yyn] == x) | |
4918 | size += strlen(yytname[x]) + 15, count++; | |
4919 | msg = (char *) malloc(size + 15); | |
4920 | if (msg != 0) | |
4921 | { | |
4922 | strcpy(msg, "parse error"); | |
4923 | ||
4924 | if (count < 5) | |
4925 | { | |
4926 | count = 0; | |
4927 | for (x = (yyn < 0 ? -yyn : 0); | |
4928 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
4929 | if (yycheck[x + yyn] == x) | |
4930 | { | |
4931 | strcat(msg, count == 0 ? ", expecting `" : " or `"); | |
4932 | strcat(msg, yytname[x]); | |
4933 | strcat(msg, "'"); | |
4934 | count++; | |
4935 | } | |
4936 | } | |
4937 | yyerror(msg); | |
4938 | free(msg); | |
4939 | } | |
4940 | else | |
4941 | yyerror ("parse error; also virtual memory exceeded"); | |
4942 | } | |
4943 | else | |
4944 | #endif /* YYERROR_VERBOSE */ | |
4945 | yyerror("parse error"); | |
4946 | } | |
4947 | ||
4948 | goto yyerrlab1; | |
4949 | yyerrlab1: /* here on error raised explicitly by an action */ | |
4950 | ||
4951 | if (yyerrstatus == 3) | |
4952 | { | |
4953 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ | |
4954 | ||
4955 | /* return failure if at end of input */ | |
4956 | if (yychar == YYEOF) | |
4957 | YYABORT; | |
4958 | ||
4959 | #if YYDEBUG != 0 | |
4960 | if (yydebug) | |
4961 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); | |
4962 | #endif | |
4963 | ||
4964 | yychar = YYEMPTY; | |
4965 | } | |
4966 | ||
4967 | /* Else will try to reuse lookahead token | |
4968 | after shifting the error token. */ | |
4969 | ||
4970 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
4971 | ||
4972 | goto yyerrhandle; | |
4973 | ||
4974 | yyerrdefault: /* current state does not do anything special for the error token. */ | |
4975 | ||
4976 | #if 0 | |
4977 | /* This is wrong; only states that explicitly want error tokens | |
4978 | should shift them. */ | |
4979 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ | |
4980 | if (yyn) goto yydefault; | |
4981 | #endif | |
4982 | ||
4983 | yyerrpop: /* pop the current state because it cannot handle the error token */ | |
4984 | ||
4985 | if (yyssp == yyss) YYABORT; | |
4986 | yyvsp--; | |
4987 | yystate = *--yyssp; | |
4988 | #ifdef YYLSP_NEEDED | |
4989 | yylsp--; | |
4990 | #endif | |
4991 | ||
4992 | #if YYDEBUG != 0 | |
4993 | if (yydebug) | |
4994 | { | |
4995 | short *ssp1 = yyss - 1; | |
4996 | fprintf (stderr, "Error: state stack now"); | |
4997 | while (ssp1 != yyssp) | |
4998 | fprintf (stderr, " %d", *++ssp1); | |
4999 | fprintf (stderr, "\n"); | |
5000 | } | |
5001 | #endif | |
5002 | ||
5003 | yyerrhandle: | |
5004 | ||
5005 | yyn = yypact[yystate]; | |
5006 | if (yyn == YYFLAG) | |
5007 | goto yyerrdefault; | |
5008 | ||
5009 | yyn += YYTERROR; | |
5010 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
5011 | goto yyerrdefault; | |
5012 | ||
5013 | yyn = yytable[yyn]; | |
5014 | if (yyn < 0) | |
5015 | { | |
5016 | if (yyn == YYFLAG) | |
5017 | goto yyerrpop; | |
5018 | yyn = -yyn; | |
5019 | goto yyreduce; | |
5020 | } | |
5021 | else if (yyn == 0) | |
5022 | goto yyerrpop; | |
5023 | ||
5024 | if (yyn == YYFINAL) | |
5025 | YYACCEPT; | |
5026 | ||
5027 | #if YYDEBUG != 0 | |
5028 | if (yydebug) | |
5029 | fprintf(stderr, "Shifting error token, "); | |
5030 | #endif | |
5031 | ||
5032 | *++yyvsp = yylval; | |
5033 | #ifdef YYLSP_NEEDED | |
5034 | *++yylsp = yylloc; | |
5035 | #endif | |
5036 | ||
5037 | yystate = yyn; | |
5038 | goto yynewstate; | |
518f173d APB |
5039 | |
5040 | yyacceptlab: | |
5041 | /* YYACCEPT comes here. */ | |
5042 | if (yyfree_stacks) | |
5043 | { | |
5044 | free (yyss); | |
5045 | free (yyvs); | |
5046 | #ifdef YYLSP_NEEDED | |
5047 | free (yyls); | |
5048 | #endif | |
5049 | } | |
5050 | return 0; | |
5051 | ||
5052 | yyabortlab: | |
5053 | /* YYABORT comes here. */ | |
5054 | if (yyfree_stacks) | |
5055 | { | |
5056 | free (yyss); | |
5057 | free (yyvs); | |
5058 | #ifdef YYLSP_NEEDED | |
5059 | free (yyls); | |
5060 | #endif | |
5061 | } | |
5062 | return 1; | |
8b27f225 | 5063 | } |
f8989a66 | 5064 | #line 2375 "./parse.y" |
8b27f225 PB |
5065 | |
5066 | \f | |
5067 | ||
8b27f225 PB |
5068 | /* Flag for the error report routine to issue the error the first time |
5069 | it's called (overriding the default behavior which is to drop the | |
5070 | first invocation and honor the second one, taking advantage of a | |
5071 | richer context. */ | |
5072 | static int force_error = 0; | |
5073 | ||
5074 | /* Create a new parser context and make it the current one. */ | |
5075 | ||
5076 | void | |
5077 | java_push_parser_context () | |
5078 | { | |
5079 | struct parser_ctxt *new = | |
23a79c61 | 5080 | (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt)); |
8b27f225 | 5081 | |
4504ead1 | 5082 | bzero ((PTR) new, sizeof (struct parser_ctxt)); |
8b27f225 PB |
5083 | new->next = ctxp; |
5084 | ctxp = new; | |
5085 | if (ctxp->next) | |
5e942c50 APB |
5086 | { |
5087 | ctxp->incomplete_class = ctxp->next->incomplete_class; | |
5088 | ctxp->gclass_list = ctxp->next->gclass_list; | |
5089 | } | |
8b27f225 PB |
5090 | } |
5091 | ||
5092 | void | |
5093 | java_parser_context_save_global () | |
5094 | { | |
22eed1e6 APB |
5095 | if (!ctxp) |
5096 | { | |
5097 | java_push_parser_context (); | |
ee07f4f4 APB |
5098 | ctxp->saved_data_ctx = 1; |
5099 | } | |
5100 | else if (ctxp->saved_data) | |
5101 | { | |
5102 | struct parser_ctxt *new = | |
5103 | (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt)); | |
5104 | bzero ((PTR)new, sizeof (struct parser_ctxt)); | |
5105 | memcpy ((PTR)new, (PTR)ctxp, sizeof (struct parser_ctxt)); | |
5106 | new->next = ctxp; | |
5107 | ctxp = new; | |
5108 | ctxp->saved_data_ctx = 1; | |
22eed1e6 | 5109 | } |
8b27f225 PB |
5110 | ctxp->finput = finput; |
5111 | ctxp->lineno = lineno; | |
5112 | ctxp->current_class = current_class; | |
5113 | ctxp->filename = input_filename; | |
5114 | ctxp->current_function_decl = current_function_decl; | |
ee07f4f4 | 5115 | ctxp->saved_data = 1; |
8b27f225 PB |
5116 | } |
5117 | ||
5118 | void | |
5119 | java_parser_context_restore_global () | |
5120 | { | |
5121 | finput = ctxp->finput; | |
5122 | lineno = ctxp->lineno; | |
5123 | current_class = ctxp->current_class; | |
5124 | input_filename = ctxp->filename; | |
ee07f4f4 | 5125 | ctxp->saved_data = 0; |
8b27f225 | 5126 | current_function_decl = ctxp->current_function_decl; |
ee07f4f4 APB |
5127 | if (ctxp->saved_data_ctx) |
5128 | java_pop_parser_context (0); | |
8b27f225 PB |
5129 | } |
5130 | ||
5131 | void | |
b351b287 APB |
5132 | java_pop_parser_context (generate) |
5133 | int generate; | |
8b27f225 PB |
5134 | { |
5135 | tree current; | |
5e942c50 | 5136 | struct parser_ctxt *toFree, *next; |
8b27f225 | 5137 | |
5e942c50 APB |
5138 | if (!ctxp) |
5139 | return; | |
5140 | ||
5141 | toFree = ctxp; | |
5142 | next = ctxp->next; | |
8b27f225 PB |
5143 | if (next) |
5144 | { | |
5145 | next->incomplete_class = ctxp->incomplete_class; | |
5e942c50 | 5146 | next->gclass_list = ctxp->gclass_list; |
8b27f225 PB |
5147 | lineno = ctxp->lineno; |
5148 | finput = ctxp->finput; | |
5149 | current_class = ctxp->current_class; | |
5150 | } | |
5151 | ||
5152 | /* Set the single import class file flag to 0 for the current list | |
5153 | of imported things */ | |
5154 | for (current = ctxp->import_list; current; current = TREE_CHAIN (current)) | |
5155 | IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 0; | |
5156 | ||
5157 | /* And restore those of the previous context */ | |
5158 | if ((ctxp = next)) /* Assignment is really meant here */ | |
5159 | for (current = ctxp->import_list; current; current = TREE_CHAIN (current)) | |
5160 | IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1; | |
5161 | ||
b351b287 APB |
5162 | if (generate) |
5163 | { | |
5164 | toFree->next = ctxp_for_generation; | |
5165 | ctxp_for_generation = toFree; | |
5166 | } | |
5167 | else | |
5168 | free (toFree); | |
8b27f225 PB |
5169 | } |
5170 | ||
ee07f4f4 APB |
5171 | /* Dump the stacked up parser contexts. Intended to be called from a |
5172 | debugger. */ | |
5173 | ||
5174 | static void | |
5175 | java_debug_context_do (tab) | |
5176 | int tab; | |
5177 | { | |
5178 | #define JAVA_TAB_CONTEXT(C) \ | |
5179 | {int i; for (i = 0; i < (C); i++) fputc (' ', stderr);} | |
5180 | ||
5181 | struct parser_ctxt *copy = ctxp; | |
5182 | while (copy) | |
5183 | { | |
5184 | JAVA_TAB_CONTEXT (tab); | |
5185 | fprintf (stderr, "ctxt: 0x%0lX\n", (unsigned long)copy); | |
5186 | JAVA_TAB_CONTEXT (tab); | |
5187 | fprintf (stderr, "filename: %s\n", copy->filename); | |
5188 | JAVA_TAB_CONTEXT (tab); | |
5189 | fprintf (stderr, "package: %s\n", | |
5190 | (copy->package ? | |
5191 | IDENTIFIER_POINTER (copy->package) : "<none>")); | |
5192 | JAVA_TAB_CONTEXT (tab); | |
5193 | fprintf (stderr, "context for saving: %d\n", copy->saved_data_ctx); | |
5194 | JAVA_TAB_CONTEXT (tab); | |
5195 | fprintf (stderr, "saved data: %d\n", copy->saved_data); | |
5196 | copy = copy->next; | |
5197 | tab += 2; | |
5198 | } | |
5199 | #undef JAVA_TAB_CONTEXT | |
5200 | } | |
5201 | ||
5202 | void | |
5203 | java_debug_context () | |
5204 | { | |
5205 | java_debug_context_do (0); | |
5206 | } | |
5207 | ||
5208 | ||
8119c720 APB |
5209 | /* Reporting an constructor invocation error. */ |
5210 | static void | |
5211 | parse_ctor_invocation_error () | |
5212 | { | |
5213 | if (DECL_CONSTRUCTOR_P (current_function_decl)) | |
5214 | yyerror ("Constructor invocation must be first thing in a constructor"); | |
5215 | else | |
5216 | yyerror ("Only constructors can invoke constructors"); | |
5217 | } | |
5218 | ||
5219 | /* Reporting JDK1.1 features not implemented. */ | |
8b27f225 PB |
5220 | |
5221 | static tree | |
5222 | parse_jdk1_1_error (msg) | |
49f48c71 | 5223 | const char *msg; |
8b27f225 PB |
5224 | { |
5225 | sorry (": `%s' JDK1.1(TM) feature", msg); | |
5226 | java_error_count++; | |
c877974e | 5227 | return empty_stmt_node; |
8b27f225 PB |
5228 | } |
5229 | ||
5230 | static int do_warning = 0; | |
5231 | ||
5232 | void | |
5233 | yyerror (msg) | |
49f48c71 | 5234 | const char *msg; |
8b27f225 PB |
5235 | { |
5236 | static java_lc elc; | |
5237 | static int prev_lineno; | |
49f48c71 | 5238 | static const char *prev_msg; |
8b27f225 PB |
5239 | |
5240 | int save_lineno; | |
5241 | char *remainder, *code_from_source; | |
5242 | extern struct obstack temporary_obstack; | |
5243 | ||
5244 | if (!force_error && prev_lineno == lineno) | |
5245 | return; | |
5246 | ||
5247 | /* Save current error location but report latter, when the context is | |
5248 | richer. */ | |
5249 | if (ctxp->java_error_flag == 0) | |
5250 | { | |
5251 | ctxp->java_error_flag = 1; | |
5252 | elc = ctxp->elc; | |
5253 | /* Do something to use the previous line if we're reaching the | |
5254 | end of the file... */ | |
5255 | #ifdef VERBOSE_SKELETON | |
5256 | printf ("* Error detected (%s)\n", (msg ? msg : "(null)")); | |
5257 | #endif | |
5258 | return; | |
5259 | } | |
5260 | ||
5261 | /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */ | |
5262 | if (!force_error && msg == prev_msg && prev_lineno == elc.line) | |
5263 | return; | |
5264 | ||
5265 | ctxp->java_error_flag = 0; | |
5266 | if (do_warning) | |
5267 | java_warning_count++; | |
5268 | else | |
5269 | java_error_count++; | |
5270 | ||
5271 | if (elc.col == 0 && msg[1] == ';') | |
5272 | { | |
5273 | elc.col = ctxp->p_line->char_col-1; | |
5274 | elc.line = ctxp->p_line->lineno; | |
5275 | } | |
5276 | ||
5277 | save_lineno = lineno; | |
5278 | prev_lineno = lineno = elc.line; | |
5279 | prev_msg = msg; | |
5280 | ||
5281 | code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col); | |
5282 | obstack_grow0 (&temporary_obstack, | |
5283 | code_from_source, strlen (code_from_source)); | |
5284 | remainder = obstack_finish (&temporary_obstack); | |
5285 | if (do_warning) | |
5286 | warning ("%s.\n%s", msg, remainder); | |
5287 | else | |
5288 | error ("%s.\n%s", msg, remainder); | |
5289 | ||
5290 | /* This allow us to cheaply avoid an extra 'Invalid expression | |
5291 | statement' error report when errors have been already reported on | |
5292 | the same line. This occurs when we report an error but don't have | |
5293 | a synchronization point other than ';', which | |
5294 | expression_statement is the only one to take care of. */ | |
5295 | ctxp->prevent_ese = lineno = save_lineno; | |
5296 | } | |
5297 | ||
5298 | static void | |
12472854 | 5299 | issue_warning_error_from_context (cl, msg, ap) |
5e942c50 | 5300 | tree cl; |
d4476be2 | 5301 | const char *msg; |
12472854 | 5302 | va_list ap; |
5e942c50 | 5303 | { |
1886c9d8 | 5304 | char *saved, *saved_input_filename; |
12472854 PB |
5305 | char buffer [4096]; |
5306 | vsprintf (buffer, msg, ap); | |
5307 | force_error = 1; | |
5e942c50 APB |
5308 | |
5309 | ctxp->elc.line = EXPR_WFL_LINENO (cl); | |
82371d41 APB |
5310 | ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 : |
5311 | (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl))); | |
5e942c50 APB |
5312 | |
5313 | /* We have a CL, that's a good reason for using it if it contains data */ | |
5314 | saved = ctxp->filename; | |
5315 | if (TREE_CODE (cl) == EXPR_WITH_FILE_LOCATION && EXPR_WFL_FILENAME_NODE (cl)) | |
5316 | ctxp->filename = EXPR_WFL_FILENAME (cl); | |
1886c9d8 APB |
5317 | saved_input_filename = input_filename; |
5318 | input_filename = ctxp->filename; | |
12472854 PB |
5319 | java_error (NULL); |
5320 | java_error (buffer); | |
5e942c50 | 5321 | ctxp->filename = saved; |
1886c9d8 | 5322 | input_filename = saved_input_filename; |
12472854 | 5323 | force_error = 0; |
5e942c50 APB |
5324 | } |
5325 | ||
8b27f225 PB |
5326 | /* Issue an error message at a current source line CL */ |
5327 | ||
12472854 | 5328 | void |
df32d2ce | 5329 | parse_error_context VPARAMS ((tree cl, const char *msg, ...)) |
8b27f225 | 5330 | { |
d4476be2 | 5331 | #ifndef ANSI_PROTOTYPES |
8b27f225 | 5332 | tree cl; |
d4476be2 | 5333 | const char *msg; |
8b27f225 | 5334 | #endif |
8b27f225 PB |
5335 | va_list ap; |
5336 | ||
5337 | VA_START (ap, msg); | |
d4476be2 | 5338 | #ifndef ANSI_PROTOTYPES |
8b27f225 | 5339 | cl = va_arg (ap, tree); |
d4476be2 | 5340 | msg = va_arg (ap, const char *); |
8b27f225 | 5341 | #endif |
12472854 PB |
5342 | issue_warning_error_from_context (cl, msg, ap); |
5343 | va_end (ap); | |
8b27f225 PB |
5344 | } |
5345 | ||
5346 | /* Issue a warning at a current source line CL */ | |
5347 | ||
5348 | static void | |
df32d2ce | 5349 | parse_warning_context VPARAMS ((tree cl, const char *msg, ...)) |
8b27f225 | 5350 | { |
d4476be2 | 5351 | #ifndef ANSI_PROTOTYPES |
8b27f225 | 5352 | tree cl; |
d4476be2 | 5353 | const char *msg; |
8b27f225 | 5354 | #endif |
8b27f225 PB |
5355 | va_list ap; |
5356 | ||
5357 | VA_START (ap, msg); | |
d4476be2 | 5358 | #ifndef ANSI_PROTOTYPES |
8b27f225 | 5359 | cl = va_arg (ap, tree); |
d4476be2 | 5360 | msg = va_arg (ap, const char *); |
8b27f225 | 5361 | #endif |
8b27f225 | 5362 | |
c877974e | 5363 | force_error = do_warning = 1; |
12472854 | 5364 | issue_warning_error_from_context (cl, msg, ap); |
c877974e | 5365 | do_warning = force_error = 0; |
12472854 | 5366 | va_end (ap); |
8b27f225 PB |
5367 | } |
5368 | ||
82371d41 APB |
5369 | static tree |
5370 | find_expr_with_wfl (node) | |
5371 | tree node; | |
5372 | { | |
5373 | while (node) | |
5374 | { | |
5375 | char code; | |
5376 | tree to_return; | |
5377 | ||
5378 | switch (TREE_CODE (node)) | |
5379 | { | |
5380 | case BLOCK: | |
c0d87ff6 PB |
5381 | node = BLOCK_EXPR_BODY (node); |
5382 | continue; | |
82371d41 APB |
5383 | |
5384 | case COMPOUND_EXPR: | |
5385 | to_return = find_expr_with_wfl (TREE_OPERAND (node, 0)); | |
5386 | if (to_return) | |
5387 | return to_return; | |
c0d87ff6 PB |
5388 | node = TREE_OPERAND (node, 1); |
5389 | continue; | |
82371d41 APB |
5390 | |
5391 | case LOOP_EXPR: | |
c0d87ff6 PB |
5392 | node = TREE_OPERAND (node, 0); |
5393 | continue; | |
82371d41 APB |
5394 | |
5395 | case LABELED_BLOCK_EXPR: | |
c0d87ff6 PB |
5396 | node = TREE_OPERAND (node, 1); |
5397 | continue; | |
5398 | ||
82371d41 APB |
5399 | default: |
5400 | code = TREE_CODE_CLASS (TREE_CODE (node)); | |
5401 | if (((code == '1') || (code == '2') || (code == 'e')) | |
5402 | && EXPR_WFL_LINECOL (node)) | |
5403 | return node; | |
ba179f9f | 5404 | return NULL_TREE; |
82371d41 APB |
5405 | } |
5406 | } | |
5407 | return NULL_TREE; | |
5408 | } | |
5409 | ||
5410 | /* Issue a missing return statement error. Uses METHOD to figure the | |
5411 | last line of the method the error occurs in. */ | |
5412 | ||
5413 | static void | |
5414 | missing_return_error (method) | |
5415 | tree method; | |
5416 | { | |
5417 | EXPR_WFL_SET_LINECOL (wfl_operator, DECL_SOURCE_LINE_LAST (method), -2); | |
5418 | parse_error_context (wfl_operator, "Missing return statement"); | |
5419 | } | |
5420 | ||
5421 | /* Issue an unreachable statement error. From NODE, find the next | |
5422 | statement to report appropriately. */ | |
5423 | static void | |
5424 | unreachable_stmt_error (node) | |
5425 | tree node; | |
5426 | { | |
5427 | /* Browse node to find the next expression node that has a WFL. Use | |
5428 | the location to report the error */ | |
5429 | if (TREE_CODE (node) == COMPOUND_EXPR) | |
5430 | node = find_expr_with_wfl (TREE_OPERAND (node, 1)); | |
5431 | else | |
5432 | node = find_expr_with_wfl (node); | |
5433 | ||
5434 | if (node) | |
5435 | { | |
5436 | EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2); | |
5437 | parse_error_context (wfl_operator, "Unreachable statement"); | |
5438 | } | |
5439 | else | |
5440 | fatal ("Can't get valid statement - unreachable_stmt_error"); | |
5441 | } | |
5442 | ||
c877974e | 5443 | int |
8b27f225 PB |
5444 | java_report_errors () |
5445 | { | |
5446 | if (java_error_count) | |
5447 | fprintf (stderr, "%d error%s", | |
5448 | java_error_count, (java_error_count == 1 ? "" : "s")); | |
5449 | if (java_warning_count) | |
5450 | fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""), | |
5451 | java_warning_count, (java_warning_count == 1 ? "" : "s")); | |
5452 | if (java_error_count || java_warning_count) | |
5453 | putc ('\n', stderr); | |
c877974e | 5454 | return java_error_count; |
8b27f225 PB |
5455 | } |
5456 | ||
5457 | static char * | |
5458 | java_accstring_lookup (flags) | |
5459 | int flags; | |
5460 | { | |
5461 | static char buffer [80]; | |
5462 | #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;} | |
5463 | ||
5464 | /* Access modifier looked-up first for easier report on forbidden | |
5465 | access. */ | |
5466 | if (flags & ACC_PUBLIC) COPY_RETURN ("public"); | |
5467 | if (flags & ACC_PRIVATE) COPY_RETURN ("private"); | |
5468 | if (flags & ACC_PROTECTED) COPY_RETURN ("protected"); | |
5469 | if (flags & ACC_STATIC) COPY_RETURN ("static"); | |
5470 | if (flags & ACC_FINAL) COPY_RETURN ("final"); | |
5471 | if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized"); | |
5472 | if (flags & ACC_VOLATILE) COPY_RETURN ("volatile"); | |
5473 | if (flags & ACC_TRANSIENT) COPY_RETURN ("transient"); | |
5474 | if (flags & ACC_NATIVE) COPY_RETURN ("native"); | |
5475 | if (flags & ACC_INTERFACE) COPY_RETURN ("interface"); | |
5476 | if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract"); | |
5477 | ||
5478 | buffer [0] = '\0'; | |
5479 | return buffer; | |
5480 | #undef COPY_RETURN | |
5481 | } | |
5482 | ||
5483 | /* Issuing error messages upon redefinition of classes, interfaces or | |
5484 | variables. */ | |
5485 | ||
5486 | static void | |
5487 | classitf_redefinition_error (context, id, decl, cl) | |
49f48c71 | 5488 | const char *context; |
8b27f225 PB |
5489 | tree id, decl, cl; |
5490 | { | |
5491 | parse_error_context (cl, "%s `%s' already defined in %s:%d", | |
5492 | context, IDENTIFIER_POINTER (id), | |
5493 | DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); | |
5494 | /* Here we should point out where its redefined. It's a unicode. FIXME */ | |
5495 | } | |
5496 | ||
5497 | static void | |
5498 | variable_redefinition_error (context, name, type, line) | |
5499 | tree context, name, type; | |
5500 | int line; | |
5501 | { | |
49f48c71 | 5502 | const char *type_name; |
8b27f225 PB |
5503 | |
5504 | /* Figure a proper name for type. We might haven't resolved it */ | |
c877974e APB |
5505 | if (TREE_CODE (type) == POINTER_TYPE && !TREE_TYPE (type)) |
5506 | type_name = IDENTIFIER_POINTER (TYPE_NAME (type)); | |
8b27f225 PB |
5507 | else |
5508 | type_name = lang_printable_name (type, 0); | |
5509 | ||
5510 | parse_error_context (context, | |
781b0558 | 5511 | "Variable `%s' is already defined in this method and was declared `%s %s' at line %d", |
8b27f225 PB |
5512 | IDENTIFIER_POINTER (name), |
5513 | type_name, IDENTIFIER_POINTER (name), line); | |
5514 | } | |
5515 | ||
5516 | static tree | |
5517 | build_array_from_name (type, type_wfl, name, ret_name) | |
5518 | tree type, type_wfl, name, *ret_name; | |
5519 | { | |
5520 | int more_dims = 0; | |
49f48c71 | 5521 | const char *string; |
8b27f225 PB |
5522 | |
5523 | /* Eventually get more dims */ | |
5524 | string = IDENTIFIER_POINTER (name); | |
5525 | while (string [more_dims] == '[') | |
5526 | more_dims++; | |
5527 | ||
5528 | /* If we have, then craft a new type for this variable */ | |
5529 | if (more_dims) | |
5530 | { | |
c0d87ff6 | 5531 | name = get_identifier (&string [more_dims]); |
8b27f225 | 5532 | |
34f4db93 APB |
5533 | /* If we have a pointer, use its type */ |
5534 | if (TREE_CODE (type) == POINTER_TYPE) | |
5535 | type = TREE_TYPE (type); | |
8b27f225 PB |
5536 | |
5537 | /* Building the first dimension of a primitive type uses this | |
5538 | function */ | |
5539 | if (JPRIMITIVE_TYPE_P (type)) | |
5540 | { | |
5541 | type = build_java_array_type (type, -1); | |
22eed1e6 | 5542 | CLASS_LOADED_P (type) = 1; |
8b27f225 PB |
5543 | more_dims--; |
5544 | } | |
5545 | /* Otherwise, if we have a WFL for this type, use it (the type | |
5546 | is already an array on an unresolved type, and we just keep | |
5547 | on adding dimensions) */ | |
5548 | else if (type_wfl) | |
5549 | type = type_wfl; | |
5550 | ||
5551 | /* Add all the dimensions */ | |
5552 | while (more_dims--) | |
5553 | type = build_unresolved_array_type (type); | |
5554 | ||
5555 | /* The type may have been incomplete in the first place */ | |
5556 | if (type_wfl) | |
5557 | type = obtain_incomplete_type (type); | |
5558 | } | |
5559 | ||
5560 | *ret_name = name; | |
5561 | return type; | |
5562 | } | |
5563 | ||
5564 | /* Build something that the type identifier resolver will identify as | |
5565 | being an array to an unresolved type. TYPE_WFL is a WFL on a | |
5566 | identifier. */ | |
5567 | ||
5568 | static tree | |
5569 | build_unresolved_array_type (type_or_wfl) | |
5570 | tree type_or_wfl; | |
5571 | { | |
49f48c71 | 5572 | const char *ptr; |
8b27f225 | 5573 | |
1886c9d8 | 5574 | /* TYPE_OR_WFL might be an array on a resolved type. In this case, |
8b27f225 PB |
5575 | just create a array type */ |
5576 | if (TREE_CODE (type_or_wfl) == RECORD_TYPE) | |
5577 | { | |
5578 | tree type = build_java_array_type (type_or_wfl, -1); | |
5579 | CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl); | |
5580 | return type; | |
5581 | } | |
5582 | ||
5583 | obstack_1grow (&temporary_obstack, '['); | |
5584 | obstack_grow0 (&temporary_obstack, | |
5585 | IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)), | |
5586 | IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl))); | |
5587 | ptr = obstack_finish (&temporary_obstack); | |
5588 | return build_expr_wfl (get_identifier (ptr), | |
5589 | EXPR_WFL_FILENAME (type_or_wfl), | |
5590 | EXPR_WFL_LINENO (type_or_wfl), | |
5591 | EXPR_WFL_COLNO (type_or_wfl)); | |
5592 | } | |
5593 | ||
8b27f225 PB |
5594 | static void |
5595 | parser_add_interface (class_decl, interface_decl, wfl) | |
5596 | tree class_decl, interface_decl, wfl; | |
5597 | { | |
5598 | if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl))) | |
5599 | parse_error_context (wfl, "Interface `%s' repeated", | |
5600 | IDENTIFIER_POINTER (DECL_NAME (interface_decl))); | |
5601 | } | |
5602 | ||
5603 | /* Bulk of common class/interface checks. Return 1 if an error was | |
5604 | encountered. TAG is 0 for a class, 1 for an interface. */ | |
5605 | ||
5606 | static int | |
5607 | check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl) | |
5608 | int is_interface, flags; | |
5609 | tree raw_name, qualified_name, decl, cl; | |
5610 | { | |
5611 | tree node; | |
5612 | ||
5613 | if (!quiet_flag) | |
5614 | fprintf (stderr, " %s %s", (is_interface ? "interface" : "class"), | |
5615 | IDENTIFIER_POINTER (qualified_name)); | |
5616 | ||
5617 | /* Scope of an interface/class type name: | |
5618 | - Can't be imported by a single type import | |
5619 | - Can't already exists in the package */ | |
5620 | if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name) | |
5621 | && (node = find_name_in_single_imports (raw_name))) | |
5622 | { | |
5623 | parse_error_context | |
5624 | (cl, "%s name `%s' clashes with imported type `%s'", | |
5625 | (is_interface ? "Interface" : "Class"), | |
5626 | IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node)); | |
5627 | return 1; | |
5628 | } | |
5629 | if (decl && CLASS_COMPLETE_P (decl)) | |
5630 | { | |
5631 | classitf_redefinition_error ((is_interface ? "Interface" : "Class"), | |
5632 | qualified_name, decl, cl); | |
5633 | return 1; | |
5634 | } | |
5635 | ||
5636 | /* If public, file name should match class/interface name */ | |
5637 | if (flags & ACC_PUBLIC) | |
5638 | { | |
49f48c71 | 5639 | const char *f; |
8b27f225 PB |
5640 | |
5641 | /* Contains OS dependent assumption on path separator. FIXME */ | |
5642 | for (f = &input_filename [strlen (input_filename)]; | |
fa322ab5 TT |
5643 | f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR; |
5644 | f--) | |
5645 | ; | |
847fe791 | 5646 | if (f[0] == '/' || f[0] == DIR_SEPARATOR) |
8b27f225 PB |
5647 | f++; |
5648 | if (strncmp (IDENTIFIER_POINTER (raw_name), | |
5649 | f , IDENTIFIER_LENGTH (raw_name)) || | |
5650 | f [IDENTIFIER_LENGTH (raw_name)] != '.') | |
781b0558 KG |
5651 | parse_error_context |
5652 | (cl, "Public %s `%s' must be defined in a file called `%s.java'", | |
8b27f225 PB |
5653 | (is_interface ? "interface" : "class"), |
5654 | IDENTIFIER_POINTER (qualified_name), | |
5655 | IDENTIFIER_POINTER (raw_name)); | |
5656 | } | |
5657 | ||
2884c41e KG |
5658 | if (is_interface) |
5659 | check_modifiers ("Illegal modifier `%s' for interface declaration", | |
5660 | flags, INTERFACE_MODIFIERS); | |
5661 | else | |
5662 | check_modifiers ("Illegal modifier `%s' for class declaration", | |
5663 | flags, CLASS_MODIFIERS); | |
8b27f225 PB |
5664 | return 0; |
5665 | } | |
5666 | ||
5667 | /* If DECL is NULL, create and push a new DECL, record the current | |
5668 | line CL and do other maintenance things. */ | |
5669 | ||
5670 | static tree | |
5671 | maybe_create_class_interface_decl (decl, qualified_name, cl) | |
5672 | tree decl, qualified_name, cl; | |
5673 | { | |
5e942c50 | 5674 | if (!decl) |
8b27f225 PB |
5675 | decl = push_class (make_class (), qualified_name); |
5676 | ||
5677 | /* Take care of the file and line business */ | |
5678 | DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl); | |
f099f336 APB |
5679 | /* If we're emiting xrefs, store the line/col number information */ |
5680 | if (flag_emit_xref) | |
5681 | DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (cl); | |
5682 | else | |
5683 | DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl); | |
8b27f225 | 5684 | CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1; |
b351b287 APB |
5685 | CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl)) = |
5686 | IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl)); | |
8b27f225 PB |
5687 | |
5688 | ctxp->current_parsed_class = decl; | |
5689 | ||
5690 | /* Link the declaration to the already seen ones */ | |
5691 | TREE_CHAIN (decl) = ctxp->class_list; | |
5692 | ctxp->class_list = decl; | |
5e942c50 | 5693 | |
23a79c61 | 5694 | /* Create a new nodes in the global lists */ |
5e942c50 | 5695 | ctxp->gclass_list = tree_cons (NULL_TREE, decl, ctxp->gclass_list); |
23a79c61 | 5696 | all_class_list = tree_cons (NULL_TREE, decl, all_class_list); |
5e942c50 | 5697 | |
8b27f225 PB |
5698 | /* Install a new dependency list element */ |
5699 | create_jdep_list (ctxp); | |
5700 | ||
5701 | SOURCE_FRONTEND_DEBUG (("Defining class/interface %s", | |
5702 | IDENTIFIER_POINTER (qualified_name))); | |
5703 | return decl; | |
5704 | } | |
5705 | ||
5706 | static void | |
5707 | add_superinterfaces (decl, interface_list) | |
5708 | tree decl, interface_list; | |
5709 | { | |
5710 | tree node; | |
5711 | /* Superinterface(s): if present and defined, parser_check_super_interface () | |
5712 | takes care of ensuring that: | |
5713 | - This is an accessible interface type, | |
5714 | - Circularity detection. | |
5715 | parser_add_interface is then called. If present but not defined, | |
5716 | the check operation is delayed until the super interface gets | |
5717 | defined. */ | |
5718 | for (node = interface_list; node; node = TREE_CHAIN (node)) | |
5719 | { | |
5e942c50 APB |
5720 | tree current = TREE_PURPOSE (node); |
5721 | tree idecl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current)); | |
5722 | if (idecl && CLASS_LOADED_P (TREE_TYPE (idecl))) | |
8b27f225 | 5723 | { |
5e942c50 APB |
5724 | if (!parser_check_super_interface (idecl, decl, current)) |
5725 | parser_add_interface (decl, idecl, current); | |
8b27f225 PB |
5726 | } |
5727 | else | |
5728 | register_incomplete_type (JDEP_INTERFACE, | |
5729 | current, decl, NULL_TREE); | |
5730 | } | |
5731 | } | |
5732 | ||
5733 | /* Create an interface in pass1 and return its decl. Return the | |
5734 | interface's decl in pass 2. */ | |
5735 | ||
5736 | static tree | |
5737 | create_interface (flags, id, super) | |
5738 | int flags; | |
5739 | tree id, super; | |
5740 | { | |
5741 | tree raw_name = EXPR_WFL_NODE (id); | |
5742 | tree q_name = parser_qualified_classname (id); | |
5743 | tree decl = IDENTIFIER_CLASS_VALUE (q_name); | |
5744 | ||
5745 | EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */ | |
5746 | ||
5747 | /* Basic checks: scope, redefinition, modifiers */ | |
5748 | if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id)) | |
5749 | return NULL_TREE; | |
5750 | ||
5751 | /* Interface modifiers check | |
5752 | - public/abstract allowed (already done at that point) | |
5753 | - abstract is obsolete (comes first, it's a warning, or should be) | |
5754 | - Can't use twice the same (checked in the modifier rule) */ | |
c877974e | 5755 | if ((flags & ACC_ABSTRACT) && flag_redundant) |
8b27f225 PB |
5756 | parse_warning_context |
5757 | (MODIFIER_WFL (ABSTRACT_TK), | |
781b0558 | 5758 | "Redundant use of `abstract' modifier. Interface `%s' is implicitely abstract", IDENTIFIER_POINTER (raw_name)); |
8b27f225 PB |
5759 | |
5760 | /* Create a new decl if DECL is NULL, otherwise fix it */ | |
5761 | decl = maybe_create_class_interface_decl (decl, q_name, id); | |
5762 | ||
5763 | /* Set super info and mark the class a complete */ | |
2aa11e97 | 5764 | set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl), |
8b27f225 PB |
5765 | object_type_node, ctxp->interface_number); |
5766 | ctxp->interface_number = 0; | |
5767 | CLASS_COMPLETE_P (decl) = 1; | |
5768 | add_superinterfaces (decl, super); | |
5769 | ||
5770 | return decl; | |
5771 | } | |
5772 | ||
5773 | /* Create an class in pass1 and return its decl. Return class | |
5774 | interface's decl in pass 2. */ | |
5775 | ||
5776 | static tree | |
5777 | create_class (flags, id, super, interfaces) | |
5778 | int flags; | |
5779 | tree id, super, interfaces; | |
5780 | { | |
5781 | tree raw_name = EXPR_WFL_NODE (id); | |
5782 | tree class_id, decl; | |
9ee9b555 | 5783 | tree super_decl_type; |
8b27f225 PB |
5784 | |
5785 | class_id = parser_qualified_classname (id); | |
5786 | decl = IDENTIFIER_CLASS_VALUE (class_id); | |
5e942c50 | 5787 | ctxp->current_parsed_class_un = EXPR_WFL_NODE (id); |
8b27f225 PB |
5788 | EXPR_WFL_NODE (id) = class_id; |
5789 | ||
5790 | /* Basic check: scope, redefinition, modifiers */ | |
5791 | if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id)) | |
5792 | return NULL_TREE; | |
5793 | ||
5794 | /* Class modifier check: | |
5795 | - Allowed modifier (already done at that point) | |
5796 | - abstract AND final forbidden | |
5797 | - Public classes defined in the correct file */ | |
5798 | if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL)) | |
781b0558 KG |
5799 | parse_error_context |
5800 | (id, "Class `%s' can't be declared both abstract and final", | |
5801 | IDENTIFIER_POINTER (raw_name)); | |
8b27f225 PB |
5802 | |
5803 | /* Create a new decl if DECL is NULL, otherwise fix it */ | |
5804 | decl = maybe_create_class_interface_decl (decl, class_id, id); | |
5805 | ||
5806 | /* If SUPER exists, use it, otherwise use Object */ | |
5807 | if (super) | |
5808 | { | |
5809 | /* Can't extend java.lang.Object */ | |
5810 | if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node) | |
5811 | { | |
5812 | parse_error_context (id, "Can't extend `java.lang.Object'"); | |
5813 | return NULL_TREE; | |
5814 | } | |
5815 | ||
2c3199bc PB |
5816 | super_decl_type = |
5817 | register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE); | |
8b27f225 PB |
5818 | } |
5819 | else if (TREE_TYPE (decl) != object_type_node) | |
5820 | super_decl_type = object_type_node; | |
5821 | /* We're defining java.lang.Object */ | |
5822 | else | |
5823 | super_decl_type = NULL_TREE; | |
5824 | ||
5825 | /* Set super info and mark the class a complete */ | |
5826 | set_super_info (flags, TREE_TYPE (decl), super_decl_type, | |
5827 | ctxp->interface_number); | |
5828 | ctxp->interface_number = 0; | |
5829 | CLASS_COMPLETE_P (decl) = 1; | |
5830 | add_superinterfaces (decl, interfaces); | |
5831 | ||
7f10c2e2 APB |
5832 | /* If doing xref, store the location at which the inherited class |
5833 | (if any) was seen. */ | |
5834 | if (flag_emit_xref && super) | |
5835 | DECL_INHERITED_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (super); | |
5836 | ||
5e942c50 APB |
5837 | /* Eventually sets the @deprecated tag flag */ |
5838 | CHECK_DEPRECATED (decl); | |
5839 | ||
8b27f225 PB |
5840 | return decl; |
5841 | } | |
5842 | ||
5843 | /* Can't use lookup_field () since we don't want to load the class and | |
5844 | can't set the CLASS_LOADED_P flag */ | |
5845 | ||
5846 | static tree | |
5847 | find_field (class, name) | |
5848 | tree class; | |
5849 | tree name; | |
5850 | { | |
5851 | tree decl; | |
5852 | for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl)) | |
5853 | { | |
5854 | if (DECL_NAME (decl) == name) | |
5855 | return decl; | |
5856 | } | |
5857 | return NULL_TREE; | |
5858 | } | |
5859 | ||
5860 | /* Wrap around lookup_field that doesn't potentially upset the value | |
5861 | of CLASS */ | |
5862 | ||
5863 | static tree | |
5864 | lookup_field_wrapper (class, name) | |
5865 | tree class, name; | |
5866 | { | |
5867 | tree type = class; | |
5b09b33e | 5868 | tree decl; |
c877974e | 5869 | java_parser_context_save_global (); |
5b09b33e | 5870 | decl = lookup_field (&type, name); |
c877974e | 5871 | java_parser_context_restore_global (); |
93024893 | 5872 | return decl == error_mark_node ? NULL : decl; |
8b27f225 PB |
5873 | } |
5874 | ||
5875 | /* Find duplicate field within the same class declarations and report | |
5876 | the error. Returns 1 if a duplicated field was found, 0 | |
5877 | otherwise. */ | |
5878 | ||
5879 | static int | |
5880 | duplicate_declaration_error_p (new_field_name, new_type, cl) | |
5881 | tree new_field_name, new_type, cl; | |
5882 | { | |
5883 | /* This might be modified to work with method decl as well */ | |
5884 | tree decl = find_field (TREE_TYPE (ctxp->current_parsed_class), | |
5885 | new_field_name); | |
5886 | if (decl) | |
5887 | { | |
c2e3db92 | 5888 | char *t1 = xstrdup (purify_type_name |
4a5f66c3 APB |
5889 | ((TREE_CODE (new_type) == POINTER_TYPE |
5890 | && TREE_TYPE (new_type) == NULL_TREE) ? | |
5891 | IDENTIFIER_POINTER (TYPE_NAME (new_type)) : | |
5892 | lang_printable_name (new_type, 1))); | |
c877974e APB |
5893 | /* The type may not have been completed by the time we report |
5894 | the error */ | |
c2e3db92 | 5895 | char *t2 = xstrdup (purify_type_name |
4a5f66c3 | 5896 | ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE |
c877974e APB |
5897 | && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ? |
5898 | IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) : | |
5899 | lang_printable_name (TREE_TYPE (decl), 1))); | |
8b27f225 PB |
5900 | parse_error_context |
5901 | (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)", | |
5902 | t1, IDENTIFIER_POINTER (new_field_name), | |
5903 | t2, IDENTIFIER_POINTER (DECL_NAME (decl)), | |
5904 | DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); | |
5905 | free (t1); | |
5906 | free (t2); | |
5907 | return 1; | |
5908 | } | |
5909 | return 0; | |
5910 | } | |
5911 | ||
5912 | /* Field registration routine. If TYPE doesn't exist, field | |
5913 | declarations are linked to the undefined TYPE dependency list, to | |
5914 | be later resolved in java_complete_class () */ | |
5915 | ||
5916 | static void | |
5917 | register_fields (flags, type, variable_list) | |
5918 | int flags; | |
5919 | tree type, variable_list; | |
5920 | { | |
5921 | tree current, saved_type; | |
5922 | tree class_type = TREE_TYPE (ctxp->current_parsed_class); | |
5923 | int saved_lineno = lineno; | |
5924 | int must_chain = 0; | |
5925 | tree wfl = NULL_TREE; | |
5926 | ||
5927 | /* If we're adding fields to interfaces, those fields are public, | |
5928 | static, final */ | |
5929 | if (CLASS_INTERFACE (TYPE_NAME (class_type))) | |
5930 | { | |
5931 | OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), | |
2884c41e | 5932 | flags, ACC_PUBLIC, "interface field(s)"); |
8b27f225 | 5933 | OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK), |
2884c41e | 5934 | flags, ACC_STATIC, "interface field(s)"); |
8b27f225 | 5935 | OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK), |
2884c41e | 5936 | flags, ACC_FINAL, "interface field(s)"); |
8b27f225 PB |
5937 | check_modifiers ("Illegal interface member modifier `%s'", flags, |
5938 | INTERFACE_FIELD_MODIFIERS); | |
5939 | flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL); | |
5940 | } | |
5941 | ||
5942 | /* Obtain a suitable type for resolution, if necessary */ | |
5943 | SET_TYPE_FOR_RESOLUTION (type, wfl, must_chain); | |
5944 | ||
5945 | /* If TYPE is fully resolved and we don't have a reference, make one */ | |
1886c9d8 | 5946 | PROMOTE_RECORD_IF_COMPLETE (type, must_chain); |
8b27f225 PB |
5947 | |
5948 | for (current = variable_list, saved_type = type; current; | |
5949 | current = TREE_CHAIN (current), type = saved_type) | |
5950 | { | |
c877974e | 5951 | tree real_type; |
8b27f225 PB |
5952 | tree field_decl; |
5953 | tree cl = TREE_PURPOSE (current); | |
5954 | tree init = TREE_VALUE (current); | |
5955 | tree current_name = EXPR_WFL_NODE (cl); | |
5956 | ||
5957 | /* Process NAME, as it may specify extra dimension(s) for it */ | |
5958 | type = build_array_from_name (type, wfl, current_name, ¤t_name); | |
5959 | ||
8b27f225 PB |
5960 | /* Type adjustment. We may have just readjusted TYPE because |
5961 | the variable specified more dimensions. Make sure we have | |
22eed1e6 APB |
5962 | a reference if we can and don't have one already. Also |
5963 | change the name if we have an init. */ | |
5964 | if (type != saved_type) | |
5965 | { | |
1886c9d8 | 5966 | PROMOTE_RECORD_IF_COMPLETE (type, must_chain); |
22eed1e6 APB |
5967 | if (init) |
5968 | EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = current_name; | |
5969 | } | |
8b27f225 | 5970 | |
c877974e APB |
5971 | real_type = GET_REAL_TYPE (type); |
5972 | /* Check for redeclarations */ | |
5973 | if (duplicate_declaration_error_p (current_name, real_type, cl)) | |
5974 | continue; | |
5975 | ||
8b27f225 | 5976 | /* Set lineno to the line the field was found and create a |
5e942c50 | 5977 | declaration for it. Eventually sets the @deprecated tag flag. */ |
f099f336 APB |
5978 | if (flag_emit_xref) |
5979 | lineno = EXPR_WFL_LINECOL (cl); | |
5980 | else | |
5981 | lineno = EXPR_WFL_LINENO (cl); | |
c877974e | 5982 | field_decl = add_field (class_type, current_name, real_type, flags); |
5e942c50 | 5983 | CHECK_DEPRECATED (field_decl); |
8b27f225 PB |
5984 | |
5985 | /* Check if we must chain. */ | |
5986 | if (must_chain) | |
5987 | register_incomplete_type (JDEP_FIELD, wfl, field_decl, type); | |
5988 | ||
8b27f225 PB |
5989 | /* If we have an initialization value tied to the field */ |
5990 | if (init) | |
5991 | { | |
5992 | /* The field is declared static */ | |
5993 | if (flags & ACC_STATIC) | |
5994 | { | |
63a212ed PB |
5995 | /* We include the field and its initialization part into |
5996 | a list used to generate <clinit>. After <clinit> is | |
ba179f9f APB |
5997 | walked, field initializations will be processed and |
5998 | fields initialized with known constants will be taken | |
5999 | out of <clinit> and have their DECL_INITIAL set | |
63a212ed PB |
6000 | appropriately. */ |
6001 | TREE_CHAIN (init) = ctxp->static_initialized; | |
6002 | ctxp->static_initialized = init; | |
7f10c2e2 APB |
6003 | if (TREE_OPERAND (init, 1) |
6004 | && TREE_CODE (TREE_OPERAND (init, 1)) == NEW_ARRAY_INIT) | |
5bba4807 | 6005 | TREE_STATIC (TREE_OPERAND (init, 1)) = 1; |
8b27f225 | 6006 | } |
5e942c50 APB |
6007 | /* A non-static field declared with an immediate initialization is |
6008 | to be initialized in <init>, if any. This field is remembered | |
6009 | to be processed at the time of the generation of <init>. */ | |
8b27f225 PB |
6010 | else |
6011 | { | |
6012 | TREE_CHAIN (init) = ctxp->non_static_initialized; | |
6013 | ctxp->non_static_initialized = init; | |
6014 | } | |
5b09b33e | 6015 | MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1; |
8576f094 | 6016 | DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1); |
8b27f225 PB |
6017 | } |
6018 | } | |
6019 | lineno = saved_lineno; | |
6020 | } | |
6021 | ||
ac825856 | 6022 | /* Generate the method $finit$ that initializes fields initialized |
22eed1e6 APB |
6023 | upon declaration. */ |
6024 | ||
6025 | static void | |
6026 | maybe_generate_finit () | |
6027 | { | |
6028 | tree mdecl, current; | |
6029 | ||
6030 | if (!ctxp->non_static_initialized || java_error_count) | |
6031 | return; | |
6032 | ||
6033 | mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class), | |
ac825856 | 6034 | ACC_PRIVATE, void_type_node, |
82371d41 | 6035 | finit_identifier_node, end_params_node); |
22eed1e6 APB |
6036 | start_artificial_method_body (mdecl); |
6037 | ||
6038 | ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized); | |
6039 | for (current = ctxp->non_static_initialized; current; | |
6040 | current = TREE_CHAIN (current)) | |
6041 | java_method_add_stmt (mdecl, | |
6042 | build_debugable_stmt (EXPR_WFL_LINECOL (current), | |
6043 | current)); | |
6044 | ||
6045 | end_artificial_method_body (mdecl); | |
6046 | CLASS_HAS_FINIT_P (TREE_TYPE (ctxp->current_parsed_class)) = 1; | |
6047 | ctxp->non_static_initialized = NULL_TREE; | |
6048 | } | |
6049 | ||
8b27f225 PB |
6050 | /* Check whether it is necessary to generate a <clinit> for the class |
6051 | we just parsed. */ | |
6052 | ||
6053 | static void | |
6054 | maybe_generate_clinit () | |
6055 | { | |
22eed1e6 | 6056 | tree mdecl, c; |
8b27f225 PB |
6057 | |
6058 | if (!ctxp->static_initialized || java_error_count) | |
6059 | return; | |
6060 | ||
22eed1e6 APB |
6061 | mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class), |
6062 | ACC_STATIC, void_type_node, | |
82371d41 | 6063 | clinit_identifier_node, end_params_node); |
22eed1e6 | 6064 | start_artificial_method_body (mdecl); |
8b27f225 PB |
6065 | |
6066 | /* Keep initialization in order to enforce 8.5 */ | |
6067 | ctxp->static_initialized = nreverse (ctxp->static_initialized); | |
6068 | ||
6069 | /* We process the list of assignment we produced as the result of | |
6070 | the declaration of initialized static field and add them as | |
6071 | statement to the <clinit> method. */ | |
6072 | for (c = ctxp->static_initialized; c; c = TREE_CHAIN (c)) | |
6073 | { | |
6074 | /* We build the assignment expression that will initialize the | |
6075 | field to its value. There are strict rules on static | |
6076 | initializers (8.5). FIXME */ | |
22eed1e6 APB |
6077 | java_method_add_stmt (mdecl, |
6078 | build_debugable_stmt (EXPR_WFL_LINECOL (c), c)); | |
8b27f225 PB |
6079 | } |
6080 | ||
22eed1e6 | 6081 | end_artificial_method_body (mdecl); |
8b27f225 PB |
6082 | ctxp->static_initialized = NULL_TREE; |
6083 | } | |
6084 | ||
6085 | /* Shared accros method_declarator and method_header to remember the | |
6086 | patch stage that was reached during the declaration of the method. | |
6087 | A method DECL is built differently is there is no patch | |
6088 | (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN) | |
6089 | pending on the currently defined method. */ | |
6090 | ||
6091 | static int patch_stage; | |
6092 | ||
6093 | /* Check the method declaration and add the method to its current | |
6094 | class. If the argument list is known to contain incomplete types, | |
6095 | the method is partially added and the registration will be resume | |
22eed1e6 APB |
6096 | once the method arguments resolved. If TYPE is NULL, we're dealing |
6097 | with a constructor. */ | |
8b27f225 PB |
6098 | |
6099 | static tree | |
6100 | method_header (flags, type, mdecl, throws) | |
6101 | int flags; | |
6102 | tree type, mdecl, throws; | |
6103 | { | |
6104 | tree meth = TREE_VALUE (mdecl); | |
6105 | tree id = TREE_PURPOSE (mdecl); | |
1886c9d8 | 6106 | tree type_wfl = NULL_TREE; |
79d13333 APB |
6107 | tree meth_name = NULL_TREE; |
6108 | tree current, orig_arg, this_class; | |
8b27f225 | 6109 | int saved_lineno; |
1886c9d8 | 6110 | int constructor_ok = 0, must_chain; |
8b27f225 PB |
6111 | |
6112 | check_modifiers_consistency (flags); | |
79d13333 APB |
6113 | |
6114 | if (ctxp->current_parsed_class) | |
6115 | this_class = TREE_TYPE (ctxp->current_parsed_class); | |
6116 | else | |
6117 | return NULL_TREE; | |
8b27f225 PB |
6118 | |
6119 | /* There are some forbidden modifiers for an abstract method and its | |
6120 | class must be abstract as well. */ | |
22eed1e6 | 6121 | if (type && (flags & ACC_ABSTRACT)) |
8b27f225 PB |
6122 | { |
6123 | ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private"); | |
6124 | ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static"); | |
6125 | ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final"); | |
6126 | ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native"); | |
6127 | ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized"); | |
2aa11e97 APB |
6128 | if (!CLASS_ABSTRACT (TYPE_NAME (this_class)) |
6129 | && !CLASS_INTERFACE (TYPE_NAME (this_class))) | |
8b27f225 | 6130 | parse_error_context |
781b0558 | 6131 | (id, "Class `%s' must be declared abstract to define abstract method `%s'", |
8b27f225 PB |
6132 | IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)), |
6133 | IDENTIFIER_POINTER (EXPR_WFL_NODE (id))); | |
6134 | } | |
22eed1e6 APB |
6135 | /* Things to be checked when declaring a constructor */ |
6136 | if (!type) | |
6137 | { | |
6138 | int ec = java_error_count; | |
6139 | /* 8.6: Constructor declarations: we might be trying to define a | |
6140 | method without specifying a return type. */ | |
5e942c50 | 6141 | if (EXPR_WFL_NODE (id) != ctxp->current_parsed_class_un) |
22eed1e6 APB |
6142 | parse_error_context |
6143 | (id, "Invalid method declaration, return type required"); | |
6144 | /* 8.6.3: Constructor modifiers */ | |
6145 | else | |
6146 | { | |
6147 | JCONSTRUCTOR_CHECK (flags, ACC_ABSTRACT, id, "abstract"); | |
6148 | JCONSTRUCTOR_CHECK (flags, ACC_STATIC, id, "static"); | |
6149 | JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final"); | |
6150 | JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native"); | |
6151 | JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized"); | |
6152 | } | |
6153 | /* If we found error here, we don't consider it's OK to tread | |
6154 | the method definition as a constructor, for the rest of this | |
6155 | function */ | |
6156 | if (ec == java_error_count) | |
6157 | constructor_ok = 1; | |
6158 | } | |
8b27f225 PB |
6159 | |
6160 | /* Method declared within the scope of an interface are implicitly | |
6161 | abstract and public. Conflicts with other erroneously provided | |
c0d87ff6 | 6162 | modifiers are checked right after. */ |
8b27f225 PB |
6163 | |
6164 | if (CLASS_INTERFACE (TYPE_NAME (this_class))) | |
6165 | { | |
6166 | /* If FLAGS isn't set because of a modifier, turn the | |
6167 | corresponding modifier WFL to NULL so we issue a warning on | |
6168 | the obsolete use of the modifier */ | |
6169 | if (!(flags & ACC_PUBLIC)) | |
6170 | MODIFIER_WFL (PUBLIC_TK) = NULL; | |
6171 | if (!(flags & ACC_ABSTRACT)) | |
6172 | MODIFIER_WFL (ABSTRACT_TK) = NULL; | |
6173 | flags |= ACC_PUBLIC; | |
9ee9b555 | 6174 | flags |= ACC_ABSTRACT; |
8b27f225 PB |
6175 | } |
6176 | ||
6177 | /* Modifiers context reset moved up, so abstract method declaration | |
6178 | modifiers can be later checked. */ | |
6179 | ||
22eed1e6 APB |
6180 | /* Set constructor returned type to void and method name to <init>, |
6181 | unless we found an error identifier the constructor (in which | |
6182 | case we retain the original name) */ | |
6183 | if (!type) | |
6184 | { | |
6185 | type = void_type_node; | |
6186 | if (constructor_ok) | |
6187 | meth_name = init_identifier_node; | |
6188 | } | |
6189 | else | |
6190 | meth_name = EXPR_WFL_NODE (id); | |
8b27f225 | 6191 | |
1886c9d8 APB |
6192 | /* Do the returned type resolution and registration if necessary */ |
6193 | SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain); | |
6194 | ||
4a5f66c3 APB |
6195 | if (meth_name) |
6196 | type = build_array_from_name (type, type_wfl, meth_name, &meth_name); | |
1886c9d8 APB |
6197 | EXPR_WFL_NODE (id) = meth_name; |
6198 | PROMOTE_RECORD_IF_COMPLETE (type, must_chain); | |
6199 | ||
6200 | if (must_chain) | |
8b27f225 | 6201 | { |
1886c9d8 APB |
6202 | patch_stage = JDEP_METHOD_RETURN; |
6203 | register_incomplete_type (patch_stage, type_wfl, id, type); | |
6204 | TREE_TYPE (meth) = GET_REAL_TYPE (type); | |
8b27f225 | 6205 | } |
5e942c50 | 6206 | else |
1886c9d8 | 6207 | TREE_TYPE (meth) = type; |
8b27f225 PB |
6208 | |
6209 | saved_lineno = lineno; | |
6210 | /* When defining an abstract or interface method, the curly | |
6211 | bracket at level 1 doesn't exist because there is no function | |
6212 | body */ | |
6213 | lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 : | |
6214 | EXPR_WFL_LINENO (id)); | |
6215 | ||
5e942c50 APB |
6216 | /* Remember the original argument list */ |
6217 | orig_arg = TYPE_ARG_TYPES (meth); | |
6218 | ||
8b27f225 PB |
6219 | if (patch_stage) /* includes ret type and/or all args */ |
6220 | { | |
6221 | jdep *jdep; | |
6222 | meth = add_method_1 (this_class, flags, meth_name, meth); | |
6223 | /* Patch for the return type */ | |
6224 | if (patch_stage == JDEP_METHOD_RETURN) | |
6225 | { | |
6226 | jdep = CLASSD_LAST (ctxp->classd_list); | |
6227 | JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth)); | |
6228 | } | |
6229 | /* This is the stop JDEP. METH allows the function's signature | |
6230 | to be computed. */ | |
6231 | register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE); | |
6232 | } | |
6233 | else | |
5e942c50 APB |
6234 | meth = add_method (this_class, flags, meth_name, |
6235 | build_java_signature (meth)); | |
6236 | ||
6237 | /* Fix the method argument list so we have the argument name | |
6238 | information */ | |
6239 | fix_method_argument_names (orig_arg, meth); | |
6240 | ||
6241 | /* Register the parameter number and re-install the current line | |
6242 | number */ | |
8b27f225 PB |
6243 | DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1; |
6244 | lineno = saved_lineno; | |
6245 | ||
6246 | /* Register exception specified by the `throws' keyword for | |
6247 | resolution and set the method decl appropriate field to the list. | |
6248 | Note: the grammar ensures that what we get here are class | |
6249 | types. */ | |
6250 | if (throws) | |
6251 | { | |
6252 | throws = nreverse (throws); | |
6253 | for (current = throws; current; current = TREE_CHAIN (current)) | |
6254 | { | |
6255 | register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current), | |
6256 | NULL_TREE, NULL_TREE); | |
6257 | JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) = | |
6258 | &TREE_VALUE (current); | |
6259 | } | |
22eed1e6 APB |
6260 | DECL_FUNCTION_THROWS (meth) = throws; |
6261 | } | |
6262 | ||
6263 | /* We set the DECL_NAME to ID so we can track the location where | |
6264 | the function was declared. This allow us to report | |
6265 | redefinition error accurately. When method are verified, | |
6266 | DECL_NAME is reinstalled properly (using the content of the | |
6267 | WFL node ID) (see check_method_redefinition). We don't do that | |
6268 | when Object is being defined. Constructor <init> names will be | |
6269 | reinstalled the same way. */ | |
6270 | if (TREE_TYPE (ctxp->current_parsed_class) != object_type_node) | |
6271 | DECL_NAME (meth) = id; | |
6272 | ||
6273 | /* Set the flag if we correctly processed a constructor */ | |
6274 | if (constructor_ok) | |
6275 | DECL_CONSTRUCTOR_P (meth) = 1; | |
6276 | ||
5e942c50 APB |
6277 | /* Eventually set the @deprecated tag flag */ |
6278 | CHECK_DEPRECATED (meth); | |
6279 | ||
7f10c2e2 APB |
6280 | /* If doing xref, store column and line number information instead |
6281 | of the line number only. */ | |
6282 | if (flag_emit_xref) | |
6283 | DECL_SOURCE_LINE (meth) = EXPR_WFL_LINECOL (id); | |
6284 | ||
22eed1e6 APB |
6285 | return meth; |
6286 | } | |
6287 | ||
5e942c50 APB |
6288 | static void |
6289 | fix_method_argument_names (orig_arg, meth) | |
6290 | tree orig_arg, meth; | |
6291 | { | |
6292 | tree arg = TYPE_ARG_TYPES (TREE_TYPE (meth)); | |
6293 | if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE) | |
6294 | { | |
6295 | TREE_PURPOSE (arg) = this_identifier_node; | |
6296 | arg = TREE_CHAIN (arg); | |
6297 | } | |
82371d41 | 6298 | while (orig_arg != end_params_node) |
5e942c50 APB |
6299 | { |
6300 | TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg); | |
6301 | orig_arg = TREE_CHAIN (orig_arg); | |
6302 | arg = TREE_CHAIN (arg); | |
6303 | } | |
6304 | } | |
6305 | ||
22eed1e6 APB |
6306 | /* Complete the method declaration with METHOD_BODY. */ |
6307 | ||
6308 | static void | |
e85ac860 | 6309 | finish_method_declaration (method_body) |
22eed1e6 APB |
6310 | tree method_body; |
6311 | { | |
79d13333 APB |
6312 | int flags; |
6313 | ||
6314 | if (!current_function_decl) | |
6315 | return; | |
6316 | ||
6317 | flags = get_access_flags_from_decl (current_function_decl); | |
5256aa37 APB |
6318 | |
6319 | /* 8.4.5 Method Body */ | |
6320 | if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body) | |
6321 | { | |
6322 | tree wfl = DECL_NAME (current_function_decl); | |
6323 | parse_error_context (wfl, | |
6324 | "%s method `%s' can't have a body defined", | |
6325 | (METHOD_NATIVE (current_function_decl) ? | |
6326 | "Native" : "Abstract"), | |
6327 | IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); | |
6328 | method_body = NULL_TREE; | |
6329 | } | |
6330 | else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body) | |
6331 | { | |
6332 | tree wfl = DECL_NAME (current_function_decl); | |
781b0558 KG |
6333 | parse_error_context |
6334 | (wfl, | |
6335 | "Non native and non abstract method `%s' must have a body defined", | |
6336 | IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); | |
5256aa37 APB |
6337 | method_body = NULL_TREE; |
6338 | } | |
6339 | ||
2c56429a APB |
6340 | if (flag_emit_class_files && method_body |
6341 | && TREE_CODE (method_body) == NOP_EXPR | |
6342 | && TREE_TYPE (current_function_decl) | |
6343 | && TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node) | |
6344 | method_body = build1 (RETURN_EXPR, void_type_node, NULL); | |
6345 | ||
22eed1e6 APB |
6346 | BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body; |
6347 | maybe_absorb_scoping_blocks (); | |
6348 | /* Exit function's body */ | |
6349 | exit_block (); | |
6350 | /* Merge last line of the function with first line, directly in the | |
6351 | function decl. It will be used to emit correct debug info. */ | |
7f10c2e2 APB |
6352 | if (!flag_emit_xref) |
6353 | DECL_SOURCE_LINE_MERGE (current_function_decl, ctxp->last_ccb_indent1); | |
f099f336 APB |
6354 | /* So we don't have an irrelevant function declaration context for |
6355 | the next static block we'll see. */ | |
6356 | current_function_decl = NULL_TREE; | |
22eed1e6 APB |
6357 | } |
6358 | ||
6359 | /* Build a an error message for constructor circularity errors. */ | |
6360 | ||
6361 | static char * | |
6362 | constructor_circularity_msg (from, to) | |
6363 | tree from, to; | |
6364 | { | |
6365 | static char string [4096]; | |
c2e3db92 | 6366 | char *t = xstrdup (lang_printable_name (from, 0)); |
22eed1e6 APB |
6367 | sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0)); |
6368 | free (t); | |
6369 | return string; | |
6370 | } | |
6371 | ||
6372 | /* Verify a circular call to METH. Return 1 if an error is found, 0 | |
6373 | otherwise. */ | |
6374 | ||
6375 | static int | |
6376 | verify_constructor_circularity (meth, current) | |
6377 | tree meth, current; | |
6378 | { | |
6379 | static tree list = NULL_TREE; | |
6380 | tree c; | |
6381 | for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c)) | |
6382 | { | |
6383 | if (TREE_VALUE (c) == meth) | |
6384 | { | |
6385 | char *t; | |
6386 | if (list) | |
6387 | { | |
6388 | tree liste; | |
6389 | list = nreverse (list); | |
6390 | for (liste = list; liste; liste = TREE_CHAIN (liste)) | |
6391 | { | |
6392 | parse_error_context | |
c63b98cd | 6393 | (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s", |
22eed1e6 APB |
6394 | constructor_circularity_msg |
6395 | (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste)))); | |
6396 | java_error_count--; | |
6397 | } | |
6398 | } | |
c2e3db92 | 6399 | t = xstrdup (lang_printable_name (meth, 0)); |
22eed1e6 APB |
6400 | parse_error_context (TREE_PURPOSE (c), |
6401 | "%s: recursive invocation of constructor `%s'", | |
6402 | constructor_circularity_msg (current, meth), t); | |
6403 | free (t); | |
6404 | list = NULL_TREE; | |
6405 | return 1; | |
6406 | } | |
8b27f225 | 6407 | } |
22eed1e6 APB |
6408 | for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c)) |
6409 | { | |
6410 | list = tree_cons (c, current, list); | |
6411 | if (verify_constructor_circularity (meth, TREE_VALUE (c))) | |
6412 | return 1; | |
6413 | list = TREE_CHAIN (list); | |
6414 | } | |
6415 | return 0; | |
8b27f225 PB |
6416 | } |
6417 | ||
6418 | /* Check modifiers that can be declared but exclusively */ | |
6419 | ||
6420 | static void | |
6421 | check_modifiers_consistency (flags) | |
6422 | int flags; | |
6423 | { | |
6424 | int acc_count = 0; | |
6425 | tree cl = NULL_TREE; | |
6426 | ||
6427 | THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl); | |
6428 | THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl); | |
6429 | THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl); | |
6430 | if (acc_count > 1) | |
6431 | parse_error_context | |
781b0558 | 6432 | (cl, "Inconsistent member declaration. At most one of `public', `private', or `protected' may be specified"); |
8b27f225 PB |
6433 | } |
6434 | ||
6435 | /* Check the methode header METH for abstract specifics features */ | |
6436 | ||
6437 | static void | |
6438 | check_abstract_method_header (meth) | |
6439 | tree meth; | |
6440 | { | |
6441 | int flags = get_access_flags_from_decl (meth); | |
6442 | /* DECL_NAME might still be a WFL node */ | |
c877974e | 6443 | tree name = GET_METHOD_NAME (meth); |
8b27f225 | 6444 | |
2884c41e KG |
6445 | OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (ABSTRACT_TK), flags, |
6446 | ACC_ABSTRACT, "abstract method", | |
6447 | IDENTIFIER_POINTER (name)); | |
6448 | OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags, | |
6449 | ACC_PUBLIC, "abstract method", | |
6450 | IDENTIFIER_POINTER (name)); | |
8b27f225 PB |
6451 | |
6452 | check_modifiers ("Illegal modifier `%s' for interface method", | |
6453 | flags, INTERFACE_METHOD_MODIFIERS); | |
6454 | } | |
6455 | ||
6456 | /* Create a FUNCTION_TYPE node and start augmenting it with the | |
6457 | declared function arguments. Arguments type that can't be resolved | |
6458 | are left as they are, but the returned node is marked as containing | |
6459 | incomplete types. */ | |
6460 | ||
6461 | static tree | |
6462 | method_declarator (id, list) | |
6463 | tree id, list; | |
6464 | { | |
6465 | tree arg_types = NULL_TREE, current, node; | |
6466 | tree meth = make_node (FUNCTION_TYPE); | |
6467 | jdep *jdep; | |
6468 | ||
6469 | patch_stage = JDEP_NO_PATCH; | |
6470 | ||
6471 | for (current = list; current; current = TREE_CHAIN (current)) | |
6472 | { | |
6473 | int must_chain = 0; | |
6474 | tree wfl_name = TREE_PURPOSE (current); | |
6475 | tree type = TREE_VALUE (current); | |
6476 | tree name = EXPR_WFL_NODE (wfl_name); | |
6477 | tree already, arg_node; | |
6478 | tree type_wfl = NULL_TREE; | |
23a79c61 | 6479 | tree real_type; |
8b27f225 PB |
6480 | |
6481 | /* Obtain a suitable type for resolution, if necessary */ | |
6482 | SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain); | |
6483 | ||
6484 | /* Process NAME, as it may specify extra dimension(s) for it */ | |
6485 | type = build_array_from_name (type, type_wfl, name, &name); | |
6486 | EXPR_WFL_NODE (wfl_name) = name; | |
6487 | ||
23a79c61 APB |
6488 | real_type = GET_REAL_TYPE (type); |
6489 | if (TREE_CODE (real_type) == RECORD_TYPE) | |
6490 | { | |
6491 | real_type = promote_type (real_type); | |
6492 | if (TREE_CODE (type) == TREE_LIST) | |
6493 | TREE_PURPOSE (type) = real_type; | |
6494 | } | |
5e942c50 | 6495 | |
8b27f225 PB |
6496 | /* Check redefinition */ |
6497 | for (already = arg_types; already; already = TREE_CHAIN (already)) | |
6498 | if (TREE_PURPOSE (already) == name) | |
6499 | { | |
781b0558 KG |
6500 | parse_error_context |
6501 | (wfl_name, "Variable `%s' is used more than once in the argument list of method `%s'", | |
6502 | IDENTIFIER_POINTER (name), | |
8b27f225 PB |
6503 | IDENTIFIER_POINTER (EXPR_WFL_NODE (id))); |
6504 | break; | |
6505 | } | |
6506 | ||
6507 | /* If we've an incomplete argument type, we know there is a location | |
6508 | to patch when the type get resolved, later. */ | |
6509 | jdep = NULL; | |
6510 | if (must_chain) | |
6511 | { | |
6512 | patch_stage = JDEP_METHOD; | |
6513 | type = register_incomplete_type (patch_stage, | |
6514 | type_wfl, wfl_name, type); | |
6515 | jdep = CLASSD_LAST (ctxp->classd_list); | |
6516 | JDEP_MISC (jdep) = id; | |
6517 | } | |
6518 | ||
6519 | /* The argument node: a name and a (possibly) incomplete type */ | |
23a79c61 | 6520 | arg_node = build_tree_list (name, real_type); |
8b27f225 PB |
6521 | if (jdep) |
6522 | JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node); | |
6523 | TREE_CHAIN (arg_node) = arg_types; | |
6524 | arg_types = arg_node; | |
6525 | } | |
82371d41 | 6526 | TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node); |
8b27f225 PB |
6527 | node = build_tree_list (id, meth); |
6528 | return node; | |
6529 | } | |
6530 | ||
6531 | static int | |
6532 | unresolved_type_p (wfl, returned) | |
6533 | tree wfl; | |
6534 | tree *returned; | |
6535 | ||
6536 | { | |
6537 | if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION) | |
6538 | { | |
6539 | tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl)); | |
6540 | if (returned) | |
6541 | *returned = (decl ? TREE_TYPE (decl) : NULL_TREE); | |
6542 | return 1; | |
6543 | } | |
6544 | if (returned) | |
6545 | *returned = wfl; | |
6546 | return 0; | |
6547 | } | |
6548 | ||
6549 | /* From NAME, build a qualified identifier node using the | |
6550 | qualification from the current package definition. */ | |
6551 | ||
6552 | static tree | |
6553 | parser_qualified_classname (name) | |
6554 | tree name; | |
6555 | { | |
6556 | if (ctxp->package) | |
6557 | return merge_qualified_name (ctxp->package, EXPR_WFL_NODE (name)); | |
6558 | else | |
6559 | return EXPR_WFL_NODE (name); | |
6560 | } | |
6561 | ||
6562 | /* Called once the type a interface extends is resolved. Returns 0 if | |
6563 | everything is OK. */ | |
6564 | ||
6565 | static int | |
6566 | parser_check_super_interface (super_decl, this_decl, this_wfl) | |
6567 | tree super_decl, this_decl, this_wfl; | |
6568 | { | |
6569 | tree super_type = TREE_TYPE (super_decl); | |
6570 | ||
6571 | /* Has to be an interface */ | |
6572 | if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl)))) | |
6573 | { | |
6574 | parse_error_context | |
6575 | (this_wfl, "Can't use %s `%s' to implement/extend %s `%s'", | |
6576 | (TYPE_ARRAY_P (super_type) ? "array" : "class"), | |
6577 | IDENTIFIER_POINTER (DECL_NAME (super_decl)), | |
6578 | (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ? | |
6579 | "interface" : "class"), | |
6580 | IDENTIFIER_POINTER (DECL_NAME (this_decl))); | |
6581 | return 1; | |
6582 | } | |
6583 | ||
6584 | /* Check scope: same package OK, other package: OK if public */ | |
6585 | if (check_pkg_class_access (DECL_NAME (super_decl), lookup_cl (this_decl))) | |
6586 | return 1; | |
6587 | ||
6588 | SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s", | |
6589 | IDENTIFIER_POINTER (DECL_NAME (this_decl)), | |
6590 | IDENTIFIER_POINTER (DECL_NAME (super_decl)))); | |
6591 | return 0; | |
6592 | } | |
6593 | ||
6594 | /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns | |
6595 | 0 if everthing is OK. */ | |
6596 | ||
6597 | static int | |
6598 | parser_check_super (super_decl, this_decl, wfl) | |
6599 | tree super_decl, this_decl, wfl; | |
6600 | { | |
6601 | tree super_type = TREE_TYPE (super_decl); | |
6602 | ||
6603 | /* SUPER should be a CLASS (neither an array nor an interface) */ | |
6604 | if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type))) | |
6605 | { | |
6606 | parse_error_context | |
6607 | (wfl, "Class `%s' can't subclass %s `%s'", | |
6608 | IDENTIFIER_POINTER (DECL_NAME (this_decl)), | |
6609 | (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"), | |
6610 | IDENTIFIER_POINTER (DECL_NAME (super_decl))); | |
6611 | return 1; | |
6612 | } | |
6613 | ||
6614 | if (CLASS_FINAL (TYPE_NAME (super_type))) | |
6615 | { | |
6616 | parse_error_context (wfl, "Can't subclass final classes: %s", | |
6617 | IDENTIFIER_POINTER (DECL_NAME (super_decl))); | |
6618 | return 1; | |
6619 | } | |
6620 | ||
6621 | /* Check scope: same package OK, other package: OK if public */ | |
6622 | if (check_pkg_class_access (DECL_NAME (super_decl), wfl)) | |
6623 | return 1; | |
6624 | ||
6625 | SOURCE_FRONTEND_DEBUG (("Completing class %s with %s", | |
6626 | IDENTIFIER_POINTER (DECL_NAME (this_decl)), | |
6627 | IDENTIFIER_POINTER (DECL_NAME (super_decl)))); | |
6628 | return 0; | |
6629 | } | |
6630 | ||
6631 | /* Create a new dependency list and link it (in a LIFO manner) to the | |
6632 | CTXP list of type dependency list. */ | |
6633 | ||
6634 | static void | |
6635 | create_jdep_list (ctxp) | |
6636 | struct parser_ctxt *ctxp; | |
6637 | { | |
23a79c61 | 6638 | jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist)); |
8b27f225 PB |
6639 | new->first = new->last = NULL; |
6640 | new->next = ctxp->classd_list; | |
6641 | ctxp->classd_list = new; | |
6642 | } | |
6643 | ||
6644 | static jdeplist * | |
6645 | reverse_jdep_list (ctxp) | |
6646 | struct parser_ctxt *ctxp; | |
6647 | { | |
6648 | register jdeplist *prev = NULL, *current, *next; | |
6649 | for (current = ctxp->classd_list; current; current = next) | |
6650 | { | |
6651 | next = current->next; | |
6652 | current->next = prev; | |
6653 | prev = current; | |
6654 | } | |
6655 | return prev; | |
6656 | } | |
6657 | ||
23a79c61 APB |
6658 | /* Create a fake pointer based on the ID stored in |
6659 | TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be | |
6660 | registered again. */ | |
8b27f225 PB |
6661 | |
6662 | static tree | |
23a79c61 APB |
6663 | obtain_incomplete_type (type_name) |
6664 | tree type_name; | |
8b27f225 | 6665 | { |
23a79c61 APB |
6666 | tree ptr, name; |
6667 | ||
6668 | if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION) | |
6669 | name = EXPR_WFL_NODE (type_name); | |
6670 | else if (INCOMPLETE_TYPE_P (type_name)) | |
6671 | name = TYPE_NAME (type_name); | |
6672 | else | |
6673 | fatal ("invalid type name - obtain_incomplete_type"); | |
8b27f225 PB |
6674 | |
6675 | for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr)) | |
78d21f92 | 6676 | if (TYPE_NAME (ptr) == name) |
8b27f225 PB |
6677 | break; |
6678 | ||
6679 | if (!ptr) | |
6680 | { | |
8b27f225 | 6681 | push_obstacks (&permanent_obstack, &permanent_obstack); |
78d21f92 PB |
6682 | BUILD_PTR_FROM_NAME (ptr, name); |
6683 | layout_type (ptr); | |
8b27f225 PB |
6684 | pop_obstacks (); |
6685 | TREE_CHAIN (ptr) = ctxp->incomplete_class; | |
6686 | ctxp->incomplete_class = ptr; | |
6687 | } | |
6688 | ||
6689 | return ptr; | |
6690 | } | |
6691 | ||
6692 | /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is | |
6693 | non NULL instead of computing a new fake type based on WFL. The new | |
6694 | dependency is inserted in the current type dependency list, in FIFO | |
6695 | manner. */ | |
6696 | ||
6697 | static tree | |
6698 | register_incomplete_type (kind, wfl, decl, ptr) | |
6699 | int kind; | |
6700 | tree wfl, decl, ptr; | |
6701 | { | |
23a79c61 | 6702 | jdep *new = (jdep *)xmalloc (sizeof (jdep)); |
8b27f225 | 6703 | |
8b27f225 PB |
6704 | if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */ |
6705 | ptr = obtain_incomplete_type (wfl); | |
6706 | ||
6707 | JDEP_KIND (new) = kind; | |
6708 | JDEP_DECL (new) = decl; | |
6709 | JDEP_SOLV (new) = ptr; | |
6710 | JDEP_WFL (new) = wfl; | |
6711 | JDEP_CHAIN (new) = NULL; | |
6712 | JDEP_MISC (new) = NULL_TREE; | |
6713 | JDEP_GET_PATCH (new) = (tree *)NULL; | |
6714 | ||
6715 | JDEP_INSERT (ctxp->classd_list, new); | |
6716 | ||
6717 | return ptr; | |
6718 | } | |
6719 | ||
6720 | void | |
6721 | java_check_circular_reference () | |
6722 | { | |
6723 | tree current; | |
6724 | for (current = ctxp->class_list; current; current = TREE_CHAIN (current)) | |
6725 | { | |
6726 | tree type = TREE_TYPE (current); | |
781b0558 | 6727 | if (CLASS_INTERFACE (current)) |
8b27f225 PB |
6728 | { |
6729 | /* Check all interfaces this class extends */ | |
6730 | tree basetype_vec = TYPE_BINFO_BASETYPES (type); | |
6731 | int n, i; | |
6732 | ||
6733 | if (!basetype_vec) | |
6734 | return; | |
6735 | n = TREE_VEC_LENGTH (basetype_vec); | |
6736 | for (i = 0; i < n; i++) | |
6737 | { | |
6738 | tree vec_elt = TREE_VEC_ELT (basetype_vec, i); | |
6739 | if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node | |
6740 | && interface_of_p (type, BINFO_TYPE (vec_elt))) | |
6741 | parse_error_context (lookup_cl (current), | |
6742 | "Cyclic interface inheritance"); | |
6743 | } | |
6744 | } | |
6745 | else | |
6746 | if (inherits_from_p (CLASSTYPE_SUPER (type), type)) | |
6747 | parse_error_context (lookup_cl (current), | |
6748 | "Cyclic class inheritance"); | |
6749 | } | |
6750 | } | |
6751 | ||
781b0558 KG |
6752 | /* Fix the constructors. This will be called right after circular |
6753 | references have been checked. It is necessary to fix constructors | |
6754 | early even if no code generation will take place for that class: | |
6755 | some generated constructor might be required by the class whose | |
6756 | compilation triggered this one to be simply loaded. */ | |
6757 | ||
6758 | void | |
6759 | java_fix_constructors () | |
6760 | { | |
6761 | tree current; | |
6762 | ||
6763 | for (current = ctxp->class_list; current; current = TREE_CHAIN (current)) | |
6764 | { | |
6765 | tree decl; | |
6766 | tree class_type = TREE_TYPE (current); | |
6767 | int saw_ctor = 0; | |
6768 | ||
6769 | for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl)) | |
6770 | { | |
6771 | if (DECL_CONSTRUCTOR_P (decl)) | |
6772 | { | |
6773 | fix_constructors (decl); | |
6774 | saw_ctor = 1; | |
6775 | } | |
6776 | } | |
6777 | ||
6778 | if (!saw_ctor) | |
6779 | { | |
6780 | int flags = (get_access_flags_from_decl (current) & ACC_PUBLIC ? | |
6781 | ACC_PUBLIC : 0); | |
6782 | decl = create_artificial_method (class_type, flags, void_type_node, | |
6783 | init_identifier_node, | |
6784 | end_params_node); | |
6785 | DECL_CONSTRUCTOR_P (decl) = 1; | |
6786 | } | |
6787 | } | |
6788 | } | |
6789 | ||
23a79c61 APB |
6790 | /* safe_layout_class just makes sure that we can load a class without |
6791 | disrupting the current_class, input_file, lineno, etc, information | |
6792 | about the class processed currently. */ | |
6793 | ||
8b27f225 PB |
6794 | void |
6795 | safe_layout_class (class) | |
6796 | tree class; | |
6797 | { | |
6798 | tree save_current_class = current_class; | |
6799 | char *save_input_filename = input_filename; | |
6800 | int save_lineno = lineno; | |
5e942c50 | 6801 | |
8b27f225 | 6802 | push_obstacks (&permanent_obstack, &permanent_obstack); |
5e942c50 | 6803 | |
8b27f225 PB |
6804 | layout_class (class); |
6805 | pop_obstacks (); | |
5e942c50 | 6806 | |
8b27f225 PB |
6807 | current_class = save_current_class; |
6808 | input_filename = save_input_filename; | |
6809 | lineno = save_lineno; | |
6810 | CLASS_LOADED_P (class) = 1; | |
6811 | } | |
6812 | ||
6813 | static tree | |
6814 | jdep_resolve_class (dep) | |
6815 | jdep *dep; | |
6816 | { | |
6817 | tree decl; | |
6818 | ||
23a79c61 APB |
6819 | if (JDEP_RESOLVED_P (dep)) |
6820 | decl = JDEP_RESOLVED_DECL (dep); | |
6821 | else | |
8b27f225 | 6822 | { |
23a79c61 APB |
6823 | decl = resolve_class (JDEP_TO_RESOLVE (dep), |
6824 | JDEP_DECL (dep), JDEP_WFL (dep)); | |
8b27f225 PB |
6825 | JDEP_RESOLVED (dep, decl); |
6826 | } | |
23a79c61 | 6827 | |
8b27f225 | 6828 | if (!decl) |
23a79c61 APB |
6829 | complete_class_report_errors (dep); |
6830 | ||
8b27f225 PB |
6831 | return decl; |
6832 | } | |
6833 | ||
6834 | /* Complete unsatisfied class declaration and their dependencies */ | |
6835 | ||
6836 | void | |
6837 | java_complete_class () | |
6838 | { | |
6839 | tree cclass; | |
6840 | jdeplist *cclassd; | |
6841 | int error_found; | |
6842 | tree type; | |
6843 | ||
6844 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
6845 | ||
6846 | /* Process imports and reverse the import on demand list */ | |
6847 | process_imports (); | |
6848 | if (ctxp->import_demand_list) | |
6849 | ctxp->import_demand_list = nreverse (ctxp->import_demand_list); | |
6850 | ||
6851 | /* Rever things so we have the right order */ | |
6852 | ctxp->class_list = nreverse (ctxp->class_list); | |
6853 | ctxp->classd_list = reverse_jdep_list (ctxp); | |
c877974e | 6854 | |
8b27f225 PB |
6855 | for (cclassd = ctxp->classd_list, cclass = ctxp->class_list; |
6856 | cclass && cclassd; | |
6857 | cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd)) | |
6858 | { | |
6859 | jdep *dep; | |
6860 | for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep)) | |
6861 | { | |
6862 | tree decl; | |
8b27f225 PB |
6863 | if (!(decl = jdep_resolve_class (dep))) |
6864 | continue; | |
6865 | ||
6866 | /* Now it's time to patch */ | |
6867 | switch (JDEP_KIND (dep)) | |
6868 | { | |
6869 | case JDEP_SUPER: | |
6870 | /* Simply patch super */ | |
6871 | if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep))) | |
6872 | continue; | |
6873 | BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO | |
6874 | (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl); | |
6875 | break; | |
6876 | ||
6877 | case JDEP_FIELD: | |
6878 | { | |
6879 | /* We do part of the job done in add_field */ | |
6880 | tree field_decl = JDEP_DECL (dep); | |
6881 | tree field_type = TREE_TYPE (decl); | |
6882 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
6883 | if (TREE_CODE (field_type) == RECORD_TYPE) | |
6884 | field_type = promote_type (field_type); | |
6885 | pop_obstacks (); | |
6886 | TREE_TYPE (field_decl) = field_type; | |
5e942c50 APB |
6887 | DECL_ALIGN (field_decl) = 0; |
6888 | layout_decl (field_decl, 0); | |
8b27f225 PB |
6889 | SOURCE_FRONTEND_DEBUG |
6890 | (("Completed field/var decl `%s' with `%s'", | |
6891 | IDENTIFIER_POINTER (DECL_NAME (field_decl)), | |
6892 | IDENTIFIER_POINTER (DECL_NAME (decl)))); | |
6893 | break; | |
6894 | } | |
6895 | case JDEP_METHOD: /* We start patching a method */ | |
6896 | case JDEP_METHOD_RETURN: | |
6897 | error_found = 0; | |
6898 | while (1) | |
6899 | { | |
6900 | if (decl) | |
6901 | { | |
6902 | type = TREE_TYPE(decl); | |
6903 | if (TREE_CODE (type) == RECORD_TYPE) | |
6904 | type = promote_type (type); | |
6905 | JDEP_APPLY_PATCH (dep, type); | |
6906 | SOURCE_FRONTEND_DEBUG | |
6907 | (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ? | |
6908 | "Completing fct `%s' with ret type `%s'": | |
6909 | "Completing arg `%s' with type `%s'"), | |
6910 | IDENTIFIER_POINTER (EXPR_WFL_NODE | |
6911 | (JDEP_DECL_WFL (dep))), | |
6912 | IDENTIFIER_POINTER (DECL_NAME (decl)))); | |
6913 | } | |
6914 | else | |
6915 | error_found = 1; | |
6916 | dep = JDEP_CHAIN (dep); | |
6917 | if (JDEP_KIND (dep) == JDEP_METHOD_END) | |
6918 | break; | |
6919 | else | |
6920 | decl = jdep_resolve_class (dep); | |
6921 | } | |
6922 | if (!error_found) | |
6923 | { | |
6924 | tree mdecl = JDEP_DECL (dep), signature; | |
6925 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
6926 | /* Recompute and reset the signature */ | |
6927 | signature = build_java_signature (TREE_TYPE (mdecl)); | |
6928 | set_java_signature (TREE_TYPE (mdecl), signature); | |
6929 | pop_obstacks (); | |
6930 | } | |
6931 | else | |
6932 | continue; | |
6933 | break; | |
6934 | ||
6935 | case JDEP_INTERFACE: | |
6936 | if (parser_check_super_interface (decl, JDEP_DECL (dep), | |
6937 | JDEP_WFL (dep))) | |
6938 | continue; | |
6939 | parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep)); | |
6940 | break; | |
6941 | ||
6942 | case JDEP_PARM: | |
6943 | case JDEP_VARIABLE: | |
6944 | type = TREE_TYPE(decl); | |
6945 | if (TREE_CODE (type) == RECORD_TYPE) | |
6946 | type = promote_type (type); | |
6947 | JDEP_APPLY_PATCH (dep, type); | |
6948 | break; | |
6949 | ||
6950 | case JDEP_TYPE: | |
6951 | JDEP_APPLY_PATCH (dep, TREE_TYPE (decl)); | |
6952 | SOURCE_FRONTEND_DEBUG | |
6953 | (("Completing a random type dependency on a '%s' node", | |
6954 | tree_code_name [TREE_CODE (JDEP_DECL (dep))])); | |
6955 | break; | |
6956 | ||
6957 | case JDEP_EXCEPTION: | |
c877974e APB |
6958 | JDEP_APPLY_PATCH (dep, TREE_TYPE (decl)); |
6959 | SOURCE_FRONTEND_DEBUG | |
6960 | (("Completing `%s' `throws' argument node", | |
6961 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))))); | |
8b27f225 PB |
6962 | break; |
6963 | ||
6964 | default: | |
6965 | fatal ("Can't handle patch code %d - java_complete_class", | |
6966 | JDEP_KIND (dep)); | |
6967 | } | |
6968 | } | |
6969 | } | |
6970 | pop_obstacks (); | |
6971 | return; | |
6972 | } | |
6973 | ||
6974 | /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an | |
6975 | array. */ | |
6976 | ||
6977 | static tree | |
6978 | resolve_class (class_type, decl, cl) | |
6979 | tree class_type, decl, cl; | |
6980 | { | |
49f48c71 KG |
6981 | const char *name = IDENTIFIER_POINTER (TYPE_NAME (class_type)); |
6982 | const char *base = name; | |
78d21f92 PB |
6983 | tree resolved_type = TREE_TYPE (class_type); |
6984 | tree resolved_type_decl; | |
8b27f225 | 6985 | |
78d21f92 PB |
6986 | if (resolved_type != NULL_TREE) |
6987 | { | |
6988 | tree resolved_type_decl = TYPE_NAME (resolved_type); | |
6989 | if (resolved_type_decl == NULL_TREE | |
6990 | || TREE_CODE (resolved_type_decl) == IDENTIFIER_NODE) | |
6991 | { | |
6992 | resolved_type_decl = build_decl (TYPE_DECL, | |
6993 | TYPE_NAME (class_type), | |
6994 | resolved_type); | |
6995 | } | |
6996 | return resolved_type_decl; | |
6997 | } | |
6998 | ||
8b27f225 PB |
6999 | /* 1- Check to see if we have an array. If true, find what we really |
7000 | want to resolve */ | |
7001 | while (name[0] == '[') | |
7002 | name++; | |
7003 | if (base != name) | |
7004 | TYPE_NAME (class_type) = get_identifier (name); | |
7005 | ||
7006 | /* 2- Resolve the bare type */ | |
7007 | if (!(resolved_type_decl = do_resolve_class (class_type, decl, cl))) | |
7008 | return NULL_TREE; | |
7009 | resolved_type = TREE_TYPE (resolved_type_decl); | |
7010 | ||
7011 | /* 3- If we have and array, reconstruct the array down to its nesting */ | |
7012 | if (base != name) | |
7013 | { | |
7014 | while (base != name) | |
7015 | { | |
7016 | if (TREE_CODE (resolved_type) == RECORD_TYPE) | |
7017 | resolved_type = promote_type (resolved_type); | |
7018 | resolved_type = build_java_array_type (resolved_type, -1); | |
7019 | CLASS_LOADED_P (resolved_type) = 1; | |
7020 | name--; | |
7021 | } | |
7022 | /* Build a fake decl for this, since this is what is expected to | |
7023 | be returned. */ | |
7024 | resolved_type_decl = | |
7025 | build_decl (TYPE_DECL, TYPE_NAME (resolved_type), resolved_type); | |
7026 | /* Figure how those two things are important for error report. FIXME */ | |
7027 | DECL_SOURCE_LINE (resolved_type_decl) = 0; | |
7028 | DECL_SOURCE_FILE (resolved_type_decl) = input_filename; | |
78d21f92 | 7029 | TYPE_NAME (class_type) = TYPE_NAME (resolved_type); |
8b27f225 | 7030 | } |
78d21f92 | 7031 | TREE_TYPE (class_type) = resolved_type; |
8b27f225 PB |
7032 | return resolved_type_decl; |
7033 | } | |
7034 | ||
7035 | /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL | |
7036 | are used to report error messages. */ | |
7037 | ||
78d21f92 | 7038 | tree |
8b27f225 PB |
7039 | do_resolve_class (class_type, decl, cl) |
7040 | tree class_type; | |
7041 | tree decl; | |
7042 | tree cl; | |
7043 | { | |
7044 | tree new_class_decl; | |
7045 | tree original_name = NULL_TREE; | |
7046 | ||
7047 | /* Do not try to replace TYPE_NAME (class_type) by a variable, since | |
7048 | its is changed by find_in_imports{_on_demand} */ | |
7049 | ||
7050 | /* 1- Check for the type in single imports */ | |
7051 | if (find_in_imports (class_type)) | |
7052 | return NULL_TREE; | |
7053 | ||
7054 | /* 2- And check for the type in the current compilation unit. If it fails, | |
ee07f4f4 | 7055 | try with a name qualified with the package name we've seen so far */ |
8b27f225 PB |
7056 | if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) |
7057 | { | |
7058 | if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && | |
7059 | !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl))) | |
7060 | load_class (TYPE_NAME (class_type), 0); | |
7061 | return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); | |
7062 | } | |
7063 | ||
7064 | original_name = TYPE_NAME (class_type); | |
ee07f4f4 | 7065 | if (!QUALIFIED_P (TYPE_NAME (class_type))) |
bc3ca41b | 7066 | { |
ee07f4f4 APB |
7067 | tree package; |
7068 | for (package = package_list; package; package = TREE_CHAIN (package)) | |
bc3ca41b | 7069 | { |
ee07f4f4 APB |
7070 | tree new_qualified; |
7071 | ||
7072 | new_qualified = merge_qualified_name (TREE_PURPOSE (package), | |
7073 | original_name); | |
7074 | TYPE_NAME (class_type) = new_qualified; | |
7075 | new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); | |
7076 | if (!new_class_decl) | |
7077 | load_class (TYPE_NAME (class_type), 0); | |
7078 | new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); | |
7079 | if (new_class_decl) | |
7080 | { | |
7081 | if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && | |
7082 | !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl))) | |
7083 | load_class (TYPE_NAME (class_type), 0); | |
7084 | return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); | |
7085 | } | |
bc3ca41b PB |
7086 | } |
7087 | } | |
8b27f225 PB |
7088 | TYPE_NAME (class_type) = original_name; |
7089 | ||
7090 | /* 3- Check an other compilation unit that bears the name of type */ | |
7091 | load_class (TYPE_NAME (class_type), 0); | |
7092 | if (check_pkg_class_access (TYPE_NAME (class_type), | |
7093 | (cl ? cl : lookup_cl (decl)))) | |
7094 | return NULL_TREE; | |
7095 | ||
7096 | if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) | |
7097 | return new_class_decl; | |
7098 | ||
7099 | /* 4- Check the import on demands. Don't allow bar.baz to be | |
7100 | imported from foo.* */ | |
7101 | if (!QUALIFIED_P (TYPE_NAME (class_type))) | |
7102 | if (find_in_imports_on_demand (class_type)) | |
7103 | return NULL_TREE; | |
7104 | ||
7105 | /* 5- Last call for a resolution */ | |
7106 | return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); | |
7107 | } | |
7108 | ||
7109 | /* Resolve NAME and lay it out (if not done and if not the current | |
23a79c61 APB |
7110 | parsed class). Return a decl node. This function is meant to be |
7111 | called when type resolution is necessary during the walk pass. */ | |
8b27f225 PB |
7112 | |
7113 | static tree | |
c877974e APB |
7114 | resolve_and_layout (something, cl) |
7115 | tree something; | |
8b27f225 PB |
7116 | tree cl; |
7117 | { | |
c877974e APB |
7118 | tree decl; |
7119 | ||
23a79c61 APB |
7120 | /* Don't do that on the current class */ |
7121 | if (something == current_class) | |
7122 | return TYPE_NAME (current_class); | |
c877974e | 7123 | |
23a79c61 | 7124 | /* Don't do anything for void and other primitive types */ |
c877974e APB |
7125 | if (JPRIMITIVE_TYPE_P (something) || something == void_type_node) |
7126 | return NULL_TREE; | |
7127 | ||
23a79c61 APB |
7128 | /* Pointer types can be reall pointer types or fake pointers. When |
7129 | finding a real pointer, recheck for primitive types */ | |
7130 | if (TREE_CODE (something) == POINTER_TYPE) | |
7131 | { | |
7132 | if (TREE_TYPE (something)) | |
7133 | { | |
7134 | something = TREE_TYPE (something); | |
7135 | if (JPRIMITIVE_TYPE_P (something) || something == void_type_node) | |
7136 | return NULL_TREE; | |
7137 | } | |
7138 | else | |
7139 | something = TYPE_NAME (something); | |
7140 | } | |
7141 | ||
7142 | /* Don't do anything for arrays of primitive types */ | |
7143 | if (TREE_CODE (something) == RECORD_TYPE && TYPE_ARRAY_P (something) | |
7144 | && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something))) | |
7145 | return NULL_TREE; | |
7146 | ||
7147 | /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL | |
7148 | or a real TYPE */ | |
c877974e APB |
7149 | if (TREE_CODE (something) != IDENTIFIER_NODE) |
7150 | something = (TREE_CODE (TYPE_NAME (something)) == TYPE_DECL ? | |
7151 | DECL_NAME (TYPE_NAME (something)) : TYPE_NAME (something)); | |
7152 | ||
23a79c61 APB |
7153 | if (!(decl = resolve_no_layout (something, cl))) |
7154 | return NULL_TREE; | |
7155 | ||
7156 | /* Resolve and layout if necessary */ | |
7157 | layout_class_methods (TREE_TYPE (decl)); | |
7705e9db APB |
7158 | /* Check methods, but only once */ |
7159 | if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) | |
7160 | && !CLASS_LOADED_P (TREE_TYPE (decl))) | |
23a79c61 APB |
7161 | CHECK_METHODS (decl); |
7162 | if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl))) | |
8b27f225 | 7163 | safe_layout_class (TREE_TYPE (decl)); |
23a79c61 | 7164 | |
8b27f225 PB |
7165 | return decl; |
7166 | } | |
7167 | ||
7168 | /* Resolve a class, returns its decl but doesn't perform any | |
7169 | layout. The current parsing context is saved and restored */ | |
7170 | ||
7171 | static tree | |
7172 | resolve_no_layout (name, cl) | |
7173 | tree name, cl; | |
7174 | { | |
7175 | tree ptr, decl; | |
7176 | BUILD_PTR_FROM_NAME (ptr, name); | |
7177 | java_parser_context_save_global (); | |
7178 | decl = resolve_class (ptr, NULL_TREE, cl); | |
7179 | java_parser_context_restore_global (); | |
7180 | ||
7181 | return decl; | |
7182 | } | |
7183 | ||
23a79c61 | 7184 | /* Called when reporting errors. Skip leader '[' in a complex array |
82371d41 | 7185 | type description that failed to be resolved. */ |
8b27f225 | 7186 | |
49f48c71 | 7187 | static const char * |
8b27f225 | 7188 | purify_type_name (name) |
49f48c71 | 7189 | const char *name; |
8b27f225 PB |
7190 | { |
7191 | while (*name && *name == '[') | |
7192 | name++; | |
7193 | return name; | |
7194 | } | |
7195 | ||
7196 | /* The type CURRENT refers to can't be found. We print error messages. */ | |
7197 | ||
7198 | static void | |
7199 | complete_class_report_errors (dep) | |
7200 | jdep *dep; | |
7201 | { | |
49f48c71 | 7202 | const char *name; |
23a79c61 APB |
7203 | |
7204 | if (!JDEP_WFL (dep)) | |
7205 | return; | |
7206 | ||
7207 | name = IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))); | |
8b27f225 PB |
7208 | switch (JDEP_KIND (dep)) |
7209 | { | |
7210 | case JDEP_SUPER: | |
7211 | parse_error_context | |
7212 | (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found", | |
23a79c61 | 7213 | purify_type_name (name), |
8b27f225 PB |
7214 | IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); |
7215 | break; | |
7216 | case JDEP_FIELD: | |
7217 | parse_error_context | |
7218 | (JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'", | |
23a79c61 | 7219 | purify_type_name (name), |
8b27f225 PB |
7220 | IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); |
7221 | break; | |
7222 | case JDEP_METHOD: /* Covers arguments */ | |
7223 | parse_error_context | |
781b0558 | 7224 | (JDEP_WFL (dep), "Type `%s' not found in the declaration of the argument `%s' of method `%s'", |
23a79c61 | 7225 | purify_type_name (name), |
8b27f225 PB |
7226 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))), |
7227 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep)))); | |
7228 | break; | |
7229 | case JDEP_METHOD_RETURN: /* Covers return type */ | |
7230 | parse_error_context | |
781b0558 | 7231 | (JDEP_WFL (dep), "Type `%s' not found in the declaration of the return type of method `%s'", |
23a79c61 | 7232 | purify_type_name (name), |
8b27f225 PB |
7233 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep)))); |
7234 | break; | |
7235 | case JDEP_INTERFACE: | |
7236 | parse_error_context | |
7237 | (JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found", | |
7238 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))), | |
7239 | (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")), | |
7240 | IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); | |
7241 | break; | |
7242 | case JDEP_VARIABLE: | |
7243 | parse_error_context | |
781b0558 | 7244 | (JDEP_WFL (dep), "Type `%s' not found in the declaration of the local variable `%s'", |
8b27f225 PB |
7245 | purify_type_name (IDENTIFIER_POINTER |
7246 | (EXPR_WFL_NODE (JDEP_WFL (dep)))), | |
7247 | IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); | |
7248 | break; | |
7249 | case JDEP_EXCEPTION: /* As specified by `throws' */ | |
7250 | parse_error_context | |
7251 | (JDEP_WFL (dep), "Class `%s' not found in `throws'", | |
7252 | IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))); | |
7253 | break; | |
7254 | default: | |
7255 | /* Fix for -Wall. Just break doing nothing. The error will be | |
7256 | caught later */ | |
7257 | break; | |
7258 | } | |
7259 | } | |
7260 | ||
7261 | /* Check uninitialized final. */ | |
7262 | ||
7263 | void | |
7264 | java_check_final () | |
7265 | { | |
7266 | } | |
7267 | ||
22eed1e6 APB |
7268 | /* Return a static string containing the DECL prototype string. If |
7269 | DECL is a constructor, use the class name instead of the form | |
7270 | <init> */ | |
7271 | ||
49f48c71 | 7272 | static const char * |
22eed1e6 APB |
7273 | get_printable_method_name (decl) |
7274 | tree decl; | |
7275 | { | |
49f48c71 | 7276 | const char *to_return; |
9ee9b555 | 7277 | tree name = NULL_TREE; |
22eed1e6 APB |
7278 | |
7279 | if (DECL_CONSTRUCTOR_P (decl)) | |
7280 | { | |
7281 | name = DECL_NAME (decl); | |
5e942c50 | 7282 | DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))); |
22eed1e6 APB |
7283 | } |
7284 | ||
7285 | to_return = lang_printable_name (decl, 0); | |
7286 | if (DECL_CONSTRUCTOR_P (decl)) | |
7287 | DECL_NAME (decl) = name; | |
7288 | ||
7289 | return to_return; | |
7290 | } | |
7291 | ||
5e942c50 APB |
7292 | /* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method |
7293 | nevertheless needs to be verfied, 1 otherwise. */ | |
7294 | ||
7295 | static int | |
7296 | reset_method_name (method) | |
7297 | tree method; | |
7298 | { | |
7f1d4866 | 7299 | if (!IS_CLINIT (method) && DECL_NAME (method) != finit_identifier_node) |
5e942c50 APB |
7300 | { |
7301 | /* NAME is just the plain name when Object is being defined */ | |
7302 | if (DECL_CONTEXT (method) != object_type_node) | |
c877974e APB |
7303 | DECL_NAME (method) = (DECL_CONSTRUCTOR_P (method) ? |
7304 | init_identifier_node : GET_METHOD_NAME (method)); | |
5e942c50 APB |
7305 | return 0; |
7306 | } | |
7307 | else | |
7308 | return 1; | |
7309 | } | |
7310 | ||
c877974e APB |
7311 | /* Return the name of METHOD_DECL, when DECL_NAME is a WFL */ |
7312 | ||
7313 | tree | |
7314 | java_get_real_method_name (method_decl) | |
7315 | tree method_decl; | |
7316 | { | |
7317 | tree method_name = DECL_NAME (method_decl); | |
7318 | if (DECL_CONSTRUCTOR_P (method_decl)) | |
7319 | return init_identifier_node; | |
82371d41 APB |
7320 | |
7321 | /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P | |
7322 | and still can be a constructor. FIXME */ | |
7323 | ||
23a79c61 APB |
7324 | /* Don't confuse method only bearing the name of their class as |
7325 | constructors */ | |
82371d41 APB |
7326 | else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl)) |
7327 | && ctxp | |
7328 | && ctxp->current_parsed_class_un == EXPR_WFL_NODE (method_name) | |
23a79c61 APB |
7329 | && get_access_flags_from_decl (method_decl) <= ACC_PROTECTED |
7330 | && TREE_TYPE (TREE_TYPE (method_decl)) == void_type_node) | |
c877974e APB |
7331 | return init_identifier_node; |
7332 | else | |
7333 | return EXPR_WFL_NODE (method_name); | |
7334 | } | |
7335 | ||
22eed1e6 APB |
7336 | /* Track method being redefined inside the same class. As a side |
7337 | effect, set DECL_NAME to an IDENTIFIER (prior entering this | |
d77613be | 7338 | function it's a FWL, so we can track errors more accurately.) */ |
22eed1e6 | 7339 | |
8b27f225 PB |
7340 | static int |
7341 | check_method_redefinition (class, method) | |
7342 | tree class, method; | |
7343 | { | |
7344 | tree redef, name; | |
7345 | tree cl = DECL_NAME (method); | |
c3f2a476 | 7346 | tree sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method)); |
ba179f9f APB |
7347 | /* decl name of artificial <clinit> and $finit$ doesn't need to be |
7348 | fixed and checked */ | |
5e942c50 APB |
7349 | |
7350 | /* Reset the method name before running the check. If it returns 1, | |
7351 | the method doesn't need to be verified with respect to method | |
7352 | redeclaration and we return 0 */ | |
7353 | if (reset_method_name (method)) | |
8b27f225 | 7354 | return 0; |
5e942c50 APB |
7355 | |
7356 | name = DECL_NAME (method); | |
8b27f225 PB |
7357 | for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef)) |
7358 | { | |
c3f2a476 | 7359 | if (redef == method) |
8b27f225 | 7360 | break; |
c3f2a476 APB |
7361 | if (DECL_NAME (redef) == name |
7362 | && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef))) | |
8b27f225 | 7363 | { |
22eed1e6 APB |
7364 | parse_error_context |
7365 | (cl, "Duplicate %s declaration `%s'", | |
7366 | (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"), | |
7367 | get_printable_method_name (redef)); | |
8b27f225 PB |
7368 | return 1; |
7369 | } | |
7370 | } | |
7371 | return 0; | |
7372 | } | |
7373 | ||
d77613be APB |
7374 | static void |
7375 | check_abstract_method_definitions (do_interface, class_decl, type) | |
7376 | int do_interface; | |
7377 | tree class_decl, type; | |
7378 | { | |
7379 | tree class = TREE_TYPE (class_decl); | |
7380 | tree method, end_type; | |
7381 | ||
7382 | end_type = (do_interface ? object_type_node : type); | |
7383 | for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method)) | |
7384 | { | |
7385 | tree other_super, other_method, method_sig, method_name; | |
7386 | int found = 0; | |
7387 | ||
7388 | if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method)) | |
7389 | continue; | |
7390 | ||
7391 | /* Now verify that somewhere in between TYPE and CLASS, | |
7392 | abstract method METHOD gets a non abstract definition | |
7393 | that is inherited by CLASS. */ | |
7394 | ||
7395 | method_sig = build_java_signature (TREE_TYPE (method)); | |
7396 | method_name = DECL_NAME (method); | |
7397 | if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION) | |
7398 | method_name = EXPR_WFL_NODE (method_name); | |
7399 | ||
7400 | for (other_super = class; other_super != end_type; | |
7401 | other_super = CLASSTYPE_SUPER (other_super)) | |
7402 | { | |
7403 | for (other_method = TYPE_METHODS (other_super); other_method; | |
7404 | other_method = TREE_CHAIN (other_method)) | |
7405 | { | |
7406 | tree s = build_java_signature (TREE_TYPE (other_method)); | |
7407 | tree other_name = DECL_NAME (other_method); | |
7408 | ||
7409 | if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION) | |
7410 | other_name = EXPR_WFL_NODE (other_name); | |
7411 | if (!IS_CLINIT (other_method) | |
7412 | && !DECL_CONSTRUCTOR_P (other_method) | |
7413 | && method_name == other_name && method_sig == s) | |
7414 | { | |
7415 | found = 1; | |
7416 | break; | |
7417 | } | |
7418 | } | |
7419 | } | |
7420 | ||
7421 | /* Report that abstract METHOD didn't find an implementation | |
7422 | that CLASS can use. */ | |
7423 | if (!found) | |
7424 | { | |
c2e3db92 | 7425 | char *t = xstrdup (lang_printable_name |
d77613be APB |
7426 | (TREE_TYPE (TREE_TYPE (method)), 0)); |
7427 | tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method))); | |
7428 | tree saved_wfl = NULL_TREE; | |
7429 | ||
7430 | if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION) | |
7431 | { | |
7432 | saved_wfl = DECL_NAME (method); | |
7433 | DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method)); | |
7434 | } | |
7435 | ||
7436 | parse_error_context | |
7437 | (lookup_cl (class_decl), | |
781b0558 | 7438 | "Class `%s' doesn't define the abstract method `%s %s' from %s `%s'. This method must be defined or %s `%s' must be declared abstract", |
d77613be APB |
7439 | IDENTIFIER_POINTER (DECL_NAME (class_decl)), |
7440 | t, lang_printable_name (method, 0), | |
7441 | (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ? | |
7442 | "interface" : "class"), | |
7443 | IDENTIFIER_POINTER (ccn), | |
7444 | (CLASS_INTERFACE (class_decl) ? "interface" : "class"), | |
7445 | IDENTIFIER_POINTER (DECL_NAME (class_decl))); | |
7446 | ||
7447 | free (t); | |
7448 | ||
7449 | if (saved_wfl) | |
7450 | DECL_NAME (method) = saved_wfl; | |
7451 | } | |
7452 | } | |
7453 | } | |
7454 | ||
518f173d | 7455 | /* Check that CLASS_DECL somehow implements all inherited abstract |
d77613be APB |
7456 | methods. */ |
7457 | ||
7458 | static void | |
7459 | java_check_abstract_method_definitions (class_decl) | |
7460 | tree class_decl; | |
7461 | { | |
7462 | tree class = TREE_TYPE (class_decl); | |
7463 | tree super, vector; | |
7464 | int i; | |
7465 | ||
7466 | if (CLASS_ABSTRACT (class_decl)) | |
7467 | return; | |
7468 | ||
7469 | /* Check for inherited types */ | |
7470 | for (super = CLASSTYPE_SUPER (class); super != object_type_node; | |
7471 | super = CLASSTYPE_SUPER (super)) | |
7472 | { | |
7473 | if (!CLASS_ABSTRACT (TYPE_NAME (super))) | |
7474 | continue; | |
7475 | ||
7476 | check_abstract_method_definitions (0, class_decl, super); | |
7477 | } | |
7478 | ||
7479 | /* Check for implemented interfaces. */ | |
7480 | vector = TYPE_BINFO_BASETYPES (class); | |
7481 | for (i = 1; i < TREE_VEC_LENGTH (vector); i++) | |
7482 | { | |
7483 | super = BINFO_TYPE (TREE_VEC_ELT (vector, i)); | |
7484 | check_abstract_method_definitions (1, class_decl, super); | |
7485 | } | |
7486 | } | |
7487 | ||
7488 | /* Check all the methods of CLASS_DECL. Methods are first completed | |
7489 | then checked according to regular method existance rules. If no | |
7490 | constructor for CLASS_DECL were encountered, then build its | |
7491 | declaration. */ | |
8b27f225 PB |
7492 | |
7493 | static void | |
7494 | java_check_regular_methods (class_decl) | |
7495 | tree class_decl; | |
7496 | { | |
5e942c50 | 7497 | int saw_constructor = 0; |
8b27f225 PB |
7498 | tree method; |
7499 | tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl)); | |
5e942c50 | 7500 | tree saved_found_wfl = NULL_TREE, found = NULL_TREE; |
c877974e APB |
7501 | tree mthrows; |
7502 | ||
7503 | /* It is not necessary to check methods defined in java.lang.Object */ | |
7504 | if (class == object_type_node) | |
7505 | return; | |
8b27f225 | 7506 | |
23a79c61 APB |
7507 | if (!TYPE_NVIRTUALS (class)) |
7508 | TYPE_METHODS (class) = nreverse (TYPE_METHODS (class)); | |
8b27f225 PB |
7509 | |
7510 | /* Should take interfaces into account. FIXME */ | |
7511 | for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method)) | |
7512 | { | |
5e942c50 | 7513 | tree sig; |
8b27f225 PB |
7514 | tree method_wfl = DECL_NAME (method); |
7515 | int aflags; | |
7516 | ||
5e942c50 APB |
7517 | /* If we previously found something and its name was saved, |
7518 | reinstall it now */ | |
7519 | if (found && saved_found_wfl) | |
ba179f9f APB |
7520 | { |
7521 | DECL_NAME (found) = saved_found_wfl; | |
7522 | saved_found_wfl = NULL_TREE; | |
7523 | } | |
5e942c50 | 7524 | |
8b27f225 PB |
7525 | /* Check for redefinitions */ |
7526 | if (check_method_redefinition (class, method)) | |
7527 | continue; | |
7528 | ||
22eed1e6 APB |
7529 | /* If we see one constructor a mark so we don't generate the |
7530 | default one. Also skip other verifications: constructors | |
7531 | can't be inherited hence hiden or overriden */ | |
7532 | if (DECL_CONSTRUCTOR_P (method)) | |
7533 | { | |
7534 | saw_constructor = 1; | |
7535 | continue; | |
7536 | } | |
7537 | ||
c877974e APB |
7538 | /* We verify things thrown by the method. They must inherits from |
7539 | java.lang.Throwable */ | |
7540 | for (mthrows = DECL_FUNCTION_THROWS (method); | |
7541 | mthrows; mthrows = TREE_CHAIN (mthrows)) | |
7542 | { | |
7543 | if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node)) | |
7544 | parse_error_context | |
781b0558 | 7545 | (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be a subclass of class `java.lang.Throwable'", |
c877974e APB |
7546 | IDENTIFIER_POINTER |
7547 | (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows))))); | |
7548 | } | |
7549 | ||
8b27f225 | 7550 | sig = build_java_argument_signature (TREE_TYPE (method)); |
518f173d | 7551 | found = lookup_argument_method2 (class, DECL_NAME (method), sig); |
8b27f225 | 7552 | |
5e942c50 | 7553 | /* Nothing overrides or it's a private method. */ |
aabd7048 | 7554 | if (!found) |
5e942c50 | 7555 | continue; |
aabd7048 PB |
7556 | if (METHOD_PRIVATE (found)) |
7557 | { | |
7558 | found = NULL_TREE; | |
7559 | continue; | |
7560 | } | |
5e942c50 APB |
7561 | |
7562 | /* If found wasn't verified, it's DECL_NAME won't be set properly. | |
7563 | We set it temporarily for the sake of the error report. */ | |
7564 | saved_found_wfl = DECL_NAME (found); | |
7565 | reset_method_name (found); | |
7566 | ||
518f173d APB |
7567 | /* If `found' is declared in an interface, make sure the |
7568 | modifier matches. */ | |
7569 | if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found))) | |
7570 | && clinit_identifier_node != DECL_NAME (found) | |
7571 | && !METHOD_PUBLIC (method)) | |
7572 | { | |
7573 | tree found_decl = TYPE_NAME (DECL_CONTEXT (found)); | |
7574 | parse_error_context (method_wfl, "Class `%s' must override `%s' with a public method in order to implement interface `%s'", | |
7575 | IDENTIFIER_POINTER (DECL_NAME (class_decl)), | |
7576 | lang_printable_name (method, 0), | |
7577 | IDENTIFIER_POINTER (DECL_NAME (found_decl))); | |
7578 | } | |
7579 | ||
8b27f225 PB |
7580 | /* Can't override a method with the same name and different return |
7581 | types. */ | |
7582 | if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method))) | |
7583 | { | |
518f173d APB |
7584 | char *t = xstrdup |
7585 | (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0)); | |
8b27f225 | 7586 | parse_error_context |
7f10c2e2 | 7587 | (method_wfl, |
8b27f225 PB |
7588 | "Method `%s' was defined with return type `%s' in class `%s'", |
7589 | lang_printable_name (found, 0), t, | |
7590 | IDENTIFIER_POINTER | |
7591 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7592 | free (t); | |
7593 | } | |
7594 | ||
7f10c2e2 APB |
7595 | aflags = get_access_flags_from_decl (found); |
7596 | /* If the method has default, access in an other package, then | |
7597 | issue a warning that the current method doesn't override the | |
7598 | one that was found elsewhere. Do not issue this warning when | |
7599 | the match was found in java.lang.Object. */ | |
7600 | if (DECL_CONTEXT (found) != object_type_node | |
a003f638 | 7601 | && ((aflags & ACC_VISIBILITY) == 0) |
7f10c2e2 | 7602 | && !class_in_current_package (DECL_CONTEXT (found)) |
1fb89a4d | 7603 | && DECL_NAME (found) != clinit_identifier_node |
7f10c2e2 APB |
7604 | && flag_not_overriding) |
7605 | { | |
7606 | parse_warning_context | |
781b0558 | 7607 | (method_wfl, "Method `%s' in class `%s' does not override the corresponding method in class `%s', which is private to a different package", |
7f10c2e2 APB |
7608 | lang_printable_name (found, 0), |
7609 | IDENTIFIER_POINTER (DECL_NAME (class_decl)), | |
7610 | IDENTIFIER_POINTER (DECL_NAME | |
7611 | (TYPE_NAME (DECL_CONTEXT (found))))); | |
7612 | continue; | |
7613 | } | |
7614 | ||
8b27f225 PB |
7615 | /* Can't override final. Can't override static. */ |
7616 | if (METHOD_FINAL (found) || METHOD_STATIC (found)) | |
7617 | { | |
7618 | /* Static *can* override static */ | |
7619 | if (METHOD_STATIC (found) && METHOD_STATIC (method)) | |
7620 | continue; | |
7621 | parse_error_context | |
7622 | (method_wfl, | |
7623 | "%s methods can't be overriden. Method `%s' is %s in class `%s'", | |
7624 | (METHOD_FINAL (found) ? "Final" : "Static"), | |
7625 | lang_printable_name (found, 0), | |
7626 | (METHOD_FINAL (found) ? "final" : "static"), | |
7627 | IDENTIFIER_POINTER | |
7628 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7629 | continue; | |
7630 | } | |
7f10c2e2 | 7631 | |
8b27f225 PB |
7632 | /* Static method can't override instance method. */ |
7633 | if (METHOD_STATIC (method)) | |
7634 | { | |
7635 | parse_error_context | |
7636 | (method_wfl, | |
781b0558 | 7637 | "Instance methods can't be overriden by a static method. Method `%s' is an instance method in class `%s'", |
8b27f225 PB |
7638 | lang_printable_name (found, 0), |
7639 | IDENTIFIER_POINTER | |
7640 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7641 | continue; | |
7642 | } | |
5e942c50 | 7643 | |
5e942c50 APB |
7644 | /* - Overriding/hiding public must be public |
7645 | - Overriding/hiding protected must be protected or public | |
7646 | - If the overriden or hidden method has default (package) | |
7647 | access, then the overriding or hiding method must not be | |
518f173d APB |
7648 | private; otherwise, a compile-time error occurs. If |
7649 | `found' belongs to an interface, things have been already | |
7650 | taken care of. */ | |
7651 | if (!CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found))) | |
7652 | && ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method)) | |
7653 | || (METHOD_PROTECTED (found) | |
7654 | && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method))) | |
7655 | || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC)) | |
7656 | && METHOD_PRIVATE (method)))) | |
8b27f225 PB |
7657 | { |
7658 | parse_error_context | |
7659 | (method_wfl, | |
781b0558 | 7660 | "Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 0), |
5e942c50 APB |
7661 | (METHOD_PUBLIC (method) ? "public" : |
7662 | (METHOD_PRIVATE (method) ? "private" : "protected")), | |
7663 | IDENTIFIER_POINTER (DECL_NAME | |
7664 | (TYPE_NAME (DECL_CONTEXT (found))))); | |
8b27f225 PB |
7665 | continue; |
7666 | } | |
7667 | ||
7668 | /* Overriding methods must have compatible `throws' clauses on checked | |
7669 | exceptions, if any */ | |
7670 | check_throws_clauses (method, method_wfl, found); | |
7671 | ||
8b27f225 PB |
7672 | /* Inheriting multiple methods with the same signature. FIXME */ |
7673 | } | |
7674 | ||
5e942c50 APB |
7675 | /* Don't forget eventual pending found and saved_found_wfl. Take |
7676 | into account that we might have exited because we saw an | |
d77613be | 7677 | artificial method as the last entry. */ |
5e942c50 APB |
7678 | |
7679 | if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl) | |
7680 | DECL_NAME (found) = saved_found_wfl; | |
7681 | ||
23a79c61 APB |
7682 | if (!TYPE_NVIRTUALS (class)) |
7683 | TYPE_METHODS (class) = nreverse (TYPE_METHODS (class)); | |
8b27f225 | 7684 | |
d77613be APB |
7685 | /* Search for inherited abstract method not yet implemented in this |
7686 | class. */ | |
7687 | java_check_abstract_method_definitions (class_decl); | |
7688 | ||
22eed1e6 | 7689 | if (!saw_constructor) |
781b0558 | 7690 | fatal ("No constructor found"); |
8b27f225 PB |
7691 | } |
7692 | ||
7693 | /* Return a non zero value if the `throws' clause of METHOD (if any) | |
7694 | is incompatible with the `throws' clause of FOUND (if any). */ | |
7695 | ||
7696 | static void | |
7697 | check_throws_clauses (method, method_wfl, found) | |
7698 | tree method, method_wfl, found; | |
7699 | { | |
7700 | tree mthrows, fthrows; | |
7701 | ||
c877974e APB |
7702 | /* Can't check these things with class loaded from bytecode. FIXME */ |
7703 | if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found))) | |
7704 | return; | |
7705 | ||
8b27f225 PB |
7706 | for (mthrows = DECL_FUNCTION_THROWS (method); |
7707 | mthrows; mthrows = TREE_CHAIN (mthrows)) | |
7708 | { | |
7709 | /* We don't verify unchecked expressions */ | |
c877974e | 7710 | if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows))) |
8b27f225 PB |
7711 | continue; |
7712 | /* Checked expression must be compatible */ | |
7713 | for (fthrows = DECL_FUNCTION_THROWS (found); | |
7714 | fthrows; fthrows = TREE_CHAIN (fthrows)) | |
7715 | if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows))) | |
7716 | break; | |
7717 | if (!fthrows) | |
7718 | { | |
7719 | parse_error_context | |
781b0558 | 7720 | (method_wfl, "Invalid checked exception class `%s' in `throws' clause. The exception must be a subclass of an exception thrown by `%s' from class `%s'", |
8b27f225 PB |
7721 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))), |
7722 | lang_printable_name (found, 0), | |
7723 | IDENTIFIER_POINTER | |
7724 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7725 | } | |
7726 | } | |
7727 | } | |
7728 | ||
7729 | /* Check abstract method of interface INTERFACE */ | |
7730 | ||
7731 | static void | |
5e942c50 APB |
7732 | java_check_abstract_methods (interface_decl) |
7733 | tree interface_decl; | |
8b27f225 PB |
7734 | { |
7735 | int i, n; | |
7736 | tree method, basetype_vec, found; | |
5e942c50 | 7737 | tree interface = TREE_TYPE (interface_decl); |
8b27f225 PB |
7738 | |
7739 | for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method)) | |
7740 | { | |
7741 | tree method_wfl = DECL_NAME (method); | |
7742 | ||
7743 | /* 2- Check for double definition inside the defining interface */ | |
7744 | if (check_method_redefinition (interface, method)) | |
7745 | continue; | |
7746 | ||
7747 | /* 3- Overriding is OK as far as we preserve the return type and | |
7748 | the thrown exceptions (FIXME) */ | |
7749 | found = lookup_java_interface_method2 (interface, method); | |
7750 | if (found) | |
7751 | { | |
5e942c50 APB |
7752 | char *t; |
7753 | tree saved_found_wfl = DECL_NAME (found); | |
7754 | reset_method_name (found); | |
c2e3db92 | 7755 | t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0)); |
8b27f225 PB |
7756 | parse_error_context |
7757 | (method_wfl, | |
5e942c50 | 7758 | "Method `%s' was defined with return type `%s' in class `%s'", |
8b27f225 PB |
7759 | lang_printable_name (found, 0), t, |
7760 | IDENTIFIER_POINTER | |
7761 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7762 | free (t); | |
5e942c50 | 7763 | DECL_NAME (found) = saved_found_wfl; |
c63b98cd | 7764 | continue; |
8b27f225 PB |
7765 | } |
7766 | } | |
7767 | ||
7768 | /* 4- Inherited methods can't differ by their returned types */ | |
7769 | if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface))) | |
7770 | return; | |
7771 | n = TREE_VEC_LENGTH (basetype_vec); | |
7772 | for (i = 0; i < n; i++) | |
7773 | { | |
7774 | tree sub_interface_method, sub_interface; | |
7775 | tree vec_elt = TREE_VEC_ELT (basetype_vec, i); | |
7776 | if (!vec_elt) | |
7777 | continue; | |
7778 | sub_interface = BINFO_TYPE (vec_elt); | |
7779 | for (sub_interface_method = TYPE_METHODS (sub_interface); | |
7780 | sub_interface_method; | |
7781 | sub_interface_method = TREE_CHAIN (sub_interface_method)) | |
7782 | { | |
7783 | found = lookup_java_interface_method2 (interface, | |
7784 | sub_interface_method); | |
7785 | if (found && (found != sub_interface_method)) | |
5e942c50 APB |
7786 | { |
7787 | tree saved_found_wfl = DECL_NAME (found); | |
7788 | reset_method_name (found); | |
7789 | parse_error_context | |
7790 | (lookup_cl (sub_interface_method), | |
781b0558 | 7791 | "Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'", |
5e942c50 APB |
7792 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))), |
7793 | lang_printable_name (found, 0), | |
7794 | IDENTIFIER_POINTER | |
7795 | (DECL_NAME (TYPE_NAME | |
7796 | (DECL_CONTEXT (sub_interface_method)))), | |
7797 | IDENTIFIER_POINTER | |
7798 | (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); | |
7799 | DECL_NAME (found) = saved_found_wfl; | |
7800 | } | |
8b27f225 PB |
7801 | } |
7802 | } | |
7803 | } | |
7804 | ||
8b27f225 PB |
7805 | /* Lookup methods in interfaces using their name and partial |
7806 | signature. Return a matching method only if their types differ. */ | |
7807 | ||
7808 | static tree | |
7809 | lookup_java_interface_method2 (class, method_decl) | |
7810 | tree class, method_decl; | |
7811 | { | |
7812 | int i, n; | |
7813 | tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return; | |
7814 | ||
7815 | if (!basetype_vec) | |
7816 | return NULL_TREE; | |
7817 | ||
7818 | n = TREE_VEC_LENGTH (basetype_vec); | |
7819 | for (i = 0; i < n; i++) | |
7820 | { | |
7821 | tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return; | |
7822 | if ((BINFO_TYPE (vec_elt) != object_type_node) | |
7823 | && (to_return = | |
7824 | lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1))) | |
7825 | return to_return; | |
7826 | } | |
7827 | for (i = 0; i < n; i++) | |
7828 | { | |
7829 | to_return = lookup_java_interface_method2 | |
7830 | (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl); | |
7831 | if (to_return) | |
7832 | return to_return; | |
7833 | } | |
7834 | ||
7835 | return NULL_TREE; | |
7836 | } | |
7837 | ||
7838 | /* Lookup method using their name and partial signature. Return a | |
7839 | matching method only if their types differ. */ | |
7840 | ||
7841 | static tree | |
7842 | lookup_java_method2 (clas, method_decl, do_interface) | |
7843 | tree clas, method_decl; | |
7844 | int do_interface; | |
7845 | { | |
5e942c50 APB |
7846 | tree method, method_signature, method_name, method_type, name; |
7847 | ||
8b27f225 | 7848 | method_signature = build_java_argument_signature (TREE_TYPE (method_decl)); |
5e942c50 APB |
7849 | name = DECL_NAME (method_decl); |
7850 | method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ? | |
7851 | EXPR_WFL_NODE (name) : name); | |
8b27f225 PB |
7852 | method_type = TREE_TYPE (TREE_TYPE (method_decl)); |
7853 | ||
7854 | while (clas != NULL_TREE) | |
7855 | { | |
7856 | for (method = TYPE_METHODS (clas); | |
7857 | method != NULL_TREE; method = TREE_CHAIN (method)) | |
7858 | { | |
7859 | tree method_sig = build_java_argument_signature (TREE_TYPE (method)); | |
5e942c50 APB |
7860 | tree name = DECL_NAME (method); |
7861 | if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ? | |
7862 | EXPR_WFL_NODE (name) : name) == method_name | |
8b27f225 PB |
7863 | && method_sig == method_signature |
7864 | && TREE_TYPE (TREE_TYPE (method)) != method_type) | |
5e942c50 | 7865 | return method; |
8b27f225 PB |
7866 | } |
7867 | clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas)); | |
7868 | } | |
7869 | return NULL_TREE; | |
7870 | } | |
7871 | ||
f441f671 APB |
7872 | /* Return the line that matches DECL line number, and try its best to |
7873 | position the column number. Used during error reports. */ | |
8b27f225 PB |
7874 | |
7875 | static tree | |
7876 | lookup_cl (decl) | |
7877 | tree decl; | |
7878 | { | |
7879 | static tree cl = NULL_TREE; | |
f441f671 | 7880 | char *line, *found; |
8b27f225 PB |
7881 | |
7882 | if (!decl) | |
7883 | return NULL_TREE; | |
7884 | ||
7885 | if (cl == NULL_TREE) | |
7886 | cl = build_expr_wfl (NULL_TREE, NULL, 0, 0); | |
7887 | ||
7888 | EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl)); | |
7889 | EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1); | |
7890 | ||
f441f671 APB |
7891 | line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)), |
7892 | EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl)); | |
7893 | ||
7894 | found = strstr ((const char *)line, | |
7895 | (const char *)IDENTIFIER_POINTER (DECL_NAME (decl))); | |
7896 | if (found) | |
7897 | EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line); | |
7898 | ||
8b27f225 PB |
7899 | return cl; |
7900 | } | |
7901 | ||
7902 | /* Look for a simple name in the single-type import list */ | |
7903 | ||
7904 | static tree | |
7905 | find_name_in_single_imports (name) | |
7906 | tree name; | |
7907 | { | |
7908 | tree node; | |
7909 | ||
7910 | for (node = ctxp->import_list; node; node = TREE_CHAIN (node)) | |
7911 | if (TREE_VALUE (node) == name) | |
7912 | return (EXPR_WFL_NODE (TREE_PURPOSE (node))); | |
7913 | ||
7914 | return NULL_TREE; | |
7915 | } | |
7916 | ||
7917 | /* Process all single-type import. */ | |
7918 | ||
7919 | static int | |
7920 | process_imports () | |
7921 | { | |
7922 | tree import; | |
7923 | int error_found; | |
7924 | ||
7925 | for (import = ctxp->import_list; import; import = TREE_CHAIN (import)) | |
7926 | { | |
7927 | tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import)); | |
7928 | ||
7929 | /* Don't load twice something already defined. */ | |
7930 | if (IDENTIFIER_CLASS_VALUE (to_be_found)) | |
7931 | continue; | |
7932 | QUALIFIED_P (to_be_found) = 1; | |
7933 | load_class (to_be_found, 0); | |
7934 | error_found = | |
7935 | check_pkg_class_access (to_be_found, TREE_PURPOSE (import)); | |
7936 | if (!IDENTIFIER_CLASS_VALUE (to_be_found)) | |
7937 | { | |
7938 | parse_error_context (TREE_PURPOSE (import), | |
7939 | "Class or interface `%s' not found in import", | |
7940 | IDENTIFIER_POINTER (to_be_found)); | |
7941 | return 1; | |
7942 | } | |
7943 | if (error_found) | |
7944 | return 1; | |
7945 | } | |
7946 | return 0; | |
7947 | } | |
7948 | ||
7949 | /* Possibly find a class imported by a single-type import statement. Return | |
7950 | 1 if an error occured, 0 otherwise. */ | |
7951 | ||
7952 | static int | |
7953 | find_in_imports (class_type) | |
7954 | tree class_type; | |
7955 | { | |
7956 | tree import; | |
7957 | ||
7958 | for (import = ctxp->import_list; import; import = TREE_CHAIN (import)) | |
7959 | if (TREE_VALUE (import) == TYPE_NAME (class_type)) | |
7960 | { | |
7961 | TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import)); | |
7962 | QUALIFIED_P (TYPE_NAME (class_type)) = 1; | |
8b27f225 PB |
7963 | } |
7964 | return 0; | |
7965 | } | |
7966 | ||
8b27f225 | 7967 | static int |
63a212ed | 7968 | note_possible_classname (name, len) |
49f48c71 | 7969 | const char *name; |
63a212ed | 7970 | int len; |
8b27f225 | 7971 | { |
63a212ed PB |
7972 | tree node; |
7973 | if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0) | |
7974 | len = len - 5; | |
7975 | else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0) | |
7976 | len = len - 6; | |
8b27f225 | 7977 | else |
63a212ed PB |
7978 | return 0; |
7979 | node = ident_subst (name, len, "", '/', '.', ""); | |
7980 | IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */ | |
fe0e4d76 | 7981 | QUALIFIED_P (node) = strchr (name, '/') ? 1 : 0; |
63a212ed | 7982 | return 1; |
8b27f225 PB |
7983 | } |
7984 | ||
7985 | /* Read a import directory, gathering potential match for further type | |
7986 | references. Indifferently reads a filesystem or a ZIP archive | |
7987 | directory. */ | |
7988 | ||
7989 | static void | |
7990 | read_import_dir (wfl) | |
7991 | tree wfl; | |
7992 | { | |
63a212ed | 7993 | tree package_id = EXPR_WFL_NODE (wfl); |
49f48c71 | 7994 | const char *package_name = IDENTIFIER_POINTER (package_id); |
63a212ed | 7995 | int package_length = IDENTIFIER_LENGTH (package_id); |
8b27f225 | 7996 | DIR *dirp = NULL; |
d8fccff5 | 7997 | JCF *saved_jcf = current_jcf; |
8b27f225 | 7998 | |
63a212ed PB |
7999 | int found = 0; |
8000 | int k; | |
8001 | void *entry; | |
8002 | struct buffer filename[1]; | |
8003 | ||
8b27f225 | 8004 | |
63a212ed PB |
8005 | if (IS_AN_IMPORT_ON_DEMAND_P (package_id)) |
8006 | return; | |
8007 | IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1; | |
8008 | ||
8009 | BUFFER_INIT (filename); | |
8010 | buffer_grow (filename, package_length + 100); | |
8b27f225 | 8011 | |
63a212ed PB |
8012 | for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry)) |
8013 | { | |
49f48c71 | 8014 | const char *entry_name = jcf_path_name (entry); |
63a212ed PB |
8015 | int entry_length = strlen (entry_name); |
8016 | if (jcf_path_is_zipfile (entry)) | |
8017 | { | |
8018 | ZipFile *zipf; | |
8019 | buffer_grow (filename, entry_length); | |
8020 | memcpy (filename->data, entry_name, entry_length - 1); | |
8021 | filename->data[entry_length-1] = '\0'; | |
8022 | zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry)); | |
8023 | if (zipf == NULL) | |
8024 | error ("malformed .zip archive in CLASSPATH: %s", entry_name); | |
8025 | else | |
8026 | { | |
8027 | ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory; | |
8028 | BUFFER_RESET (filename); | |
8029 | for (k = 0; k < package_length; k++) | |
8030 | { | |
8031 | char ch = package_name[k]; | |
8032 | *filename->ptr++ = ch == '.' ? '/' : ch; | |
8033 | } | |
8034 | *filename->ptr++ = '/'; | |
8035 | ||
345137c7 | 8036 | for (k = 0; k < zipf->count; k++, zipd = ZIPDIR_NEXT (zipd)) |
63a212ed | 8037 | { |
49f48c71 | 8038 | const char *current_entry = ZIPDIR_FILENAME (zipd); |
63a212ed PB |
8039 | int current_entry_len = zipd->filename_length; |
8040 | ||
345137c7 TT |
8041 | if (current_entry_len >= BUFFER_LENGTH (filename) |
8042 | && strncmp (filename->data, current_entry, | |
8043 | BUFFER_LENGTH (filename)) != 0) | |
63a212ed | 8044 | continue; |
345137c7 | 8045 | found |= note_possible_classname (current_entry, |
63a212ed PB |
8046 | current_entry_len); |
8047 | } | |
8048 | } | |
8049 | } | |
8050 | else | |
8051 | { | |
8052 | BUFFER_RESET (filename); | |
8053 | buffer_grow (filename, entry_length + package_length + 4); | |
8054 | strcpy (filename->data, entry_name); | |
8055 | filename->ptr = filename->data + entry_length; | |
8056 | for (k = 0; k < package_length; k++) | |
8057 | { | |
8058 | char ch = package_name[k]; | |
8059 | *filename->ptr++ = ch == '.' ? '/' : ch; | |
8060 | } | |
8061 | *filename->ptr = '\0'; | |
8062 | ||
8063 | dirp = opendir (filename->data); | |
8064 | if (dirp == NULL) | |
8065 | continue; | |
8066 | *filename->ptr++ = '/'; | |
8067 | for (;;) | |
8068 | { | |
63a212ed | 8069 | int len; |
49f48c71 | 8070 | const char *d_name; |
63a212ed PB |
8071 | struct dirent *direntp = readdir (dirp); |
8072 | if (!direntp) | |
8073 | break; | |
8074 | d_name = direntp->d_name; | |
8075 | len = strlen (direntp->d_name); | |
8076 | buffer_grow (filename, len+1); | |
8077 | strcpy (filename->ptr, d_name); | |
345137c7 | 8078 | found |= note_possible_classname (filename->data + entry_length, |
63a212ed PB |
8079 | package_length+len+1); |
8080 | } | |
8081 | if (dirp) | |
8082 | closedir (dirp); | |
8083 | } | |
8084 | } | |
8085 | ||
8086 | free (filename->data); | |
8087 | ||
8088 | /* Here we should have a unified way of retrieving an entry, to be | |
8089 | indexed. */ | |
8090 | if (!found) | |
8b27f225 PB |
8091 | { |
8092 | static int first = 1; | |
8093 | if (first) | |
8094 | { | |
781b0558 | 8095 | error ("Can't find default package `%s'. Check the CLASSPATH environment variable and the access to the archives.", package_name); |
8b27f225 PB |
8096 | java_error_count++; |
8097 | first = 0; | |
8098 | } | |
8099 | else | |
63a212ed PB |
8100 | parse_error_context (wfl, "Package `%s' not found in import", |
8101 | package_name); | |
8b27f225 PB |
8102 | current_jcf = saved_jcf; |
8103 | return; | |
8104 | } | |
8b27f225 PB |
8105 | current_jcf = saved_jcf; |
8106 | } | |
8107 | ||
8108 | /* Possibly find a type in the import on demands specified | |
8109 | types. Returns 1 if an error occured, 0 otherwise. Run throught the | |
8110 | entire list, to detected potential double definitions. */ | |
8111 | ||
8112 | static int | |
8113 | find_in_imports_on_demand (class_type) | |
8114 | tree class_type; | |
8115 | { | |
ab3a6dd6 | 8116 | tree node, import, node_to_use = NULL_TREE; |
8b27f225 | 8117 | int seen_once = -1; |
ab3a6dd6 | 8118 | tree cl = NULL_TREE; |
8b27f225 PB |
8119 | |
8120 | for (import = ctxp->import_demand_list; import; import = TREE_CHAIN (import)) | |
8121 | { | |
49f48c71 | 8122 | const char *id_name; |
8b27f225 PB |
8123 | obstack_grow (&temporary_obstack, |
8124 | IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))), | |
8125 | IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import)))); | |
63a212ed | 8126 | obstack_1grow (&temporary_obstack, '.'); |
8b27f225 PB |
8127 | obstack_grow0 (&temporary_obstack, |
8128 | IDENTIFIER_POINTER (TYPE_NAME (class_type)), | |
8129 | IDENTIFIER_LENGTH (TYPE_NAME (class_type))); | |
8130 | id_name = obstack_finish (&temporary_obstack); | |
8131 | ||
8132 | node = maybe_get_identifier (id_name); | |
8133 | if (node && IS_A_CLASSFILE_NAME (node)) | |
8134 | { | |
8135 | if (seen_once < 0) | |
8136 | { | |
8137 | cl = TREE_PURPOSE (import); | |
8138 | seen_once = 1; | |
8139 | node_to_use = node; | |
8140 | } | |
8141 | else | |
8142 | { | |
8143 | seen_once++; | |
8144 | parse_error_context | |
8145 | (import, "Type `%s' also potentially defined in package `%s'", | |
8146 | IDENTIFIER_POINTER (TYPE_NAME (class_type)), | |
8147 | IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import)))); | |
8148 | } | |
8149 | } | |
8150 | } | |
8151 | ||
8152 | if (seen_once == 1) | |
8153 | { | |
8154 | /* Setup lineno so that it refers to the line of the import (in | |
8155 | case we parse a class file and encounter errors */ | |
8156 | tree decl; | |
8157 | int saved_lineno = lineno; | |
8158 | lineno = EXPR_WFL_LINENO (cl); | |
63a212ed | 8159 | TYPE_NAME (class_type) = node_to_use; |
8b27f225 PB |
8160 | QUALIFIED_P (TYPE_NAME (class_type)) = 1; |
8161 | decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); | |
8162 | /* If there is no DECL set for the class or if the class isn't | |
8163 | loaded and not seen in source yet, the load */ | |
8164 | if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl)) | |
8165 | && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))) | |
8166 | load_class (node_to_use, 0); | |
8167 | lineno = saved_lineno; | |
8168 | return check_pkg_class_access (TYPE_NAME (class_type), cl); | |
8169 | } | |
8170 | else | |
8171 | return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */ | |
8172 | } | |
8173 | ||
5e942c50 APB |
8174 | static tree |
8175 | resolve_package (pkg, next) | |
8176 | tree pkg, *next; | |
8177 | { | |
2c56429a | 8178 | tree current; |
5e942c50 | 8179 | tree type_name = NULL_TREE; |
49f48c71 | 8180 | const char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg)); |
5e942c50 APB |
8181 | |
8182 | /* The trick is to determine when the package name stops and were | |
8183 | the name of something contained in the package starts. Then we | |
8184 | return a fully qualified name of what we want to get. */ | |
8185 | ||
8186 | /* Do a quick search on well known package names */ | |
8187 | if (!strncmp (name, "java.lang.reflect", 17)) | |
8188 | { | |
8189 | *next = | |
8190 | TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg)))); | |
8191 | type_name = lookup_package_type (name, 17); | |
8192 | } | |
8193 | else if (!strncmp (name, "java.lang", 9)) | |
8194 | { | |
8195 | *next = TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg))); | |
8196 | type_name = lookup_package_type (name, 9); | |
8197 | } | |
5e942c50 | 8198 | |
2c56429a APB |
8199 | /* If we found something here, return */ |
8200 | if (type_name) | |
8201 | return type_name; | |
8202 | ||
8203 | *next = EXPR_WFL_QUALIFICATION (pkg); | |
8204 | ||
8205 | /* Try the current package. */ | |
8206 | if (ctxp->package && !strncmp (name, IDENTIFIER_POINTER (ctxp->package), | |
8207 | IDENTIFIER_LENGTH (ctxp->package))) | |
8208 | { | |
8209 | type_name = | |
8210 | lookup_package_type_and_set_next (name, | |
8211 | IDENTIFIER_LENGTH (ctxp->package), | |
8212 | next ); | |
8213 | if (type_name) | |
8214 | return type_name; | |
8215 | } | |
8216 | ||
8217 | /* Search in imported package */ | |
8218 | for (current = ctxp->import_list; current; current = TREE_CHAIN (current)) | |
8219 | { | |
8220 | tree current_pkg_name = EXPR_WFL_NODE (TREE_PURPOSE (current)); | |
8221 | int len = IDENTIFIER_LENGTH (current_pkg_name); | |
8222 | if (!strncmp (name, IDENTIFIER_POINTER (current_pkg_name), len)) | |
8223 | { | |
8224 | tree left, dummy; | |
8225 | ||
8226 | breakdown_qualified (&left, &dummy, current_pkg_name); | |
8227 | len = IDENTIFIER_LENGTH (left); | |
8228 | type_name = lookup_package_type_and_set_next (name, len, next); | |
8229 | if (type_name) | |
8230 | break; | |
8231 | } | |
8232 | } | |
8233 | ||
8234 | return type_name; | |
8235 | } | |
8236 | ||
8237 | static tree | |
8238 | lookup_package_type_and_set_next (name, len, next) | |
49f48c71 | 8239 | const char *name; |
2c56429a APB |
8240 | int len; |
8241 | tree *next; | |
8242 | { | |
49f48c71 | 8243 | const char *ptr; |
2c56429a APB |
8244 | tree type_name = lookup_package_type (name, len); |
8245 | ||
8246 | if (!type_name) | |
8247 | return NULL; | |
8248 | ||
8249 | ptr = IDENTIFIER_POINTER (type_name); | |
8250 | while (ptr && (ptr = strchr (ptr, '.'))) | |
8251 | { | |
8252 | *next = TREE_CHAIN (*next); | |
8253 | ptr++; | |
8254 | } | |
5e942c50 APB |
8255 | return type_name; |
8256 | } | |
8257 | ||
8258 | static tree | |
8259 | lookup_package_type (name, from) | |
49f48c71 | 8260 | const char *name; |
5e942c50 APB |
8261 | int from; |
8262 | { | |
8263 | char subname [128]; | |
49f48c71 | 8264 | const char *sub = &name[from+1]; |
5e942c50 APB |
8265 | while (*sub != '.' && *sub) |
8266 | sub++; | |
8267 | strncpy (subname, name, sub-name); | |
8268 | subname [sub-name] = '\0'; | |
8269 | return get_identifier (subname); | |
8270 | } | |
8271 | ||
8b27f225 PB |
8272 | /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no |
8273 | access violations were found, 1 otherwise. */ | |
8274 | ||
8275 | static int | |
8276 | check_pkg_class_access (class_name, cl) | |
8277 | tree class_name; | |
8278 | tree cl; | |
8279 | { | |
8280 | tree type; | |
8281 | ||
8282 | if (!QUALIFIED_P (class_name) || !IDENTIFIER_CLASS_VALUE (class_name)) | |
8283 | return 0; | |
8284 | ||
8285 | if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name)))) | |
8286 | return 0; | |
8287 | ||
8288 | if (!CLASS_PUBLIC (TYPE_NAME (type))) | |
8289 | { | |
78d21f92 PB |
8290 | /* Access to a private class within the same package is |
8291 | allowed. */ | |
8292 | tree l, r; | |
8293 | breakdown_qualified (&l, &r, class_name); | |
8294 | if (l == ctxp->package) | |
8295 | return 0; | |
8296 | ||
8b27f225 | 8297 | parse_error_context |
781b0558 | 8298 | (cl, "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed", |
8b27f225 PB |
8299 | (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"), |
8300 | IDENTIFIER_POINTER (class_name)); | |
8301 | return 1; | |
8302 | } | |
8303 | return 0; | |
8304 | } | |
8305 | ||
8306 | /* Local variable declaration. */ | |
8307 | ||
8308 | static void | |
8309 | declare_local_variables (modifier, type, vlist) | |
8310 | int modifier; | |
8311 | tree type; | |
8312 | tree vlist; | |
8313 | { | |
8314 | tree decl, current, saved_type; | |
8315 | tree type_wfl = NULL_TREE; | |
8316 | int must_chain = 0; | |
8317 | ||
2aa11e97 | 8318 | /* Push a new block if statements were seen between the last time we |
8b27f225 | 8319 | pushed a block and now. Keep a cound of block to close */ |
f099f336 | 8320 | if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl))) |
8b27f225 | 8321 | { |
f099f336 | 8322 | tree body = GET_CURRENT_BLOCK (current_function_decl); |
8b27f225 | 8323 | tree b = enter_block (); |
f099f336 | 8324 | BLOCK_EXPR_ORIGIN (b) = body; |
8b27f225 PB |
8325 | } |
8326 | ||
8327 | if (modifier) | |
8328 | { | |
8329 | int i; | |
8330 | for (i = 0; i <= 10; i++) if (1 << i & modifier) break; | |
c877974e APB |
8331 | if (modifier == ACC_FINAL) |
8332 | { | |
8333 | if (flag_static_local_jdk1_1) | |
8334 | parse_warning_context (ctxp->modifier_ctx [i], | |
781b0558 | 8335 | "Unsupported JDK1.1 `final' local variable (treated as non final)"); |
c877974e APB |
8336 | } |
8337 | else | |
8338 | { | |
8339 | parse_error_context | |
8340 | (ctxp->modifier_ctx [i], | |
8341 | "Only `final' is allowed as a local variables modifier"); | |
8342 | return; | |
8343 | } | |
8b27f225 PB |
8344 | } |
8345 | ||
8346 | /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will | |
8347 | hold the TYPE value if a new incomplete has to be created (as | |
8348 | opposed to being found already existing and reused). */ | |
8349 | SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain); | |
8350 | ||
8351 | /* If TYPE is fully resolved and we don't have a reference, make one */ | |
1886c9d8 | 8352 | PROMOTE_RECORD_IF_COMPLETE (type, must_chain); |
8b27f225 PB |
8353 | |
8354 | /* Go through all the declared variables */ | |
8355 | for (current = vlist, saved_type = type; current; | |
8356 | current = TREE_CHAIN (current), type = saved_type) | |
8357 | { | |
c877974e | 8358 | tree other, real_type; |
8b27f225 PB |
8359 | tree wfl = TREE_PURPOSE (current); |
8360 | tree name = EXPR_WFL_NODE (wfl); | |
8361 | tree init = TREE_VALUE (current); | |
8362 | ||
8363 | /* Process NAME, as it may specify extra dimension(s) for it */ | |
8364 | type = build_array_from_name (type, type_wfl, name, &name); | |
8365 | ||
8366 | /* Variable redefinition check */ | |
8367 | if ((other = lookup_name_in_blocks (name))) | |
8368 | { | |
8369 | variable_redefinition_error (wfl, name, TREE_TYPE (other), | |
8370 | DECL_SOURCE_LINE (other)); | |
8371 | continue; | |
8372 | } | |
8373 | ||
8374 | /* Type adjustment. We may have just readjusted TYPE because | |
8375 | the variable specified more dimensions. Make sure we have | |
8376 | a reference if we can and don't have one already. */ | |
1886c9d8 | 8377 | PROMOTE_RECORD_IF_COMPLETE (type, must_chain); |
c877974e APB |
8378 | |
8379 | real_type = GET_REAL_TYPE (type); | |
8b27f225 PB |
8380 | /* Never layout this decl. This will be done when its scope |
8381 | will be entered */ | |
c877974e | 8382 | decl = build_decl (VAR_DECL, name, real_type); |
8b27f225 PB |
8383 | BLOCK_CHAIN_DECL (decl); |
8384 | ||
d4370213 APB |
8385 | /* If doing xreferencing, replace the line number with the WFL |
8386 | compound value */ | |
8387 | if (flag_emit_xref) | |
8388 | DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl); | |
8389 | ||
8b27f225 PB |
8390 | /* Don't try to use an INIT statement when an error was found */ |
8391 | if (init && java_error_count) | |
8392 | init = NULL_TREE; | |
8393 | ||
8394 | /* Add the initialization function to the current function's code */ | |
8395 | if (init) | |
8396 | { | |
8397 | /* Name might have been readjusted */ | |
8398 | EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = name; | |
8399 | MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1; | |
8400 | java_method_add_stmt (current_function_decl, | |
8401 | build_debugable_stmt (EXPR_WFL_LINECOL (init), | |
8402 | init)); | |
8403 | } | |
8404 | ||
8405 | /* Setup dependency the type of the decl */ | |
8406 | if (must_chain) | |
8407 | { | |
8408 | jdep *dep; | |
8409 | register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type); | |
8410 | dep = CLASSD_LAST (ctxp->classd_list); | |
8411 | JDEP_GET_PATCH (dep) = &TREE_TYPE (decl); | |
8412 | } | |
8413 | } | |
8414 | SOURCE_FRONTEND_DEBUG (("Defined locals")); | |
8415 | } | |
8416 | ||
8417 | /* Called during parsing. Build decls from argument list. */ | |
8418 | ||
8419 | static void | |
8420 | source_start_java_method (fndecl) | |
8421 | tree fndecl; | |
8422 | { | |
8423 | tree tem; | |
8424 | tree parm_decl; | |
8425 | int i; | |
8426 | ||
79d13333 APB |
8427 | if (!fndecl) |
8428 | return; | |
8429 | ||
8b27f225 PB |
8430 | current_function_decl = fndecl; |
8431 | ||
8432 | /* New scope for the function */ | |
8433 | enter_block (); | |
8434 | for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0; | |
82371d41 | 8435 | tem != end_params_node; tem = TREE_CHAIN (tem), i++) |
8b27f225 PB |
8436 | { |
8437 | tree type = TREE_VALUE (tem); | |
8438 | tree name = TREE_PURPOSE (tem); | |
8439 | ||
23a79c61 APB |
8440 | /* If type is incomplete. Create an incomplete decl and ask for |
8441 | the decl to be patched later */ | |
8b27f225 PB |
8442 | if (INCOMPLETE_TYPE_P (type)) |
8443 | { | |
8444 | jdep *jdep; | |
c877974e APB |
8445 | tree real_type = GET_REAL_TYPE (type); |
8446 | parm_decl = build_decl (PARM_DECL, name, real_type); | |
23a79c61 | 8447 | type = obtain_incomplete_type (type); |
8b27f225 PB |
8448 | register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type); |
8449 | jdep = CLASSD_LAST (ctxp->classd_list); | |
8450 | JDEP_MISC (jdep) = name; | |
8451 | JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl); | |
8452 | } | |
8453 | else | |
8454 | parm_decl = build_decl (PARM_DECL, name, type); | |
8455 | ||
8456 | BLOCK_CHAIN_DECL (parm_decl); | |
8457 | } | |
8458 | tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)); | |
8459 | BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) = | |
8460 | nreverse (tem); | |
8461 | DECL_ARG_SLOT_COUNT (current_function_decl) = i; | |
8462 | } | |
8463 | ||
22eed1e6 APB |
8464 | /* Called during parsing. Creates an artificial method declaration. */ |
8465 | ||
8466 | static tree | |
8467 | create_artificial_method (class, flags, type, name, args) | |
8468 | tree class; | |
8469 | int flags; | |
8470 | tree type, name, args; | |
8471 | { | |
8472 | int saved_lineno = lineno; | |
8473 | tree mdecl; | |
8474 | ||
8475 | lineno = 0; | |
8476 | mdecl = make_node (FUNCTION_TYPE); | |
8477 | TREE_TYPE (mdecl) = type; | |
8478 | TYPE_ARG_TYPES (mdecl) = args; | |
8479 | mdecl = add_method (class, flags, name, build_java_signature (mdecl)); | |
8480 | lineno = saved_lineno; | |
8481 | DECL_ARTIFICIAL (mdecl) = 1; | |
8482 | return mdecl; | |
8483 | } | |
8484 | ||
8485 | /* Starts the body if an artifical method. */ | |
8486 | ||
8487 | static void | |
8488 | start_artificial_method_body (mdecl) | |
8489 | tree mdecl; | |
8490 | { | |
8491 | DECL_SOURCE_LINE (mdecl) = 1; | |
8492 | DECL_SOURCE_LINE_MERGE (mdecl, 1); | |
8493 | source_start_java_method (mdecl); | |
8494 | enter_block (); | |
8495 | } | |
8496 | ||
8497 | static void | |
8498 | end_artificial_method_body (mdecl) | |
8499 | tree mdecl; | |
8500 | { | |
8501 | BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block (); | |
8502 | exit_block (); | |
8503 | } | |
8504 | ||
8b27f225 PB |
8505 | /* Called during expansion. Push decls formerly built from argument |
8506 | list so they're usable during expansion. */ | |
8507 | ||
8508 | static void | |
8509 | expand_start_java_method (fndecl) | |
8510 | tree fndecl; | |
8511 | { | |
8512 | tree tem, *ptr; | |
8513 | ||
8514 | current_function_decl = fndecl; | |
8515 | ||
8516 | announce_function (fndecl); | |
8517 | pushlevel (1); /* Push parameters */ | |
8518 | ptr = &DECL_ARGUMENTS (fndecl); | |
8519 | tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)); | |
8520 | while (tem) | |
8521 | { | |
8522 | tree next = TREE_CHAIN (tem); | |
8523 | tree type = TREE_TYPE (tem); | |
e438e1b7 JJ |
8524 | if (PROMOTE_PROTOTYPES |
8525 | && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node) | |
8b27f225 PB |
8526 | && INTEGRAL_TYPE_P (type)) |
8527 | type = integer_type_node; | |
8b27f225 PB |
8528 | DECL_ARG_TYPE (tem) = type; |
8529 | layout_decl (tem, 0); | |
8530 | pushdecl (tem); | |
8b27f225 PB |
8531 | *ptr = tem; |
8532 | ptr = &TREE_CHAIN (tem); | |
8533 | tem = next; | |
8534 | } | |
8535 | *ptr = NULL_TREE; | |
8536 | pushdecl_force_head (DECL_ARGUMENTS (fndecl)); | |
8537 | lineno = DECL_SOURCE_LINE_FIRST (fndecl); | |
8b27f225 PB |
8538 | } |
8539 | ||
8540 | /* Terminate a function and expand its body. */ | |
8541 | ||
8542 | static void | |
8543 | source_end_java_method () | |
8544 | { | |
8545 | tree fndecl = current_function_decl; | |
138657ec | 8546 | int flag_asynchronous_exceptions = asynchronous_exceptions; |
8b27f225 | 8547 | |
79d13333 APB |
8548 | if (!fndecl) |
8549 | return; | |
8550 | ||
8b27f225 PB |
8551 | java_parser_context_save_global (); |
8552 | lineno = ctxp->last_ccb_indent1; | |
8553 | ||
8554 | /* Set EH language codes */ | |
8555 | java_set_exception_lang_code (); | |
8556 | ||
5423609c APB |
8557 | /* Turn function bodies with only a NOP expr null, so they don't get |
8558 | generated at all and we won't get warnings when using the -W | |
8559 | -Wall flags. */ | |
8560 | if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) == empty_stmt_node) | |
8561 | BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE; | |
8562 | ||
8b27f225 PB |
8563 | /* Generate function's code */ |
8564 | if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) | |
5423609c APB |
8565 | && ! flag_emit_class_files |
8566 | && ! flag_emit_xref) | |
8b27f225 PB |
8567 | expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))); |
8568 | ||
8569 | /* pop out of its parameters */ | |
8570 | pushdecl_force_head (DECL_ARGUMENTS (fndecl)); | |
8571 | poplevel (1, 0, 1); | |
8572 | BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl; | |
8573 | ||
8574 | /* Generate rtl for function exit. */ | |
5423609c | 8575 | if (! flag_emit_class_files && ! flag_emit_xref) |
8b27f225 PB |
8576 | { |
8577 | lineno = DECL_SOURCE_LINE_LAST (fndecl); | |
8578 | /* Emit catch-finally clauses */ | |
8579 | emit_handlers (); | |
8580 | expand_function_end (input_filename, lineno, 0); | |
8581 | ||
138657ec AH |
8582 | /* FIXME: If the current method contains any exception handlers, |
8583 | force asynchronous_exceptions: this is necessary because signal | |
8584 | handlers in libjava may throw exceptions. This is far from being | |
8585 | a perfect solution, but it's better than doing nothing at all.*/ | |
8586 | if (catch_clauses) | |
8587 | asynchronous_exceptions = 1; | |
8588 | ||
8b27f225 PB |
8589 | /* Run the optimizers and output assembler code for this function. */ |
8590 | rest_of_compilation (fndecl); | |
8591 | } | |
8592 | ||
8593 | current_function_decl = NULL_TREE; | |
8226320b | 8594 | permanent_allocation (1); |
8b27f225 | 8595 | java_parser_context_restore_global (); |
138657ec | 8596 | asynchronous_exceptions = flag_asynchronous_exceptions; |
8b27f225 PB |
8597 | } |
8598 | ||
8599 | /* Record EXPR in the current function block. Complements compound | |
8600 | expression second operand if necessary. */ | |
8601 | ||
8602 | tree | |
8603 | java_method_add_stmt (fndecl, expr) | |
8604 | tree fndecl, expr; | |
8605 | { | |
b771925e APB |
8606 | if (!GET_CURRENT_BLOCK (fndecl)) |
8607 | return NULL_TREE; | |
f099f336 | 8608 | return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr); |
8b27f225 PB |
8609 | } |
8610 | ||
8611 | static tree | |
8612 | add_stmt_to_block (b, type, stmt) | |
8613 | tree b, type, stmt; | |
8614 | { | |
8615 | tree body = BLOCK_EXPR_BODY (b), c; | |
8616 | ||
8617 | if (java_error_count) | |
8618 | return body; | |
8619 | ||
8620 | if ((c = add_stmt_to_compound (body, type, stmt)) == body) | |
8621 | return body; | |
8622 | ||
8623 | BLOCK_EXPR_BODY (b) = c; | |
8624 | TREE_SIDE_EFFECTS (c) = 1; | |
8625 | return c; | |
8626 | } | |
8627 | ||
8628 | /* Add STMT to EXISTING if possible, otherwise create a new | |
8629 | COMPOUND_EXPR and add STMT to it. */ | |
8630 | ||
8631 | static tree | |
8632 | add_stmt_to_compound (existing, type, stmt) | |
8633 | tree existing, type, stmt; | |
8634 | { | |
12472854 PB |
8635 | if (existing) |
8636 | return build (COMPOUND_EXPR, type, existing, stmt); | |
8b27f225 | 8637 | else |
12472854 | 8638 | return stmt; |
8b27f225 PB |
8639 | } |
8640 | ||
8641 | /* Hold THIS for the scope of the current public method decl. */ | |
8642 | static tree current_this; | |
8643 | ||
1886c9d8 APB |
8644 | void java_layout_seen_class_methods () |
8645 | { | |
8646 | tree previous_list = all_class_list; | |
8647 | tree end = NULL_TREE; | |
8648 | tree current; | |
8649 | ||
8650 | while (1) | |
8651 | { | |
8652 | for (current = previous_list; | |
8653 | current != end; current = TREE_CHAIN (current)) | |
8654 | layout_class_methods (TREE_TYPE (TREE_VALUE (current))); | |
8655 | ||
8656 | if (previous_list != all_class_list) | |
8657 | { | |
8658 | end = previous_list; | |
8659 | previous_list = all_class_list; | |
8660 | } | |
8661 | else | |
8662 | break; | |
8663 | } | |
8664 | } | |
8665 | ||
23a79c61 APB |
8666 | /* Layout the methods of all classes loaded in one way on an |
8667 | other. Check methods of source parsed classes. Then reorder the | |
8668 | fields and layout the classes or the type of all source parsed | |
8669 | classes */ | |
8b27f225 PB |
8670 | |
8671 | void | |
8672 | java_layout_classes () | |
8673 | { | |
8674 | tree current; | |
bc3ca41b | 8675 | int save_error_count = java_error_count; |
5e942c50 | 8676 | |
23a79c61 | 8677 | /* Layout the methods of all classes seen so far */ |
1886c9d8 | 8678 | java_layout_seen_class_methods (); |
23a79c61 APB |
8679 | java_parse_abort_on_error (); |
8680 | all_class_list = NULL_TREE; | |
8681 | ||
8682 | /* Then check the methods of all parsed classes */ | |
8683 | for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current)) | |
8684 | if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current)))) | |
8685 | CHECK_METHODS (TREE_VALUE (current)); | |
8686 | java_parse_abort_on_error (); | |
8687 | ||
5e942c50 | 8688 | for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current)) |
8b27f225 | 8689 | { |
5e942c50 | 8690 | current_class = TREE_TYPE (TREE_VALUE (current)); |
22eed1e6 | 8691 | |
c877974e APB |
8692 | /* Reverse the fields, but leave the dummy field in front. |
8693 | Fields are already ordered for Object and Class */ | |
8694 | if (TYPE_FIELDS (current_class) && current_class != object_type_node | |
8695 | && current_class != class_type_node) | |
8696 | { | |
23a79c61 APB |
8697 | /* If the dummy field is there, reverse the right fields and |
8698 | just layout the type for proper fields offset */ | |
c877974e APB |
8699 | if (!DECL_NAME (TYPE_FIELDS (current_class))) |
8700 | { | |
8701 | tree fields = TYPE_FIELDS (current_class); | |
8702 | TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields)); | |
8703 | TYPE_SIZE (current_class) = NULL_TREE; | |
8704 | layout_type (current_class); | |
8705 | } | |
23a79c61 APB |
8706 | /* We don't have a dummy field, we need to layout the class, |
8707 | after having reversed the fields */ | |
c877974e APB |
8708 | else |
8709 | { | |
8710 | TYPE_FIELDS (current_class) = | |
8711 | nreverse (TYPE_FIELDS (current_class)); | |
8712 | TYPE_SIZE (current_class) = NULL_TREE; | |
8713 | layout_class (current_class); | |
8714 | } | |
8715 | } | |
23a79c61 APB |
8716 | else |
8717 | layout_class (current_class); | |
5e942c50 | 8718 | |
c877974e APB |
8719 | /* From now on, the class is considered completely loaded */ |
8720 | CLASS_LOADED_P (current_class) = 1; | |
8721 | ||
5e942c50 APB |
8722 | /* Error reported by the caller */ |
8723 | if (java_error_count) | |
8724 | return; | |
8b27f225 | 8725 | } |
23a79c61 APB |
8726 | |
8727 | /* We might have reloaded classes durign the process of laying out | |
8728 | classes for code generation. We must layout the methods of those | |
8729 | late additions, as constructor checks might use them */ | |
1886c9d8 | 8730 | java_layout_seen_class_methods (); |
23a79c61 | 8731 | java_parse_abort_on_error (); |
8b27f225 PB |
8732 | } |
8733 | ||
8734 | /* Expand all methods in all registered classes. */ | |
8735 | ||
49f48c71 | 8736 | static void |
8b27f225 PB |
8737 | java_complete_expand_methods () |
8738 | { | |
8739 | tree current; | |
ce6e9147 APB |
8740 | |
8741 | do_not_fold = flag_emit_xref; | |
8b27f225 PB |
8742 | |
8743 | for (current = ctxp->class_list; current; current = TREE_CHAIN (current)) | |
8744 | { | |
7f1d4866 | 8745 | int is_interface; |
8b27f225 | 8746 | tree class_type = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current)); |
781b0558 | 8747 | tree decl, prev_decl; |
8b27f225 PB |
8748 | |
8749 | current_class = TREE_TYPE (current); | |
7f1d4866 | 8750 | is_interface = CLASS_INTERFACE (TYPE_NAME (current_class)); |
8b27f225 PB |
8751 | |
8752 | /* Initialize a new constant pool */ | |
8753 | init_outgoing_cpool (); | |
8754 | ||
63a212ed | 8755 | /* We want <clinit> (if any) to be processed first. */ |
781b0558 KG |
8756 | for (prev_decl = NULL_TREE, decl = TYPE_METHODS (class_type); |
8757 | decl; prev_decl= decl, decl = TREE_CHAIN (decl)) | |
8758 | if (IS_CLINIT (decl)) | |
8759 | { | |
8760 | if (!java_pre_expand_clinit (decl)) | |
8761 | { | |
8762 | if (prev_decl) | |
8763 | TREE_CHAIN (prev_decl) = TREE_CHAIN (decl); | |
8764 | else | |
8765 | TYPE_METHODS (class_type) = TREE_CHAIN (decl); | |
8766 | } | |
8767 | break; | |
8768 | } | |
cd9643f7 | 8769 | |
781b0558 | 8770 | /* Now go on for regular business. */ |
7f1d4866 APB |
8771 | for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl)) |
8772 | { | |
7f1d4866 APB |
8773 | current_function_decl = decl; |
8774 | /* Don't generate debug info on line zero when expanding a | |
8775 | generated constructor. */ | |
8776 | if (DECL_CONSTRUCTOR_P (decl) && !DECL_FUNCTION_BODY (decl)) | |
8777 | { | |
8778 | /* If we found errors, it's too dangerous to try to | |
8779 | generate and expand a constructor */ | |
8780 | if (!java_error_count) | |
8781 | { | |
8782 | restore_line_number_status (1); | |
8783 | java_complete_expand_method (decl); | |
8784 | restore_line_number_status (0); | |
8b27f225 | 8785 | } |
7f1d4866 APB |
8786 | } |
8787 | else if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl)) | |
8788 | continue; | |
8789 | else | |
8790 | java_complete_expand_method (decl); | |
8791 | } | |
8b27f225 | 8792 | |
22eed1e6 APB |
8793 | /* Now verify constructor circularity (stop after the first one |
8794 | we find) */ | |
7f1d4866 | 8795 | if (!is_interface) |
22eed1e6 APB |
8796 | for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl)) |
8797 | if (DECL_CONSTRUCTOR_P (decl) && | |
8798 | verify_constructor_circularity (decl, decl)) | |
8799 | break; | |
8800 | ||
8b27f225 PB |
8801 | /* Make the class data, register it and run the rest of decl |
8802 | compilation on it */ | |
63a212ed PB |
8803 | if (!java_error_count) |
8804 | { | |
8805 | if (flag_emit_class_files) | |
8806 | write_classfile (current_class); | |
f099f336 APB |
8807 | if (flag_emit_xref) |
8808 | expand_xref (current_class); | |
aabd7048 | 8809 | else if (! flag_syntax_only) |
d593dd8c | 8810 | finish_class (); |
63a212ed | 8811 | } |
8b27f225 PB |
8812 | } |
8813 | } | |
8814 | ||
8815 | /* Hold a list of catch clauses list. The first element of this list is | |
8816 | the list of the catch clauses of the currently analysed try block. */ | |
8817 | static tree currently_caught_type_list; | |
8818 | ||
781b0558 KG |
8819 | /* Complete and expand <clinit>. Return a non zero value if <clinit> |
8820 | is worth keeping. */ | |
8821 | ||
8822 | static int | |
8823 | java_pre_expand_clinit (decl) | |
8824 | tree decl; | |
8825 | { | |
8826 | tree fbody = DECL_FUNCTION_BODY (decl); | |
781b0558 KG |
8827 | int to_return = 1; |
8828 | ||
8829 | if (fbody != NULL_TREE) | |
8830 | { | |
8831 | /* First check if we can ignore empty <clinit> */ | |
8832 | tree block_body = BLOCK_EXPR_BODY (fbody); | |
8833 | ||
8834 | current_this = NULL_TREE; | |
8835 | current_function_decl = decl; | |
8836 | if (block_body != NULL_TREE) | |
8837 | { | |
8838 | /* Prevent the use of `this' inside <clinit> */ | |
8839 | ctxp->explicit_constructor_p = 1; | |
8840 | block_body = java_complete_tree (block_body); | |
8841 | ctxp->explicit_constructor_p = 0; | |
8842 | ||
8843 | BLOCK_EXPR_BODY (fbody) = block_body; | |
8844 | if (block_body != NULL_TREE && TREE_CODE (block_body) == BLOCK | |
8845 | && BLOCK_EXPR_BODY (block_body) == empty_stmt_node) | |
8846 | to_return = 0; | |
8847 | } | |
8848 | } | |
8849 | return to_return; | |
8850 | } | |
8851 | ||
8b27f225 PB |
8852 | /* Complete and expand a method. */ |
8853 | ||
8854 | static void | |
8855 | java_complete_expand_method (mdecl) | |
8856 | tree mdecl; | |
8857 | { | |
22eed1e6 APB |
8858 | /* Fix constructors before expanding them */ |
8859 | if (DECL_CONSTRUCTOR_P (mdecl)) | |
8860 | fix_constructors (mdecl); | |
8b27f225 | 8861 | |
22eed1e6 | 8862 | /* Expand functions that have a body */ |
8b27f225 PB |
8863 | if (DECL_FUNCTION_BODY (mdecl)) |
8864 | { | |
c877974e APB |
8865 | tree fbody = DECL_FUNCTION_BODY (mdecl); |
8866 | tree block_body = BLOCK_EXPR_BODY (fbody); | |
cd531a2e | 8867 | tree exception_copy = NULL_TREE; |
8b27f225 | 8868 | expand_start_java_method (mdecl); |
939d7216 | 8869 | build_result_decl (mdecl); |
8b27f225 PB |
8870 | |
8871 | current_this | |
8872 | = (!METHOD_STATIC (mdecl) ? | |
8873 | BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE); | |
8874 | ||
ce6e9147 APB |
8875 | /* Purge the `throws' list of unchecked exceptions. If we're |
8876 | doing xref, save a copy of the list and re-install it | |
8877 | later. */ | |
8878 | if (flag_emit_xref) | |
8879 | exception_copy = copy_list (DECL_FUNCTION_THROWS (mdecl)); | |
8880 | ||
8b27f225 PB |
8881 | purge_unchecked_exceptions (mdecl); |
8882 | ||
8883 | /* Install exceptions thrown with `throws' */ | |
8884 | PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl)); | |
8885 | ||
c877974e | 8886 | if (block_body != NULL_TREE) |
bc3ca41b PB |
8887 | { |
8888 | block_body = java_complete_tree (block_body); | |
ce6e9147 APB |
8889 | if (!flag_emit_xref) |
8890 | check_for_initialization (block_body); | |
f099f336 | 8891 | ctxp->explicit_constructor_p = 0; |
bc3ca41b | 8892 | } |
c877974e | 8893 | BLOCK_EXPR_BODY (fbody) = block_body; |
5e942c50 | 8894 | |
c877974e | 8895 | if ((block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body)) |
ce6e9147 APB |
8896 | && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE |
8897 | && !flag_emit_xref) | |
82371d41 | 8898 | missing_return_error (current_function_decl); |
63a212ed | 8899 | |
939d7216 PB |
8900 | complete_start_java_method (mdecl); |
8901 | ||
8b27f225 PB |
8902 | /* Don't go any further if we've found error(s) during the |
8903 | expansion */ | |
8904 | if (!java_error_count) | |
8905 | source_end_java_method (); | |
22eed1e6 APB |
8906 | else |
8907 | { | |
8908 | pushdecl_force_head (DECL_ARGUMENTS (mdecl)); | |
8909 | poplevel (1, 0, 1); | |
8910 | } | |
8b27f225 PB |
8911 | |
8912 | /* Pop the exceptions and sanity check */ | |
8913 | POP_EXCEPTIONS(); | |
8914 | if (currently_caught_type_list) | |
8915 | fatal ("Exception list non empty - java_complete_expand_method"); | |
ce6e9147 APB |
8916 | |
8917 | if (flag_emit_xref) | |
8918 | DECL_FUNCTION_THROWS (mdecl) = exception_copy; | |
8b27f225 PB |
8919 | } |
8920 | } | |
8921 | ||
22eed1e6 APB |
8922 | /* Craft a body for default constructor. Patch existing constructor |
8923 | bodies with call to super() and field initialization statements if | |
8924 | necessary. */ | |
8925 | ||
8926 | static void | |
8927 | fix_constructors (mdecl) | |
8928 | tree mdecl; | |
8929 | { | |
8930 | tree body = DECL_FUNCTION_BODY (mdecl); | |
22eed1e6 | 8931 | |
22eed1e6 APB |
8932 | if (!body) |
8933 | { | |
ac825856 APB |
8934 | /* The constructor body must be crafted by hand. It's the |
8935 | constructor we defined when we realize we didn't have the | |
8936 | CLASSNAME() constructor */ | |
8937 | ||
22eed1e6 APB |
8938 | tree compound; |
8939 | ||
8940 | /* It is an error for the compiler to generate a default | |
8941 | constructor if the superclass doesn't have a constructor that | |
8942 | takes no argument */ | |
8943 | if (verify_constructor_super ()) | |
8944 | { | |
8945 | tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (current_class)); | |
49f48c71 | 8946 | const char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl)); |
781b0558 KG |
8947 | parse_error_context |
8948 | (lookup_cl (TYPE_NAME (current_class)), | |
8949 | "No constructor matching `%s()' found in class `%s'", n, n); | |
22eed1e6 APB |
8950 | } |
8951 | ||
8952 | start_artificial_method_body (mdecl); | |
8953 | ||
8954 | /* We don't generate a super constructor invocation if we're | |
8955 | compiling java.lang.Object. build_super_invocation takes care | |
8956 | of that. */ | |
781b0558 | 8957 | compound = java_method_add_stmt (mdecl, build_super_invocation (mdecl)); |
22eed1e6 APB |
8958 | |
8959 | end_artificial_method_body (mdecl); | |
8960 | } | |
8961 | /* Search for an explicit constructor invocation */ | |
8962 | else | |
8963 | { | |
8964 | int found = 0; | |
8965 | tree main_block = BLOCK_EXPR_BODY (body); | |
8966 | tree compound = NULL_TREE; | |
8967 | ||
8968 | while (body) | |
8969 | switch (TREE_CODE (body)) | |
8970 | { | |
8971 | case CALL_EXPR: | |
8972 | found = CALL_EXPLICIT_CONSTRUCTOR_P (body); | |
8973 | body = NULL_TREE; | |
8974 | break; | |
8975 | case COMPOUND_EXPR: | |
8976 | case EXPR_WITH_FILE_LOCATION: | |
8977 | body = TREE_OPERAND (body, 0); | |
8978 | break; | |
8979 | case BLOCK: | |
8980 | body = BLOCK_EXPR_BODY (body); | |
8981 | break; | |
8982 | default: | |
8983 | found = 0; | |
8984 | body = NULL_TREE; | |
8985 | } | |
8986 | /* The constructor is missing an invocation of super() */ | |
8987 | if (!found) | |
8988 | compound = add_stmt_to_compound (compound, NULL_TREE, | |
781b0558 | 8989 | build_super_invocation (mdecl)); |
22eed1e6 | 8990 | |
22eed1e6 APB |
8991 | /* Fix the constructor main block if we're adding extra stmts */ |
8992 | if (compound) | |
8993 | { | |
8994 | compound = add_stmt_to_compound (compound, NULL_TREE, | |
8995 | BLOCK_EXPR_BODY (main_block)); | |
8996 | BLOCK_EXPR_BODY (main_block) = compound; | |
8997 | } | |
8998 | } | |
8999 | } | |
9000 | ||
9001 | /* Browse constructors in the super class, searching for a constructor | |
9002 | that doesn't take any argument. Return 0 if one is found, 1 | |
9003 | otherwise. */ | |
9004 | ||
9005 | static int | |
9006 | verify_constructor_super () | |
9007 | { | |
9008 | tree class = CLASSTYPE_SUPER (current_class); | |
9009 | if (!class) | |
9010 | return 0; | |
9011 | ||
9012 | if (class) | |
9013 | { | |
9014 | tree mdecl; | |
9015 | for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl)) | |
9016 | { | |
9017 | if (DECL_CONSTRUCTOR_P (mdecl) | |
d77613be APB |
9018 | && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) |
9019 | == end_params_node) | |
22eed1e6 APB |
9020 | return 0; |
9021 | } | |
9022 | } | |
9023 | return 1; | |
9024 | } | |
9025 | ||
8b27f225 PB |
9026 | /* Expand finals. */ |
9027 | ||
49f48c71 | 9028 | static void |
8b27f225 PB |
9029 | java_expand_finals () |
9030 | { | |
9031 | } | |
9032 | ||
22eed1e6 | 9033 | /* Generate code for all context remembered for code generation. */ |
b351b287 APB |
9034 | |
9035 | void | |
9036 | java_expand_classes () | |
9037 | { | |
5423609c | 9038 | int save_error_count = 0; |
23a79c61 APB |
9039 | java_parse_abort_on_error (); |
9040 | if (!(ctxp = ctxp_for_generation)) | |
5e942c50 APB |
9041 | return; |
9042 | java_layout_classes (); | |
9043 | java_parse_abort_on_error (); | |
9044 | ||
b351b287 APB |
9045 | for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next) |
9046 | { | |
9047 | ctxp = ctxp_for_generation; | |
9048 | lang_init_source (2); /* Error msgs have method prototypes */ | |
9049 | java_complete_expand_methods (); /* Complete and expand method bodies */ | |
9050 | java_parse_abort_on_error (); | |
9051 | java_expand_finals (); /* Expand and check the finals */ | |
9052 | java_parse_abort_on_error (); | |
9053 | java_check_final (); /* Check unitialized final */ | |
9054 | java_parse_abort_on_error (); | |
9055 | } | |
b351b287 APB |
9056 | } |
9057 | ||
8b27f225 PB |
9058 | /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to |
9059 | a tree list node containing RIGHT. Fore coming RIGHTs will be | |
9060 | chained to this hook. LOCATION contains the location of the | |
9061 | separating `.' operator. */ | |
9062 | ||
9063 | static tree | |
9064 | make_qualified_primary (primary, right, location) | |
9065 | tree primary, right; | |
9066 | int location; | |
9067 | { | |
9068 | tree wfl; | |
9069 | ||
9070 | /* We want to process THIS . xxx symbolicaly, to keep it consistent | |
9071 | with the way we're processing SUPER. A THIS from a primary as a | |
9072 | different form than a SUPER. Turn THIS into something symbolic */ | |
9073 | if (TREE_CODE (primary) == THIS_EXPR) | |
9074 | { | |
9ee9b555 | 9075 | wfl = build_wfl_node (this_identifier_node); |
8b27f225 PB |
9076 | EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary); |
9077 | wfl = make_qualified_name (wfl, right, location); | |
9078 | PRIMARY_P (wfl) = 1; | |
9079 | return wfl; | |
9080 | } | |
9081 | /* Other non WFL node are wrapped around a WFL */ | |
9082 | else if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION) | |
9083 | { | |
9084 | wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0); | |
9085 | EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary); | |
9086 | EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (primary, NULL_TREE); | |
9087 | } | |
9088 | else | |
9089 | { | |
9090 | wfl = primary; | |
9091 | if (!EXPR_WFL_QUALIFICATION (primary)) | |
9092 | EXPR_WFL_QUALIFICATION (primary) = | |
9093 | build_tree_list (primary, NULL_TREE); | |
9094 | } | |
9095 | ||
9096 | EXPR_WFL_LINECOL (right) = location; | |
9097 | chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE)); | |
9098 | PRIMARY_P (wfl) = 1; | |
9099 | return wfl; | |
9100 | } | |
9101 | ||
9102 | /* Simple merge of two name separated by a `.' */ | |
9103 | ||
9104 | static tree | |
9105 | merge_qualified_name (left, right) | |
9106 | tree left, right; | |
9107 | { | |
9108 | tree node; | |
9109 | obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left), | |
9110 | IDENTIFIER_LENGTH (left)); | |
9111 | obstack_1grow (&temporary_obstack, '.'); | |
9112 | obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right), | |
9113 | IDENTIFIER_LENGTH (right)); | |
9114 | node = get_identifier (obstack_base (&temporary_obstack)); | |
9115 | obstack_free (&temporary_obstack, obstack_base (&temporary_obstack)); | |
9116 | QUALIFIED_P (node) = 1; | |
9117 | return node; | |
9118 | } | |
9119 | ||
9120 | /* Merge the two parts of a qualified name into LEFT. Set the | |
9121 | location information of the resulting node to LOCATION, usually | |
9122 | inherited from the location information of the `.' operator. */ | |
9123 | ||
9124 | static tree | |
9125 | make_qualified_name (left, right, location) | |
9126 | tree left, right; | |
9127 | int location; | |
9128 | { | |
bc3ca41b PB |
9129 | #ifdef USE_COMPONENT_REF |
9130 | tree node = build (COMPONENT_REF, NULL_TREE, left, right); | |
9131 | EXPR_WFL_LINECOL (node) = location; | |
9132 | return node; | |
9133 | #else | |
8b27f225 PB |
9134 | tree left_id = EXPR_WFL_NODE (left); |
9135 | tree right_id = EXPR_WFL_NODE (right); | |
9136 | tree wfl, merge; | |
9137 | ||
9138 | merge = merge_qualified_name (left_id, right_id); | |
9139 | ||
9140 | /* Left wasn't qualified and is now qualified */ | |
9141 | if (!QUALIFIED_P (left_id)) | |
9142 | { | |
9143 | tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0); | |
9144 | EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left); | |
9145 | EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE); | |
9146 | } | |
9147 | ||
9148 | wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0); | |
9149 | EXPR_WFL_LINECOL (wfl) = location; | |
9150 | chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE)); | |
9151 | ||
9152 | EXPR_WFL_NODE (left) = merge; | |
9153 | return left; | |
bc3ca41b | 9154 | #endif |
8b27f225 PB |
9155 | } |
9156 | ||
9157 | /* Extract the last identifier component of the qualified in WFL. The | |
9158 | last identifier is removed from the linked list */ | |
9159 | ||
9160 | static tree | |
9161 | cut_identifier_in_qualified (wfl) | |
9162 | tree wfl; | |
9163 | { | |
9164 | tree q; | |
9165 | tree previous = NULL_TREE; | |
9166 | for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q)) | |
9167 | if (!TREE_CHAIN (q)) | |
9168 | { | |
9169 | if (!previous) | |
781b0558 | 9170 | fatal ("Operating on a non qualified qualified WFL - cut_identifier_in_qualified"); |
8b27f225 PB |
9171 | TREE_CHAIN (previous) = NULL_TREE; |
9172 | return TREE_PURPOSE (q); | |
9173 | } | |
9174 | } | |
9175 | ||
9176 | /* Resolve the expression name NAME. Return its decl. */ | |
9177 | ||
9178 | static tree | |
5e942c50 | 9179 | resolve_expression_name (id, orig) |
8b27f225 | 9180 | tree id; |
5e942c50 | 9181 | tree *orig; |
8b27f225 PB |
9182 | { |
9183 | tree name = EXPR_WFL_NODE (id); | |
9184 | tree decl; | |
9185 | ||
9186 | /* 6.5.5.1: Simple expression names */ | |
9187 | if (!PRIMARY_P (id) && !QUALIFIED_P (name)) | |
9188 | { | |
9189 | /* 15.13.1: NAME can appear within the scope of a local variable | |
9190 | declaration */ | |
9191 | if ((decl = IDENTIFIER_LOCAL_VALUE (name))) | |
9192 | return decl; | |
9193 | ||
9194 | /* 15.13.1: NAME can appear within a class declaration */ | |
9195 | else | |
9196 | { | |
9197 | decl = lookup_field_wrapper (current_class, name); | |
9198 | if (decl) | |
9199 | { | |
9200 | int fs = FIELD_STATIC (decl); | |
9201 | /* Instance variable (8.3.1.1) can't appear within | |
9202 | static method, static initializer or initializer for | |
9203 | a static variable. */ | |
9204 | if (!fs && METHOD_STATIC (current_function_decl)) | |
9205 | { | |
7f10c2e2 | 9206 | static_ref_err (id, name, current_class); |
8b27f225 PB |
9207 | return error_mark_node; |
9208 | } | |
22eed1e6 APB |
9209 | /* Instance variables can't appear as an argument of |
9210 | an explicit constructor invocation */ | |
9211 | if (!fs && ctxp->explicit_constructor_p) | |
9212 | { | |
9213 | parse_error_context | |
781b0558 | 9214 | (id, "Can't reference `%s' before the superclass constructor has been called", IDENTIFIER_POINTER (name)); |
22eed1e6 APB |
9215 | return error_mark_node; |
9216 | } | |
5e942c50 APB |
9217 | |
9218 | /* Otherwise build what it takes to access the field */ | |
8b27f225 | 9219 | decl = build_field_ref ((fs ? NULL_TREE : current_this), |
7f1d4866 | 9220 | DECL_CONTEXT (decl), name); |
5423609c | 9221 | if (fs && !flag_emit_class_files && !flag_emit_xref) |
7f1d4866 | 9222 | decl = build_class_init (DECL_CONTEXT (decl), decl); |
5e942c50 APB |
9223 | /* We may be asked to save the real field access node */ |
9224 | if (orig) | |
9225 | *orig = decl; | |
9226 | /* And we return what we got */ | |
5b09b33e | 9227 | return decl; |
8b27f225 PB |
9228 | } |
9229 | /* Fall down to error report on undefined variable */ | |
9230 | } | |
9231 | } | |
9232 | /* 6.5.5.2 Qualified Expression Names */ | |
9233 | else | |
9234 | { | |
5e942c50 APB |
9235 | if (orig) |
9236 | *orig = NULL_TREE; | |
8b27f225 PB |
9237 | qualify_ambiguous_name (id); |
9238 | /* 15.10.1 Field Access Using a Primary and/or Expression Name */ | |
9239 | /* 15.10.2: Accessing Superclass Members using super */ | |
3ff9925c | 9240 | return resolve_field_access (id, orig, NULL); |
8b27f225 PB |
9241 | } |
9242 | ||
9243 | /* We've got an error here */ | |
9244 | parse_error_context (id, "Undefined variable `%s'", | |
9245 | IDENTIFIER_POINTER (name)); | |
9246 | ||
9247 | return error_mark_node; | |
9248 | } | |
9249 | ||
7f10c2e2 APB |
9250 | static void |
9251 | static_ref_err (wfl, field_id, class_type) | |
9252 | tree wfl, field_id, class_type; | |
9253 | { | |
9254 | parse_error_context | |
9255 | (wfl, | |
9256 | "Can't make a static reference to nonstatic variable `%s' in class `%s'", | |
9257 | IDENTIFIER_POINTER (field_id), | |
9258 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type)))); | |
9259 | } | |
9260 | ||
8b27f225 PB |
9261 | /* 15.10.1 Field Acess Using a Primary and/or Expression Name. |
9262 | We return something suitable to generate the field access. We also | |
9263 | return the field decl in FIELD_DECL and its type in FIELD_TYPE. If | |
9264 | recipient's address can be null. */ | |
9265 | ||
9266 | static tree | |
9267 | resolve_field_access (qual_wfl, field_decl, field_type) | |
9268 | tree qual_wfl; | |
9269 | tree *field_decl, *field_type; | |
9270 | { | |
9271 | int is_static = 0; | |
9272 | tree field_ref; | |
9273 | tree decl, where_found, type_found; | |
9274 | ||
9275 | if (resolve_qualified_expression_name (qual_wfl, &decl, | |
9276 | &where_found, &type_found)) | |
9277 | return error_mark_node; | |
9278 | ||
9279 | /* Resolve the LENGTH field of an array here */ | |
9280 | if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found) | |
5423609c | 9281 | && ! flag_emit_class_files && ! flag_emit_xref) |
8b27f225 PB |
9282 | { |
9283 | tree length = build_java_array_length_access (where_found); | |
9284 | field_ref = | |
9285 | build_java_arraynull_check (type_found, length, int_type_node); | |
9286 | } | |
9287 | /* We might have been trying to resolve field.method(). In which | |
9288 | case, the resolution is over and decl is the answer */ | |
34f4db93 | 9289 | else if (JDECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl) |
8b27f225 | 9290 | field_ref = decl; |
34f4db93 | 9291 | else if (JDECL_P (decl)) |
8b27f225 | 9292 | { |
5e942c50 APB |
9293 | int static_final_found = 0; |
9294 | if (!type_found) | |
9295 | type_found = DECL_CONTEXT (decl); | |
34f4db93 | 9296 | is_static = JDECL_P (decl) && FIELD_STATIC (decl); |
5e942c50 APB |
9297 | if (FIELD_FINAL (decl) |
9298 | && JPRIMITIVE_TYPE_P (TREE_TYPE (decl)) | |
9299 | && DECL_LANG_SPECIFIC (decl) | |
63a212ed | 9300 | && DECL_INITIAL (decl)) |
5e942c50 | 9301 | { |
63a212ed | 9302 | field_ref = DECL_INITIAL (decl); |
5e942c50 APB |
9303 | static_final_found = 1; |
9304 | } | |
9305 | else | |
7f10c2e2 APB |
9306 | field_ref = build_field_ref ((is_static && !flag_emit_xref? |
9307 | NULL_TREE : where_found), | |
5e942c50 | 9308 | type_found, DECL_NAME (decl)); |
8b27f225 PB |
9309 | if (field_ref == error_mark_node) |
9310 | return error_mark_node; | |
5423609c APB |
9311 | if (is_static && !static_final_found |
9312 | && !flag_emit_class_files && !flag_emit_xref) | |
3ff9925c | 9313 | field_ref = build_class_init (type_found, field_ref); |
8b27f225 PB |
9314 | } |
9315 | else | |
9316 | field_ref = decl; | |
9317 | ||
9318 | if (field_decl) | |
9319 | *field_decl = decl; | |
9320 | if (field_type) | |
c877974e APB |
9321 | *field_type = (QUAL_DECL_TYPE (decl) ? |
9322 | QUAL_DECL_TYPE (decl) : TREE_TYPE (decl)); | |
8b27f225 PB |
9323 | return field_ref; |
9324 | } | |
9325 | ||
78d21f92 PB |
9326 | /* If NODE is an access to f static field, strip out the class |
9327 | initialization part and return the field decl, otherwise, return | |
9328 | NODE. */ | |
9329 | ||
9330 | static tree | |
9331 | strip_out_static_field_access_decl (node) | |
9332 | tree node; | |
9333 | { | |
9334 | if (TREE_CODE (node) == COMPOUND_EXPR) | |
9335 | { | |
9336 | tree op1 = TREE_OPERAND (node, 1); | |
9337 | if (TREE_CODE (op1) == COMPOUND_EXPR) | |
9338 | { | |
9339 | tree call = TREE_OPERAND (op1, 0); | |
9340 | if (TREE_CODE (call) == CALL_EXPR | |
9341 | && TREE_CODE (TREE_OPERAND (call, 0)) == ADDR_EXPR | |
9342 | && TREE_OPERAND (TREE_OPERAND (call, 0), 0) | |
9343 | == soft_initclass_node) | |
9344 | return TREE_OPERAND (op1, 1); | |
9345 | } | |
2f11d407 TT |
9346 | else if (JDECL_P (op1)) |
9347 | return op1; | |
78d21f92 PB |
9348 | } |
9349 | return node; | |
9350 | } | |
9351 | ||
8b27f225 PB |
9352 | /* 6.5.5.2: Qualified Expression Names */ |
9353 | ||
9354 | static int | |
9355 | resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) | |
9356 | tree wfl; | |
9357 | tree *found_decl, *type_found, *where_found; | |
9358 | { | |
9359 | int from_type = 0; /* Field search initiated from a type */ | |
9360 | int from_super = 0, from_cast = 0; | |
9361 | int previous_call_static = 0; | |
9362 | int is_static; | |
9363 | tree decl = NULL_TREE, type = NULL_TREE, q; | |
c877974e | 9364 | *type_found = *where_found = NULL_TREE; |
8b27f225 PB |
9365 | |
9366 | for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q)) | |
9367 | { | |
9368 | tree qual_wfl = QUAL_WFL (q); | |
7705e9db APB |
9369 | tree ret_decl; /* for EH checking */ |
9370 | int location; /* for EH checking */ | |
8b27f225 PB |
9371 | |
9372 | /* 15.10.1 Field Access Using a Primary */ | |
8b27f225 PB |
9373 | switch (TREE_CODE (qual_wfl)) |
9374 | { | |
9375 | case CALL_EXPR: | |
9376 | case NEW_CLASS_EXPR: | |
9377 | /* If the access to the function call is a non static field, | |
9378 | build the code to access it. */ | |
34f4db93 | 9379 | if (JDECL_P (decl) && !FIELD_STATIC (decl)) |
8b27f225 | 9380 | { |
ac825856 APB |
9381 | decl = maybe_access_field (decl, *where_found, |
9382 | DECL_CONTEXT (decl)); | |
8b27f225 PB |
9383 | if (decl == error_mark_node) |
9384 | return 1; | |
9385 | } | |
9386 | /* And code for the function call */ | |
9387 | if (complete_function_arguments (qual_wfl)) | |
9388 | return 1; | |
7705e9db | 9389 | |
ac825856 APB |
9390 | if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR) |
9391 | CALL_USING_SUPER (qual_wfl) = 1; | |
7705e9db APB |
9392 | location = (TREE_CODE (qual_wfl) == CALL_EXPR ? |
9393 | EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0); | |
9394 | *where_found = patch_method_invocation (qual_wfl, decl, type, | |
9395 | &is_static, &ret_decl); | |
8b27f225 PB |
9396 | if (*where_found == error_mark_node) |
9397 | return 1; | |
9398 | *type_found = type = QUAL_DECL_TYPE (*where_found); | |
9399 | ||
7705e9db APB |
9400 | /* EH check */ |
9401 | if (location) | |
9402 | check_thrown_exceptions (location, ret_decl); | |
9403 | ||
8b27f225 PB |
9404 | /* If the previous call was static and this one is too, |
9405 | build a compound expression to hold the two (because in | |
9406 | that case, previous function calls aren't transported as | |
9407 | forcoming function's argument. */ | |
9408 | if (previous_call_static && is_static) | |
9409 | { | |
9410 | decl = build (COMPOUND_EXPR, type, decl, *where_found); | |
9411 | TREE_SIDE_EFFECTS (decl) = 1; | |
9412 | } | |
9413 | else | |
9414 | { | |
9415 | previous_call_static = is_static; | |
9416 | decl = *where_found; | |
9417 | } | |
9418 | continue; | |
9419 | ||
d8fccff5 APB |
9420 | case NEW_ARRAY_EXPR: |
9421 | *where_found = decl = java_complete_tree (qual_wfl); | |
9422 | if (decl == error_mark_node) | |
9423 | return 1; | |
9424 | *type_found = type = QUAL_DECL_TYPE (decl); | |
9425 | CLASS_LOADED_P (type) = 1; | |
9426 | continue; | |
9427 | ||
8b27f225 PB |
9428 | case CONVERT_EXPR: |
9429 | *where_found = decl = java_complete_tree (qual_wfl); | |
9430 | if (decl == error_mark_node) | |
9431 | return 1; | |
9432 | *type_found = type = QUAL_DECL_TYPE (decl); | |
9433 | from_cast = 1; | |
9434 | continue; | |
9435 | ||
22eed1e6 | 9436 | case CONDITIONAL_EXPR: |
5e942c50 | 9437 | case STRING_CST: |
ac22f9cb | 9438 | case MODIFY_EXPR: |
22eed1e6 APB |
9439 | *where_found = decl = java_complete_tree (qual_wfl); |
9440 | if (decl == error_mark_node) | |
9441 | return 1; | |
9442 | *type_found = type = QUAL_DECL_TYPE (decl); | |
9443 | continue; | |
9444 | ||
8b27f225 PB |
9445 | case ARRAY_REF: |
9446 | /* If the access to the function call is a non static field, | |
9447 | build the code to access it. */ | |
34f4db93 | 9448 | if (JDECL_P (decl) && !FIELD_STATIC (decl)) |
8b27f225 PB |
9449 | { |
9450 | decl = maybe_access_field (decl, *where_found, type); | |
9451 | if (decl == error_mark_node) | |
9452 | return 1; | |
9453 | } | |
9454 | /* And code for the array reference expression */ | |
9455 | decl = java_complete_tree (qual_wfl); | |
9456 | if (decl == error_mark_node) | |
9457 | return 1; | |
9458 | type = QUAL_DECL_TYPE (decl); | |
9459 | continue; | |
9460 | ||
b5b8a0e7 APB |
9461 | case PLUS_EXPR: |
9462 | if ((decl = java_complete_tree (qual_wfl)) == error_mark_node) | |
9463 | return 1; | |
9464 | if ((type = patch_string (decl))) | |
9465 | decl = type; | |
9466 | *where_found = QUAL_RESOLUTION (q) = decl; | |
9467 | *type_found = type = TREE_TYPE (decl); | |
9468 | break; | |
9469 | ||
8b27f225 PB |
9470 | default: |
9471 | /* Fix for -Wall Just go to the next statement. Don't | |
9472 | continue */ | |
a3f406ce | 9473 | break; |
8b27f225 PB |
9474 | } |
9475 | ||
9476 | /* If we fall here, we weren't processing a (static) function call. */ | |
9477 | previous_call_static = 0; | |
9478 | ||
9479 | /* It can be the keyword THIS */ | |
9480 | if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node) | |
9481 | { | |
9482 | if (!current_this) | |
9483 | { | |
9484 | parse_error_context | |
9485 | (wfl, "Keyword `this' used outside allowed context"); | |
9486 | return 1; | |
9487 | } | |
f63991a8 APB |
9488 | if (ctxp->explicit_constructor_p) |
9489 | { | |
781b0558 | 9490 | parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called"); |
f63991a8 APB |
9491 | return 1; |
9492 | } | |
8b27f225 PB |
9493 | /* We have to generate code for intermediate acess */ |
9494 | *where_found = decl = current_this; | |
5e942c50 | 9495 | *type_found = type = QUAL_DECL_TYPE (decl); |
8b27f225 PB |
9496 | continue; |
9497 | } | |
9498 | ||
9499 | /* 15.10.2 Accessing Superclass Members using SUPER */ | |
9500 | if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node) | |
9501 | { | |
9502 | tree node; | |
9503 | /* Check on the restricted use of SUPER */ | |
9504 | if (METHOD_STATIC (current_function_decl) | |
9505 | || current_class == object_type_node) | |
9506 | { | |
9507 | parse_error_context | |
9508 | (wfl, "Keyword `super' used outside allowed context"); | |
9509 | return 1; | |
9510 | } | |
9511 | /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */ | |
9512 | node = build_cast (EXPR_WFL_LINECOL (qual_wfl), | |
9513 | CLASSTYPE_SUPER (current_class), | |
9514 | build_this (EXPR_WFL_LINECOL (qual_wfl))); | |
9515 | *where_found = decl = java_complete_tree (node); | |
22eed1e6 APB |
9516 | if (decl == error_mark_node) |
9517 | return 1; | |
8b27f225 PB |
9518 | *type_found = type = QUAL_DECL_TYPE (decl); |
9519 | from_super = from_type = 1; | |
9520 | continue; | |
9521 | } | |
9522 | ||
9523 | /* 15.13.1: Can't search for field name in packages, so we | |
9524 | assume a variable/class name was meant. */ | |
9525 | if (RESOLVE_PACKAGE_NAME_P (qual_wfl)) | |
9526 | { | |
5e942c50 APB |
9527 | tree name = resolve_package (wfl, &q); |
9528 | if (name) | |
9529 | { | |
9530 | *where_found = decl = resolve_no_layout (name, qual_wfl); | |
9531 | /* We wan't to be absolutely that the class is laid | |
9532 | out. We're going to search something inside it. */ | |
9533 | *type_found = type = TREE_TYPE (decl); | |
9534 | layout_class (type); | |
9535 | from_type = 1; | |
9536 | /* Should be a list, really. FIXME */ | |
9537 | RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 1; | |
9538 | RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 0; | |
9539 | } | |
8b27f225 | 9540 | else |
5e942c50 APB |
9541 | { |
9542 | if (from_super || from_cast) | |
9543 | parse_error_context | |
9544 | ((from_cast ? qual_wfl : wfl), | |
9545 | "No variable `%s' defined in class `%s'", | |
9546 | IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), | |
9547 | lang_printable_name (type, 0)); | |
9548 | else | |
9549 | parse_error_context | |
9550 | (qual_wfl, "Undefined variable or class name: `%s'", | |
9551 | IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl))); | |
9552 | return 1; | |
9553 | } | |
8b27f225 PB |
9554 | } |
9555 | ||
9556 | /* We have a type name. It's been already resolved when the | |
9557 | expression was qualified. */ | |
9558 | else if (RESOLVE_TYPE_NAME_P (qual_wfl)) | |
9559 | { | |
9560 | if (!(decl = QUAL_RESOLUTION (q))) | |
9561 | return 1; /* Error reported already */ | |
9562 | ||
9563 | if (not_accessible_p (TREE_TYPE (decl), decl, 0)) | |
9564 | { | |
9565 | parse_error_context | |
9566 | (qual_wfl, "Can't access %s field `%s.%s' from `%s'", | |
9567 | java_accstring_lookup (get_access_flags_from_decl (decl)), | |
2aa11e97 | 9568 | GET_TYPE_NAME (type), |
8b27f225 PB |
9569 | IDENTIFIER_POINTER (DECL_NAME (decl)), |
9570 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)))); | |
9571 | return 1; | |
9572 | } | |
5e942c50 | 9573 | check_deprecation (qual_wfl, decl); |
8b27f225 PB |
9574 | |
9575 | type = TREE_TYPE (decl); | |
9576 | from_type = 1; | |
9577 | } | |
9578 | /* We resolve and expression name */ | |
9579 | else | |
9580 | { | |
cd531a2e | 9581 | tree field_decl = NULL_TREE; |
8b27f225 PB |
9582 | |
9583 | /* If there exists an early resolution, use it. That occurs | |
9584 | only once and we know that there are more things to | |
9585 | come. Don't do that when processing something after SUPER | |
9586 | (we need more thing to be put in place below */ | |
9587 | if (!from_super && QUAL_RESOLUTION (q)) | |
9588 | { | |
9589 | decl = QUAL_RESOLUTION (q); | |
c877974e | 9590 | if (!type) |
5e942c50 | 9591 | { |
7f10c2e2 APB |
9592 | if (TREE_CODE (decl) == FIELD_DECL && !FIELD_STATIC (decl)) |
9593 | { | |
9594 | if (current_this) | |
9595 | *where_found = current_this; | |
9596 | else | |
9597 | { | |
9598 | static_ref_err (qual_wfl, DECL_NAME (decl), | |
9599 | current_class); | |
9600 | return 1; | |
9601 | } | |
9602 | } | |
c877974e APB |
9603 | else |
9604 | { | |
9605 | *where_found = TREE_TYPE (decl); | |
9606 | if (TREE_CODE (*where_found) == POINTER_TYPE) | |
9607 | *where_found = TREE_TYPE (*where_found); | |
9608 | } | |
5e942c50 | 9609 | } |
8b27f225 PB |
9610 | } |
9611 | ||
9612 | /* We have to search for a field, knowing the type of its | |
9613 | container. The flag FROM_TYPE indicates that we resolved | |
9614 | the last member of the expression as a type name, which | |
5e942c50 APB |
9615 | means that for the resolution of this field, we'll look |
9616 | for other errors than if it was resolved as a member of | |
9617 | an other field. */ | |
8b27f225 PB |
9618 | else |
9619 | { | |
9620 | int is_static; | |
5e942c50 APB |
9621 | tree field_decl_type; /* For layout */ |
9622 | ||
8b27f225 PB |
9623 | if (!from_type && !JREFERENCE_TYPE_P (type)) |
9624 | { | |
9625 | parse_error_context | |
9626 | (qual_wfl, "Attempt to reference field `%s' in `%s %s'", | |
9627 | IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), | |
9628 | lang_printable_name (type, 0), | |
9629 | IDENTIFIER_POINTER (DECL_NAME (field_decl))); | |
9630 | return 1; | |
9631 | } | |
9632 | ||
939d7216 PB |
9633 | field_decl = lookup_field_wrapper (type, |
9634 | EXPR_WFL_NODE (qual_wfl)); | |
9635 | if (field_decl == NULL_TREE) | |
8b27f225 PB |
9636 | { |
9637 | parse_error_context | |
2aa11e97 | 9638 | (qual_wfl, "No variable `%s' defined in type `%s'", |
8b27f225 | 9639 | IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), |
2aa11e97 | 9640 | GET_TYPE_NAME (type)); |
8b27f225 PB |
9641 | return 1; |
9642 | } | |
939d7216 PB |
9643 | if (field_decl == error_mark_node) |
9644 | return 1; | |
5e942c50 APB |
9645 | |
9646 | /* Layout the type of field_decl, since we may need | |
c877974e APB |
9647 | it. Don't do primitive types or loaded classes. The |
9648 | situation of non primitive arrays may not handled | |
9649 | properly here. FIXME */ | |
5e942c50 APB |
9650 | if (TREE_CODE (TREE_TYPE (field_decl)) == POINTER_TYPE) |
9651 | field_decl_type = TREE_TYPE (TREE_TYPE (field_decl)); | |
9652 | else | |
9653 | field_decl_type = TREE_TYPE (field_decl); | |
9654 | if (!JPRIMITIVE_TYPE_P (field_decl_type) | |
c877974e APB |
9655 | && !CLASS_LOADED_P (field_decl_type) |
9656 | && !TYPE_ARRAY_P (field_decl_type)) | |
9657 | resolve_and_layout (field_decl_type, NULL_TREE); | |
9658 | if (TYPE_ARRAY_P (field_decl_type)) | |
9659 | CLASS_LOADED_P (field_decl_type) = 1; | |
8b27f225 PB |
9660 | |
9661 | /* Check on accessibility here */ | |
9662 | if (not_accessible_p (type, field_decl, from_super)) | |
9663 | { | |
9664 | parse_error_context | |
9665 | (qual_wfl, | |
9666 | "Can't access %s field `%s.%s' from `%s'", | |
9667 | java_accstring_lookup | |
9668 | (get_access_flags_from_decl (field_decl)), | |
2aa11e97 | 9669 | GET_TYPE_NAME (type), |
8b27f225 PB |
9670 | IDENTIFIER_POINTER (DECL_NAME (field_decl)), |
9671 | IDENTIFIER_POINTER | |
9672 | (DECL_NAME (TYPE_NAME (current_class)))); | |
9673 | return 1; | |
9674 | } | |
5e942c50 | 9675 | check_deprecation (qual_wfl, field_decl); |
8b27f225 PB |
9676 | |
9677 | /* There are things to check when fields are accessed | |
9678 | from type. There are no restrictions on a static | |
9679 | declaration of the field when it is accessed from an | |
9680 | interface */ | |
9681 | is_static = FIELD_STATIC (field_decl); | |
9682 | if (!from_super && from_type | |
9683 | && !TYPE_INTERFACE_P (type) && !is_static) | |
9684 | { | |
7f10c2e2 | 9685 | static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type); |
8b27f225 PB |
9686 | return 1; |
9687 | } | |
9688 | from_cast = from_super = 0; | |
9689 | ||
5e942c50 APB |
9690 | /* If we need to generate something to get a proper |
9691 | handle on what this field is accessed from, do it | |
9692 | now. */ | |
8b27f225 PB |
9693 | if (!is_static) |
9694 | { | |
9695 | decl = maybe_access_field (decl, *where_found, *type_found); | |
9696 | if (decl == error_mark_node) | |
9697 | return 1; | |
9698 | } | |
9699 | ||
9700 | /* We want to keep the location were found it, and the type | |
9701 | we found. */ | |
9702 | *where_found = decl; | |
9703 | *type_found = type; | |
9704 | ||
9705 | /* This is the decl found and eventually the next one to | |
9706 | search from */ | |
9707 | decl = field_decl; | |
9708 | } | |
9709 | from_type = 0; | |
9710 | type = QUAL_DECL_TYPE (decl); | |
9711 | } | |
9712 | } | |
9713 | *found_decl = decl; | |
9714 | return 0; | |
9715 | } | |
9716 | ||
9717 | /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl) | |
9718 | can't be accessed from REFERENCE (a record type). */ | |
9719 | ||
be245ac0 KG |
9720 | static int |
9721 | not_accessible_p (reference, member, from_super) | |
8b27f225 PB |
9722 | tree reference, member; |
9723 | int from_super; | |
9724 | { | |
9725 | int access_flag = get_access_flags_from_decl (member); | |
9726 | ||
9727 | /* Access always granted for members declared public */ | |
9728 | if (access_flag & ACC_PUBLIC) | |
9729 | return 0; | |
9730 | ||
9731 | /* Check access on protected members */ | |
9732 | if (access_flag & ACC_PROTECTED) | |
9733 | { | |
9734 | /* Access granted if it occurs from within the package | |
9735 | containing the class in which the protected member is | |
9736 | declared */ | |
9737 | if (class_in_current_package (DECL_CONTEXT (member))) | |
9738 | return 0; | |
9739 | ||
c877974e APB |
9740 | /* If accessed with the form `super.member', then access is granted */ |
9741 | if (from_super) | |
9742 | return 0; | |
8b27f225 | 9743 | |
c877974e APB |
9744 | /* Otherwise, access is granted if occuring from the class where |
9745 | member is declared or a subclass of it */ | |
9746 | if (inherits_from_p (reference, current_class)) | |
9747 | return 0; | |
8b27f225 PB |
9748 | return 1; |
9749 | } | |
9750 | ||
9751 | /* Check access on private members. Access is granted only if it | |
c877974e | 9752 | occurs from within the class in witch it is declared */ |
8b27f225 PB |
9753 | if (access_flag & ACC_PRIVATE) |
9754 | return (current_class == DECL_CONTEXT (member) ? 0 : 1); | |
9755 | ||
9756 | /* Default access are permitted only when occuring within the | |
9757 | package in which the type (REFERENCE) is declared. In other words, | |
9758 | REFERENCE is defined in the current package */ | |
9759 | if (ctxp->package) | |
9760 | return !class_in_current_package (reference); | |
9761 | ||
9762 | /* Otherwise, access is granted */ | |
9763 | return 0; | |
9764 | } | |
9765 | ||
5e942c50 APB |
9766 | /* Test deprecated decl access. */ |
9767 | static void | |
9768 | check_deprecation (wfl, decl) | |
9769 | tree wfl, decl; | |
9770 | { | |
49f48c71 | 9771 | const char *file = DECL_SOURCE_FILE (decl); |
5e942c50 APB |
9772 | /* Complain if the field is deprecated and the file it was defined |
9773 | in isn't compiled at the same time the file which contains its | |
9774 | use is */ | |
9775 | if (DECL_DEPRECATED (decl) | |
9776 | && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file))) | |
9777 | { | |
9778 | char the [20]; | |
9779 | switch (TREE_CODE (decl)) | |
9780 | { | |
9781 | case FUNCTION_DECL: | |
9782 | strcpy (the, "method"); | |
9783 | break; | |
9784 | case FIELD_DECL: | |
9785 | strcpy (the, "field"); | |
9786 | break; | |
9787 | case TYPE_DECL: | |
9788 | strcpy (the, "class"); | |
9789 | break; | |
9790 | default: | |
9791 | fatal ("unexpected DECL code - check_deprecation"); | |
9792 | } | |
9793 | parse_warning_context | |
9794 | (wfl, "The %s `%s' in class `%s' has been deprecated", | |
9795 | the, lang_printable_name (decl, 0), | |
9796 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))))); | |
9797 | } | |
9798 | } | |
9799 | ||
8b27f225 PB |
9800 | /* Returns 1 if class was declared in the current package, 0 otherwise */ |
9801 | ||
9802 | static int | |
9803 | class_in_current_package (class) | |
9804 | tree class; | |
9805 | { | |
9806 | static tree cache = NULL_TREE; | |
9807 | int qualified_flag; | |
9808 | tree left; | |
9809 | ||
9810 | if (cache == class) | |
9811 | return 1; | |
9812 | ||
9813 | qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class))); | |
9814 | ||
9815 | /* If the current package is empty and the name of CLASS is | |
9816 | qualified, class isn't in the current package. If there is a | |
9817 | current package and the name of the CLASS is not qualified, class | |
9818 | isn't in the current package */ | |
9819 | if ((!ctxp->package && qualified_flag) || (ctxp->package && !qualified_flag)) | |
9820 | return 0; | |
9821 | ||
9822 | /* If there is not package and the name of CLASS isn't qualified, | |
9823 | they belong to the same unnamed package */ | |
9824 | if (!ctxp->package && !qualified_flag) | |
9825 | return 1; | |
9826 | ||
9827 | /* Compare the left part of the name of CLASS with the package name */ | |
9828 | breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class))); | |
9829 | if (ctxp->package == left) | |
9830 | { | |
9831 | cache = class; | |
9832 | return 1; | |
9833 | } | |
9834 | return 0; | |
9835 | } | |
9836 | ||
9837 | /* This function may generate code to access DECL from WHERE. This is | |
9838 | done only if certain conditions meet. */ | |
9839 | ||
9840 | static tree | |
9841 | maybe_access_field (decl, where, type) | |
9842 | tree decl, where, type; | |
9843 | { | |
5e942c50 APB |
9844 | if (TREE_CODE (decl) == FIELD_DECL && decl != current_this |
9845 | && !FIELD_STATIC (decl)) | |
8b27f225 PB |
9846 | decl = build_field_ref (where ? where : current_this, |
9847 | (type ? type : DECL_CONTEXT (decl)), | |
9848 | DECL_NAME (decl)); | |
9849 | return decl; | |
9850 | } | |
9851 | ||
12472854 | 9852 | /* Build a method invocation, by patching PATCH. If non NULL |
8b27f225 PB |
9853 | and according to the situation, PRIMARY and WHERE may be |
9854 | used. IS_STATIC is set to 1 if the invoked function is static. */ | |
9855 | ||
9856 | static tree | |
ac825856 | 9857 | patch_method_invocation (patch, primary, where, is_static, ret_decl) |
8b27f225 PB |
9858 | tree patch, primary, where; |
9859 | int *is_static; | |
9860 | tree *ret_decl; | |
9861 | { | |
9862 | tree wfl = TREE_OPERAND (patch, 0); | |
9863 | tree args = TREE_OPERAND (patch, 1); | |
9864 | tree name = EXPR_WFL_NODE (wfl); | |
5e942c50 | 9865 | tree list; |
22eed1e6 | 9866 | int is_static_flag = 0; |
ac825856 | 9867 | int is_super_init = 0; |
bccaf73a | 9868 | tree this_arg = NULL_TREE; |
8b27f225 PB |
9869 | |
9870 | /* Should be overriden if everything goes well. Otherwise, if | |
9871 | something fails, it should keep this value. It stop the | |
9872 | evaluation of a bogus assignment. See java_complete_tree, | |
9873 | MODIFY_EXPR: for the reasons why we sometimes want to keep on | |
9874 | evaluating an assignment */ | |
9875 | TREE_TYPE (patch) = error_mark_node; | |
9876 | ||
9877 | /* Since lookup functions are messing with line numbers, save the | |
9878 | context now. */ | |
9879 | java_parser_context_save_global (); | |
9880 | ||
9881 | /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */ | |
9882 | ||
9883 | /* Resolution of qualified name, excluding constructors */ | |
9884 | if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch)) | |
9885 | { | |
9886 | tree class_decl, identifier, identifier_wfl; | |
9887 | /* Extract the last IDENTIFIER of the qualified | |
9888 | expression. This is a wfl and we will use it's location | |
9889 | data during error report. */ | |
9890 | identifier_wfl = cut_identifier_in_qualified (wfl); | |
9891 | identifier = EXPR_WFL_NODE (identifier_wfl); | |
9892 | ||
9893 | /* Given the context, IDENTIFIER is syntactically qualified | |
9894 | as a MethodName. We need to qualify what's before */ | |
9895 | qualify_ambiguous_name (wfl); | |
9896 | ||
2c56429a | 9897 | /* Package resolution */ |
8b27f225 PB |
9898 | if (RESOLVE_PACKAGE_NAME_P (wfl)) |
9899 | { | |
2c56429a APB |
9900 | tree next, decl, name = resolve_package (wfl, &next); |
9901 | ||
9902 | if (!name) | |
9903 | { | |
9904 | tree remainder; | |
9905 | breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl)); | |
781b0558 KG |
9906 | parse_error_context |
9907 | (wfl, "Can't search method `%s' in package `%s'", | |
9908 | IDENTIFIER_POINTER (identifier), | |
9909 | IDENTIFIER_POINTER (remainder)); | |
2c56429a APB |
9910 | PATCH_METHOD_RETURN_ERROR (); |
9911 | } | |
9912 | RESOLVE_PACKAGE_NAME_P (wfl) = 0; | |
9913 | if ((decl = resolve_no_layout (name, QUAL_WFL (next)))) | |
9914 | { | |
9915 | QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl)) = decl; | |
9916 | RESOLVE_EXPRESSION_NAME_P (wfl) = 0; | |
9917 | RESOLVE_TYPE_NAME_P (wfl) = 1; | |
9918 | } | |
9919 | else | |
9920 | { | |
9921 | RESOLVE_EXPRESSION_NAME_P (wfl) = 1; | |
9922 | RESOLVE_TYPE_NAME_P (wfl) = 0; | |
9923 | } | |
8b27f225 | 9924 | } |
2c56429a | 9925 | |
8b27f225 | 9926 | /* We're resolving a call from a type */ |
2c56429a | 9927 | if (RESOLVE_TYPE_NAME_P (wfl)) |
8b27f225 PB |
9928 | { |
9929 | tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl)); | |
9930 | tree name = DECL_NAME (decl); | |
9931 | tree type; | |
9932 | ||
9933 | class_decl = resolve_and_layout (name, wfl); | |
9934 | if (CLASS_INTERFACE (decl)) | |
9935 | { | |
9936 | parse_error_context | |
781b0558 KG |
9937 | (identifier_wfl, |
9938 | "Can't make static reference to method `%s' in interface `%s'", | |
9939 | IDENTIFIER_POINTER (identifier), | |
8b27f225 PB |
9940 | IDENTIFIER_POINTER (name)); |
9941 | PATCH_METHOD_RETURN_ERROR (); | |
9942 | } | |
9943 | /* Look the method up in the type selector. The method ought | |
9944 | to be static. */ | |
9945 | type = TREE_TYPE (class_decl); | |
9946 | list = lookup_method_invoke (0, wfl, type, identifier, args); | |
9947 | if (list && !METHOD_STATIC (list)) | |
9948 | { | |
c2e3db92 | 9949 | char *fct_name = xstrdup (lang_printable_name (list, 0)); |
8b27f225 PB |
9950 | parse_error_context |
9951 | (identifier_wfl, | |
9952 | "Can't make static reference to method `%s %s' in class `%s'", | |
9953 | lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0), | |
9954 | fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))); | |
9955 | free (fct_name); | |
9956 | PATCH_METHOD_RETURN_ERROR (); | |
9957 | } | |
5e942c50 | 9958 | args = nreverse (args); |
8b27f225 PB |
9959 | } |
9960 | /* We're resolving an expression name */ | |
9961 | else | |
9962 | { | |
9963 | tree field, type; | |
9964 | ||
9965 | /* 1- Find the field to which the call applies */ | |
9966 | field = resolve_field_access (wfl, NULL, &type); | |
9967 | if (field == error_mark_node) | |
9968 | PATCH_METHOD_RETURN_ERROR (); | |
c3f2a476 APB |
9969 | /* field is used in lieu of a primary. It alows us not to |
9970 | report errors on erroneous use of `this' in | |
9971 | constructors. */ | |
9972 | primary = field; | |
8b27f225 PB |
9973 | |
9974 | /* 2- Do the layout of the class where the last field | |
9975 | was found, so we can search it. */ | |
c877974e | 9976 | class_decl = resolve_and_layout (type, NULL_TREE); |
59e4a38e | 9977 | if (class_decl != NULL_TREE) |
c877974e APB |
9978 | type = TREE_TYPE (class_decl); |
9979 | ||
8b27f225 PB |
9980 | /* 3- Retrieve a filtered list of method matches, Refine |
9981 | if necessary. In any cases, point out errors. */ | |
9982 | list = lookup_method_invoke (0, identifier_wfl, type, | |
9983 | identifier, args); | |
9984 | ||
9985 | /* 4- Add the field as an argument */ | |
bccaf73a PB |
9986 | args = nreverse (args); |
9987 | this_arg = field; | |
8b27f225 PB |
9988 | } |
9989 | ||
5e942c50 | 9990 | /* IDENTIFIER_WFL will be used to report any problem further */ |
8b27f225 PB |
9991 | wfl = identifier_wfl; |
9992 | } | |
9993 | /* Resolution of simple names, names generated after a primary: or | |
9994 | constructors */ | |
9995 | else | |
9996 | { | |
cd531a2e | 9997 | tree class_to_search = NULL_TREE; |
8b27f225 PB |
9998 | int lc; /* Looking for Constructor */ |
9999 | ||
10000 | /* We search constructor in their target class */ | |
10001 | if (CALL_CONSTRUCTOR_P (patch)) | |
10002 | { | |
22eed1e6 APB |
10003 | if (TREE_CODE (patch) == NEW_CLASS_EXPR) |
10004 | class_to_search = EXPR_WFL_NODE (wfl); | |
10005 | else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) == | |
10006 | this_identifier_node) | |
10007 | class_to_search = NULL_TREE; | |
10008 | else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) == | |
10009 | super_identifier_node) | |
8b27f225 | 10010 | { |
ac825856 | 10011 | is_super_init = 1; |
22eed1e6 APB |
10012 | if (CLASSTYPE_SUPER (current_class)) |
10013 | class_to_search = | |
10014 | DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class))); | |
10015 | else | |
10016 | { | |
781b0558 | 10017 | parse_error_context (wfl, "Can't invoke super constructor on java.lang.Object"); |
22eed1e6 APB |
10018 | PATCH_METHOD_RETURN_ERROR (); |
10019 | } | |
8b27f225 | 10020 | } |
22eed1e6 APB |
10021 | |
10022 | /* Class to search is NULL if we're searching the current one */ | |
10023 | if (class_to_search) | |
8b27f225 | 10024 | { |
23a79c61 APB |
10025 | class_to_search = resolve_and_layout (class_to_search, |
10026 | NULL_TREE); | |
22eed1e6 APB |
10027 | if (!class_to_search) |
10028 | { | |
10029 | parse_error_context | |
10030 | (wfl, "Class `%s' not found in type declaration", | |
10031 | IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); | |
10032 | PATCH_METHOD_RETURN_ERROR (); | |
10033 | } | |
10034 | ||
5e942c50 APB |
10035 | /* Can't instantiate an abstract class, but we can |
10036 | invoke it's constructor. It's use within the `new' | |
10037 | context is denied here. */ | |
10038 | if (CLASS_ABSTRACT (class_to_search) | |
10039 | && TREE_CODE (patch) == NEW_CLASS_EXPR) | |
22eed1e6 APB |
10040 | { |
10041 | parse_error_context | |
781b0558 KG |
10042 | (wfl, "Class `%s' is an abstract class. It can't be instantiated", |
10043 | IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); | |
22eed1e6 APB |
10044 | PATCH_METHOD_RETURN_ERROR (); |
10045 | } | |
10046 | class_to_search = TREE_TYPE (class_to_search); | |
8b27f225 | 10047 | } |
22eed1e6 APB |
10048 | else |
10049 | class_to_search = current_class; | |
8b27f225 PB |
10050 | lc = 1; |
10051 | } | |
10052 | /* This is a regular search in the local class, unless an | |
10053 | alternate class is specified. */ | |
10054 | else | |
10055 | { | |
10056 | class_to_search = (where ? where : current_class); | |
10057 | lc = 0; | |
10058 | } | |
10059 | ||
10060 | /* NAME is a simple identifier or comes from a primary. Search | |
10061 | in the class whose declaration contain the method being | |
10062 | invoked. */ | |
c877974e | 10063 | resolve_and_layout (class_to_search, NULL_TREE); |
8b27f225 PB |
10064 | list = lookup_method_invoke (lc, wfl, class_to_search, name, args); |
10065 | ||
10066 | /* Don't continue if no method were found, as the next statement | |
10067 | can't be executed then. */ | |
10068 | if (!list) | |
10069 | PATCH_METHOD_RETURN_ERROR (); | |
10070 | ||
10071 | /* Check for static reference if non static methods */ | |
10072 | if (check_for_static_method_reference (wfl, patch, list, | |
10073 | class_to_search, primary)) | |
10074 | PATCH_METHOD_RETURN_ERROR (); | |
10075 | ||
22eed1e6 APB |
10076 | /* Non static methods are called with the current object extra |
10077 | argument. If patch a `new TYPE()', the argument is the value | |
10078 | returned by the object allocator. If method is resolved as a | |
10079 | primary, use the primary otherwise use the current THIS. */ | |
8b27f225 | 10080 | args = nreverse (args); |
bccaf73a PB |
10081 | if (TREE_CODE (patch) != NEW_CLASS_EXPR) |
10082 | this_arg = primary ? primary : current_this; | |
8b27f225 PB |
10083 | } |
10084 | ||
10085 | /* Merge point of all resolution schemes. If we have nothing, this | |
10086 | is an error, already signaled */ | |
10087 | if (!list) | |
10088 | PATCH_METHOD_RETURN_ERROR (); | |
10089 | ||
10090 | /* Check accessibility, position the is_static flag, build and | |
10091 | return the call */ | |
c877974e | 10092 | if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0)) |
8b27f225 | 10093 | { |
c2e3db92 | 10094 | char *fct_name = xstrdup (lang_printable_name (list, 0)); |
8b27f225 PB |
10095 | parse_error_context |
10096 | (wfl, "Can't access %s method `%s %s.%s' from `%s'", | |
10097 | java_accstring_lookup (get_access_flags_from_decl (list)), | |
10098 | lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0), | |
5e942c50 APB |
10099 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list)))), |
10100 | fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)))); | |
8b27f225 PB |
10101 | free (fct_name); |
10102 | PATCH_METHOD_RETURN_ERROR (); | |
10103 | } | |
5e942c50 | 10104 | check_deprecation (wfl, list); |
22eed1e6 APB |
10105 | |
10106 | is_static_flag = METHOD_STATIC (list); | |
bccaf73a PB |
10107 | if (! METHOD_STATIC (list) && this_arg != NULL_TREE) |
10108 | args = tree_cons (NULL_TREE, this_arg, args); | |
22eed1e6 | 10109 | |
c3f2a476 APB |
10110 | /* In the context of an explicit constructor invocation, we can't |
10111 | invoke any method relying on `this'. Exceptions are: we're | |
10112 | invoking a static function, primary exists and is not the current | |
10113 | this, we're creating a new object. */ | |
22eed1e6 | 10114 | if (ctxp->explicit_constructor_p |
c3f2a476 APB |
10115 | && !is_static_flag |
10116 | && (!primary || primary == current_this) | |
10117 | && (TREE_CODE (patch) != NEW_CLASS_EXPR)) | |
22eed1e6 | 10118 | { |
781b0558 | 10119 | parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called"); |
22eed1e6 APB |
10120 | PATCH_METHOD_RETURN_ERROR (); |
10121 | } | |
8b27f225 | 10122 | java_parser_context_restore_global (); |
22eed1e6 APB |
10123 | if (is_static) |
10124 | *is_static = is_static_flag; | |
8b27f225 PB |
10125 | /* Sometimes, we want the decl of the selected method. Such as for |
10126 | EH checking */ | |
10127 | if (ret_decl) | |
10128 | *ret_decl = list; | |
ac825856 APB |
10129 | patch = patch_invoke (patch, list, args); |
10130 | if (is_super_init && CLASS_HAS_FINIT_P (current_class)) | |
10131 | { | |
10132 | /* Generate the code used to initialize fields declared with an | |
10133 | initialization statement. For now, it returns a call the the | |
10134 | artificial function $finit$, if required. */ | |
10135 | ||
10136 | tree finit_call = | |
10137 | build_method_invocation (build_expr_wfl (finit_identifier_node, | |
10138 | input_filename, 0, 0), | |
10139 | NULL_TREE); | |
10140 | patch = build (COMPOUND_EXPR, void_type_node, patch, | |
10141 | java_complete_tree (finit_call)); | |
10142 | CAN_COMPLETE_NORMALLY (patch) = 1; | |
10143 | } | |
10144 | return patch; | |
8b27f225 PB |
10145 | } |
10146 | ||
10147 | /* Check that we're not trying to do a static reference to a method in | |
10148 | non static method. Return 1 if it's the case, 0 otherwise. */ | |
10149 | ||
10150 | static int | |
10151 | check_for_static_method_reference (wfl, node, method, where, primary) | |
10152 | tree wfl, node, method, where, primary; | |
10153 | { | |
10154 | if (METHOD_STATIC (current_function_decl) | |
10155 | && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node)) | |
10156 | { | |
c2e3db92 | 10157 | char *fct_name = xstrdup (lang_printable_name (method, 0)); |
8b27f225 PB |
10158 | parse_error_context |
10159 | (wfl, "Can't make static reference to method `%s %s' in class `%s'", | |
10160 | lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name, | |
10161 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where)))); | |
10162 | free (fct_name); | |
10163 | return 1; | |
10164 | } | |
10165 | return 0; | |
10166 | } | |
10167 | ||
10168 | /* Patch an invoke expression METHOD and ARGS, based on its invocation | |
10169 | mode. */ | |
10170 | ||
10171 | static tree | |
ac825856 | 10172 | patch_invoke (patch, method, args) |
8b27f225 PB |
10173 | tree patch, method, args; |
10174 | { | |
8b27f225 | 10175 | tree dtable, func; |
8b27f225 PB |
10176 | tree original_call, t, ta; |
10177 | ||
5e942c50 APB |
10178 | /* Last step for args: convert build-in types. If we're dealing with |
10179 | a new TYPE() type call, the first argument to the constructor | |
10180 | isn't found in the incomming argument list, but delivered by | |
10181 | `new' */ | |
10182 | t = TYPE_ARG_TYPES (TREE_TYPE (method)); | |
10183 | if (TREE_CODE (patch) == NEW_CLASS_EXPR) | |
10184 | t = TREE_CHAIN (t); | |
ac825856 APB |
10185 | for (ta = args; t != end_params_node && ta; |
10186 | t = TREE_CHAIN (t), ta = TREE_CHAIN (ta)) | |
8b27f225 PB |
10187 | if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) && |
10188 | TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t)) | |
10189 | TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta)); | |
1a6d4fb7 APB |
10190 | |
10191 | /* Resolve unresolved returned type isses */ | |
10192 | t = TREE_TYPE (TREE_TYPE (method)); | |
10193 | if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t))) | |
10194 | resolve_and_layout (TREE_TYPE (t), NULL); | |
22eed1e6 | 10195 | |
5423609c | 10196 | if (flag_emit_class_files || flag_emit_xref) |
12472854 PB |
10197 | func = method; |
10198 | else | |
8b27f225 | 10199 | { |
12472854 | 10200 | tree signature = build_java_signature (TREE_TYPE (method)); |
ac825856 | 10201 | switch (invocation_mode (method, CALL_USING_SUPER (patch))) |
12472854 PB |
10202 | { |
10203 | case INVOKE_VIRTUAL: | |
10204 | dtable = invoke_build_dtable (0, args); | |
10205 | func = build_invokevirtual (dtable, method); | |
10206 | break; | |
8b27f225 | 10207 | |
12472854 PB |
10208 | case INVOKE_SUPER: |
10209 | case INVOKE_STATIC: | |
10210 | func = build_known_method_ref (method, TREE_TYPE (method), | |
10211 | DECL_CONTEXT (method), | |
10212 | signature, args); | |
10213 | break; | |
8b27f225 | 10214 | |
12472854 PB |
10215 | case INVOKE_INTERFACE: |
10216 | dtable = invoke_build_dtable (1, args); | |
518f173d | 10217 | func = build_invokeinterface (dtable, method); |
12472854 | 10218 | break; |
5e942c50 | 10219 | |
12472854 | 10220 | default: |
ac825856 | 10221 | fatal ("internal error - unknown invocation_mode result"); |
12472854 PB |
10222 | } |
10223 | ||
10224 | /* Ensure self_type is initialized, (invokestatic). FIXME */ | |
10225 | func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func); | |
8b27f225 PB |
10226 | } |
10227 | ||
8b27f225 PB |
10228 | TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method)); |
10229 | TREE_OPERAND (patch, 0) = func; | |
10230 | TREE_OPERAND (patch, 1) = args; | |
10231 | original_call = patch; | |
10232 | ||
22eed1e6 APB |
10233 | /* We're processing a `new TYPE ()' form. New is called an its |
10234 | returned value is the first argument to the constructor. We build | |
10235 | a COMPOUND_EXPR and use saved expression so that the overall NEW | |
10236 | expression value is a pointer to a newly created and initialized | |
10237 | class. */ | |
10238 | if (TREE_CODE (original_call) == NEW_CLASS_EXPR) | |
8b27f225 PB |
10239 | { |
10240 | tree class = DECL_CONTEXT (method); | |
10241 | tree c1, saved_new, size, new; | |
5423609c | 10242 | if (flag_emit_class_files || flag_emit_xref) |
12472854 PB |
10243 | { |
10244 | TREE_TYPE (patch) = build_pointer_type (class); | |
10245 | return patch; | |
10246 | } | |
8b27f225 PB |
10247 | if (!TYPE_SIZE (class)) |
10248 | safe_layout_class (class); | |
10249 | size = size_in_bytes (class); | |
10250 | new = build (CALL_EXPR, promote_type (class), | |
10251 | build_address_of (alloc_object_node), | |
10252 | tree_cons (NULL_TREE, build_class_ref (class), | |
10253 | build_tree_list (NULL_TREE, | |
10254 | size_in_bytes (class))), | |
10255 | NULL_TREE); | |
10256 | saved_new = save_expr (new); | |
10257 | c1 = build_tree_list (NULL_TREE, saved_new); | |
10258 | TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1); | |
10259 | TREE_OPERAND (original_call, 1) = c1; | |
10260 | TREE_SET_CODE (original_call, CALL_EXPR); | |
10261 | patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new); | |
10262 | } | |
10263 | return patch; | |
10264 | } | |
10265 | ||
10266 | static int | |
10267 | invocation_mode (method, super) | |
10268 | tree method; | |
10269 | int super; | |
10270 | { | |
10271 | int access = get_access_flags_from_decl (method); | |
10272 | ||
22eed1e6 APB |
10273 | if (super) |
10274 | return INVOKE_SUPER; | |
10275 | ||
82371d41 | 10276 | if (access & ACC_STATIC || access & ACC_FINAL || access & ACC_PRIVATE) |
8b27f225 PB |
10277 | return INVOKE_STATIC; |
10278 | ||
10279 | if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method)))) | |
10280 | return INVOKE_STATIC; | |
10281 | ||
8b27f225 PB |
10282 | if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method)))) |
10283 | return INVOKE_INTERFACE; | |
10284 | ||
10285 | if (DECL_CONSTRUCTOR_P (method)) | |
10286 | return INVOKE_STATIC; | |
22eed1e6 | 10287 | |
8b27f225 PB |
10288 | return INVOKE_VIRTUAL; |
10289 | } | |
10290 | ||
10291 | /* Retrieve a refined list of matching methods. It covers the step | |
10292 | 15.11.2 (Compile-Time Step 2) */ | |
10293 | ||
10294 | static tree | |
10295 | lookup_method_invoke (lc, cl, class, name, arg_list) | |
10296 | int lc; | |
10297 | tree cl; | |
10298 | tree class, name, arg_list; | |
10299 | { | |
82371d41 | 10300 | tree atl = end_params_node; /* Arg Type List */ |
c877974e | 10301 | tree method, signature, list, node; |
49f48c71 | 10302 | const char *candidates; /* Used for error report */ |
b5b8a0e7 | 10303 | char *dup; |
8b27f225 | 10304 | |
5e942c50 | 10305 | /* Fix the arguments */ |
8b27f225 PB |
10306 | for (node = arg_list; node; node = TREE_CHAIN (node)) |
10307 | { | |
0b4d333e | 10308 | tree current_arg = TREE_TYPE (TREE_VALUE (node)); |
c877974e | 10309 | /* Non primitive type may have to be resolved */ |
0b4d333e | 10310 | if (!JPRIMITIVE_TYPE_P (current_arg)) |
c877974e APB |
10311 | resolve_and_layout (current_arg, NULL_TREE); |
10312 | /* And promoted */ | |
8b27f225 | 10313 | if (TREE_CODE (current_arg) == RECORD_TYPE) |
c877974e | 10314 | current_arg = promote_type (current_arg); |
5e942c50 | 10315 | atl = tree_cons (NULL_TREE, current_arg, atl); |
8b27f225 PB |
10316 | } |
10317 | ||
5e942c50 APB |
10318 | /* Find all candidates and then refine the list, searching for the |
10319 | most specific method. */ | |
10320 | list = find_applicable_accessible_methods_list (lc, class, name, atl); | |
10321 | list = find_most_specific_methods_list (list); | |
8b27f225 PB |
10322 | if (list && !TREE_CHAIN (list)) |
10323 | return TREE_VALUE (list); | |
10324 | ||
10325 | /* Issue an error. List candidates if any. Candidates are listed | |
10326 | only if accessible (non accessible methods may end-up here for | |
10327 | the sake of a better error report). */ | |
10328 | candidates = NULL; | |
10329 | if (list) | |
10330 | { | |
10331 | tree current; | |
10332 | obstack_grow (&temporary_obstack, ". Candidates are:\n", 18); | |
10333 | for (current = list; current; current = TREE_CHAIN (current)) | |
10334 | { | |
10335 | tree cm = TREE_VALUE (current); | |
10336 | char string [4096]; | |
10337 | if (!cm || not_accessible_p (class, cm, 0)) | |
10338 | continue; | |
8b27f225 | 10339 | sprintf |
22eed1e6 APB |
10340 | (string, " `%s' in `%s'%s", |
10341 | get_printable_method_name (cm), | |
8b27f225 PB |
10342 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))), |
10343 | (TREE_CHAIN (current) ? "\n" : "")); | |
10344 | obstack_grow (&temporary_obstack, string, strlen (string)); | |
10345 | } | |
10346 | obstack_1grow (&temporary_obstack, '\0'); | |
10347 | candidates = obstack_finish (&temporary_obstack); | |
10348 | } | |
10349 | /* Issue the error message */ | |
c877974e APB |
10350 | method = make_node (FUNCTION_TYPE); |
10351 | TYPE_ARG_TYPES (method) = atl; | |
8b27f225 | 10352 | signature = build_java_argument_signature (method); |
c63b98cd | 10353 | dup = xstrdup (lang_printable_name (class, 0)); |
b5b8a0e7 | 10354 | parse_error_context (cl, "Can't find %s `%s(%s)' in type `%s'%s", |
22eed1e6 | 10355 | (lc ? "constructor" : "method"), |
b5b8a0e7 APB |
10356 | (lc ? dup : IDENTIFIER_POINTER (name)), |
10357 | IDENTIFIER_POINTER (signature), dup, | |
8b27f225 | 10358 | (candidates ? candidates : "")); |
b5b8a0e7 | 10359 | free (dup); |
8b27f225 PB |
10360 | return NULL_TREE; |
10361 | } | |
10362 | ||
5e942c50 APB |
10363 | /* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1 |
10364 | when we're looking for a constructor. */ | |
8b27f225 PB |
10365 | |
10366 | static tree | |
5e942c50 APB |
10367 | find_applicable_accessible_methods_list (lc, class, name, arglist) |
10368 | int lc; | |
8b27f225 PB |
10369 | tree class, name, arglist; |
10370 | { | |
8b27f225 PB |
10371 | tree list = NULL_TREE, all_list = NULL_TREE; |
10372 | ||
cc596f8c | 10373 | /* Search interfaces */ |
f4e16489 APB |
10374 | if (CLASS_INTERFACE (TYPE_NAME (class)) |
10375 | || CLASS_ABSTRACT (TYPE_NAME (class))) | |
8b27f225 | 10376 | { |
de0b553f APB |
10377 | static tree searched_interfaces = NULL_TREE; |
10378 | static int search_not_done = 0; | |
cc596f8c APB |
10379 | int i, n; |
10380 | tree basetype_vec = TYPE_BINFO_BASETYPES (class); | |
10381 | ||
de0b553f APB |
10382 | /* Have we searched this interface already? */ |
10383 | if (searched_interfaces) | |
10384 | { | |
10385 | tree current; | |
10386 | for (current = searched_interfaces; | |
10387 | current; current = TREE_CHAIN (current)) | |
10388 | if (TREE_VALUE (current) == class) | |
10389 | return NULL; | |
10390 | } | |
10391 | searched_interfaces = tree_cons (NULL_TREE, class, searched_interfaces); | |
10392 | ||
cc596f8c APB |
10393 | search_applicable_methods_list |
10394 | (lc, TYPE_METHODS (class), name, arglist, &list, &all_list); | |
10395 | ||
10396 | n = TREE_VEC_LENGTH (basetype_vec); | |
10397 | for (i = 0; i < n; i++) | |
8b27f225 | 10398 | { |
de0b553f APB |
10399 | tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)); |
10400 | tree rlist; | |
10401 | ||
10402 | /* Skip java.lang.Object (we'll search it once later.) */ | |
10403 | if (t == object_type_node) | |
10404 | continue; | |
10405 | ||
10406 | search_not_done++; | |
10407 | rlist = find_applicable_accessible_methods_list (lc, t, name, | |
10408 | arglist); | |
cc596f8c | 10409 | all_list = chainon (rlist, (list ? list : all_list)); |
de0b553f APB |
10410 | search_not_done--; |
10411 | } | |
10412 | ||
10413 | /* We're done. Reset the searched interfaces list and finally search | |
10414 | java.lang.Object */ | |
10415 | if (!search_not_done) | |
10416 | { | |
10417 | searched_interfaces = NULL_TREE; | |
10418 | search_applicable_methods_list (lc, TYPE_METHODS (object_type_node), | |
10419 | name, arglist, &list, &all_list); | |
8b27f225 | 10420 | } |
8b27f225 | 10421 | } |
cc596f8c APB |
10422 | /* Search classes */ |
10423 | else | |
10424 | while (class != NULL_TREE) | |
10425 | { | |
10426 | search_applicable_methods_list | |
10427 | (lc, TYPE_METHODS (class), name, arglist, &list, &all_list); | |
10428 | class = (lc ? NULL_TREE : CLASSTYPE_SUPER (class)); | |
10429 | } | |
10430 | ||
8b27f225 PB |
10431 | /* Either return the list obtained or all selected (but |
10432 | inaccessible) methods for better error report. */ | |
10433 | return (!list ? all_list : list); | |
10434 | } | |
10435 | ||
cc596f8c APB |
10436 | /* Effectively search for the approriate method in method */ |
10437 | ||
10438 | static void | |
10439 | search_applicable_methods_list(lc, method, name, arglist, list, all_list) | |
10440 | int lc; | |
10441 | tree method, name, arglist; | |
10442 | tree *list, *all_list; | |
10443 | { | |
10444 | for (; method; method = TREE_CHAIN (method)) | |
10445 | { | |
10446 | /* When dealing with constructor, stop here, otherwise search | |
10447 | other classes */ | |
10448 | if (lc && !DECL_CONSTRUCTOR_P (method)) | |
10449 | continue; | |
10450 | else if (!lc && (DECL_CONSTRUCTOR_P (method) | |
10451 | || (GET_METHOD_NAME (method) != name))) | |
10452 | continue; | |
10453 | ||
10454 | if (argument_types_convertible (method, arglist)) | |
10455 | { | |
10456 | /* Retain accessible methods only */ | |
10457 | if (!not_accessible_p (DECL_CONTEXT (current_function_decl), | |
10458 | method, 0)) | |
10459 | *list = tree_cons (NULL_TREE, method, *list); | |
10460 | else | |
10461 | /* Also retain all selected method here */ | |
10462 | *all_list = tree_cons (NULL_TREE, method, *list); | |
10463 | } | |
10464 | } | |
10465 | } | |
10466 | ||
8b27f225 PB |
10467 | /* 15.11.2.2 Choose the Most Specific Method */ |
10468 | ||
10469 | static tree | |
10470 | find_most_specific_methods_list (list) | |
10471 | tree list; | |
10472 | { | |
10473 | int max = 0; | |
10474 | tree current, new_list = NULL_TREE; | |
10475 | for (current = list; current; current = TREE_CHAIN (current)) | |
10476 | { | |
10477 | tree method; | |
10478 | DECL_SPECIFIC_COUNT (TREE_VALUE (current)) = 0; | |
10479 | ||
10480 | for (method = list; method; method = TREE_CHAIN (method)) | |
10481 | { | |
10482 | /* Don't test a method against itself */ | |
10483 | if (method == current) | |
10484 | continue; | |
10485 | ||
10486 | /* Compare arguments and location where method where declared */ | |
10487 | if (argument_types_convertible (TREE_VALUE (method), | |
10488 | TREE_VALUE (current)) | |
10489 | && valid_method_invocation_conversion_p | |
10490 | (DECL_CONTEXT (TREE_VALUE (method)), | |
10491 | DECL_CONTEXT (TREE_VALUE (current)))) | |
10492 | { | |
10493 | int v = ++DECL_SPECIFIC_COUNT (TREE_VALUE (current)); | |
10494 | max = (v > max ? v : max); | |
10495 | } | |
10496 | } | |
10497 | } | |
10498 | ||
10499 | /* Review the list and select the maximally specific methods */ | |
10500 | for (current = list; current; current = TREE_CHAIN (current)) | |
10501 | if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max) | |
10502 | new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list); | |
10503 | ||
10504 | /* If we can't find one, lower expectations and try to gather multiple | |
10505 | maximally specific methods */ | |
10506 | while (!new_list) | |
10507 | { | |
10508 | while (--max > 0) | |
10509 | { | |
10510 | if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max) | |
10511 | new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list); | |
10512 | } | |
10513 | return new_list; | |
10514 | } | |
10515 | ||
10516 | return new_list; | |
10517 | } | |
10518 | ||
10519 | /* Make sure that the type of each M2_OR_ARGLIST arguments can be | |
10520 | converted by method invocation conversion (5.3) to the type of the | |
10521 | corresponding parameter of M1. Implementation expects M2_OR_ARGLIST | |
10522 | to change less often than M1. */ | |
10523 | ||
10524 | static int | |
10525 | argument_types_convertible (m1, m2_or_arglist) | |
10526 | tree m1, m2_or_arglist; | |
10527 | { | |
10528 | static tree m2_arg_value = NULL_TREE; | |
10529 | static tree m2_arg_cache = NULL_TREE; | |
10530 | ||
10531 | register tree m1_arg, m2_arg; | |
10532 | ||
10533 | m1_arg = TYPE_ARG_TYPES (TREE_TYPE (m1)); | |
10534 | if (!METHOD_STATIC (m1)) | |
10535 | m1_arg = TREE_CHAIN (m1_arg); | |
10536 | ||
10537 | if (m2_arg_value == m2_or_arglist) | |
10538 | m2_arg = m2_arg_cache; | |
10539 | else | |
10540 | { | |
10541 | /* M2_OR_ARGLIST can be a function DECL or a raw list of | |
10542 | argument types */ | |
10543 | if (m2_or_arglist && TREE_CODE (m2_or_arglist) == FUNCTION_DECL) | |
10544 | { | |
10545 | m2_arg = TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist)); | |
10546 | if (!METHOD_STATIC (m2_or_arglist)) | |
10547 | m2_arg = TREE_CHAIN (m2_arg); | |
10548 | } | |
10549 | else | |
10550 | m2_arg = m2_or_arglist; | |
10551 | ||
10552 | m2_arg_value = m2_or_arglist; | |
10553 | m2_arg_cache = m2_arg; | |
10554 | } | |
10555 | ||
82371d41 | 10556 | while (m1_arg != end_params_node && m2_arg != end_params_node) |
8b27f225 | 10557 | { |
c877974e | 10558 | resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE); |
8b27f225 PB |
10559 | if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg), |
10560 | TREE_VALUE (m2_arg))) | |
10561 | break; | |
10562 | m1_arg = TREE_CHAIN (m1_arg); | |
10563 | m2_arg = TREE_CHAIN (m2_arg); | |
10564 | } | |
82371d41 | 10565 | return m1_arg == end_params_node && m2_arg == end_params_node; |
8b27f225 PB |
10566 | } |
10567 | ||
10568 | /* Qualification routines */ | |
10569 | ||
10570 | static void | |
10571 | qualify_ambiguous_name (id) | |
10572 | tree id; | |
10573 | { | |
cd531a2e KG |
10574 | tree qual, qual_wfl, name = NULL_TREE, decl, ptr_type = NULL_TREE, |
10575 | saved_current_class; | |
d8fccff5 | 10576 | int again, super_found = 0, this_found = 0, new_array_found = 0; |
8576f094 | 10577 | int code; |
8b27f225 PB |
10578 | |
10579 | /* We first qualify the first element, then derive qualification of | |
10580 | others based on the first one. If the first element is qualified | |
10581 | by a resolution (field or type), this resolution is stored in the | |
10582 | QUAL_RESOLUTION of the qual element being examined. We need to | |
10583 | save the current_class since the use of SUPER might change the | |
10584 | its value. */ | |
10585 | saved_current_class = current_class; | |
10586 | qual = EXPR_WFL_QUALIFICATION (id); | |
10587 | do { | |
10588 | ||
10589 | /* Simple qualified expression feature a qual_wfl that is a | |
10590 | WFL. Expression derived from a primary feature more complicated | |
10591 | things like a CALL_EXPR. Expression from primary need to be | |
10592 | worked out to extract the part on which the qualification will | |
10593 | take place. */ | |
10594 | qual_wfl = QUAL_WFL (qual); | |
10595 | switch (TREE_CODE (qual_wfl)) | |
10596 | { | |
10597 | case CALL_EXPR: | |
10598 | qual_wfl = TREE_OPERAND (qual_wfl, 0); | |
10599 | if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION) | |
10600 | { | |
10601 | qual = EXPR_WFL_QUALIFICATION (qual_wfl); | |
10602 | qual_wfl = QUAL_WFL (qual); | |
10603 | } | |
10604 | break; | |
d8fccff5 APB |
10605 | case NEW_ARRAY_EXPR: |
10606 | qual = TREE_CHAIN (qual); | |
1a6d4fb7 | 10607 | again = new_array_found = 1; |
d8fccff5 | 10608 | continue; |
8b27f225 PB |
10609 | case NEW_CLASS_EXPR: |
10610 | case CONVERT_EXPR: | |
10611 | qual_wfl = TREE_OPERAND (qual_wfl, 0); | |
10612 | break; | |
10613 | case ARRAY_REF: | |
10614 | while (TREE_CODE (qual_wfl) == ARRAY_REF) | |
10615 | qual_wfl = TREE_OPERAND (qual_wfl, 0); | |
10616 | break; | |
8576f094 APB |
10617 | case STRING_CST: |
10618 | qual = TREE_CHAIN (qual); | |
10619 | qual_wfl = QUAL_WFL (qual); | |
10620 | break; | |
8b27f225 PB |
10621 | default: |
10622 | /* Fix for -Wall. Just break doing nothing */ | |
10623 | break; | |
10624 | } | |
8576f094 | 10625 | |
8b27f225 PB |
10626 | ptr_type = current_class; |
10627 | again = 0; | |
8576f094 APB |
10628 | code = TREE_CODE (qual_wfl); |
10629 | ||
10630 | /* Pos evaluation: non WFL leading expression nodes */ | |
10631 | if (code == CONVERT_EXPR | |
10632 | && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION) | |
10633 | name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl)); | |
10634 | ||
ac22f9cb | 10635 | else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) && |
8576f094 APB |
10636 | TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION) |
10637 | name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0)); | |
10638 | ||
b5b8a0e7 APB |
10639 | else if (code == STRING_CST || code == CONDITIONAL_EXPR |
10640 | || code == PLUS_EXPR) | |
8576f094 APB |
10641 | { |
10642 | qual = TREE_CHAIN (qual); | |
10643 | qual_wfl = QUAL_WFL (qual); | |
10644 | again = 1; | |
10645 | } | |
10646 | else | |
f441f671 APB |
10647 | { |
10648 | name = EXPR_WFL_NODE (qual_wfl); | |
10649 | if (!name) | |
10650 | { | |
10651 | qual = EXPR_WFL_QUALIFICATION (qual_wfl); | |
10652 | again = 1; | |
10653 | } | |
10654 | } | |
10655 | ||
8b27f225 PB |
10656 | /* If we have a THIS (from a primary), we set the context accordingly */ |
10657 | if (name == this_identifier_node) | |
10658 | { | |
10659 | qual = TREE_CHAIN (qual); | |
10660 | qual_wfl = QUAL_WFL (qual); | |
22eed1e6 APB |
10661 | if (TREE_CODE (qual_wfl) == CALL_EXPR) |
10662 | again = 1; | |
10663 | else | |
10664 | name = EXPR_WFL_NODE (qual_wfl); | |
8b27f225 PB |
10665 | this_found = 1; |
10666 | } | |
10667 | /* If we have a SUPER, we set the context accordingly */ | |
10668 | if (name == super_identifier_node) | |
10669 | { | |
10670 | current_class = CLASSTYPE_SUPER (ptr_type); | |
10671 | /* Check that there is such a thing as a super class. If not, | |
10672 | return. The error will be caught later on, during the | |
10673 | resolution */ | |
10674 | if (!current_class) | |
10675 | { | |
10676 | current_class = saved_current_class; | |
10677 | return; | |
10678 | } | |
10679 | qual = TREE_CHAIN (qual); | |
10680 | /* Do one more interation to set things up */ | |
10681 | super_found = again = 1; | |
10682 | } | |
10683 | } while (again); | |
10684 | ||
10685 | /* If name appears within the scope of a location variable | |
10686 | declaration or parameter declaration, then it is an expression | |
10687 | name. We don't carry this test out if we're in the context of the | |
10688 | use of SUPER or THIS */ | |
1a6d4fb7 APB |
10689 | if (!this_found && !super_found && |
10690 | TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name))) | |
8b27f225 PB |
10691 | { |
10692 | RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; | |
10693 | QUAL_RESOLUTION (qual) = decl; | |
10694 | } | |
10695 | ||
10696 | /* If within the class/interface NAME was found to be used there | |
10697 | exists a (possibly inherited) field named NAME, then this is an | |
d8fccff5 APB |
10698 | expression name. If we saw a NEW_ARRAY_EXPR before and want to |
10699 | address length, it is OK. */ | |
10700 | else if ((decl = lookup_field_wrapper (ptr_type, name)) | |
10701 | || (new_array_found && name == length_identifier_node)) | |
8b27f225 PB |
10702 | { |
10703 | RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; | |
d8fccff5 | 10704 | QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl); |
8b27f225 PB |
10705 | } |
10706 | ||
1a6d4fb7 | 10707 | /* We reclassify NAME as yielding to a type name resolution if: |
8b27f225 PB |
10708 | - NAME is a class/interface declared within the compilation |
10709 | unit containing NAME, | |
10710 | - NAME is imported via a single-type-import declaration, | |
10711 | - NAME is declared in an another compilation unit of the package | |
10712 | of the compilation unit containing NAME, | |
10713 | - NAME is declared by exactly on type-import-on-demand declaration | |
1a6d4fb7 APB |
10714 | of the compilation unit containing NAME. |
10715 | - NAME is actually a STRING_CST. */ | |
10716 | else if (TREE_CODE (name) == STRING_CST || | |
10717 | (decl = resolve_and_layout (name, NULL_TREE))) | |
8b27f225 PB |
10718 | { |
10719 | RESOLVE_TYPE_NAME_P (qual_wfl) = 1; | |
10720 | QUAL_RESOLUTION (qual) = decl; | |
10721 | } | |
10722 | ||
10723 | /* Method call are expression name */ | |
c877974e | 10724 | else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR |
8576f094 APB |
10725 | || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF |
10726 | || TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR) | |
8b27f225 PB |
10727 | RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; |
10728 | ||
10729 | /* Check here that NAME isn't declared by more than one | |
10730 | type-import-on-demand declaration of the compilation unit | |
10731 | containing NAME. FIXME */ | |
10732 | ||
10733 | /* Otherwise, NAME is reclassified as a package name */ | |
10734 | else | |
10735 | RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1; | |
10736 | ||
10737 | /* Propagate the qualification accross other components of the | |
10738 | qualified name */ | |
10739 | for (qual = TREE_CHAIN (qual); qual; | |
10740 | qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual)) | |
10741 | { | |
10742 | if (RESOLVE_PACKAGE_NAME_P (qual_wfl)) | |
10743 | RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1; | |
10744 | else | |
10745 | RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1; | |
10746 | } | |
10747 | ||
10748 | /* Store the global qualification for the ambiguous part of ID back | |
10749 | into ID fields */ | |
10750 | if (RESOLVE_EXPRESSION_NAME_P (qual_wfl)) | |
10751 | RESOLVE_EXPRESSION_NAME_P (id) = 1; | |
10752 | else if (RESOLVE_TYPE_NAME_P (qual_wfl)) | |
10753 | RESOLVE_TYPE_NAME_P (id) = 1; | |
10754 | else if (RESOLVE_PACKAGE_NAME_P (qual_wfl)) | |
10755 | RESOLVE_PACKAGE_NAME_P (id) = 1; | |
10756 | ||
10757 | /* Restore the current class */ | |
10758 | current_class = saved_current_class; | |
10759 | } | |
10760 | ||
10761 | static int | |
10762 | breakdown_qualified (left, right, source) | |
10763 | tree *left, *right, source; | |
10764 | { | |
10765 | char *p = IDENTIFIER_POINTER (source), *base; | |
10766 | int l = IDENTIFIER_LENGTH (source); | |
10767 | ||
10768 | /* Breakdown NAME into REMAINDER . IDENTIFIER */ | |
10769 | base = p; | |
10770 | p += (l-1); | |
10771 | while (*p != '.' && p != base) | |
10772 | p--; | |
10773 | ||
10774 | /* We didn't find a '.'. Return an error */ | |
10775 | if (p == base) | |
10776 | return 1; | |
10777 | ||
10778 | *p = '\0'; | |
10779 | if (right) | |
10780 | *right = get_identifier (p+1); | |
10781 | *left = get_identifier (IDENTIFIER_POINTER (source)); | |
10782 | *p = '.'; | |
10783 | ||
10784 | return 0; | |
10785 | } | |
10786 | ||
8b27f225 | 10787 | /* Patch tree nodes in a function body. When a BLOCK is found, push |
5b09b33e PB |
10788 | local variable decls if present. |
10789 | Same as java_complete_lhs, but does resolve static finals to values. */ | |
8b27f225 PB |
10790 | |
10791 | static tree | |
10792 | java_complete_tree (node) | |
10793 | tree node; | |
5b09b33e PB |
10794 | { |
10795 | node = java_complete_lhs (node); | |
10796 | if (TREE_CODE (node) == VAR_DECL && FIELD_STATIC (node) | |
7f10c2e2 APB |
10797 | && FIELD_FINAL (node) && DECL_INITIAL (node) != NULL_TREE |
10798 | && !flag_emit_xref) | |
5b09b33e PB |
10799 | { |
10800 | tree value = DECL_INITIAL (node); | |
10801 | DECL_INITIAL (node) = NULL_TREE; | |
100f7cd8 | 10802 | push_obstacks (&permanent_obstack, &permanent_obstack); |
5b09b33e | 10803 | value = fold_constant_for_init (value, node); |
100f7cd8 | 10804 | pop_obstacks (); |
5b09b33e PB |
10805 | DECL_INITIAL (node) = value; |
10806 | if (value != NULL_TREE) | |
10807 | return value; | |
10808 | } | |
10809 | return node; | |
10810 | } | |
10811 | ||
2aa11e97 APB |
10812 | static tree |
10813 | java_stabilize_reference (node) | |
10814 | tree node; | |
10815 | { | |
10816 | if (TREE_CODE (node) == COMPOUND_EXPR) | |
10817 | { | |
10818 | tree op0 = TREE_OPERAND (node, 0); | |
10819 | tree op1 = TREE_OPERAND (node, 1); | |
642f15d1 | 10820 | TREE_OPERAND (node, 0) = save_expr (op0); |
2aa11e97 APB |
10821 | TREE_OPERAND (node, 1) = java_stabilize_reference (op1); |
10822 | return node; | |
10823 | } | |
5cbdba64 | 10824 | return stabilize_reference (node); |
2aa11e97 APB |
10825 | } |
10826 | ||
5b09b33e PB |
10827 | /* Patch tree nodes in a function body. When a BLOCK is found, push |
10828 | local variable decls if present. | |
10829 | Same as java_complete_tree, but does not resolve static finals to values. */ | |
10830 | ||
10831 | static tree | |
10832 | java_complete_lhs (node) | |
10833 | tree node; | |
8b27f225 | 10834 | { |
22eed1e6 | 10835 | tree nn, cn, wfl_op1, wfl_op2, wfl_op3; |
8b27f225 PB |
10836 | int flag; |
10837 | ||
10838 | /* CONVERT_EXPR always has its type set, even though it needs to be | |
10839 | worked out. */ | |
10840 | if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR) | |
10841 | return node; | |
10842 | ||
10843 | /* The switch block implements cases processing container nodes | |
10844 | first. Contained nodes are always written back. Leaves come | |
10845 | next and return a value. */ | |
10846 | switch (TREE_CODE (node)) | |
10847 | { | |
10848 | case BLOCK: | |
10849 | ||
10850 | /* 1- Block section. | |
10851 | Set the local values on decl names so we can identify them | |
10852 | faster when they're referenced. At that stage, identifiers | |
10853 | are legal so we don't check for declaration errors. */ | |
10854 | for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn)) | |
10855 | { | |
10856 | DECL_CONTEXT (cn) = current_function_decl; | |
10857 | IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn; | |
8b27f225 | 10858 | } |
12472854 PB |
10859 | if (BLOCK_EXPR_BODY (node) == NULL_TREE) |
10860 | CAN_COMPLETE_NORMALLY (node) = 1; | |
10861 | else | |
8b27f225 | 10862 | { |
12472854 PB |
10863 | tree stmt = BLOCK_EXPR_BODY (node); |
10864 | tree *ptr; | |
10865 | int error_seen = 0; | |
10866 | if (TREE_CODE (stmt) == COMPOUND_EXPR) | |
10867 | { | |
c877974e APB |
10868 | /* Re-order from (((A; B); C); ...; Z) to |
10869 | (A; (B; (C ; (...; Z)))). | |
12472854 PB |
10870 | This makes it easier to scan the statements left-to-right |
10871 | without using recursion (which might overflow the stack | |
10872 | if the block has many statements. */ | |
10873 | for (;;) | |
10874 | { | |
10875 | tree left = TREE_OPERAND (stmt, 0); | |
10876 | if (TREE_CODE (left) != COMPOUND_EXPR) | |
10877 | break; | |
10878 | TREE_OPERAND (stmt, 0) = TREE_OPERAND (left, 1); | |
10879 | TREE_OPERAND (left, 1) = stmt; | |
10880 | stmt = left; | |
10881 | } | |
10882 | BLOCK_EXPR_BODY (node) = stmt; | |
10883 | } | |
10884 | ||
c877974e APB |
10885 | /* Now do the actual complete, without deep recursion for |
10886 | long blocks. */ | |
12472854 | 10887 | ptr = &BLOCK_EXPR_BODY (node); |
939d7216 PB |
10888 | while (TREE_CODE (*ptr) == COMPOUND_EXPR |
10889 | && TREE_OPERAND (*ptr, 1) != empty_stmt_node) | |
12472854 PB |
10890 | { |
10891 | tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0)); | |
10892 | tree *next = &TREE_OPERAND (*ptr, 1); | |
10893 | TREE_OPERAND (*ptr, 0) = cur; | |
cd9643f7 PB |
10894 | if (cur == empty_stmt_node) |
10895 | { | |
10896 | /* Optimization; makes it easier to detect empty bodies. | |
10897 | Most useful for <clinit> with all-constant initializer. */ | |
10898 | *ptr = *next; | |
10899 | continue; | |
10900 | } | |
12472854 PB |
10901 | if (TREE_CODE (cur) == ERROR_MARK) |
10902 | error_seen++; | |
10903 | else if (! CAN_COMPLETE_NORMALLY (cur)) | |
10904 | { | |
10905 | wfl_op2 = *next; | |
10906 | for (;;) | |
10907 | { | |
10908 | if (TREE_CODE (wfl_op2) == BLOCK) | |
10909 | wfl_op2 = BLOCK_EXPR_BODY (wfl_op2); | |
10910 | else if (TREE_CODE (wfl_op2) == COMPOUND_EXPR) | |
10911 | wfl_op2 = TREE_OPERAND (wfl_op2, 0); | |
10912 | else | |
10913 | break; | |
10914 | } | |
10915 | if (TREE_CODE (wfl_op2) != CASE_EXPR | |
939d7216 | 10916 | && TREE_CODE (wfl_op2) != DEFAULT_EXPR) |
82371d41 | 10917 | unreachable_stmt_error (*ptr); |
12472854 PB |
10918 | } |
10919 | ptr = next; | |
10920 | } | |
10921 | *ptr = java_complete_tree (*ptr); | |
10922 | ||
10923 | if (TREE_CODE (*ptr) == ERROR_MARK || error_seen > 0) | |
8b27f225 | 10924 | return error_mark_node; |
12472854 | 10925 | CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (*ptr); |
8b27f225 PB |
10926 | } |
10927 | /* Turn local bindings to null */ | |
10928 | for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn)) | |
10929 | IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE; | |
10930 | ||
10931 | TREE_TYPE (node) = void_type_node; | |
10932 | break; | |
10933 | ||
10934 | /* 2- They are expressions but ultimately deal with statements */ | |
10935 | ||
10936 | case THROW_EXPR: | |
10937 | wfl_op1 = TREE_OPERAND (node, 0); | |
10938 | COMPLETE_CHECK_OP_0 (node); | |
12472854 | 10939 | /* CAN_COMPLETE_NORMALLY (node) = 0; */ |
8b27f225 PB |
10940 | return patch_throw_statement (node, wfl_op1); |
10941 | ||
10942 | case SYNCHRONIZED_EXPR: | |
10943 | wfl_op1 = TREE_OPERAND (node, 0); | |
8b27f225 PB |
10944 | return patch_synchronized_statement (node, wfl_op1); |
10945 | ||
10946 | case TRY_EXPR: | |
10947 | return patch_try_statement (node); | |
10948 | ||
a7d8d81f PB |
10949 | case TRY_FINALLY_EXPR: |
10950 | COMPLETE_CHECK_OP_0 (node); | |
10951 | COMPLETE_CHECK_OP_1 (node); | |
10952 | CAN_COMPLETE_NORMALLY (node) | |
10953 | = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0)) | |
10954 | && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))); | |
10955 | TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 0)); | |
10956 | return node; | |
10957 | ||
5a005d9e PB |
10958 | case CLEANUP_POINT_EXPR: |
10959 | COMPLETE_CHECK_OP_0 (node); | |
10960 | TREE_TYPE (node) = void_type_node; | |
2aa11e97 APB |
10961 | CAN_COMPLETE_NORMALLY (node) = |
10962 | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0)); | |
5a005d9e PB |
10963 | return node; |
10964 | ||
10965 | case WITH_CLEANUP_EXPR: | |
10966 | COMPLETE_CHECK_OP_0 (node); | |
10967 | COMPLETE_CHECK_OP_2 (node); | |
2aa11e97 APB |
10968 | CAN_COMPLETE_NORMALLY (node) = |
10969 | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0)); | |
5a005d9e PB |
10970 | TREE_TYPE (node) = void_type_node; |
10971 | return node; | |
10972 | ||
8b27f225 PB |
10973 | case LABELED_BLOCK_EXPR: |
10974 | PUSH_LABELED_BLOCK (node); | |
10975 | if (LABELED_BLOCK_BODY (node)) | |
10976 | COMPLETE_CHECK_OP_1 (node); | |
10977 | TREE_TYPE (node) = void_type_node; | |
10978 | POP_LABELED_BLOCK (); | |
1fb89a4d APB |
10979 | |
10980 | if (LABELED_BLOCK_BODY (node) == empty_stmt_node) | |
6efa1cc2 APB |
10981 | { |
10982 | LABELED_BLOCK_BODY (node) = NULL_TREE; | |
10983 | CAN_COMPLETE_NORMALLY (node) = 1; | |
10984 | } | |
1fb89a4d | 10985 | else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node))) |
12472854 | 10986 | CAN_COMPLETE_NORMALLY (node) = 1; |
8b27f225 PB |
10987 | return node; |
10988 | ||
10989 | case EXIT_BLOCK_EXPR: | |
10990 | /* We don't complete operand 1, because it's the return value of | |
10991 | the EXIT_BLOCK_EXPR which doesn't exist it Java */ | |
10992 | return patch_bc_statement (node); | |
10993 | ||
12472854 PB |
10994 | case CASE_EXPR: |
10995 | cn = java_complete_tree (TREE_OPERAND (node, 0)); | |
10996 | if (cn == error_mark_node) | |
10997 | return cn; | |
10998 | ||
8576f094 APB |
10999 | /* First, the case expression must be constant. Values of final |
11000 | fields are accepted. */ | |
12472854 | 11001 | cn = fold (cn); |
8576f094 APB |
11002 | if ((TREE_CODE (cn) == COMPOUND_EXPR || TREE_CODE (cn) == COMPONENT_REF) |
11003 | && JDECL_P (TREE_OPERAND (cn, 1)) | |
11004 | && FIELD_FINAL (TREE_OPERAND (cn, 1)) | |
11005 | && DECL_INITIAL (TREE_OPERAND (cn, 1))) | |
100f7cd8 APB |
11006 | { |
11007 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
11008 | cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)), | |
11009 | TREE_OPERAND (cn, 1)); | |
11010 | pop_obstacks (); | |
11011 | } | |
12472854 | 11012 | |
ce6e9147 | 11013 | if (!TREE_CONSTANT (cn) && !flag_emit_xref) |
12472854 PB |
11014 | { |
11015 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
11016 | parse_error_context (node, "Constant expression required"); | |
11017 | return error_mark_node; | |
11018 | } | |
11019 | ||
11020 | nn = ctxp->current_loop; | |
11021 | ||
11022 | /* It must be assignable to the type of the switch expression. */ | |
c877974e APB |
11023 | if (!try_builtin_assignconv (NULL_TREE, |
11024 | TREE_TYPE (TREE_OPERAND (nn, 0)), cn)) | |
12472854 PB |
11025 | { |
11026 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
11027 | parse_error_context | |
11028 | (wfl_operator, | |
11029 | "Incompatible type for case. Can't convert `%s' to `int'", | |
11030 | lang_printable_name (TREE_TYPE (cn), 0)); | |
11031 | return error_mark_node; | |
11032 | } | |
11033 | ||
11034 | cn = fold (convert (int_type_node, cn)); | |
11035 | ||
11036 | /* Multiple instance of a case label bearing the same | |
11037 | value is checked during code generation. The case | |
11038 | expression is allright so far. */ | |
11039 | TREE_OPERAND (node, 0) = cn; | |
c877974e | 11040 | TREE_TYPE (node) = void_type_node; |
12472854 | 11041 | CAN_COMPLETE_NORMALLY (node) = 1; |
23a79c61 | 11042 | TREE_SIDE_EFFECTS (node) = 1; |
12472854 PB |
11043 | break; |
11044 | ||
11045 | case DEFAULT_EXPR: | |
11046 | nn = ctxp->current_loop; | |
11047 | /* Only one default label is allowed per switch statement */ | |
11048 | if (SWITCH_HAS_DEFAULT (nn)) | |
11049 | { | |
11050 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
11051 | parse_error_context (wfl_operator, | |
11052 | "Duplicate case label: `default'"); | |
11053 | return error_mark_node; | |
11054 | } | |
11055 | else | |
11056 | SWITCH_HAS_DEFAULT (nn) = 1; | |
c877974e | 11057 | TREE_TYPE (node) = void_type_node; |
23a79c61 | 11058 | TREE_SIDE_EFFECTS (node) = 1; |
12472854 PB |
11059 | CAN_COMPLETE_NORMALLY (node) = 1; |
11060 | break; | |
11061 | ||
8b27f225 PB |
11062 | case SWITCH_EXPR: |
11063 | case LOOP_EXPR: | |
11064 | PUSH_LOOP (node); | |
11065 | /* Check whether the loop was enclosed in a labeled | |
11066 | statement. If not, create one, insert the loop in it and | |
11067 | return the node */ | |
11068 | nn = patch_loop_statement (node); | |
11069 | ||
11070 | /* Anyways, walk the body of the loop */ | |
11071 | if (TREE_CODE (node) == LOOP_EXPR) | |
11072 | TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); | |
11073 | /* Switch statement: walk the switch expression and the cases */ | |
11074 | else | |
11075 | node = patch_switch_statement (node); | |
11076 | ||
11077 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
e85ac860 PB |
11078 | nn = error_mark_node; |
11079 | else | |
12472854 | 11080 | { |
e85ac860 PB |
11081 | TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node; |
11082 | /* If we returned something different, that's because we | |
11083 | inserted a label. Pop the label too. */ | |
11084 | if (nn != node) | |
11085 | { | |
11086 | if (CAN_COMPLETE_NORMALLY (node)) | |
11087 | CAN_COMPLETE_NORMALLY (nn) = 1; | |
11088 | POP_LABELED_BLOCK (); | |
11089 | } | |
12472854 | 11090 | } |
8b27f225 PB |
11091 | POP_LOOP (); |
11092 | return nn; | |
11093 | ||
11094 | case EXIT_EXPR: | |
11095 | TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); | |
11096 | return patch_exit_expr (node); | |
11097 | ||
11098 | case COND_EXPR: | |
11099 | /* Condition */ | |
11100 | TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); | |
11101 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
11102 | return error_mark_node; | |
11103 | /* then-else branches */ | |
11104 | TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1)); | |
11105 | if (TREE_OPERAND (node, 1) == error_mark_node) | |
11106 | return error_mark_node; | |
11107 | TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2)); | |
11108 | if (TREE_OPERAND (node, 2) == error_mark_node) | |
11109 | return error_mark_node; | |
11110 | return patch_if_else_statement (node); | |
11111 | break; | |
11112 | ||
22eed1e6 APB |
11113 | case CONDITIONAL_EXPR: |
11114 | /* Condition */ | |
11115 | wfl_op1 = TREE_OPERAND (node, 0); | |
11116 | COMPLETE_CHECK_OP_0 (node); | |
11117 | wfl_op2 = TREE_OPERAND (node, 1); | |
11118 | COMPLETE_CHECK_OP_1 (node); | |
11119 | wfl_op3 = TREE_OPERAND (node, 2); | |
11120 | COMPLETE_CHECK_OP_2 (node); | |
11121 | return patch_conditional_expr (node, wfl_op1, wfl_op2); | |
11122 | ||
8b27f225 PB |
11123 | /* 3- Expression section */ |
11124 | case COMPOUND_EXPR: | |
12472854 | 11125 | wfl_op2 = TREE_OPERAND (node, 1); |
ac825856 APB |
11126 | TREE_OPERAND (node, 0) = nn = |
11127 | java_complete_tree (TREE_OPERAND (node, 0)); | |
939d7216 PB |
11128 | if (wfl_op2 == empty_stmt_node) |
11129 | CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn); | |
11130 | else | |
11131 | { | |
11132 | if (! CAN_COMPLETE_NORMALLY (nn) && TREE_CODE (nn) != ERROR_MARK) | |
bccaf73a | 11133 | { |
939d7216 PB |
11134 | /* An unreachable condition in a do-while statement |
11135 | is *not* (technically) an unreachable statement. */ | |
11136 | nn = wfl_op2; | |
11137 | if (TREE_CODE (nn) == EXPR_WITH_FILE_LOCATION) | |
11138 | nn = EXPR_WFL_NODE (nn); | |
11139 | if (TREE_CODE (nn) != EXIT_EXPR) | |
11140 | { | |
11141 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op2); | |
11142 | parse_error_context (wfl_operator, "Unreachable statement"); | |
11143 | } | |
bccaf73a | 11144 | } |
939d7216 PB |
11145 | TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1)); |
11146 | if (TREE_OPERAND (node, 1) == error_mark_node) | |
11147 | return error_mark_node; | |
11148 | CAN_COMPLETE_NORMALLY (node) | |
11149 | = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)); | |
12472854 | 11150 | } |
8b27f225 PB |
11151 | TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1)); |
11152 | break; | |
11153 | ||
11154 | case RETURN_EXPR: | |
12472854 | 11155 | /* CAN_COMPLETE_NORMALLY (node) = 0; */ |
8b27f225 PB |
11156 | return patch_return (node); |
11157 | ||
11158 | case EXPR_WITH_FILE_LOCATION: | |
11159 | if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */ | |
11160 | || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE) | |
12472854 | 11161 | { |
5423609c | 11162 | tree wfl = node; |
12472854 | 11163 | node = resolve_expression_name (node, NULL); |
939d7216 PB |
11164 | if (node == error_mark_node) |
11165 | return node; | |
5423609c APB |
11166 | /* Keep line number information somewhere were it doesn't |
11167 | disrupt the completion process. */ | |
2c56429a | 11168 | if (flag_emit_xref && TREE_CODE (node) != CALL_EXPR) |
5423609c APB |
11169 | { |
11170 | EXPR_WFL_NODE (wfl) = TREE_OPERAND (node, 1); | |
11171 | TREE_OPERAND (node, 1) = wfl; | |
11172 | } | |
12472854 PB |
11173 | CAN_COMPLETE_NORMALLY (node) = 1; |
11174 | } | |
8b27f225 PB |
11175 | else |
11176 | { | |
5b09b33e PB |
11177 | tree body; |
11178 | int save_lineno = lineno; | |
11179 | lineno = EXPR_WFL_LINENO (node); | |
11180 | body = java_complete_tree (EXPR_WFL_NODE (node)); | |
11181 | lineno = save_lineno; | |
12472854 | 11182 | EXPR_WFL_NODE (node) = body; |
939d7216 | 11183 | TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body); |
12472854 | 11184 | CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body); |
cd9643f7 PB |
11185 | if (body == empty_stmt_node) |
11186 | { | |
11187 | /* Optimization; makes it easier to detect empty bodies. */ | |
11188 | return body; | |
11189 | } | |
939d7216 | 11190 | if (body == error_mark_node) |
8b27f225 PB |
11191 | { |
11192 | /* Its important for the evaluation of assignment that | |
11193 | this mark on the TREE_TYPE is propagated. */ | |
11194 | TREE_TYPE (node) = error_mark_node; | |
11195 | return error_mark_node; | |
11196 | } | |
11197 | else | |
11198 | TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node)); | |
12472854 | 11199 | |
8b27f225 PB |
11200 | } |
11201 | break; | |
11202 | ||
11203 | case NEW_ARRAY_EXPR: | |
11204 | /* Patch all the dimensions */ | |
11205 | flag = 0; | |
11206 | for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn)) | |
11207 | { | |
11208 | int location = EXPR_WFL_LINECOL (TREE_VALUE (cn)); | |
781b0558 KG |
11209 | tree dim = convert (int_type_node, |
11210 | java_complete_tree (TREE_VALUE (cn))); | |
8b27f225 PB |
11211 | if (dim == error_mark_node) |
11212 | { | |
11213 | flag = 1; | |
11214 | continue; | |
11215 | } | |
11216 | else | |
11217 | { | |
11218 | TREE_VALUE (cn) = dim; | |
11219 | /* Setup the location of the current dimension, for | |
11220 | later error report. */ | |
11221 | TREE_PURPOSE (cn) = | |
11222 | build_expr_wfl (NULL_TREE, input_filename, 0, 0); | |
11223 | EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location; | |
11224 | } | |
11225 | } | |
11226 | /* They complete the array creation expression, if no errors | |
11227 | were found. */ | |
12472854 | 11228 | CAN_COMPLETE_NORMALLY (node) = 1; |
4fdea7b0 PB |
11229 | return (flag ? error_mark_node |
11230 | : force_evaluation_order (patch_newarray (node))); | |
8b27f225 PB |
11231 | |
11232 | case NEW_CLASS_EXPR: | |
11233 | case CALL_EXPR: | |
11234 | /* Complete function's argument(s) first */ | |
11235 | if (complete_function_arguments (node)) | |
11236 | return error_mark_node; | |
11237 | else | |
11238 | { | |
22eed1e6 APB |
11239 | tree decl, wfl = TREE_OPERAND (node, 0); |
11240 | int in_this = CALL_THIS_CONSTRUCTOR_P (node); | |
11241 | ||
c877974e | 11242 | node = patch_method_invocation (node, NULL_TREE, |
ac825856 | 11243 | NULL_TREE, 0, &decl); |
c877974e APB |
11244 | if (node == error_mark_node) |
11245 | return error_mark_node; | |
11246 | ||
11247 | check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl); | |
11248 | /* If we call this(...), register signature and positions */ | |
11249 | if (in_this) | |
11250 | DECL_CONSTRUCTOR_CALLS (current_function_decl) = | |
11251 | tree_cons (wfl, decl, | |
11252 | DECL_CONSTRUCTOR_CALLS (current_function_decl)); | |
82371d41 | 11253 | CAN_COMPLETE_NORMALLY (node) = 1; |
939d7216 | 11254 | return force_evaluation_order (node); |
8b27f225 PB |
11255 | } |
11256 | ||
11257 | case MODIFY_EXPR: | |
11258 | /* Save potential wfls */ | |
11259 | wfl_op1 = TREE_OPERAND (node, 0); | |
cd9643f7 PB |
11260 | TREE_OPERAND (node, 0) = nn = java_complete_lhs (wfl_op1); |
11261 | if (MODIFY_EXPR_FROM_INITIALIZATION_P (node) | |
11262 | && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn) | |
11263 | && DECL_INITIAL (nn) != NULL_TREE) | |
11264 | { | |
100f7cd8 APB |
11265 | tree value; |
11266 | ||
11267 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
11268 | value = fold_constant_for_init (nn, nn); | |
11269 | pop_obstacks (); | |
cd9643f7 PB |
11270 | if (value != NULL_TREE) |
11271 | { | |
11272 | tree type = TREE_TYPE (value); | |
11273 | if (JPRIMITIVE_TYPE_P (type) || type == string_ptr_type_node) | |
11274 | return empty_stmt_node; | |
11275 | } | |
11276 | DECL_INITIAL (nn) = NULL_TREE; | |
11277 | } | |
8b27f225 | 11278 | wfl_op2 = TREE_OPERAND (node, 1); |
cd9643f7 | 11279 | |
8b27f225 PB |
11280 | if (TREE_OPERAND (node, 0) == error_mark_node) |
11281 | return error_mark_node; | |
11282 | ||
5cbdba64 APB |
11283 | flag = COMPOUND_ASSIGN_P (wfl_op2); |
11284 | if (flag) | |
8b27f225 | 11285 | { |
2aa11e97 | 11286 | tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0)); |
8b27f225 PB |
11287 | |
11288 | /* Hand stablize the lhs on both places */ | |
8b27f225 | 11289 | TREE_OPERAND (node, 0) = lvalue; |
5cbdba64 APB |
11290 | TREE_OPERAND (TREE_OPERAND (node, 1), 0) = |
11291 | (flag_emit_class_files ? lvalue : save_expr (lvalue)); | |
2aa11e97 | 11292 | |
5cbdba64 | 11293 | /* 15.25.2.a: Left hand is not an array access. FIXME */ |
2aa11e97 APB |
11294 | /* Now complete the RHS. We write it back later on. */ |
11295 | nn = java_complete_tree (TREE_OPERAND (node, 1)); | |
11296 | ||
642f15d1 APB |
11297 | if ((cn = patch_string (nn))) |
11298 | nn = cn; | |
11299 | ||
2aa11e97 APB |
11300 | /* The last part of the rewrite for E1 op= E2 is to have |
11301 | E1 = (T)(E1 op E2), with T being the type of E1. */ | |
642f15d1 APB |
11302 | nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2), |
11303 | TREE_TYPE (lvalue), nn)); | |
5cbdba64 APB |
11304 | |
11305 | /* 15.25.2.b: Left hand is an array access. FIXME */ | |
8b27f225 PB |
11306 | } |
11307 | ||
f8976021 APB |
11308 | /* If we're about to patch a NEW_ARRAY_INIT, we call a special |
11309 | function to complete this RHS */ | |
2aa11e97 | 11310 | else if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT) |
63a212ed | 11311 | nn = patch_new_array_init (TREE_TYPE (TREE_OPERAND (node, 0)), |
f8976021 | 11312 | TREE_OPERAND (node, 1)); |
2aa11e97 | 11313 | /* Otherwise we simply complete the RHS */ |
f8976021 APB |
11314 | else |
11315 | nn = java_complete_tree (TREE_OPERAND (node, 1)); | |
11316 | ||
8b27f225 | 11317 | if (nn == error_mark_node) |
c0d87ff6 | 11318 | return error_mark_node; |
2aa11e97 APB |
11319 | |
11320 | /* Write back the RHS as we evaluated it. */ | |
8b27f225 PB |
11321 | TREE_OPERAND (node, 1) = nn; |
11322 | ||
11323 | /* In case we're handling = with a String as a RHS, we need to | |
11324 | produce a String out of the RHS (it might still be a | |
11325 | STRING_CST or a StringBuffer at this stage */ | |
11326 | if ((nn = patch_string (TREE_OPERAND (node, 1)))) | |
11327 | TREE_OPERAND (node, 1) = nn; | |
12472854 | 11328 | node = patch_assignment (node, wfl_op1, wfl_op2); |
5cbdba64 APB |
11329 | /* Reorganize the tree if necessary. */ |
11330 | if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node)) | |
11331 | || JSTRING_P (TREE_TYPE (node)))) | |
11332 | node = java_refold (node); | |
12472854 PB |
11333 | CAN_COMPLETE_NORMALLY (node) = 1; |
11334 | return node; | |
8b27f225 PB |
11335 | |
11336 | case MULT_EXPR: | |
11337 | case PLUS_EXPR: | |
11338 | case MINUS_EXPR: | |
11339 | case LSHIFT_EXPR: | |
11340 | case RSHIFT_EXPR: | |
11341 | case URSHIFT_EXPR: | |
11342 | case BIT_AND_EXPR: | |
11343 | case BIT_XOR_EXPR: | |
11344 | case BIT_IOR_EXPR: | |
11345 | case TRUNC_MOD_EXPR: | |
11346 | case RDIV_EXPR: | |
11347 | case TRUTH_ANDIF_EXPR: | |
11348 | case TRUTH_ORIF_EXPR: | |
11349 | case EQ_EXPR: | |
11350 | case NE_EXPR: | |
11351 | case GT_EXPR: | |
11352 | case GE_EXPR: | |
11353 | case LT_EXPR: | |
11354 | case LE_EXPR: | |
11355 | /* Operands 0 and 1 are WFL in certain cases only. patch_binop | |
11356 | knows how to handle those cases. */ | |
11357 | wfl_op1 = TREE_OPERAND (node, 0); | |
11358 | wfl_op2 = TREE_OPERAND (node, 1); | |
11359 | ||
12472854 | 11360 | CAN_COMPLETE_NORMALLY (node) = 1; |
8b27f225 PB |
11361 | /* Don't complete string nodes if dealing with the PLUS operand. */ |
11362 | if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op1)) | |
2aa11e97 APB |
11363 | { |
11364 | nn = java_complete_tree (wfl_op1); | |
11365 | if (nn == error_mark_node) | |
11366 | return error_mark_node; | |
11367 | if ((cn = patch_string (nn))) | |
11368 | nn = cn; | |
11369 | TREE_OPERAND (node, 0) = nn; | |
11370 | } | |
8b27f225 | 11371 | if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2)) |
2aa11e97 APB |
11372 | { |
11373 | nn = java_complete_tree (wfl_op2); | |
11374 | if (nn == error_mark_node) | |
11375 | return error_mark_node; | |
11376 | if ((cn = patch_string (nn))) | |
11377 | nn = cn; | |
11378 | TREE_OPERAND (node, 1) = nn; | |
11379 | } | |
939d7216 | 11380 | return force_evaluation_order (patch_binop (node, wfl_op1, wfl_op2)); |
8b27f225 | 11381 | |
5e942c50 APB |
11382 | case INSTANCEOF_EXPR: |
11383 | wfl_op1 = TREE_OPERAND (node, 0); | |
11384 | COMPLETE_CHECK_OP_0 (node); | |
ce6e9147 APB |
11385 | if (flag_emit_xref) |
11386 | { | |
11387 | TREE_TYPE (node) = boolean_type_node; | |
11388 | return node; | |
11389 | } | |
5e942c50 APB |
11390 | return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1)); |
11391 | ||
8b27f225 PB |
11392 | case UNARY_PLUS_EXPR: |
11393 | case NEGATE_EXPR: | |
11394 | case TRUTH_NOT_EXPR: | |
11395 | case BIT_NOT_EXPR: | |
11396 | case PREDECREMENT_EXPR: | |
11397 | case PREINCREMENT_EXPR: | |
11398 | case POSTDECREMENT_EXPR: | |
11399 | case POSTINCREMENT_EXPR: | |
11400 | case CONVERT_EXPR: | |
11401 | /* There are cases were wfl_op1 is a WFL. patch_unaryop knows | |
11402 | how to handle those cases. */ | |
11403 | wfl_op1 = TREE_OPERAND (node, 0); | |
12472854 | 11404 | CAN_COMPLETE_NORMALLY (node) = 1; |
8b27f225 PB |
11405 | TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1); |
11406 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
11407 | return error_mark_node; | |
4a5f66c3 APB |
11408 | node = patch_unaryop (node, wfl_op1); |
11409 | CAN_COMPLETE_NORMALLY (node) = 1; | |
11410 | break; | |
8b27f225 PB |
11411 | |
11412 | case ARRAY_REF: | |
11413 | /* There are cases were wfl_op1 is a WFL. patch_array_ref knows | |
11414 | how to handle those cases. */ | |
11415 | wfl_op1 = TREE_OPERAND (node, 0); | |
11416 | TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1); | |
11417 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
11418 | return error_mark_node; | |
7f1d4866 | 11419 | if (!flag_emit_class_files && !flag_emit_xref) |
8b27f225 PB |
11420 | TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0)); |
11421 | /* The same applies to wfl_op2 */ | |
11422 | wfl_op2 = TREE_OPERAND (node, 1); | |
11423 | TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2); | |
11424 | if (TREE_OPERAND (node, 1) == error_mark_node) | |
11425 | return error_mark_node; | |
7f1d4866 | 11426 | if (!flag_emit_class_files && !flag_emit_xref) |
22eed1e6 | 11427 | TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1)); |
c877974e APB |
11428 | return patch_array_ref (node); |
11429 | ||
63a212ed PB |
11430 | case RECORD_TYPE: |
11431 | return node;; | |
11432 | ||
11433 | case COMPONENT_REF: | |
11434 | /* The first step in the re-write of qualified name handling. FIXME. | |
11435 | So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */ | |
c877974e | 11436 | TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0)); |
63a212ed PB |
11437 | if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE) |
11438 | { | |
11439 | tree name = TREE_OPERAND (node, 1); | |
11440 | tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name); | |
11441 | if (field == NULL_TREE) | |
11442 | { | |
11443 | error ("missing static field `%s'", IDENTIFIER_POINTER (name)); | |
11444 | return error_mark_node; | |
11445 | } | |
11446 | if (! FIELD_STATIC (field)) | |
11447 | { | |
11448 | error ("not a static field `%s'", IDENTIFIER_POINTER (name)); | |
11449 | return error_mark_node; | |
11450 | } | |
11451 | return field; | |
11452 | } | |
11453 | else | |
11454 | fatal ("unimplemented java_complete_tree for COMPONENT_REF"); | |
c877974e | 11455 | break; |
8b27f225 PB |
11456 | |
11457 | case THIS_EXPR: | |
11458 | /* Can't use THIS in a static environment */ | |
11459 | if (!current_this) | |
11460 | { | |
11461 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
781b0558 KG |
11462 | parse_error_context (wfl_operator, |
11463 | "Keyword `this' used outside allowed context"); | |
8b27f225 PB |
11464 | TREE_TYPE (node) = error_mark_node; |
11465 | return error_mark_node; | |
11466 | } | |
22eed1e6 APB |
11467 | if (ctxp->explicit_constructor_p) |
11468 | { | |
11469 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
11470 | parse_error_context | |
781b0558 | 11471 | (wfl_operator, "Can't reference `this' or `super' before the superclass constructor has been called"); |
22eed1e6 APB |
11472 | TREE_TYPE (node) = error_mark_node; |
11473 | return error_mark_node; | |
11474 | } | |
8b27f225 PB |
11475 | return current_this; |
11476 | ||
11477 | default: | |
12472854 | 11478 | CAN_COMPLETE_NORMALLY (node) = 1; |
8b27f225 PB |
11479 | /* Ok: may be we have a STRING_CST or a crafted `StringBuffer' |
11480 | and it's time to turn it into the appropriate String object | |
11481 | */ | |
11482 | if ((node = patch_string (node))) | |
11483 | return node; | |
11484 | fatal ("No case for tree code `%s' - java_complete_tree\n", | |
11485 | tree_code_name [TREE_CODE (node)]); | |
11486 | } | |
11487 | return node; | |
11488 | } | |
11489 | ||
11490 | /* Complete function call's argument. Return a non zero value is an | |
11491 | error was found. */ | |
11492 | ||
11493 | static int | |
11494 | complete_function_arguments (node) | |
11495 | tree node; | |
11496 | { | |
11497 | int flag = 0; | |
11498 | tree cn; | |
11499 | ||
f63991a8 | 11500 | ctxp->explicit_constructor_p += (CALL_EXPLICIT_CONSTRUCTOR_P (node) ? 1 : 0); |
8b27f225 PB |
11501 | for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn)) |
11502 | { | |
11503 | tree wfl = TREE_VALUE (cn), parm, temp; | |
11504 | parm = java_complete_tree (wfl); | |
11505 | if (parm == error_mark_node) | |
11506 | { | |
11507 | flag = 1; | |
11508 | continue; | |
11509 | } | |
11510 | /* If have a string literal that we haven't transformed yet or a | |
11511 | crafted string buffer, as a result of use of the the String | |
11512 | `+' operator. Build `parm.toString()' and expand it. */ | |
11513 | if ((temp = patch_string (parm))) | |
11514 | parm = temp; | |
5e942c50 APB |
11515 | /* Inline PRIMTYPE.TYPE read access */ |
11516 | parm = maybe_build_primttype_type_ref (parm, wfl); | |
8b27f225 | 11517 | |
5e942c50 | 11518 | TREE_VALUE (cn) = parm; |
8b27f225 | 11519 | } |
f63991a8 | 11520 | ctxp->explicit_constructor_p -= (CALL_EXPLICIT_CONSTRUCTOR_P (node) ? 1 : 0); |
8b27f225 PB |
11521 | return flag; |
11522 | } | |
11523 | ||
11524 | /* Sometimes (for loops and variable initialized during their | |
11525 | declaration), we want to wrap a statement around a WFL and turn it | |
11526 | debugable. */ | |
11527 | ||
11528 | static tree | |
11529 | build_debugable_stmt (location, stmt) | |
11530 | int location; | |
11531 | tree stmt; | |
11532 | { | |
11533 | if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION) | |
11534 | { | |
11535 | stmt = build_expr_wfl (stmt, input_filename, 0, 0); | |
11536 | EXPR_WFL_LINECOL (stmt) = location; | |
11537 | } | |
11538 | JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt); | |
11539 | return stmt; | |
11540 | } | |
11541 | ||
11542 | static tree | |
11543 | build_expr_block (body, decls) | |
11544 | tree body, decls; | |
11545 | { | |
11546 | tree node = make_node (BLOCK); | |
11547 | BLOCK_EXPR_DECLS (node) = decls; | |
11548 | BLOCK_EXPR_BODY (node) = body; | |
11549 | if (body) | |
11550 | TREE_TYPE (node) = TREE_TYPE (body); | |
11551 | TREE_SIDE_EFFECTS (node) = 1; | |
11552 | return node; | |
11553 | } | |
11554 | ||
11555 | /* Create a new function block and link it approriately to current | |
11556 | function block chain */ | |
11557 | ||
11558 | static tree | |
11559 | enter_block () | |
11560 | { | |
11561 | return (enter_a_block (build_expr_block (NULL_TREE, NULL_TREE))); | |
11562 | } | |
11563 | ||
11564 | /* Link block B supercontext to the previous block. The current | |
11565 | function DECL is used as supercontext when enter_a_block is called | |
11566 | for the first time for a given function. The current function body | |
11567 | (DECL_FUNCTION_BODY) is set to be block B. */ | |
11568 | ||
11569 | static tree | |
11570 | enter_a_block (b) | |
11571 | tree b; | |
11572 | { | |
11573 | tree fndecl = current_function_decl; | |
11574 | ||
f099f336 APB |
11575 | if (!fndecl) { |
11576 | BLOCK_SUPERCONTEXT (b) = current_static_block; | |
11577 | current_static_block = b; | |
11578 | } | |
11579 | ||
11580 | else if (!DECL_FUNCTION_BODY (fndecl)) | |
8b27f225 PB |
11581 | { |
11582 | BLOCK_SUPERCONTEXT (b) = fndecl; | |
11583 | DECL_FUNCTION_BODY (fndecl) = b; | |
11584 | } | |
11585 | else | |
11586 | { | |
11587 | BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl); | |
11588 | DECL_FUNCTION_BODY (fndecl) = b; | |
11589 | } | |
11590 | return b; | |
11591 | } | |
11592 | ||
11593 | /* Exit a block by changing the current function body | |
11594 | (DECL_FUNCTION_BODY) to the current block super context, only if | |
11595 | the block being exited isn't the method's top level one. */ | |
11596 | ||
11597 | static tree | |
11598 | exit_block () | |
11599 | { | |
f099f336 APB |
11600 | tree b; |
11601 | if (current_function_decl) | |
11602 | { | |
11603 | b = DECL_FUNCTION_BODY (current_function_decl); | |
11604 | if (BLOCK_SUPERCONTEXT (b) != current_function_decl) | |
11605 | DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b); | |
11606 | } | |
11607 | else | |
11608 | { | |
11609 | b = current_static_block; | |
8b27f225 | 11610 | |
f099f336 APB |
11611 | if (BLOCK_SUPERCONTEXT (b)) |
11612 | current_static_block = BLOCK_SUPERCONTEXT (b); | |
11613 | } | |
8b27f225 PB |
11614 | return b; |
11615 | } | |
11616 | ||
11617 | /* Lookup for NAME in the nested function's blocks, all the way up to | |
11618 | the current toplevel one. It complies with Java's local variable | |
11619 | scoping rules. */ | |
11620 | ||
11621 | static tree | |
11622 | lookup_name_in_blocks (name) | |
11623 | tree name; | |
11624 | { | |
f099f336 | 11625 | tree b = GET_CURRENT_BLOCK (current_function_decl); |
8b27f225 PB |
11626 | |
11627 | while (b != current_function_decl) | |
11628 | { | |
11629 | tree current; | |
11630 | ||
11631 | /* Paranoid sanity check. To be removed */ | |
11632 | if (TREE_CODE (b) != BLOCK) | |
11633 | fatal ("non block expr function body - lookup_name_in_blocks"); | |
11634 | ||
11635 | for (current = BLOCK_EXPR_DECLS (b); current; | |
11636 | current = TREE_CHAIN (current)) | |
11637 | if (DECL_NAME (current) == name) | |
11638 | return current; | |
11639 | b = BLOCK_SUPERCONTEXT (b); | |
11640 | } | |
11641 | return NULL_TREE; | |
11642 | } | |
11643 | ||
11644 | static void | |
11645 | maybe_absorb_scoping_blocks () | |
11646 | { | |
f099f336 | 11647 | while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl))) |
8b27f225 PB |
11648 | { |
11649 | tree b = exit_block (); | |
11650 | java_method_add_stmt (current_function_decl, b); | |
11651 | SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno)); | |
11652 | } | |
11653 | } | |
11654 | ||
11655 | \f | |
11656 | /* This section of the source is reserved to build_* functions that | |
11657 | are building incomplete tree nodes and the patch_* functions that | |
11658 | are completing them. */ | |
11659 | ||
c877974e | 11660 | /* Build a super() constructor invocation. Returns empty_stmt_node if |
22eed1e6 APB |
11661 | we're currently dealing with the class java.lang.Object. */ |
11662 | ||
11663 | static tree | |
781b0558 KG |
11664 | build_super_invocation (mdecl) |
11665 | tree mdecl; | |
22eed1e6 | 11666 | { |
781b0558 | 11667 | if (DECL_CONTEXT (mdecl) == object_type_node) |
c877974e | 11668 | return empty_stmt_node; |
22eed1e6 APB |
11669 | else |
11670 | { | |
9ee9b555 | 11671 | tree super_wfl = build_wfl_node (super_identifier_node); |
22eed1e6 APB |
11672 | return build_method_invocation (super_wfl, NULL_TREE); |
11673 | } | |
11674 | } | |
11675 | ||
11676 | /* Build a SUPER/THIS qualified method invocation. */ | |
11677 | ||
11678 | static tree | |
11679 | build_this_super_qualified_invocation (use_this, name, args, lloc, rloc) | |
11680 | int use_this; | |
11681 | tree name, args; | |
11682 | int lloc, rloc; | |
11683 | ||
11684 | { | |
11685 | tree invok; | |
11686 | tree wfl = | |
9ee9b555 | 11687 | build_wfl_node (use_this ? this_identifier_node : super_identifier_node); |
22eed1e6 APB |
11688 | EXPR_WFL_LINECOL (wfl) = lloc; |
11689 | invok = build_method_invocation (name, args); | |
11690 | return make_qualified_primary (wfl, invok, rloc); | |
11691 | } | |
11692 | ||
8b27f225 PB |
11693 | /* Build an incomplete CALL_EXPR node. */ |
11694 | ||
11695 | static tree | |
11696 | build_method_invocation (name, args) | |
11697 | tree name; | |
11698 | tree args; | |
11699 | { | |
11700 | tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE); | |
11701 | TREE_SIDE_EFFECTS (call) = 1; | |
11702 | EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name); | |
11703 | return call; | |
11704 | } | |
11705 | ||
11706 | /* Build an incomplete new xxx(...) node. */ | |
11707 | ||
11708 | static tree | |
11709 | build_new_invocation (name, args) | |
11710 | tree name, args; | |
11711 | { | |
11712 | tree call = build (NEW_CLASS_EXPR, NULL_TREE, name, args, NULL_TREE); | |
11713 | TREE_SIDE_EFFECTS (call) = 1; | |
11714 | EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name); | |
11715 | return call; | |
11716 | } | |
11717 | ||
11718 | /* Build an incomplete assignment expression. */ | |
11719 | ||
11720 | static tree | |
11721 | build_assignment (op, op_location, lhs, rhs) | |
11722 | int op, op_location; | |
11723 | tree lhs, rhs; | |
11724 | { | |
11725 | tree assignment; | |
11726 | /* Build the corresponding binop if we deal with a Compound | |
11727 | Assignment operator. Mark the binop sub-tree as part of a | |
11728 | Compound Assignment expression */ | |
11729 | if (op != ASSIGN_TK) | |
11730 | { | |
11731 | rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs); | |
11732 | COMPOUND_ASSIGN_P (rhs) = 1; | |
11733 | } | |
11734 | assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs); | |
11735 | TREE_SIDE_EFFECTS (assignment) = 1; | |
11736 | EXPR_WFL_LINECOL (assignment) = op_location; | |
11737 | return assignment; | |
11738 | } | |
11739 | ||
11740 | /* Print an INTEGER_CST node in a static buffer, and return the buffer. */ | |
11741 | ||
12472854 | 11742 | char * |
8b27f225 PB |
11743 | print_int_node (node) |
11744 | tree node; | |
11745 | { | |
11746 | static char buffer [80]; | |
11747 | if (TREE_CONSTANT_OVERFLOW (node)) | |
11748 | sprintf (buffer, "<overflow>"); | |
11749 | ||
11750 | if (TREE_INT_CST_HIGH (node) == 0) | |
11751 | sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED, | |
11752 | TREE_INT_CST_LOW (node)); | |
11753 | else if (TREE_INT_CST_HIGH (node) == -1 | |
11754 | && TREE_INT_CST_LOW (node) != 0) | |
11755 | { | |
11756 | buffer [0] = '-'; | |
11757 | sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED, | |
11758 | -TREE_INT_CST_LOW (node)); | |
11759 | } | |
11760 | else | |
11761 | sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX, | |
11762 | TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node)); | |
11763 | ||
11764 | return buffer; | |
11765 | } | |
11766 | ||
7f1d4866 APB |
11767 | /* Return 1 if an assignment to a FINAL is attempted in a non suitable |
11768 | context. */ | |
5e942c50 APB |
11769 | |
11770 | static int | |
11771 | check_final_assignment (lvalue, wfl) | |
11772 | tree lvalue, wfl; | |
11773 | { | |
6632dcdd APB |
11774 | if (TREE_CODE (lvalue) == COMPOUND_EXPR |
11775 | && JDECL_P (TREE_OPERAND (lvalue, 1))) | |
11776 | lvalue = TREE_OPERAND (lvalue, 1); | |
11777 | ||
7f1d4866 APB |
11778 | if (JDECL_P (lvalue) |
11779 | && FIELD_FINAL (lvalue) && !IS_CLINIT (current_function_decl)) | |
5e942c50 APB |
11780 | { |
11781 | parse_error_context | |
11782 | (wfl, "Can't assign a value to the final variable `%s'", | |
11783 | IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); | |
11784 | return 1; | |
11785 | } | |
11786 | return 0; | |
11787 | } | |
11788 | ||
11789 | /* Inline references to java.lang.PRIMTYPE.TYPE when accessed in | |
11790 | read. This is needed to avoid circularities in the implementation | |
11791 | of these fields in libjava. */ | |
11792 | ||
11793 | static tree | |
11794 | maybe_build_primttype_type_ref (rhs, wfl) | |
11795 | tree rhs, wfl; | |
11796 | { | |
11797 | tree to_return = NULL_TREE; | |
11798 | tree rhs_type = TREE_TYPE (rhs); | |
11799 | if (TREE_CODE (rhs) == COMPOUND_EXPR) | |
11800 | { | |
11801 | tree n = TREE_OPERAND (rhs, 1); | |
11802 | if (TREE_CODE (n) == VAR_DECL | |
11803 | && DECL_NAME (n) == TYPE_identifier_node | |
11804 | && rhs_type == class_ptr_type) | |
11805 | { | |
49f48c71 | 11806 | const char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)); |
5e942c50 APB |
11807 | if (!strncmp (self_name, "java.lang.", 10)) |
11808 | to_return = build_primtype_type_ref (self_name); | |
11809 | } | |
11810 | } | |
11811 | return (to_return ? to_return : rhs ); | |
11812 | } | |
11813 | ||
8b27f225 PB |
11814 | /* 15.25 Assignment operators. */ |
11815 | ||
11816 | static tree | |
11817 | patch_assignment (node, wfl_op1, wfl_op2) | |
11818 | tree node; | |
11819 | tree wfl_op1; | |
11820 | tree wfl_op2; | |
11821 | { | |
11822 | tree rhs = TREE_OPERAND (node, 1); | |
5e942c50 | 11823 | tree lvalue = TREE_OPERAND (node, 0), llvalue; |
cd531a2e | 11824 | tree lhs_type = NULL_TREE, rhs_type, new_rhs = NULL_TREE; |
8b27f225 PB |
11825 | int error_found = 0; |
11826 | int lvalue_from_array = 0; | |
11827 | ||
11828 | /* Can't assign to a final. */ | |
5e942c50 APB |
11829 | if (check_final_assignment (lvalue, wfl_op1)) |
11830 | error_found = 1; | |
8b27f225 PB |
11831 | |
11832 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
11833 | ||
11834 | /* Lhs can be a named variable */ | |
34f4db93 | 11835 | if (JDECL_P (lvalue)) |
8b27f225 | 11836 | { |
8b27f225 PB |
11837 | lhs_type = TREE_TYPE (lvalue); |
11838 | } | |
11839 | /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME + | |
11840 | comment on reason why */ | |
11841 | else if (TREE_CODE (wfl_op1) == ARRAY_REF) | |
11842 | { | |
11843 | lhs_type = TREE_TYPE (lvalue); | |
11844 | lvalue_from_array = 1; | |
11845 | } | |
11846 | /* Or a field access */ | |
11847 | else if (TREE_CODE (lvalue) == COMPONENT_REF) | |
11848 | lhs_type = TREE_TYPE (lvalue); | |
11849 | /* Or a function return slot */ | |
11850 | else if (TREE_CODE (lvalue) == RESULT_DECL) | |
11851 | lhs_type = TREE_TYPE (lvalue); | |
5e942c50 APB |
11852 | /* Otherwise, we might want to try to write into an optimized static |
11853 | final, this is an of a different nature, reported further on. */ | |
11854 | else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION | |
1504b2b4 | 11855 | && resolve_expression_name (wfl_op1, &llvalue)) |
5e942c50 | 11856 | { |
6632dcdd | 11857 | if (!error_found && check_final_assignment (llvalue, wfl_op1)) |
1504b2b4 APB |
11858 | { |
11859 | /* What we should do instead is resetting the all the flags | |
11860 | previously set, exchange lvalue for llvalue and continue. */ | |
11861 | error_found = 1; | |
11862 | return error_mark_node; | |
11863 | } | |
11864 | else | |
11865 | lhs_type = TREE_TYPE (lvalue); | |
5e942c50 APB |
11866 | } |
11867 | else | |
8b27f225 PB |
11868 | { |
11869 | parse_error_context (wfl_op1, "Invalid left hand side of assignment"); | |
11870 | error_found = 1; | |
11871 | } | |
11872 | ||
11873 | rhs_type = TREE_TYPE (rhs); | |
11874 | /* 5.1 Try the assignment conversion for builtin type. */ | |
11875 | new_rhs = try_builtin_assignconv (wfl_op1, lhs_type, rhs); | |
11876 | ||
11877 | /* 5.2 If it failed, try a reference conversion */ | |
11878 | if (!new_rhs && (new_rhs = try_reference_assignconv (lhs_type, rhs))) | |
11879 | lhs_type = promote_type (rhs_type); | |
11880 | ||
11881 | /* 15.25.2 If we have a compound assignment, convert RHS into the | |
11882 | type of the LHS */ | |
11883 | else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1))) | |
11884 | new_rhs = convert (lhs_type, rhs); | |
11885 | ||
11886 | /* Explicit cast required. This is an error */ | |
11887 | if (!new_rhs) | |
11888 | { | |
c2e3db92 KG |
11889 | char *t1 = xstrdup (lang_printable_name (TREE_TYPE (rhs), 0)); |
11890 | char *t2 = xstrdup (lang_printable_name (lhs_type, 0)); | |
8b27f225 PB |
11891 | tree wfl; |
11892 | char operation [32]; /* Max size known */ | |
11893 | ||
11894 | /* If the assignment is part of a declaration, we use the WFL of | |
11895 | the declared variable to point out the error and call it a | |
11896 | declaration problem. If the assignment is a genuine = | |
11897 | operator, we call is a operator `=' problem, otherwise we | |
11898 | call it an assignment problem. In both of these last cases, | |
11899 | we use the WFL of the operator to indicate the error. */ | |
11900 | ||
11901 | if (MODIFY_EXPR_FROM_INITIALIZATION_P (node)) | |
11902 | { | |
11903 | wfl = wfl_op1; | |
11904 | strcpy (operation, "declaration"); | |
11905 | } | |
11906 | else | |
11907 | { | |
11908 | wfl = wfl_operator; | |
11909 | if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1))) | |
11910 | strcpy (operation, "assignment"); | |
11911 | else if (TREE_CODE (TREE_OPERAND (node, 0)) == RESULT_DECL) | |
11912 | strcpy (operation, "`return'"); | |
11913 | else | |
11914 | strcpy (operation, "`='"); | |
11915 | } | |
11916 | ||
1ebadc60 | 11917 | if (!valid_cast_to_p (rhs_type, lhs_type)) |
781b0558 KG |
11918 | parse_error_context |
11919 | (wfl, "Incompatible type for %s. Can't convert `%s' to `%s'", | |
11920 | operation, t1, t2); | |
1ebadc60 | 11921 | else |
781b0558 | 11922 | parse_error_context (wfl, "Incompatible type for %s. Explicit cast needed to convert `%s' to `%s'", |
1ebadc60 | 11923 | operation, t1, t2); |
8b27f225 PB |
11924 | free (t1); free (t2); |
11925 | error_found = 1; | |
11926 | } | |
11927 | ||
c877974e APB |
11928 | /* Inline read access to java.lang.PRIMTYPE.TYPE */ |
11929 | if (new_rhs) | |
11930 | new_rhs = maybe_build_primttype_type_ref (new_rhs, wfl_op2); | |
5e942c50 | 11931 | |
8b27f225 PB |
11932 | if (error_found) |
11933 | return error_mark_node; | |
11934 | ||
2622b947 APB |
11935 | /* 10.10: Array Store Exception runtime check */ |
11936 | if (!flag_emit_class_files | |
5423609c | 11937 | && !flag_emit_xref |
2622b947 | 11938 | && lvalue_from_array |
781b0558 | 11939 | && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type))) |
2622b947 APB |
11940 | { |
11941 | tree check; | |
11942 | tree base = lvalue; | |
11943 | ||
11944 | /* We need to retrieve the right argument for _Jv_CheckArrayStore */ | |
11945 | if (TREE_CODE (lvalue) == COMPOUND_EXPR) | |
11946 | base = TREE_OPERAND (lvalue, 0); | |
11947 | else | |
11948 | { | |
11949 | if (flag_bounds_check) | |
11950 | base = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (base, 0), 1), 0); | |
11951 | else | |
11952 | base = TREE_OPERAND (TREE_OPERAND (base, 0), 0); | |
11953 | } | |
11954 | ||
11955 | /* Build the invocation of _Jv_CheckArrayStore */ | |
dc4e6ccf | 11956 | new_rhs = save_expr (new_rhs); |
2622b947 APB |
11957 | check = build (CALL_EXPR, void_type_node, |
11958 | build_address_of (soft_checkarraystore_node), | |
11959 | tree_cons (NULL_TREE, base, | |
11960 | build_tree_list (NULL_TREE, new_rhs)), | |
11961 | NULL_TREE); | |
11962 | TREE_SIDE_EFFECTS (check) = 1; | |
11963 | ||
11964 | /* We have to decide on an insertion point */ | |
11965 | if (TREE_CODE (lvalue) == COMPOUND_EXPR) | |
11966 | { | |
11967 | tree t; | |
11968 | if (flag_bounds_check) | |
11969 | { | |
11970 | t = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0); | |
11971 | TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0) = | |
11972 | build (COMPOUND_EXPR, void_type_node, t, check); | |
11973 | } | |
11974 | else | |
11975 | TREE_OPERAND (lvalue, 1) = build (COMPOUND_EXPR, lhs_type, | |
11976 | check, TREE_OPERAND (lvalue, 1)); | |
11977 | } | |
11978 | else | |
11979 | { | |
11980 | /* Make sure the bound check will happen before the store check */ | |
11981 | if (flag_bounds_check) | |
11982 | TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0) = | |
11983 | build (COMPOUND_EXPR, void_type_node, | |
11984 | TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0), check); | |
11985 | else | |
11986 | lvalue = build (COMPOUND_EXPR, lhs_type, check, lvalue); | |
11987 | } | |
11988 | } | |
22eed1e6 | 11989 | |
8b27f225 PB |
11990 | TREE_OPERAND (node, 0) = lvalue; |
11991 | TREE_OPERAND (node, 1) = new_rhs; | |
11992 | TREE_TYPE (node) = lhs_type; | |
11993 | return node; | |
11994 | } | |
11995 | ||
11996 | /* Check that type SOURCE can be cast into type DEST. If the cast | |
11997 | can't occur at all, return 0 otherwise 1. This function is used to | |
11998 | produce accurate error messages on the reasons why an assignment | |
11999 | failed. */ | |
12000 | ||
12001 | static tree | |
12002 | try_reference_assignconv (lhs_type, rhs) | |
12003 | tree lhs_type, rhs; | |
12004 | { | |
12005 | tree new_rhs = NULL_TREE; | |
12006 | tree rhs_type = TREE_TYPE (rhs); | |
12007 | ||
12008 | if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type)) | |
12009 | { | |
12010 | /* `null' may be assigned to any reference type */ | |
12011 | if (rhs == null_pointer_node) | |
12012 | new_rhs = null_pointer_node; | |
12013 | /* Try the reference assignment conversion */ | |
12014 | else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0)) | |
12015 | new_rhs = rhs; | |
12016 | /* This is a magic assignment that we process differently */ | |
12017 | else if (rhs == soft_exceptioninfo_call_node) | |
12018 | new_rhs = rhs; | |
12019 | } | |
12020 | return new_rhs; | |
12021 | } | |
12022 | ||
12023 | /* Check that RHS can be converted into LHS_TYPE by the assignment | |
12024 | conversion (5.2), for the cases of RHS being a builtin type. Return | |
12025 | NULL_TREE if the conversion fails or if because RHS isn't of a | |
12026 | builtin type. Return a converted RHS if the conversion is possible. */ | |
12027 | ||
12028 | static tree | |
12029 | try_builtin_assignconv (wfl_op1, lhs_type, rhs) | |
12030 | tree wfl_op1, lhs_type, rhs; | |
12031 | { | |
12032 | tree new_rhs = NULL_TREE; | |
12033 | tree rhs_type = TREE_TYPE (rhs); | |
12034 | ||
5e942c50 APB |
12035 | /* Zero accepted everywhere */ |
12036 | if (TREE_CODE (rhs) == INTEGER_CST | |
12037 | && TREE_INT_CST_HIGH (rhs) == 0 && TREE_INT_CST_LOW (rhs) == 0 | |
12038 | && JPRIMITIVE_TYPE_P (rhs_type)) | |
12039 | new_rhs = convert (lhs_type, rhs); | |
12040 | ||
8b27f225 PB |
12041 | /* 5.1.1 Try Identity Conversion, |
12042 | 5.1.2 Try Widening Primitive Conversion */ | |
5e942c50 | 12043 | else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)) |
8b27f225 PB |
12044 | new_rhs = convert (lhs_type, rhs); |
12045 | ||
12046 | /* Try a narrowing primitive conversion (5.1.3): | |
12047 | - expression is a constant expression of type int AND | |
12048 | - variable is byte, short or char AND | |
12049 | - The value of the expression is representable in the type of the | |
12050 | variable */ | |
12051 | else if (rhs_type == int_type_node && TREE_CONSTANT (rhs) | |
12052 | && (lhs_type == byte_type_node || lhs_type == char_type_node | |
12053 | || lhs_type == short_type_node)) | |
12054 | { | |
12055 | if (int_fits_type_p (rhs, lhs_type)) | |
12056 | new_rhs = convert (lhs_type, rhs); | |
12057 | else if (wfl_op1) /* Might be called with a NULL */ | |
12058 | parse_warning_context | |
781b0558 | 12059 | (wfl_op1, "Constant expression `%s' to wide for narrowing primitive conversion to `%s'", |
8b27f225 PB |
12060 | print_int_node (rhs), lang_printable_name (lhs_type, 0)); |
12061 | /* Reported a warning that will turn into an error further | |
12062 | down, so we don't return */ | |
12063 | } | |
12064 | ||
12065 | return new_rhs; | |
12066 | } | |
12067 | ||
12068 | /* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity | |
12069 | conversion (5.1.1) or widening primitve conversion (5.1.2). Return | |
12070 | 0 is the conversion test fails. This implements parts the method | |
12071 | invocation convertion (5.3). */ | |
12072 | ||
12073 | static int | |
12074 | valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type) | |
12075 | tree lhs_type, rhs_type; | |
12076 | { | |
acd663ee | 12077 | /* 5.1.1: This is the identity conversion part. */ |
5e942c50 APB |
12078 | if (lhs_type == rhs_type) |
12079 | return 1; | |
12080 | ||
acd663ee APB |
12081 | /* Reject non primitive types */ |
12082 | if (!JPRIMITIVE_TYPE_P (lhs_type) || !JPRIMITIVE_TYPE_P (rhs_type)) | |
8b27f225 PB |
12083 | return 0; |
12084 | ||
acd663ee APB |
12085 | /* 5.1.2: widening primitive conversion. byte, even if it's smaller |
12086 | than a char can't be converted into a char. Short can't too, but | |
12087 | the < test below takes care of that */ | |
8b27f225 PB |
12088 | if (lhs_type == char_type_node && rhs_type == byte_type_node) |
12089 | return 0; | |
12090 | ||
5e942c50 APB |
12091 | /* Accept all promoted type here. Note, we can't use <= in the test |
12092 | below, because we still need to bounce out assignments of short | |
12093 | to char and the likes */ | |
12094 | if (lhs_type == int_type_node | |
12095 | && (rhs_type == promoted_byte_type_node | |
12096 | || rhs_type == promoted_short_type_node | |
12097 | || rhs_type == promoted_char_type_node | |
12098 | || rhs_type == promoted_boolean_type_node)) | |
12099 | return 1; | |
12100 | ||
acd663ee APB |
12101 | /* From here, an integral is widened if its precision is smaller |
12102 | than the precision of the LHS or if the LHS is a floating point | |
12103 | type, or the RHS is a float and the RHS a double. */ | |
12104 | if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type) | |
12105 | && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type))) | |
12106 | || (JINTEGRAL_TYPE_P (rhs_type) && JFLOAT_TYPE_P (lhs_type)) | |
12107 | || (rhs_type == float_type_node && lhs_type == double_type_node)) | |
8b27f225 PB |
12108 | return 1; |
12109 | ||
12110 | return 0; | |
12111 | } | |
12112 | ||
12113 | /* Check that something of SOURCE type can be assigned or cast to | |
12114 | something of DEST type at runtime. Return 1 if the operation is | |
12115 | valid, 0 otherwise. If CAST is set to 1, we're treating the case | |
12116 | were SOURCE is cast into DEST, which borrows a lot of the | |
12117 | assignment check. */ | |
12118 | ||
12119 | static int | |
12120 | valid_ref_assignconv_cast_p (source, dest, cast) | |
12121 | tree source; | |
12122 | tree dest; | |
12123 | int cast; | |
12124 | { | |
09ed0f70 APB |
12125 | /* SOURCE or DEST might be null if not from a declared entity. */ |
12126 | if (!source || !dest) | |
12127 | return 0; | |
5e942c50 APB |
12128 | if (JNULLP_TYPE_P (source)) |
12129 | return 1; | |
8b27f225 PB |
12130 | if (TREE_CODE (source) == POINTER_TYPE) |
12131 | source = TREE_TYPE (source); | |
12132 | if (TREE_CODE (dest) == POINTER_TYPE) | |
12133 | dest = TREE_TYPE (dest); | |
12134 | /* Case where SOURCE is a class type */ | |
12135 | if (TYPE_CLASS_P (source)) | |
12136 | { | |
12137 | if (TYPE_CLASS_P (dest)) | |
12138 | return source == dest || inherits_from_p (source, dest) | |
12139 | || (cast && inherits_from_p (dest, source)); | |
12140 | if (TYPE_INTERFACE_P (dest)) | |
12141 | { | |
12142 | /* If doing a cast and SOURCE is final, the operation is | |
12143 | always correct a compile time (because even if SOURCE | |
12144 | does not implement DEST, a subclass of SOURCE might). */ | |
12145 | if (cast && !CLASS_FINAL (TYPE_NAME (source))) | |
12146 | return 1; | |
12147 | /* Otherwise, SOURCE must implement DEST */ | |
12148 | return interface_of_p (dest, source); | |
12149 | } | |
12150 | /* DEST is an array, cast permited if SOURCE is of Object type */ | |
12151 | return (cast && source == object_type_node ? 1 : 0); | |
12152 | } | |
12153 | if (TYPE_INTERFACE_P (source)) | |
12154 | { | |
12155 | if (TYPE_CLASS_P (dest)) | |
12156 | { | |
12157 | /* If not casting, DEST must be the Object type */ | |
12158 | if (!cast) | |
12159 | return dest == object_type_node; | |
12160 | /* We're doing a cast. The cast is always valid is class | |
12161 | DEST is not final, otherwise, DEST must implement SOURCE */ | |
12162 | else if (!CLASS_FINAL (TYPE_NAME (dest))) | |
12163 | return 1; | |
12164 | else | |
12165 | return interface_of_p (source, dest); | |
12166 | } | |
12167 | if (TYPE_INTERFACE_P (dest)) | |
12168 | { | |
12169 | /* If doing a cast, then if SOURCE and DEST contain method | |
12170 | with the same signature but different return type, then | |
12171 | this is a (compile time) error */ | |
12172 | if (cast) | |
12173 | { | |
12174 | tree method_source, method_dest; | |
12175 | tree source_type; | |
12176 | tree source_sig; | |
12177 | tree source_name; | |
12178 | for (method_source = TYPE_METHODS (source); method_source; | |
12179 | method_source = TREE_CHAIN (method_source)) | |
12180 | { | |
12181 | source_sig = | |
12182 | build_java_argument_signature (TREE_TYPE (method_source)); | |
12183 | source_type = TREE_TYPE (TREE_TYPE (method_source)); | |
12184 | source_name = DECL_NAME (method_source); | |
12185 | for (method_dest = TYPE_METHODS (dest); | |
12186 | method_dest; method_dest = TREE_CHAIN (method_dest)) | |
12187 | if (source_sig == | |
12188 | build_java_argument_signature (TREE_TYPE (method_dest)) | |
12189 | && source_name == DECL_NAME (method_dest) | |
12190 | && source_type != TREE_TYPE (TREE_TYPE (method_dest))) | |
12191 | return 0; | |
12192 | } | |
12193 | return 1; | |
12194 | } | |
12195 | else | |
12196 | return source == dest || interface_of_p (dest, source); | |
12197 | } | |
12198 | else /* Array */ | |
93024893 APB |
12199 | return (cast ? |
12200 | (DECL_NAME (TYPE_NAME (source)) == java_lang_cloneable) : 0); | |
8b27f225 PB |
12201 | } |
12202 | if (TYPE_ARRAY_P (source)) | |
12203 | { | |
12204 | if (TYPE_CLASS_P (dest)) | |
12205 | return dest == object_type_node; | |
09ed0f70 APB |
12206 | /* Can't cast an array to an interface unless the interface is |
12207 | java.lang.Cloneable */ | |
8b27f225 | 12208 | if (TYPE_INTERFACE_P (dest)) |
09ed0f70 | 12209 | return (DECL_NAME (TYPE_NAME (dest)) == java_lang_cloneable ? 1 : 0); |
8b27f225 PB |
12210 | else /* Arrays */ |
12211 | { | |
12212 | tree source_element_type = TYPE_ARRAY_ELEMENT (source); | |
12213 | tree dest_element_type = TYPE_ARRAY_ELEMENT (dest); | |
12214 | ||
12215 | /* In case of severe errors, they turn out null */ | |
12216 | if (!dest_element_type || !source_element_type) | |
12217 | return 0; | |
12218 | if (source_element_type == dest_element_type) | |
12219 | return 1; | |
12220 | return valid_ref_assignconv_cast_p (source_element_type, | |
12221 | dest_element_type, cast); | |
12222 | } | |
12223 | return 0; | |
12224 | } | |
12225 | return 0; | |
12226 | } | |
12227 | ||
12228 | static int | |
12229 | valid_cast_to_p (source, dest) | |
12230 | tree source; | |
12231 | tree dest; | |
12232 | { | |
12233 | if (TREE_CODE (source) == POINTER_TYPE) | |
12234 | source = TREE_TYPE (source); | |
12235 | if (TREE_CODE (dest) == POINTER_TYPE) | |
12236 | dest = TREE_TYPE (dest); | |
12237 | ||
12238 | if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE) | |
12239 | return valid_ref_assignconv_cast_p (source, dest, 1); | |
12240 | ||
12241 | else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest)) | |
12242 | return 1; | |
12243 | ||
12244 | return 0; | |
12245 | } | |
12246 | ||
12247 | /* Method invocation conversion test. Return 1 if type SOURCE can be | |
12248 | converted to type DEST through the methond invocation conversion | |
12249 | process (5.3) */ | |
12250 | ||
12472854 PB |
12251 | static tree |
12252 | do_unary_numeric_promotion (arg) | |
12253 | tree arg; | |
12254 | { | |
12255 | tree type = TREE_TYPE (arg); | |
12256 | if (TREE_CODE (type) == INTEGER_TYPE ? TYPE_PRECISION (type) < 32 | |
12257 | : TREE_CODE (type) == CHAR_TYPE) | |
12258 | arg = convert (int_type_node, arg); | |
12259 | return arg; | |
12260 | } | |
12261 | ||
acd663ee APB |
12262 | /* Return a non zero value if SOURCE can be converted into DEST using |
12263 | the method invocation conversion rule (5.3). */ | |
8b27f225 PB |
12264 | static int |
12265 | valid_method_invocation_conversion_p (dest, source) | |
12266 | tree dest, source; | |
12267 | { | |
0b4d333e | 12268 | return ((JPRIMITIVE_TYPE_P (source) && JPRIMITIVE_TYPE_P (dest) |
acd663ee APB |
12269 | && valid_builtin_assignconv_identity_widening_p (dest, source)) |
12270 | || ((JREFERENCE_TYPE_P (source) || JNULLP_TYPE_P (source)) | |
12271 | && (JREFERENCE_TYPE_P (dest) || JNULLP_TYPE_P (dest)) | |
12272 | && valid_ref_assignconv_cast_p (source, dest, 0))); | |
8b27f225 PB |
12273 | } |
12274 | ||
12275 | /* Build an incomplete binop expression. */ | |
12276 | ||
12277 | static tree | |
12278 | build_binop (op, op_location, op1, op2) | |
12279 | enum tree_code op; | |
12280 | int op_location; | |
12281 | tree op1, op2; | |
12282 | { | |
5e942c50 | 12283 | tree binop = build (op, NULL_TREE, op1, op2); |
8b27f225 PB |
12284 | TREE_SIDE_EFFECTS (binop) = 1; |
12285 | /* Store the location of the operator, for better error report. The | |
12286 | string of the operator will be rebuild based on the OP value. */ | |
12287 | EXPR_WFL_LINECOL (binop) = op_location; | |
12288 | return binop; | |
12289 | } | |
12290 | ||
12291 | /* Build the string of the operator retained by NODE. If NODE is part | |
12292 | of a compound expression, add an '=' at the end of the string. This | |
12293 | function is called when an error needs to be reported on an | |
12294 | operator. The string is returned as a pointer to a static character | |
12295 | buffer. */ | |
12296 | ||
12297 | static char * | |
12298 | operator_string (node) | |
12299 | tree node; | |
12300 | { | |
12301 | #define BUILD_OPERATOR_STRING(S) \ | |
12302 | { \ | |
12303 | sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \ | |
12304 | return buffer; \ | |
12305 | } | |
12306 | ||
12307 | static char buffer [10]; | |
12308 | switch (TREE_CODE (node)) | |
12309 | { | |
12310 | case MULT_EXPR: BUILD_OPERATOR_STRING ("*"); | |
12311 | case RDIV_EXPR: BUILD_OPERATOR_STRING ("/"); | |
12312 | case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%"); | |
12313 | case PLUS_EXPR: BUILD_OPERATOR_STRING ("+"); | |
12314 | case MINUS_EXPR: BUILD_OPERATOR_STRING ("-"); | |
12315 | case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<"); | |
12316 | case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>"); | |
12317 | case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>"); | |
12318 | case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&"); | |
12319 | case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^"); | |
12320 | case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|"); | |
12321 | case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&"); | |
12322 | case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||"); | |
12323 | case EQ_EXPR: BUILD_OPERATOR_STRING ("=="); | |
12324 | case NE_EXPR: BUILD_OPERATOR_STRING ("!="); | |
12325 | case GT_EXPR: BUILD_OPERATOR_STRING (">"); | |
12326 | case GE_EXPR: BUILD_OPERATOR_STRING (">="); | |
12327 | case LT_EXPR: BUILD_OPERATOR_STRING ("<"); | |
12328 | case LE_EXPR: BUILD_OPERATOR_STRING ("<="); | |
12329 | case UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+"); | |
12330 | case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-"); | |
12331 | case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!"); | |
12332 | case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~"); | |
12333 | case PREINCREMENT_EXPR: /* Fall through */ | |
12334 | case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++"); | |
12335 | case PREDECREMENT_EXPR: /* Fall through */ | |
12336 | case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--"); | |
12337 | default: | |
12338 | fatal ("unregistered operator %s - operator_string", | |
12339 | tree_code_name [TREE_CODE (node)]); | |
12340 | } | |
12341 | return NULL; | |
12342 | #undef BUILD_OPERATOR_STRING | |
12343 | } | |
12344 | ||
5cbdba64 APB |
12345 | /* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */ |
12346 | ||
12347 | static int | |
12348 | java_decl_equiv (var_acc1, var_acc2) | |
12349 | tree var_acc1, var_acc2; | |
12350 | { | |
12351 | if (JDECL_P (var_acc1)) | |
12352 | return (var_acc1 == var_acc2); | |
12353 | ||
12354 | return (TREE_CODE (var_acc1) == COMPONENT_REF | |
12355 | && TREE_CODE (var_acc2) == COMPONENT_REF | |
12356 | && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0) | |
12357 | == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0) | |
12358 | && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1)); | |
12359 | } | |
12360 | ||
12361 | /* Return a non zero value if CODE is one of the operators that can be | |
12362 | used in conjunction with the `=' operator in a compound assignment. */ | |
12363 | ||
12364 | static int | |
12365 | binop_compound_p (code) | |
12366 | enum tree_code code; | |
12367 | { | |
12368 | int i; | |
12369 | for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++) | |
12370 | if (binop_lookup [i] == code) | |
12371 | break; | |
12372 | ||
12373 | return i < BINOP_COMPOUND_CANDIDATES; | |
12374 | } | |
12375 | ||
12376 | /* Reorganize after a fold to get SAVE_EXPR to generate what we want. */ | |
12377 | ||
12378 | static tree | |
12379 | java_refold (t) | |
12380 | tree t; | |
12381 | { | |
12382 | tree c, b, ns, decl; | |
12383 | ||
12384 | if (TREE_CODE (t) != MODIFY_EXPR) | |
12385 | return t; | |
12386 | ||
12387 | c = TREE_OPERAND (t, 1); | |
12388 | if (! (c && TREE_CODE (c) == COMPOUND_EXPR | |
12389 | && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR | |
12390 | && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1))))) | |
12391 | return t; | |
12392 | ||
12393 | /* Now the left branch of the binary operator. */ | |
12394 | b = TREE_OPERAND (TREE_OPERAND (c, 1), 0); | |
12395 | if (! (b && TREE_CODE (b) == NOP_EXPR | |
12396 | && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR)) | |
12397 | return t; | |
12398 | ||
12399 | ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0); | |
12400 | if (! (ns && TREE_CODE (ns) == NOP_EXPR | |
12401 | && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR)) | |
12402 | return t; | |
12403 | ||
12404 | decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0); | |
12405 | if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF) | |
12406 | /* It's got to be the an equivalent decl */ | |
12407 | && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0))) | |
12408 | { | |
12409 | /* Shorten the NOP_EXPR/SAVE_EXPR path. */ | |
12410 | TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0); | |
12411 | /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */ | |
12412 | TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1); | |
12413 | /* Change the right part of the BINOP_EXPR */ | |
12414 | TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0); | |
12415 | } | |
12416 | ||
12417 | return t; | |
12418 | } | |
12419 | ||
8b27f225 PB |
12420 | /* Binary operators (15.16 up to 15.18). We return error_mark_node on |
12421 | errors but we modify NODE so that it contains the type computed | |
12422 | according to the expression, when it's fixed. Otherwise, we write | |
12423 | error_mark_node as the type. It allows us to further the analysis | |
12424 | of remaining nodes and detects more errors in certain cases. */ | |
12425 | ||
12426 | static tree | |
12427 | patch_binop (node, wfl_op1, wfl_op2) | |
12428 | tree node; | |
12429 | tree wfl_op1; | |
12430 | tree wfl_op2; | |
12431 | { | |
12432 | tree op1 = TREE_OPERAND (node, 0); | |
12433 | tree op2 = TREE_OPERAND (node, 1); | |
12434 | tree op1_type = TREE_TYPE (op1); | |
12435 | tree op2_type = TREE_TYPE (op2); | |
ab3a6dd6 | 12436 | tree prom_type = NULL_TREE; |
8b27f225 PB |
12437 | int code = TREE_CODE (node); |
12438 | ||
12439 | /* If 1, tell the routine that we have to return error_mark_node | |
12440 | after checking for the initialization of the RHS */ | |
12441 | int error_found = 0; | |
12442 | ||
8b27f225 PB |
12443 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); |
12444 | ||
8b27f225 PB |
12445 | switch (code) |
12446 | { | |
12447 | /* 15.16 Multiplicative operators */ | |
12448 | case MULT_EXPR: /* 15.16.1 Multiplication Operator * */ | |
12449 | case RDIV_EXPR: /* 15.16.2 Division Operator / */ | |
12450 | case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */ | |
12451 | if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type)) | |
12452 | { | |
12453 | if (!JPRIMITIVE_TYPE_P (op1_type)) | |
12454 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type); | |
12455 | if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type)) | |
12456 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type); | |
12457 | TREE_TYPE (node) = error_mark_node; | |
12458 | error_found = 1; | |
12459 | break; | |
12460 | } | |
12461 | prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2); | |
12462 | /* Change the division operator if necessary */ | |
12463 | if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE) | |
12464 | TREE_SET_CODE (node, TRUNC_DIV_EXPR); | |
0b4d333e | 12465 | |
0b094f65 AH |
12466 | if (TREE_CODE (prom_type) == INTEGER_TYPE |
12467 | && flag_use_divide_subroutine | |
12468 | && ! flag_emit_class_files | |
12469 | && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR)) | |
12470 | return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2); | |
12471 | ||
0b4d333e APB |
12472 | /* This one is more complicated. FLOATs are processed by a |
12473 | function call to soft_fmod. Duplicate the value of the | |
12474 | COMPOUND_ASSIGN_P flag. */ | |
8b27f225 | 12475 | if (code == TRUNC_MOD_EXPR) |
0b4d333e APB |
12476 | { |
12477 | tree mod = build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2); | |
12478 | COMPOUND_ASSIGN_P (mod) = COMPOUND_ASSIGN_P (node); | |
939d7216 PB |
12479 | TREE_SIDE_EFFECTS (mod) |
12480 | = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2); | |
0b4d333e APB |
12481 | return mod; |
12482 | } | |
8b27f225 PB |
12483 | break; |
12484 | ||
12485 | /* 15.17 Additive Operators */ | |
12486 | case PLUS_EXPR: /* 15.17.1 String Concatenation Operator + */ | |
12487 | ||
12488 | /* Operation is valid if either one argument is a string | |
12489 | constant, a String object or a StringBuffer crafted for the | |
12490 | purpose of the a previous usage of the String concatenation | |
12491 | operator */ | |
12492 | ||
12493 | if (TREE_CODE (op1) == STRING_CST | |
12494 | || TREE_CODE (op2) == STRING_CST | |
12495 | || JSTRING_TYPE_P (op1_type) | |
12496 | || JSTRING_TYPE_P (op2_type) | |
12497 | || IS_CRAFTED_STRING_BUFFER_P (op1) | |
12498 | || IS_CRAFTED_STRING_BUFFER_P (op2)) | |
12499 | return build_string_concatenation (op1, op2); | |
12500 | ||
12501 | case MINUS_EXPR: /* 15.17.2 Additive Operators (+ and -) for | |
12502 | Numeric Types */ | |
12503 | if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type)) | |
12504 | { | |
12505 | if (!JPRIMITIVE_TYPE_P (op1_type)) | |
12506 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type); | |
12507 | if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type)) | |
12508 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type); | |
12509 | TREE_TYPE (node) = error_mark_node; | |
12510 | error_found = 1; | |
12511 | break; | |
12512 | } | |
12513 | prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2); | |
12514 | break; | |
12515 | ||
12516 | /* 15.18 Shift Operators */ | |
12517 | case LSHIFT_EXPR: | |
12518 | case RSHIFT_EXPR: | |
12519 | case URSHIFT_EXPR: | |
12520 | if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type)) | |
12521 | { | |
12522 | if (!JINTEGRAL_TYPE_P (op1_type)) | |
12523 | ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type); | |
12524 | else | |
1ebadc60 KG |
12525 | { |
12526 | if (JPRIMITIVE_TYPE_P (op2_type)) | |
12527 | parse_error_context (wfl_operator, | |
781b0558 | 12528 | "Incompatible type for `%s'. Explicit cast needed to convert shift distance from `%s' to integral", |
1ebadc60 KG |
12529 | operator_string (node), |
12530 | lang_printable_name (op2_type, 0)); | |
12531 | else | |
781b0558 KG |
12532 | parse_error_context (wfl_operator, |
12533 | "Incompatible type for `%s'. Can't convert shift distance from `%s' to integral", | |
1ebadc60 KG |
12534 | operator_string (node), |
12535 | lang_printable_name (op2_type, 0)); | |
12536 | } | |
8b27f225 PB |
12537 | TREE_TYPE (node) = error_mark_node; |
12538 | error_found = 1; | |
12539 | break; | |
12540 | } | |
12541 | ||
12542 | /* Unary numeric promotion (5.6.1) is performed on each operand | |
12543 | separatly */ | |
12472854 PB |
12544 | op1 = do_unary_numeric_promotion (op1); |
12545 | op2 = do_unary_numeric_promotion (op2); | |
8b27f225 PB |
12546 | |
12547 | /* The type of the shift expression is the type of the promoted | |
12548 | type of the left-hand operand */ | |
12549 | prom_type = TREE_TYPE (op1); | |
12550 | ||
51149cc8 MK |
12551 | /* Shift int only up to 0x1f and long up to 0x3f. The bytecode |
12552 | generator should take care of removing this operation. FIXME */ | |
12553 | op2 = fold (build (BIT_AND_EXPR, prom_type, convert (prom_type, op2), | |
12554 | (prom_type == int_type_node ? build_int_2 (0x1f, 0) : | |
12555 | convert (prom_type, build_int_2 (0x3f, 0))))); | |
8b27f225 PB |
12556 | |
12557 | /* The >>> operator is a >> operating on unsigned quantities */ | |
12472854 | 12558 | if (code == URSHIFT_EXPR && ! flag_emit_class_files) |
8b27f225 | 12559 | { |
0b4d333e | 12560 | tree to_return; |
73333a87 AH |
12561 | tree utype = unsigned_type (prom_type); |
12562 | op1 = convert (utype, op1); | |
d4476be2 | 12563 | TREE_SET_CODE (node, RSHIFT_EXPR); |
73333a87 AH |
12564 | TREE_OPERAND (node, 0) = op1; |
12565 | TREE_OPERAND (node, 1) = op2; | |
12566 | TREE_TYPE (node) = utype; | |
0b4d333e APB |
12567 | to_return = convert (prom_type, node); |
12568 | /* Copy the original value of the COMPOUND_ASSIGN_P flag */ | |
12569 | COMPOUND_ASSIGN_P (to_return) = COMPOUND_ASSIGN_P (node); | |
939d7216 PB |
12570 | TREE_SIDE_EFFECTS (to_return) |
12571 | = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2); | |
0b4d333e | 12572 | return to_return; |
8b27f225 PB |
12573 | } |
12574 | break; | |
5e942c50 APB |
12575 | |
12576 | /* 15.19.1 Type Comparison Operator instaceof */ | |
12577 | case INSTANCEOF_EXPR: | |
12578 | ||
12579 | TREE_TYPE (node) = boolean_type_node; | |
12580 | ||
12581 | if (!(op2_type = resolve_type_during_patch (op2))) | |
12582 | return error_mark_node; | |
12583 | ||
12584 | /* The first operand must be a reference type or the null type */ | |
12585 | if (!JREFERENCE_TYPE_P (op1_type) && op1 != null_pointer_node) | |
12586 | error_found = 1; /* Error reported further below */ | |
12587 | ||
12588 | /* The second operand must be a reference type */ | |
12589 | if (!JREFERENCE_TYPE_P (op2_type)) | |
12590 | { | |
12591 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op2); | |
12592 | parse_error_context | |
12593 | (wfl_operator, "Invalid argument `%s' for `instanceof'", | |
12594 | lang_printable_name (op2_type, 0)); | |
12595 | error_found = 1; | |
12596 | } | |
12597 | ||
12598 | if (!error_found && valid_ref_assignconv_cast_p (op1_type, op2_type, 1)) | |
12599 | { | |
12600 | /* If the first operand is null, the result is always false */ | |
12601 | if (op1 == null_pointer_node) | |
12602 | return boolean_false_node; | |
12472854 PB |
12603 | else if (flag_emit_class_files) |
12604 | { | |
12605 | TREE_OPERAND (node, 1) = op2_type; | |
939d7216 | 12606 | TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1); |
12472854 PB |
12607 | return node; |
12608 | } | |
5e942c50 APB |
12609 | /* Otherwise we have to invoke instance of to figure it out */ |
12610 | else | |
12611 | { | |
12612 | tree call = | |
12613 | build (CALL_EXPR, boolean_type_node, | |
12614 | build_address_of (soft_instanceof_node), | |
12615 | tree_cons | |
12616 | (NULL_TREE, op1, | |
12617 | build_tree_list (NULL_TREE, | |
12618 | build_class_ref (op2_type))), | |
12619 | NULL_TREE); | |
939d7216 | 12620 | TREE_SIDE_EFFECTS (call) = TREE_SIDE_EFFECTS (op1); |
5e942c50 APB |
12621 | return call; |
12622 | } | |
12623 | } | |
12624 | /* There is no way the expression operand can be an instance of | |
12625 | the type operand. This is a compile time error. */ | |
12626 | else | |
12627 | { | |
c2e3db92 | 12628 | char *t1 = xstrdup (lang_printable_name (op1_type, 0)); |
5e942c50 APB |
12629 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); |
12630 | parse_error_context | |
12631 | (wfl_operator, "Impossible for `%s' to be instance of `%s'", | |
12632 | t1, lang_printable_name (op2_type, 0)); | |
12633 | free (t1); | |
12634 | error_found = 1; | |
12635 | } | |
8b27f225 | 12636 | |
5e942c50 | 12637 | break; |
8b27f225 PB |
12638 | |
12639 | /* 15.21 Bitwise and Logical Operators */ | |
12640 | case BIT_AND_EXPR: | |
12641 | case BIT_XOR_EXPR: | |
12642 | case BIT_IOR_EXPR: | |
12643 | if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type)) | |
12644 | /* Binary numeric promotion is performed on both operand and the | |
12645 | expression retain that type */ | |
12646 | prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2); | |
12647 | ||
12648 | else if (TREE_CODE (op1_type) == BOOLEAN_TYPE | |
12649 | && TREE_CODE (op1_type) == BOOLEAN_TYPE) | |
12650 | /* The type of the bitwise operator expression is BOOLEAN */ | |
12651 | prom_type = boolean_type_node; | |
12652 | else | |
12653 | { | |
12654 | if (!JINTEGRAL_TYPE_P (op1_type)) | |
12655 | ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type); | |
12656 | if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type)) | |
12657 | ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type); | |
12658 | TREE_TYPE (node) = error_mark_node; | |
12659 | error_found = 1; | |
12660 | /* Insert a break here if adding thing before the switch's | |
12661 | break for this case */ | |
12662 | } | |
12663 | break; | |
12664 | ||
12665 | /* 15.22 Conditional-And Operator */ | |
12666 | case TRUTH_ANDIF_EXPR: | |
12667 | /* 15.23 Conditional-Or Operator */ | |
12668 | case TRUTH_ORIF_EXPR: | |
12669 | /* Operands must be of BOOLEAN type */ | |
12670 | if (TREE_CODE (op1_type) != BOOLEAN_TYPE || | |
12671 | TREE_CODE (op2_type) != BOOLEAN_TYPE) | |
12672 | { | |
12673 | if (TREE_CODE (op1_type) != BOOLEAN_TYPE) | |
12674 | ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type); | |
12675 | if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type)) | |
12676 | ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type); | |
12677 | TREE_TYPE (node) = boolean_type_node; | |
12678 | error_found = 1; | |
12679 | break; | |
12680 | } | |
12681 | /* The type of the conditional operators is BOOLEAN */ | |
12682 | prom_type = boolean_type_node; | |
12683 | break; | |
12684 | ||
12685 | /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */ | |
12686 | case LT_EXPR: | |
12687 | case GT_EXPR: | |
12688 | case LE_EXPR: | |
12689 | case GE_EXPR: | |
12690 | /* The type of each of the operands must be a primitive numeric | |
12691 | type */ | |
12692 | if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type)) | |
12693 | { | |
12694 | if (!JNUMERIC_TYPE_P (op1_type)) | |
12695 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type); | |
12696 | if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type)) | |
12697 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type); | |
12698 | TREE_TYPE (node) = boolean_type_node; | |
12699 | error_found = 1; | |
12700 | break; | |
12701 | } | |
12702 | /* Binary numeric promotion is performed on the operands */ | |
12703 | binary_numeric_promotion (op1_type, op2_type, &op1, &op2); | |
12704 | /* The type of the relation expression is always BOOLEAN */ | |
12705 | prom_type = boolean_type_node; | |
12706 | break; | |
12707 | ||
12708 | /* 15.20 Equality Operator */ | |
12709 | case EQ_EXPR: | |
12710 | case NE_EXPR: | |
12711 | /* 15.20.1 Numerical Equality Operators == and != */ | |
12712 | /* Binary numeric promotion is performed on the operands */ | |
5e942c50 | 12713 | if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type)) |
8b27f225 PB |
12714 | binary_numeric_promotion (op1_type, op2_type, &op1, &op2); |
12715 | ||
12716 | /* 15.20.2 Boolean Equality Operators == and != */ | |
12717 | else if (TREE_CODE (op1_type) == BOOLEAN_TYPE && | |
12718 | TREE_CODE (op2_type) == BOOLEAN_TYPE) | |
12719 | ; /* Nothing to do here */ | |
12720 | ||
12721 | /* 15.20.3 Reference Equality Operators == and != */ | |
5e942c50 APB |
12722 | /* Types have to be either references or the null type. If |
12723 | they're references, it must be possible to convert either | |
12724 | type to the other by casting conversion. */ | |
8b27f225 PB |
12725 | else if (op1 == null_pointer_node || op2 == null_pointer_node |
12726 | || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type) | |
5e942c50 APB |
12727 | && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1) |
12728 | || valid_ref_assignconv_cast_p (op2_type, | |
12729 | op1_type, 1)))) | |
8b27f225 PB |
12730 | ; /* Nothing to do here */ |
12731 | ||
12732 | /* Else we have an error figure what can't be converted into | |
12733 | what and report the error */ | |
12734 | else | |
12735 | { | |
12736 | char *t1; | |
c2e3db92 | 12737 | t1 = xstrdup (lang_printable_name (op1_type, 0)); |
8b27f225 | 12738 | parse_error_context |
781b0558 KG |
12739 | (wfl_operator, |
12740 | "Incompatible type for `%s'. Can't convert `%s' to `%s'", | |
12741 | operator_string (node), t1, | |
8b27f225 PB |
12742 | lang_printable_name (op2_type, 0)); |
12743 | free (t1); | |
12744 | TREE_TYPE (node) = boolean_type_node; | |
12745 | error_found = 1; | |
12746 | break; | |
12747 | } | |
12748 | prom_type = boolean_type_node; | |
12749 | break; | |
12750 | } | |
12751 | ||
8b27f225 PB |
12752 | if (error_found) |
12753 | return error_mark_node; | |
12754 | ||
12755 | TREE_OPERAND (node, 0) = op1; | |
12756 | TREE_OPERAND (node, 1) = op2; | |
12757 | TREE_TYPE (node) = prom_type; | |
939d7216 PB |
12758 | TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2); |
12759 | ||
ce6e9147 APB |
12760 | if (flag_emit_xref) |
12761 | return node; | |
12762 | ||
7c3f7c03 PB |
12763 | /* fold does not respect side-effect order as required for Java but not C. |
12764 | * Also, it sometimes create SAVE_EXPRs which are bad when emitting | |
12765 | * bytecode. | |
12766 | */ | |
12767 | if (flag_emit_class_files ? (TREE_CONSTANT (op1) && TREE_CONSTANT (op2)) | |
12768 | : ! TREE_SIDE_EFFECTS (node)) | |
4fdea7b0 PB |
12769 | node = fold (node); |
12770 | return node; | |
8b27f225 PB |
12771 | } |
12772 | ||
12773 | /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non | |
12774 | zero value, the value of CSTE comes after the valude of STRING */ | |
12775 | ||
12776 | static tree | |
12777 | do_merge_string_cste (cste, string, string_len, after) | |
12778 | tree cste; | |
49f48c71 | 12779 | const char *string; |
8b27f225 PB |
12780 | int string_len, after; |
12781 | { | |
12782 | int len = TREE_STRING_LENGTH (cste) + string_len; | |
49f48c71 | 12783 | const char *old = TREE_STRING_POINTER (cste); |
8b27f225 PB |
12784 | TREE_STRING_LENGTH (cste) = len; |
12785 | TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1); | |
12786 | if (after) | |
12787 | { | |
12788 | strcpy (TREE_STRING_POINTER (cste), string); | |
12789 | strcat (TREE_STRING_POINTER (cste), old); | |
12790 | } | |
12791 | else | |
12792 | { | |
12793 | strcpy (TREE_STRING_POINTER (cste), old); | |
12794 | strcat (TREE_STRING_POINTER (cste), string); | |
12795 | } | |
12796 | return cste; | |
12797 | } | |
12798 | ||
12799 | /* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a | |
12800 | new STRING_CST on success, NULL_TREE on failure */ | |
12801 | ||
12802 | static tree | |
12803 | merge_string_cste (op1, op2, after) | |
12804 | tree op1, op2; | |
12805 | int after; | |
12806 | { | |
12807 | /* Handle two string constants right away */ | |
12808 | if (TREE_CODE (op2) == STRING_CST) | |
12809 | return do_merge_string_cste (op1, TREE_STRING_POINTER (op2), | |
12810 | TREE_STRING_LENGTH (op2), after); | |
12811 | ||
12812 | /* Reasonable integer constant can be treated right away */ | |
12813 | if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2)) | |
12814 | { | |
49f48c71 KG |
12815 | static const char *boolean_true = "true"; |
12816 | static const char *boolean_false = "false"; | |
12817 | static const char *null_pointer = "null"; | |
8b27f225 | 12818 | char ch[3]; |
49f48c71 | 12819 | const char *string; |
8b27f225 PB |
12820 | |
12821 | if (op2 == boolean_true_node) | |
12822 | string = boolean_true; | |
12823 | else if (op2 == boolean_false_node) | |
12824 | string = boolean_false; | |
12825 | else if (op2 == null_pointer_node) | |
12826 | string = null_pointer; | |
12827 | else if (TREE_TYPE (op2) == char_type_node) | |
12828 | { | |
12829 | ch[0] = (char )TREE_INT_CST_LOW (op2); | |
12830 | ch[1] = '\0'; | |
12831 | string = ch; | |
12832 | } | |
12833 | else | |
12834 | string = print_int_node (op2); | |
12835 | ||
12836 | return do_merge_string_cste (op1, string, strlen (string), after); | |
12837 | } | |
12838 | return NULL_TREE; | |
12839 | } | |
12840 | ||
12841 | /* Tries to statically concatenate OP1 and OP2 if possible. Either one | |
12842 | has to be a STRING_CST and the other part must be a STRING_CST or a | |
12843 | INTEGRAL constant. Return a new STRING_CST if the operation | |
12844 | succeed, NULL_TREE otherwise. | |
12845 | ||
12846 | If the case we want to optimize for space, we might want to return | |
12847 | NULL_TREE for each invocation of this routine. FIXME */ | |
12848 | ||
12849 | static tree | |
12850 | string_constant_concatenation (op1, op2) | |
12851 | tree op1, op2; | |
12852 | { | |
12853 | if (TREE_CODE (op1) == STRING_CST || (TREE_CODE (op2) == STRING_CST)) | |
12854 | { | |
12855 | tree string, rest; | |
12856 | int invert; | |
12857 | ||
12858 | string = (TREE_CODE (op1) == STRING_CST ? op1 : op2); | |
12859 | rest = (string == op1 ? op2 : op1); | |
12860 | invert = (string == op1 ? 0 : 1 ); | |
12861 | ||
12862 | /* Walk REST, only if it looks reasonable */ | |
12863 | if (TREE_CODE (rest) != STRING_CST | |
12864 | && !IS_CRAFTED_STRING_BUFFER_P (rest) | |
12865 | && !JSTRING_TYPE_P (TREE_TYPE (rest)) | |
12866 | && TREE_CODE (rest) == EXPR_WITH_FILE_LOCATION) | |
12867 | { | |
12868 | rest = java_complete_tree (rest); | |
12869 | if (rest == error_mark_node) | |
12870 | return error_mark_node; | |
12871 | rest = fold (rest); | |
12872 | } | |
12873 | return merge_string_cste (string, rest, invert); | |
12874 | } | |
12875 | return NULL_TREE; | |
12876 | } | |
12877 | ||
12878 | /* Implement the `+' operator. Does static optimization if possible, | |
12879 | otherwise create (if necessary) and append elements to a | |
12880 | StringBuffer. The StringBuffer will be carried around until it is | |
12881 | used for a function call or an assignment. Then toString() will be | |
12882 | called on it to turn it into a String object. */ | |
12883 | ||
12884 | static tree | |
12885 | build_string_concatenation (op1, op2) | |
12886 | tree op1, op2; | |
12887 | { | |
12888 | tree result; | |
939d7216 | 12889 | int side_effects = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2); |
ce6e9147 APB |
12890 | |
12891 | if (flag_emit_xref) | |
12892 | return build (PLUS_EXPR, string_type_node, op1, op2); | |
8b27f225 PB |
12893 | |
12894 | /* Try to do some static optimization */ | |
12895 | if ((result = string_constant_concatenation (op1, op2))) | |
12896 | return result; | |
12897 | ||
c0d87ff6 PB |
12898 | /* Discard empty strings on either side of the expression */ |
12899 | if (TREE_CODE (op1) == STRING_CST && TREE_STRING_LENGTH (op1) == 0) | |
acd663ee APB |
12900 | { |
12901 | op1 = op2; | |
12902 | op2 = NULL_TREE; | |
12903 | } | |
c0d87ff6 | 12904 | else if (TREE_CODE (op2) == STRING_CST && TREE_STRING_LENGTH (op2) == 0) |
acd663ee | 12905 | op2 = NULL_TREE; |
8b27f225 | 12906 | |
acd663ee | 12907 | /* If operands are string constant, turn then into object references */ |
8b27f225 PB |
12908 | if (TREE_CODE (op1) == STRING_CST) |
12909 | op1 = patch_string_cst (op1); | |
acd663ee | 12910 | if (op2 && TREE_CODE (op2) == STRING_CST) |
8b27f225 PB |
12911 | op2 = patch_string_cst (op2); |
12912 | ||
acd663ee APB |
12913 | /* If either one of the constant is null and the other non null |
12914 | operand is a String object, return it. */ | |
12915 | if (JSTRING_TYPE_P (TREE_TYPE (op1)) && !op2) | |
12916 | return op1; | |
12917 | ||
8b27f225 PB |
12918 | /* If OP1 isn't already a StringBuffer, create and |
12919 | initialize a new one */ | |
12920 | if (!IS_CRAFTED_STRING_BUFFER_P (op1)) | |
12921 | { | |
12922 | /* Two solutions here: | |
c52b5771 AG |
12923 | 1) OP1 is a constant string reference, we call new StringBuffer(OP1) |
12924 | 2) OP1 is something else, we call new StringBuffer().append(OP1). */ | |
12925 | if (TREE_CONSTANT (op1) && JSTRING_TYPE_P (TREE_TYPE (op1))) | |
8b27f225 PB |
12926 | op1 = BUILD_STRING_BUFFER (op1); |
12927 | else | |
12928 | { | |
12929 | tree aNew = BUILD_STRING_BUFFER (NULL_TREE); | |
12930 | op1 = make_qualified_primary (aNew, BUILD_APPEND (op1), 0); | |
12931 | } | |
12932 | } | |
12933 | ||
acd663ee APB |
12934 | if (op2) |
12935 | { | |
12936 | /* OP1 is no longer the last node holding a crafted StringBuffer */ | |
12937 | IS_CRAFTED_STRING_BUFFER_P (op1) = 0; | |
12938 | /* Create a node for `{new...,xxx}.append (op2)' */ | |
12939 | if (op2) | |
12940 | op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0); | |
12941 | } | |
12942 | ||
8b27f225 PB |
12943 | /* Mark the last node holding a crafted StringBuffer */ |
12944 | IS_CRAFTED_STRING_BUFFER_P (op1) = 1; | |
939d7216 PB |
12945 | |
12946 | TREE_SIDE_EFFECTS (op1) = side_effects; | |
8b27f225 PB |
12947 | return op1; |
12948 | } | |
12949 | ||
12950 | /* Patch the string node NODE. NODE can be a STRING_CST of a crafted | |
12951 | StringBuffer. If no string were found to be patched, return | |
12952 | NULL. */ | |
12953 | ||
12954 | static tree | |
12955 | patch_string (node) | |
12956 | tree node; | |
12957 | { | |
1179ebc2 APB |
12958 | if (node == error_mark_node) |
12959 | return error_mark_node; | |
8b27f225 PB |
12960 | if (TREE_CODE (node) == STRING_CST) |
12961 | return patch_string_cst (node); | |
12962 | else if (IS_CRAFTED_STRING_BUFFER_P (node)) | |
12963 | { | |
c877974e | 12964 | int saved = ctxp->explicit_constructor_p; |
8b27f225 | 12965 | tree invoke = build_method_invocation (wfl_to_string, NULL_TREE); |
c877974e APB |
12966 | tree ret; |
12967 | /* Temporary disable forbid the use of `this'. */ | |
12968 | ctxp->explicit_constructor_p = 0; | |
12969 | ret = java_complete_tree (make_qualified_primary (node, invoke, 0)); | |
1729c265 APB |
12970 | /* String concatenation arguments must be evaluated in order too. */ |
12971 | ret = force_evaluation_order (ret); | |
c877974e APB |
12972 | /* Restore it at its previous value */ |
12973 | ctxp->explicit_constructor_p = saved; | |
12974 | return ret; | |
8b27f225 PB |
12975 | } |
12976 | return NULL_TREE; | |
12977 | } | |
12978 | ||
12979 | /* Build the internal representation of a string constant. */ | |
12980 | ||
12981 | static tree | |
12982 | patch_string_cst (node) | |
12983 | tree node; | |
12984 | { | |
12985 | int location; | |
12472854 PB |
12986 | if (! flag_emit_class_files) |
12987 | { | |
12988 | push_obstacks (&permanent_obstack, &permanent_obstack); | |
12989 | node = get_identifier (TREE_STRING_POINTER (node)); | |
12990 | location = alloc_name_constant (CONSTANT_String, node); | |
12991 | node = build_ref_from_constant_pool (location); | |
8226320b | 12992 | pop_obstacks (); |
12472854 | 12993 | } |
cd9643f7 | 12994 | TREE_TYPE (node) = string_ptr_type_node; |
8b27f225 PB |
12995 | TREE_CONSTANT (node) = 1; |
12996 | return node; | |
12997 | } | |
12998 | ||
12999 | /* Build an incomplete unary operator expression. */ | |
13000 | ||
13001 | static tree | |
13002 | build_unaryop (op_token, op_location, op1) | |
13003 | int op_token, op_location; | |
13004 | tree op1; | |
13005 | { | |
13006 | enum tree_code op; | |
13007 | tree unaryop; | |
13008 | switch (op_token) | |
13009 | { | |
13010 | case PLUS_TK: op = UNARY_PLUS_EXPR; break; | |
13011 | case MINUS_TK: op = NEGATE_EXPR; break; | |
13012 | case NEG_TK: op = TRUTH_NOT_EXPR; break; | |
13013 | case NOT_TK: op = BIT_NOT_EXPR; break; | |
13014 | default: fatal ("Unknown token `%d' for unary operator - build_unaryop", | |
13015 | op_token); | |
13016 | } | |
13017 | ||
13018 | unaryop = build1 (op, NULL_TREE, op1); | |
13019 | TREE_SIDE_EFFECTS (unaryop) = 1; | |
13020 | /* Store the location of the operator, for better error report. The | |
13021 | string of the operator will be rebuild based on the OP value. */ | |
13022 | EXPR_WFL_LINECOL (unaryop) = op_location; | |
13023 | return unaryop; | |
13024 | } | |
13025 | ||
13026 | /* Special case for the ++/-- operators, since they require an extra | |
13027 | argument to build, which is set to NULL and patched | |
13028 | later. IS_POST_P is 1 if the operator, 0 otherwise. */ | |
13029 | ||
13030 | static tree | |
13031 | build_incdec (op_token, op_location, op1, is_post_p) | |
13032 | int op_token, op_location; | |
13033 | tree op1; | |
13034 | int is_post_p; | |
13035 | { | |
13036 | static enum tree_code lookup [2][2] = | |
13037 | { | |
13038 | { PREDECREMENT_EXPR, PREINCREMENT_EXPR, }, | |
13039 | { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, }, | |
13040 | }; | |
13041 | tree node = build (lookup [is_post_p][(op_token - DECR_TK)], | |
13042 | NULL_TREE, op1, NULL_TREE); | |
13043 | TREE_SIDE_EFFECTS (node) = 1; | |
13044 | /* Store the location of the operator, for better error report. The | |
13045 | string of the operator will be rebuild based on the OP value. */ | |
13046 | EXPR_WFL_LINECOL (node) = op_location; | |
13047 | return node; | |
13048 | } | |
13049 | ||
13050 | /* Build an incomplete cast operator, based on the use of the | |
13051 | CONVERT_EXPR. Note that TREE_TYPE of the constructed node is | |
13052 | set. java_complete_tree is trained to walk a CONVERT_EXPR even | |
13053 | though its type is already set. */ | |
13054 | ||
13055 | static tree | |
13056 | build_cast (location, type, exp) | |
13057 | int location; | |
13058 | tree type, exp; | |
13059 | { | |
13060 | tree node = build1 (CONVERT_EXPR, type, exp); | |
13061 | EXPR_WFL_LINECOL (node) = location; | |
13062 | return node; | |
13063 | } | |
13064 | ||
13065 | /* 15.14 Unary operators. We return error_mark_node in case of error, | |
13066 | but preserve the type of NODE if the type is fixed. */ | |
13067 | ||
13068 | static tree | |
13069 | patch_unaryop (node, wfl_op) | |
13070 | tree node; | |
13071 | tree wfl_op; | |
13072 | { | |
13073 | tree op = TREE_OPERAND (node, 0); | |
13074 | tree op_type = TREE_TYPE (op); | |
ab3a6dd6 | 13075 | tree prom_type = NULL_TREE, value, decl; |
8b27f225 PB |
13076 | int code = TREE_CODE (node); |
13077 | int error_found = 0; | |
13078 | ||
13079 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
13080 | ||
13081 | switch (code) | |
13082 | { | |
13083 | /* 15.13.2 Postfix Increment Operator ++ */ | |
13084 | case POSTINCREMENT_EXPR: | |
13085 | /* 15.13.3 Postfix Increment Operator -- */ | |
13086 | case POSTDECREMENT_EXPR: | |
13087 | /* 15.14.1 Prefix Increment Operator ++ */ | |
13088 | case PREINCREMENT_EXPR: | |
13089 | /* 15.14.2 Prefix Decrement Operator -- */ | |
13090 | case PREDECREMENT_EXPR: | |
5cbdba64 | 13091 | op = decl = strip_out_static_field_access_decl (op); |
a3f406ce | 13092 | /* We really should have a JAVA_ARRAY_EXPR to avoid this */ |
78d21f92 | 13093 | if (!JDECL_P (decl) |
b3edebcf APB |
13094 | && TREE_CODE (decl) != COMPONENT_REF |
13095 | && !(flag_emit_class_files && TREE_CODE (decl) == ARRAY_REF) | |
13096 | && TREE_CODE (decl) != INDIRECT_REF | |
13097 | && !(TREE_CODE (decl) == COMPOUND_EXPR | |
13098 | && TREE_OPERAND (decl, 1) | |
13099 | && (TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF))) | |
8b27f225 | 13100 | { |
5e942c50 APB |
13101 | tree lvalue; |
13102 | /* Before screaming, check that we're not in fact trying to | |
13103 | increment a optimized static final access, in which case | |
13104 | we issue an different error message. */ | |
13105 | if (!(TREE_CODE (wfl_op) == EXPR_WITH_FILE_LOCATION | |
13106 | && resolve_expression_name (wfl_op, &lvalue) | |
13107 | && check_final_assignment (lvalue, wfl_op))) | |
13108 | parse_error_context (wfl_operator, "Invalid argument to `%s'", | |
13109 | operator_string (node)); | |
8b27f225 PB |
13110 | TREE_TYPE (node) = error_mark_node; |
13111 | error_found = 1; | |
13112 | } | |
5e942c50 APB |
13113 | else if (check_final_assignment (op, wfl_op)) |
13114 | error_found = 1; | |
13115 | ||
8b27f225 PB |
13116 | /* From now on, we know that op if a variable and that it has a |
13117 | valid wfl. We use wfl_op to locate errors related to the | |
13118 | ++/-- operand. */ | |
13119 | else if (!JNUMERIC_TYPE_P (op_type)) | |
13120 | { | |
13121 | parse_error_context | |
13122 | (wfl_op, "Invalid argument type `%s' to `%s'", | |
13123 | lang_printable_name (op_type, 0), operator_string (node)); | |
13124 | TREE_TYPE (node) = error_mark_node; | |
13125 | error_found = 1; | |
13126 | } | |
13127 | else | |
13128 | { | |
4a5f66c3 | 13129 | /* Before the addition, binary numeric promotion is performed on |
5cbdba64 APB |
13130 | both operands, if really necessary */ |
13131 | if (JINTEGRAL_TYPE_P (op_type)) | |
13132 | { | |
13133 | value = build_int_2 (1, 0); | |
13134 | TREE_TYPE (value) = TREE_TYPE (node) = op_type; | |
13135 | } | |
13136 | else | |
13137 | { | |
13138 | value = build_int_2 (1, 0); | |
13139 | TREE_TYPE (node) = | |
13140 | binary_numeric_promotion (op_type, | |
13141 | TREE_TYPE (value), &op, &value); | |
13142 | } | |
13143 | /* And write back into the node. */ | |
4a5f66c3 | 13144 | TREE_OPERAND (node, 0) = op; |
8b27f225 | 13145 | TREE_OPERAND (node, 1) = value; |
5cbdba64 APB |
13146 | /* Convert the overall back into its original type, if |
13147 | necessary, and return */ | |
13148 | if (JINTEGRAL_TYPE_P (op_type)) | |
13149 | return fold (node); | |
13150 | else | |
13151 | return fold (convert (op_type, node)); | |
8b27f225 PB |
13152 | } |
13153 | break; | |
13154 | ||
13155 | /* 15.14.3 Unary Plus Operator + */ | |
13156 | case UNARY_PLUS_EXPR: | |
13157 | /* 15.14.4 Unary Minus Operator - */ | |
13158 | case NEGATE_EXPR: | |
13159 | if (!JNUMERIC_TYPE_P (op_type)) | |
13160 | { | |
13161 | ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type); | |
13162 | TREE_TYPE (node) = error_mark_node; | |
13163 | error_found = 1; | |
13164 | } | |
13165 | /* Unary numeric promotion is performed on operand */ | |
13166 | else | |
13167 | { | |
12472854 PB |
13168 | op = do_unary_numeric_promotion (op); |
13169 | prom_type = TREE_TYPE (op); | |
8b27f225 | 13170 | if (code == UNARY_PLUS_EXPR) |
4a5f66c3 | 13171 | return fold (op); |
8b27f225 PB |
13172 | } |
13173 | break; | |
13174 | ||
13175 | /* 15.14.5 Bitwise Complement Operator ~ */ | |
13176 | case BIT_NOT_EXPR: | |
13177 | if (!JINTEGRAL_TYPE_P (op_type)) | |
13178 | { | |
13179 | ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type); | |
13180 | TREE_TYPE (node) = error_mark_node; | |
13181 | error_found = 1; | |
13182 | } | |
13183 | else | |
13184 | { | |
12472854 PB |
13185 | op = do_unary_numeric_promotion (op); |
13186 | prom_type = TREE_TYPE (op); | |
8b27f225 PB |
13187 | } |
13188 | break; | |
13189 | ||
13190 | /* 15.14.6 Logical Complement Operator ! */ | |
13191 | case TRUTH_NOT_EXPR: | |
13192 | if (TREE_CODE (op_type) != BOOLEAN_TYPE) | |
13193 | { | |
13194 | ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type); | |
c877974e APB |
13195 | /* But the type is known. We will report an error if further |
13196 | attempt of a assignment is made with this rhs */ | |
8b27f225 PB |
13197 | TREE_TYPE (node) = boolean_type_node; |
13198 | error_found = 1; | |
13199 | } | |
13200 | else | |
13201 | prom_type = boolean_type_node; | |
13202 | break; | |
13203 | ||
13204 | /* 15.15 Cast Expression */ | |
13205 | case CONVERT_EXPR: | |
13206 | value = patch_cast (node, wfl_operator); | |
13207 | if (value == error_mark_node) | |
c877974e APB |
13208 | { |
13209 | /* If this cast is part of an assignment, we tell the code | |
13210 | that deals with it not to complain about a mismatch, | |
13211 | because things have been cast, anyways */ | |
13212 | TREE_TYPE (node) = error_mark_node; | |
13213 | error_found = 1; | |
13214 | } | |
13215 | else | |
939d7216 PB |
13216 | { |
13217 | value = fold (value); | |
13218 | TREE_SIDE_EFFECTS (value) = TREE_SIDE_EFFECTS (op); | |
13219 | return value; | |
13220 | } | |
8b27f225 PB |
13221 | break; |
13222 | } | |
13223 | ||
8b27f225 PB |
13224 | if (error_found) |
13225 | return error_mark_node; | |
4a5f66c3 APB |
13226 | |
13227 | /* There are cases where node has been replaced by something else | |
13228 | and we don't end up returning here: UNARY_PLUS_EXPR, | |
13229 | CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */ | |
63a212ed | 13230 | TREE_OPERAND (node, 0) = fold (op); |
4a5f66c3 | 13231 | TREE_TYPE (node) = prom_type; |
939d7216 | 13232 | TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op); |
8b27f225 PB |
13233 | return fold (node); |
13234 | } | |
13235 | ||
13236 | /* Generic type resolution that sometimes takes place during node | |
13237 | patching. Returned the resolved type or generate an error | |
13238 | message. Return the resolved type or NULL_TREE. */ | |
13239 | ||
13240 | static tree | |
13241 | resolve_type_during_patch (type) | |
13242 | tree type; | |
13243 | { | |
13244 | if (unresolved_type_p (type, NULL)) | |
13245 | { | |
13246 | tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE); | |
13247 | if (!type_decl) | |
13248 | { | |
13249 | parse_error_context (type, | |
13250 | "Class `%s' not found in type declaration", | |
13251 | IDENTIFIER_POINTER (EXPR_WFL_NODE (type))); | |
13252 | return NULL_TREE; | |
13253 | } | |
13254 | else | |
5e942c50 APB |
13255 | { |
13256 | CLASS_LOADED_P (TREE_TYPE (type_decl)) = 1; | |
13257 | return TREE_TYPE (type_decl); | |
13258 | } | |
8b27f225 PB |
13259 | } |
13260 | return type; | |
13261 | } | |
13262 | /* 5.5 Casting Conversion. error_mark_node is returned if an error is | |
13263 | found. Otherwise NODE or something meant to replace it is returned. */ | |
13264 | ||
13265 | static tree | |
13266 | patch_cast (node, wfl_operator) | |
13267 | tree node; | |
13268 | tree wfl_operator; | |
13269 | { | |
13270 | tree op = TREE_OPERAND (node, 0); | |
13271 | tree op_type = TREE_TYPE (op); | |
13272 | tree cast_type = TREE_TYPE (node); | |
13273 | char *t1; | |
13274 | ||
13275 | /* First resolve OP_TYPE if unresolved */ | |
13276 | if (!(cast_type = resolve_type_during_patch (cast_type))) | |
13277 | return error_mark_node; | |
13278 | ||
13279 | /* Check on cast that are proven correct at compile time */ | |
13280 | if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type)) | |
13281 | { | |
8b27f225 PB |
13282 | /* Same type */ |
13283 | if (cast_type == op_type) | |
13284 | return node; | |
13285 | ||
0b4d333e APB |
13286 | /* float and double type are converted to the original type main |
13287 | variant and then to the target type. */ | |
13288 | if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE) | |
13289 | op = convert (integer_type_node, op); | |
13290 | ||
8b27f225 PB |
13291 | /* Try widening/narowwing convertion. Potentially, things need |
13292 | to be worked out in gcc so we implement the extreme cases | |
13293 | correctly. fold_convert() needs to be fixed. */ | |
13294 | return convert (cast_type, op); | |
13295 | } | |
13296 | ||
0b4d333e APB |
13297 | /* It's also valid to cast a boolean into a boolean */ |
13298 | if (op_type == boolean_type_node && cast_type == boolean_type_node) | |
13299 | return node; | |
13300 | ||
5e942c50 APB |
13301 | /* null can be casted to references */ |
13302 | if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type)) | |
13303 | return build_null_of_type (cast_type); | |
13304 | ||
8b27f225 PB |
13305 | /* The remaining legal casts involve conversion between reference |
13306 | types. Check for their compile time correctness. */ | |
13307 | if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type) | |
09ed0f70 | 13308 | && valid_ref_assignconv_cast_p (op_type, cast_type, 1)) |
8b27f225 PB |
13309 | { |
13310 | TREE_TYPE (node) = promote_type (cast_type); | |
13311 | /* Now, the case can be determined correct at compile time if | |
13312 | OP_TYPE can be converted into CAST_TYPE by assignment | |
13313 | conversion (5.2) */ | |
13314 | ||
13315 | if (valid_ref_assignconv_cast_p (op_type, cast_type, 0)) | |
12472854 PB |
13316 | { |
13317 | TREE_SET_CODE (node, NOP_EXPR); | |
13318 | return node; | |
13319 | } | |
13320 | ||
13321 | if (flag_emit_class_files) | |
13322 | { | |
13323 | TREE_SET_CODE (node, CONVERT_EXPR); | |
13324 | return node; | |
13325 | } | |
8b27f225 PB |
13326 | |
13327 | /* The cast requires a run-time check */ | |
13328 | return build (CALL_EXPR, promote_type (cast_type), | |
13329 | build_address_of (soft_checkcast_node), | |
13330 | tree_cons (NULL_TREE, build_class_ref (cast_type), | |
13331 | build_tree_list (NULL_TREE, op)), | |
13332 | NULL_TREE); | |
13333 | } | |
13334 | ||
13335 | /* Any other casts are proven incorrect at compile time */ | |
c2e3db92 | 13336 | t1 = xstrdup (lang_printable_name (op_type, 0)); |
8b27f225 PB |
13337 | parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'", |
13338 | t1, lang_printable_name (cast_type, 0)); | |
13339 | free (t1); | |
13340 | return error_mark_node; | |
13341 | } | |
13342 | ||
5e942c50 APB |
13343 | /* Build a null constant and give it the type TYPE. */ |
13344 | ||
13345 | static tree | |
13346 | build_null_of_type (type) | |
13347 | tree type; | |
13348 | { | |
13349 | tree node = build_int_2 (0, 0); | |
13350 | TREE_TYPE (node) = promote_type (type); | |
13351 | return node; | |
13352 | } | |
13353 | ||
8b27f225 PB |
13354 | /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't |
13355 | a list of indices. */ | |
13356 | static tree | |
13357 | build_array_ref (location, array, index) | |
13358 | int location; | |
13359 | tree array, index; | |
13360 | { | |
13361 | tree node = build (ARRAY_REF, NULL_TREE, array, index); | |
13362 | EXPR_WFL_LINECOL (node) = location; | |
13363 | return node; | |
13364 | } | |
13365 | ||
13366 | /* 15.12 Array Access Expression */ | |
13367 | ||
13368 | static tree | |
c877974e APB |
13369 | patch_array_ref (node) |
13370 | tree node; | |
8b27f225 PB |
13371 | { |
13372 | tree array = TREE_OPERAND (node, 0); | |
13373 | tree array_type = TREE_TYPE (array); | |
13374 | tree index = TREE_OPERAND (node, 1); | |
13375 | tree index_type = TREE_TYPE (index); | |
8b27f225 PB |
13376 | int error_found = 0; |
13377 | ||
13378 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
13379 | ||
8b27f225 PB |
13380 | if (TREE_CODE (array_type) == POINTER_TYPE) |
13381 | array_type = TREE_TYPE (array_type); | |
13382 | ||
13383 | /* The array reference must be an array */ | |
13384 | if (!TYPE_ARRAY_P (array_type)) | |
13385 | { | |
13386 | parse_error_context | |
781b0558 KG |
13387 | (wfl_operator, |
13388 | "`[]' can only be applied to arrays. It can't be applied to `%s'", | |
13389 | lang_printable_name (array_type, 0)); | |
8b27f225 PB |
13390 | TREE_TYPE (node) = error_mark_node; |
13391 | error_found = 1; | |
13392 | } | |
13393 | ||
13394 | /* The array index underdoes unary numeric promotion. The promoted | |
13395 | type must be int */ | |
12472854 PB |
13396 | index = do_unary_numeric_promotion (index); |
13397 | if (TREE_TYPE (index) != int_type_node) | |
8b27f225 | 13398 | { |
1ebadc60 | 13399 | if (valid_cast_to_p (index_type, int_type_node)) |
781b0558 KG |
13400 | parse_error_context (wfl_operator, |
13401 | "Incompatible type for `[]'. Explicit cast needed to convert `%s' to `int'", | |
1ebadc60 KG |
13402 | lang_printable_name (index_type, 0)); |
13403 | else | |
781b0558 KG |
13404 | parse_error_context (wfl_operator, |
13405 | "Incompatible type for `[]'. Can't convert `%s' to `int'", | |
1ebadc60 | 13406 | lang_printable_name (index_type, 0)); |
8b27f225 PB |
13407 | TREE_TYPE (node) = error_mark_node; |
13408 | error_found = 1; | |
13409 | } | |
13410 | ||
8b27f225 PB |
13411 | if (error_found) |
13412 | return error_mark_node; | |
8b27f225 | 13413 | |
5e942c50 | 13414 | array_type = TYPE_ARRAY_ELEMENT (array_type); |
5e942c50 | 13415 | |
7f1d4866 | 13416 | if (flag_emit_class_files || flag_emit_xref) |
8b27f225 | 13417 | { |
12472854 PB |
13418 | TREE_OPERAND (node, 0) = array; |
13419 | TREE_OPERAND (node, 1) = index; | |
8b27f225 PB |
13420 | } |
13421 | else | |
939d7216 PB |
13422 | { |
13423 | /* The save_expr is for correct evaluation order. It would be cleaner | |
13424 | to use force_evaluation_order (see comment there), but that is | |
13425 | difficult when we also have to deal with bounds checking. */ | |
13426 | if (TREE_SIDE_EFFECTS (index)) | |
13427 | array = save_expr (array); | |
13428 | node = build_java_arrayaccess (array, array_type, index); | |
13429 | if (TREE_SIDE_EFFECTS (index)) | |
13430 | node = build (COMPOUND_EXPR, array_type, array, node); | |
13431 | } | |
8b27f225 PB |
13432 | TREE_TYPE (node) = array_type; |
13433 | return node; | |
13434 | } | |
13435 | ||
13436 | /* 15.9 Array Creation Expressions */ | |
13437 | ||
13438 | static tree | |
13439 | build_newarray_node (type, dims, extra_dims) | |
13440 | tree type; | |
13441 | tree dims; | |
13442 | int extra_dims; | |
13443 | { | |
13444 | tree node = | |
13445 | build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims), | |
13446 | build_int_2 (extra_dims, 0)); | |
13447 | return node; | |
13448 | } | |
13449 | ||
13450 | static tree | |
13451 | patch_newarray (node) | |
13452 | tree node; | |
13453 | { | |
13454 | tree type = TREE_OPERAND (node, 0); | |
13455 | tree dims = TREE_OPERAND (node, 1); | |
13456 | tree cdim, array_type; | |
13457 | int error_found = 0; | |
13458 | int ndims = 0; | |
13459 | int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2)); | |
8b27f225 PB |
13460 | |
13461 | /* Dimension types are verified. It's better for the types to be | |
13462 | verified in order. */ | |
13463 | for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ ) | |
13464 | { | |
13465 | int dim_error = 0; | |
13466 | tree dim = TREE_VALUE (cdim); | |
13467 | ||
13468 | /* Dim might have been saved during its evaluation */ | |
13469 | dim = (TREE_CODE (dim) == SAVE_EXPR ? dim = TREE_OPERAND (dim, 0) : dim); | |
13470 | ||
13471 | /* The type of each specified dimension must be an integral type. */ | |
13472 | if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim))) | |
13473 | dim_error = 1; | |
13474 | ||
13475 | /* Each expression undergoes an unary numeric promotion (5.6.1) and the | |
13476 | promoted type must be int. */ | |
13477 | else | |
13478 | { | |
12472854 | 13479 | dim = do_unary_numeric_promotion (dim); |
8b27f225 PB |
13480 | if (TREE_TYPE (dim) != int_type_node) |
13481 | dim_error = 1; | |
13482 | } | |
13483 | ||
13484 | /* Report errors on types here */ | |
13485 | if (dim_error) | |
13486 | { | |
13487 | parse_error_context | |
13488 | (TREE_PURPOSE (cdim), | |
781b0558 | 13489 | "Incompatible type for dimension in array creation expression. %s convert `%s' to `int'", |
8b27f225 PB |
13490 | (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ? |
13491 | "Explicit cast needed to" : "Can't"), | |
13492 | lang_printable_name (TREE_TYPE (dim), 0)); | |
13493 | error_found = 1; | |
13494 | } | |
13495 | ||
8b27f225 PB |
13496 | TREE_PURPOSE (cdim) = NULL_TREE; |
13497 | } | |
13498 | ||
13499 | /* Resolve array base type if unresolved */ | |
13500 | if (!(type = resolve_type_during_patch (type))) | |
13501 | error_found = 1; | |
13502 | ||
13503 | if (error_found) | |
13504 | { | |
13505 | /* We don't want further evaluation of this bogus array creation | |
13506 | operation */ | |
13507 | TREE_TYPE (node) = error_mark_node; | |
13508 | return error_mark_node; | |
13509 | } | |
13510 | ||
12472854 PB |
13511 | /* Set array_type to the actual (promoted) array type of the result. */ |
13512 | if (TREE_CODE (type) == RECORD_TYPE) | |
13513 | type = build_pointer_type (type); | |
13514 | while (--xdims >= 0) | |
13515 | { | |
13516 | type = promote_type (build_java_array_type (type, -1)); | |
13517 | } | |
13518 | dims = nreverse (dims); | |
13519 | array_type = type; | |
13520 | for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim)) | |
13521 | { | |
13522 | type = array_type; | |
6632dcdd APB |
13523 | array_type |
13524 | = build_java_array_type (type, | |
13525 | TREE_CODE (cdim) == INTEGER_CST | |
13526 | ? (HOST_WIDE_INT) TREE_INT_CST_LOW (cdim) | |
13527 | : -1); | |
12472854 PB |
13528 | array_type = promote_type (array_type); |
13529 | } | |
13530 | dims = nreverse (dims); | |
13531 | ||
8b27f225 PB |
13532 | /* The node is transformed into a function call. Things are done |
13533 | differently according to the number of dimensions. If the number | |
13534 | of dimension is equal to 1, then the nature of the base type | |
13535 | (primitive or not) matters. */ | |
12472854 | 13536 | if (ndims == 1) |
63a212ed | 13537 | return build_new_array (type, TREE_VALUE (dims)); |
8b27f225 | 13538 | |
8b27f225 PB |
13539 | /* Can't reuse what's already written in expr.c because it uses the |
13540 | JVM stack representation. Provide a build_multianewarray. FIXME */ | |
12472854 | 13541 | return build (CALL_EXPR, array_type, |
8b27f225 | 13542 | build_address_of (soft_multianewarray_node), |
12472854 | 13543 | tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)), |
8b27f225 | 13544 | tree_cons (NULL_TREE, |
12472854 | 13545 | build_int_2 (ndims, 0), dims )), |
8b27f225 PB |
13546 | NULL_TREE); |
13547 | } | |
13548 | ||
f8976021 APB |
13549 | /* 10.6 Array initializer. */ |
13550 | ||
13551 | /* Build a wfl for array element that don't have one, so we can | |
13552 | pin-point errors. */ | |
13553 | ||
13554 | static tree | |
13555 | maybe_build_array_element_wfl (node) | |
13556 | tree node; | |
13557 | { | |
13558 | if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION) | |
13559 | return build_expr_wfl (NULL_TREE, ctxp->filename, | |
13560 | ctxp->elc.line, ctxp->elc.prev_col); | |
13561 | else | |
13562 | return NULL_TREE; | |
13563 | } | |
13564 | ||
13565 | /* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes | |
13566 | identification of initialized arrays easier to detect during walk | |
13567 | and expansion. */ | |
13568 | ||
13569 | static tree | |
13570 | build_new_array_init (location, values) | |
13571 | int location; | |
13572 | tree values; | |
13573 | { | |
13574 | tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values); | |
13575 | tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor); | |
5bba4807 | 13576 | EXPR_WFL_LINECOL (to_return) = location; |
f8976021 APB |
13577 | return to_return; |
13578 | } | |
13579 | ||
13580 | /* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error | |
13581 | occurred. Otherwise return NODE after having set its type | |
13582 | appropriately. */ | |
13583 | ||
13584 | static tree | |
13585 | patch_new_array_init (type, node) | |
13586 | tree type, node; | |
f8976021 APB |
13587 | { |
13588 | int error_seen = 0; | |
63a212ed | 13589 | tree current, element_type; |
f8976021 | 13590 | HOST_WIDE_INT length; |
63a212ed PB |
13591 | int all_constant = 1; |
13592 | tree init = TREE_OPERAND (node, 0); | |
f8976021 | 13593 | |
63a212ed PB |
13594 | if (TREE_CODE (type) != POINTER_TYPE || ! TYPE_ARRAY_P (TREE_TYPE (type))) |
13595 | { | |
13596 | parse_error_context (node, | |
13597 | "Invalid array initializer for non-array type `%s'", | |
13598 | lang_printable_name (type, 1)); | |
13599 | return error_mark_node; | |
13600 | } | |
13601 | type = TREE_TYPE (type); | |
13602 | element_type = TYPE_ARRAY_ELEMENT (type); | |
13603 | ||
13604 | CONSTRUCTOR_ELTS (init) = nreverse (CONSTRUCTOR_ELTS (init)); | |
f8976021 | 13605 | |
63a212ed PB |
13606 | for (length = 0, current = CONSTRUCTOR_ELTS (init); |
13607 | current; length++, current = TREE_CHAIN (current)) | |
f8976021 | 13608 | { |
63a212ed PB |
13609 | tree elt = TREE_VALUE (current); |
13610 | if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT) | |
f8976021 | 13611 | { |
63a212ed | 13612 | error_seen |= array_constructor_check_entry (element_type, current); |
5bba4807 PB |
13613 | elt = TREE_VALUE (current); |
13614 | /* When compiling to native code, STRING_CST is converted to | |
13615 | INDIRECT_REF, but still with a TREE_CONSTANT flag. */ | |
13616 | if (! TREE_CONSTANT (elt) || TREE_CODE (elt) == INDIRECT_REF) | |
63a212ed | 13617 | all_constant = 0; |
f8976021 | 13618 | } |
63a212ed PB |
13619 | else |
13620 | { | |
13621 | TREE_VALUE (current) = patch_new_array_init (element_type, elt); | |
13622 | TREE_PURPOSE (current) = NULL_TREE; | |
13623 | all_constant = 0; | |
13624 | } | |
13625 | if (elt && TREE_VALUE (elt) == error_mark_node) | |
13626 | error_seen = 1; | |
f8976021 APB |
13627 | } |
13628 | ||
13629 | if (error_seen) | |
13630 | return error_mark_node; | |
13631 | ||
13632 | /* Create a new type. We can't reuse the one we have here by | |
13633 | patching its dimension because it originally is of dimension -1 | |
13634 | hence reused by gcc. This would prevent triangular arrays. */ | |
63a212ed PB |
13635 | type = build_java_array_type (element_type, length); |
13636 | TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type)))); | |
13637 | TREE_TYPE (node) = promote_type (type); | |
13638 | TREE_CONSTANT (init) = all_constant; | |
bc3ca41b | 13639 | TREE_CONSTANT (node) = all_constant; |
f8976021 APB |
13640 | return node; |
13641 | } | |
13642 | ||
13643 | /* Verify that one entry of the initializer element list can be | |
13644 | assigned to the array base type. Report 1 if an error occurred, 0 | |
13645 | otherwise. */ | |
13646 | ||
13647 | static int | |
13648 | array_constructor_check_entry (type, entry) | |
13649 | tree type, entry; | |
13650 | { | |
13651 | char *array_type_string = NULL; /* For error reports */ | |
13652 | tree value, type_value, new_value, wfl_value, patched; | |
13653 | int error_seen = 0; | |
13654 | ||
13655 | new_value = NULL_TREE; | |
13656 | wfl_value = TREE_VALUE (entry); | |
13657 | ||
100f7cd8 | 13658 | push_obstacks (&permanent_obstack, &permanent_obstack); |
f8976021 | 13659 | value = java_complete_tree (TREE_VALUE (entry)); |
1179ebc2 | 13660 | /* patch_string return error_mark_node if arg is error_mark_node */ |
f8976021 APB |
13661 | if ((patched = patch_string (value))) |
13662 | value = patched; | |
1179ebc2 APB |
13663 | if (value == error_mark_node) |
13664 | return 1; | |
f8976021 | 13665 | |
f8976021 APB |
13666 | type_value = TREE_TYPE (value); |
13667 | ||
1179ebc2 | 13668 | /* At anytime, try_builtin_assignconv can report a warning on |
f8976021 APB |
13669 | constant overflow during narrowing. */ |
13670 | SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value); | |
13671 | new_value = try_builtin_assignconv (wfl_operator, type, value); | |
13672 | if (!new_value && (new_value = try_reference_assignconv (type, value))) | |
13673 | type_value = promote_type (type); | |
100f7cd8 APB |
13674 | |
13675 | pop_obstacks (); | |
f8976021 APB |
13676 | /* Check and report errors */ |
13677 | if (!new_value) | |
13678 | { | |
49f48c71 | 13679 | const char *msg = (!valid_cast_to_p (type_value, type) ? |
f8976021 APB |
13680 | "Can't" : "Explicit cast needed to"); |
13681 | if (!array_type_string) | |
c2e3db92 | 13682 | array_type_string = xstrdup (lang_printable_name (type, 1)); |
f8976021 APB |
13683 | parse_error_context |
13684 | (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'", | |
13685 | msg, lang_printable_name (type_value, 1), array_type_string); | |
13686 | error_seen = 1; | |
13687 | } | |
13688 | ||
13689 | if (new_value) | |
13690 | { | |
13691 | new_value = maybe_build_primttype_type_ref (new_value, wfl_operator); | |
13692 | TREE_VALUE (entry) = new_value; | |
13693 | } | |
13694 | ||
13695 | if (array_type_string) | |
13696 | free (array_type_string); | |
1179ebc2 APB |
13697 | |
13698 | TREE_PURPOSE (entry) = NULL_TREE; | |
f8976021 APB |
13699 | return error_seen; |
13700 | } | |
13701 | ||
8b27f225 PB |
13702 | static tree |
13703 | build_this (location) | |
13704 | int location; | |
13705 | { | |
9ee9b555 | 13706 | tree node = build_wfl_node (this_identifier_node); |
8b27f225 PB |
13707 | TREE_SET_CODE (node, THIS_EXPR); |
13708 | EXPR_WFL_LINECOL (node) = location; | |
13709 | return node; | |
13710 | } | |
13711 | ||
13712 | /* 14.15 The return statement. It builds a modify expression that | |
13713 | assigns the returned value to the RESULT_DECL that hold the value | |
13714 | to be returned. */ | |
13715 | ||
13716 | static tree | |
13717 | build_return (location, op) | |
13718 | int location; | |
13719 | tree op; | |
13720 | { | |
13721 | tree node = build1 (RETURN_EXPR, NULL_TREE, op); | |
13722 | EXPR_WFL_LINECOL (node) = location; | |
13723 | node = build_debugable_stmt (location, node); | |
13724 | return node; | |
13725 | } | |
13726 | ||
13727 | static tree | |
13728 | patch_return (node) | |
13729 | tree node; | |
13730 | { | |
13731 | tree return_exp = TREE_OPERAND (node, 0); | |
13732 | tree meth = current_function_decl; | |
13733 | tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl)); | |
8b27f225 PB |
13734 | int error_found = 0; |
13735 | ||
13736 | TREE_TYPE (node) = error_mark_node; | |
13737 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
13738 | ||
13739 | /* It's invalid to have a return value within a function that is | |
13740 | declared with the keyword void or that is a constructor */ | |
13741 | if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth))) | |
13742 | error_found = 1; | |
13743 | ||
f099f336 | 13744 | /* It's invalid to use a return statement in a static block */ |
7f1d4866 | 13745 | if (IS_CLINIT (current_function_decl)) |
f099f336 APB |
13746 | error_found = 1; |
13747 | ||
8b27f225 PB |
13748 | /* It's invalid to have a no return value within a function that |
13749 | isn't declared with the keyword `void' */ | |
13750 | if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth))) | |
13751 | error_found = 2; | |
13752 | ||
13753 | if (error_found) | |
13754 | { | |
7f1d4866 | 13755 | if (IS_CLINIT (current_function_decl)) |
f099f336 APB |
13756 | parse_error_context (wfl_operator, |
13757 | "`return' inside static initializer."); | |
13758 | ||
13759 | else if (!DECL_CONSTRUCTOR_P (meth)) | |
22eed1e6 | 13760 | { |
c2e3db92 | 13761 | char *t = xstrdup (lang_printable_name (mtype, 0)); |
22eed1e6 APB |
13762 | parse_error_context (wfl_operator, |
13763 | "`return' with%s value from `%s %s'", | |
13764 | (error_found == 1 ? "" : "out"), | |
13765 | t, lang_printable_name (meth, 0)); | |
13766 | free (t); | |
13767 | } | |
13768 | else | |
13769 | parse_error_context (wfl_operator, | |
13770 | "`return' with value from constructor `%s'", | |
13771 | lang_printable_name (meth, 0)); | |
8b27f225 PB |
13772 | return error_mark_node; |
13773 | } | |
13774 | ||
5e942c50 APB |
13775 | /* If we have a return_exp, build a modify expression and expand |
13776 | it. Note: at that point, the assignment is declared valid, but we | |
13777 | may want to carry some more hacks */ | |
8b27f225 PB |
13778 | if (return_exp) |
13779 | { | |
5e942c50 APB |
13780 | tree exp = java_complete_tree (return_exp); |
13781 | tree modify, patched; | |
13782 | ||
13783 | /* If the function returned value and EXP are booleans, EXP has | |
13784 | to be converted into the type of DECL_RESULT, which is integer | |
13785 | (see complete_start_java_method) */ | |
13786 | if (TREE_TYPE (exp) == boolean_type_node && | |
13787 | TREE_TYPE (TREE_TYPE (meth)) == boolean_type_node) | |
13788 | exp = convert_to_integer (TREE_TYPE (DECL_RESULT (meth)), exp); | |
13789 | ||
13790 | /* `null' can be assigned to a function returning a reference */ | |
13791 | if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth))) && | |
13792 | exp == null_pointer_node) | |
13793 | exp = build_null_of_type (TREE_TYPE (TREE_TYPE (meth))); | |
13794 | ||
13795 | if ((patched = patch_string (exp))) | |
13796 | exp = patched; | |
13797 | ||
13798 | modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp); | |
8b27f225 PB |
13799 | EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node); |
13800 | modify = java_complete_tree (modify); | |
5e942c50 | 13801 | |
8b27f225 PB |
13802 | if (modify != error_mark_node) |
13803 | { | |
13804 | TREE_SIDE_EFFECTS (modify) = 1; | |
13805 | TREE_OPERAND (node, 0) = modify; | |
13806 | } | |
13807 | else | |
13808 | return error_mark_node; | |
13809 | } | |
13810 | TREE_TYPE (node) = void_type_node; | |
13811 | TREE_SIDE_EFFECTS (node) = 1; | |
13812 | return node; | |
13813 | } | |
13814 | ||
13815 | /* 14.8 The if Statement */ | |
13816 | ||
13817 | static tree | |
13818 | build_if_else_statement (location, expression, if_body, else_body) | |
13819 | int location; | |
13820 | tree expression, if_body, else_body; | |
13821 | { | |
13822 | tree node; | |
8b27f225 | 13823 | if (!else_body) |
c877974e | 13824 | else_body = empty_stmt_node; |
8b27f225 PB |
13825 | node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body); |
13826 | EXPR_WFL_LINECOL (node) = location; | |
13827 | node = build_debugable_stmt (location, node); | |
13828 | return node; | |
13829 | } | |
13830 | ||
13831 | static tree | |
13832 | patch_if_else_statement (node) | |
13833 | tree node; | |
13834 | { | |
13835 | tree expression = TREE_OPERAND (node, 0); | |
13836 | ||
13837 | TREE_TYPE (node) = error_mark_node; | |
13838 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
13839 | ||
13840 | /* The type of expression must be boolean */ | |
13841 | if (TREE_TYPE (expression) != boolean_type_node | |
13842 | && TREE_TYPE (expression) != promoted_boolean_type_node) | |
13843 | { | |
13844 | parse_error_context | |
13845 | (wfl_operator, | |
13846 | "Incompatible type for `if'. Can't convert `%s' to `boolean'", | |
13847 | lang_printable_name (TREE_TYPE (expression), 0)); | |
13848 | return error_mark_node; | |
13849 | } | |
13850 | ||
13851 | TREE_TYPE (node) = void_type_node; | |
13852 | TREE_SIDE_EFFECTS (node) = 1; | |
12472854 | 13853 | CAN_COMPLETE_NORMALLY (node) |
c877974e APB |
13854 | = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)) |
13855 | | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2)); | |
8b27f225 PB |
13856 | return node; |
13857 | } | |
13858 | ||
13859 | /* 14.6 Labeled Statements */ | |
13860 | ||
13861 | /* Action taken when a lableled statement is parsed. a new | |
13862 | LABELED_BLOCK_EXPR is created. No statement is attached to the | |
e85ac860 | 13863 | label, yet. LABEL can be NULL_TREE for artificially-generated blocks. */ |
8b27f225 PB |
13864 | |
13865 | static tree | |
13866 | build_labeled_block (location, label) | |
13867 | int location; | |
13868 | tree label; | |
13869 | { | |
e85ac860 | 13870 | tree label_name ; |
8b27f225 | 13871 | tree label_decl, node; |
e85ac860 PB |
13872 | if (label == NULL_TREE || label == continue_identifier_node) |
13873 | label_name = label; | |
13874 | else | |
8b27f225 | 13875 | { |
e85ac860 PB |
13876 | label_name = merge_qualified_name (label_id, label); |
13877 | /* Issue an error if we try to reuse a label that was previously | |
13878 | declared */ | |
13879 | if (IDENTIFIER_LOCAL_VALUE (label_name)) | |
13880 | { | |
13881 | EXPR_WFL_LINECOL (wfl_operator) = location; | |
781b0558 KG |
13882 | parse_error_context (wfl_operator, |
13883 | "Declaration of `%s' shadows a previous label declaration", | |
e85ac860 PB |
13884 | IDENTIFIER_POINTER (label)); |
13885 | EXPR_WFL_LINECOL (wfl_operator) = | |
13886 | EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name)); | |
781b0558 KG |
13887 | parse_error_context (wfl_operator, |
13888 | "This is the location of the previous declaration of label `%s'", | |
e85ac860 PB |
13889 | IDENTIFIER_POINTER (label)); |
13890 | java_error_count--; | |
13891 | } | |
8b27f225 PB |
13892 | } |
13893 | ||
13894 | label_decl = create_label_decl (label_name); | |
13895 | node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE); | |
13896 | EXPR_WFL_LINECOL (node) = location; | |
13897 | TREE_SIDE_EFFECTS (node) = 1; | |
13898 | return node; | |
13899 | } | |
13900 | ||
8b27f225 PB |
13901 | /* A labeled statement LBE is attached a statement. */ |
13902 | ||
13903 | static tree | |
e85ac860 | 13904 | finish_labeled_statement (lbe, statement) |
8b27f225 PB |
13905 | tree lbe; /* Labeled block expr */ |
13906 | tree statement; | |
13907 | { | |
13908 | /* In anyways, tie the loop to its statement */ | |
13909 | LABELED_BLOCK_BODY (lbe) = statement; | |
e85ac860 PB |
13910 | pop_labeled_block (); |
13911 | POP_LABELED_BLOCK (); | |
8b27f225 PB |
13912 | return lbe; |
13913 | } | |
13914 | ||
13915 | /* 14.10, 14.11, 14.12 Loop Statements */ | |
13916 | ||
13917 | /* Create an empty LOOP_EXPR and make it the last in the nested loop | |
13918 | list. */ | |
13919 | ||
13920 | static tree | |
13921 | build_new_loop (loop_body) | |
13922 | tree loop_body; | |
13923 | { | |
13924 | tree loop = build (LOOP_EXPR, NULL_TREE, loop_body); | |
13925 | TREE_SIDE_EFFECTS (loop) = 1; | |
13926 | PUSH_LOOP (loop); | |
13927 | return loop; | |
13928 | } | |
13929 | ||
13930 | /* Create a loop body according to the following structure: | |
13931 | COMPOUND_EXPR | |
13932 | COMPOUND_EXPR (loop main body) | |
13933 | EXIT_EXPR (this order is for while/for loops. | |
13934 | LABELED_BLOCK_EXPR the order is reversed for do loops) | |
34f4db93 | 13935 | LABEL_DECL (a continue occuring here branches at the |
8b27f225 PB |
13936 | BODY end of this labeled block) |
13937 | INCREMENT (if any) | |
13938 | ||
13939 | REVERSED, if non zero, tells that the loop condition expr comes | |
13940 | after the body, like in the do-while loop. | |
13941 | ||
13942 | To obtain a loop, the loop body structure described above is | |
13943 | encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR: | |
13944 | ||
13945 | LABELED_BLOCK_EXPR | |
13946 | LABEL_DECL (use this label to exit the loop) | |
13947 | LOOP_EXPR | |
13948 | <structure described above> */ | |
13949 | ||
13950 | static tree | |
13951 | build_loop_body (location, condition, reversed) | |
13952 | int location; | |
13953 | tree condition; | |
13954 | int reversed; | |
13955 | { | |
13956 | tree first, second, body; | |
13957 | ||
13958 | condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */ | |
13959 | EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */ | |
13960 | condition = build_debugable_stmt (location, condition); | |
13961 | TREE_SIDE_EFFECTS (condition) = 1; | |
13962 | ||
e85ac860 | 13963 | body = build_labeled_block (0, continue_identifier_node); |
8b27f225 PB |
13964 | first = (reversed ? body : condition); |
13965 | second = (reversed ? condition : body); | |
13966 | return | |
13967 | build (COMPOUND_EXPR, NULL_TREE, | |
c877974e | 13968 | build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node); |
8b27f225 PB |
13969 | } |
13970 | ||
13971 | /* Install CONDITION (if any) and loop BODY (using REVERSED to tell | |
13972 | their order) on the current loop. Unlink the current loop from the | |
13973 | loop list. */ | |
13974 | ||
13975 | static tree | |
e85ac860 | 13976 | finish_loop_body (location, condition, body, reversed) |
8b27f225 PB |
13977 | int location; |
13978 | tree condition, body; | |
13979 | int reversed; | |
13980 | { | |
13981 | tree to_return = ctxp->current_loop; | |
13982 | tree loop_body = LOOP_EXPR_BODY (to_return); | |
13983 | if (condition) | |
13984 | { | |
13985 | tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed); | |
13986 | /* We wrapped the EXIT_EXPR around a WFL so we can debug it. | |
13987 | The real EXIT_EXPR is one operand further. */ | |
13988 | EXPR_WFL_LINECOL (cnode) = location; | |
13989 | /* This one is for accurate error reports */ | |
13990 | EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location; | |
13991 | TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition; | |
13992 | } | |
13993 | LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body; | |
13994 | POP_LOOP (); | |
13995 | return to_return; | |
13996 | } | |
13997 | ||
e85ac860 | 13998 | /* Tailored version of finish_loop_body for FOR loops, when FOR |
8b27f225 PB |
13999 | loops feature the condition part */ |
14000 | ||
14001 | static tree | |
e85ac860 | 14002 | finish_for_loop (location, condition, update, body) |
8b27f225 PB |
14003 | int location; |
14004 | tree condition, update, body; | |
14005 | { | |
14006 | /* Put the condition and the loop body in place */ | |
e85ac860 | 14007 | tree loop = finish_loop_body (location, condition, body, 0); |
8b27f225 PB |
14008 | /* LOOP is the current loop which has been now popped of the loop |
14009 | stack. Install the update block */ | |
14010 | LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update; | |
14011 | return loop; | |
14012 | } | |
14013 | ||
5cbdba64 APB |
14014 | /* Try to find the loop a block might be related to. This comprises |
14015 | the case where the LOOP_EXPR is found as the second operand of a | |
14016 | COMPOUND_EXPR, because the loop happens to have an initialization | |
14017 | part, then expressed as the first operand of the COMPOUND_EXPR. If | |
14018 | the search finds something, 1 is returned. Otherwise, 0 is | |
14019 | returned. The search is assumed to start from a | |
14020 | LABELED_BLOCK_EXPR's block. */ | |
14021 | ||
14022 | static tree | |
14023 | search_loop (statement) | |
14024 | tree statement; | |
14025 | { | |
14026 | if (TREE_CODE (statement) == LOOP_EXPR) | |
14027 | return statement; | |
14028 | ||
14029 | if (TREE_CODE (statement) == BLOCK) | |
14030 | statement = BLOCK_SUBBLOCKS (statement); | |
14031 | else | |
14032 | return NULL_TREE; | |
14033 | ||
14034 | if (statement && TREE_CODE (statement) == COMPOUND_EXPR) | |
14035 | while (statement && TREE_CODE (statement) == COMPOUND_EXPR) | |
14036 | statement = TREE_OPERAND (statement, 1); | |
14037 | ||
14038 | return (TREE_CODE (statement) == LOOP_EXPR | |
14039 | && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE); | |
14040 | } | |
14041 | ||
14042 | /* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is | |
14043 | returned otherwise. */ | |
14044 | ||
14045 | static int | |
14046 | labeled_block_contains_loop_p (block, loop) | |
14047 | tree block, loop; | |
14048 | { | |
14049 | if (!block) | |
14050 | return 0; | |
14051 | ||
14052 | if (LABELED_BLOCK_BODY (block) == loop) | |
14053 | return 1; | |
14054 | ||
14055 | if (IS_FOR_LOOP_P (loop) | |
14056 | && search_loop (LABELED_BLOCK_BODY (block)) == loop) | |
14057 | return 1; | |
14058 | ||
14059 | return 0; | |
14060 | } | |
14061 | ||
8b27f225 | 14062 | /* If the loop isn't surrounded by a labeled statement, create one and |
e85ac860 | 14063 | insert LOOP as its body. */ |
8b27f225 PB |
14064 | |
14065 | static tree | |
14066 | patch_loop_statement (loop) | |
14067 | tree loop; | |
14068 | { | |
cd9643f7 | 14069 | tree loop_label; |
5cbdba64 | 14070 | |
cd9643f7 | 14071 | TREE_TYPE (loop) = void_type_node; |
5cbdba64 APB |
14072 | if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop)) |
14073 | return loop; | |
14074 | ||
cd9643f7 | 14075 | loop_label = build_labeled_block (0, NULL_TREE); |
5cbdba64 APB |
14076 | /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL |
14077 | that LOOP_LABEL could enquire about, for a better accuracy. FIXME */ | |
cd9643f7 PB |
14078 | LABELED_BLOCK_BODY (loop_label) = loop; |
14079 | PUSH_LABELED_BLOCK (loop_label); | |
5cbdba64 | 14080 | return loop_label; |
8b27f225 PB |
14081 | } |
14082 | ||
14083 | /* 14.13, 14.14: break and continue Statements */ | |
14084 | ||
14085 | /* Build a break or a continue statement. a null NAME indicates an | |
14086 | unlabeled break/continue statement. */ | |
14087 | ||
14088 | static tree | |
14089 | build_bc_statement (location, is_break, name) | |
14090 | int location, is_break; | |
14091 | tree name; | |
14092 | { | |
14093 | tree break_continue, label_block_expr = NULL_TREE; | |
14094 | ||
14095 | if (name) | |
14096 | { | |
14097 | if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE | |
14098 | (merge_qualified_name (label_id, EXPR_WFL_NODE (name))))) | |
14099 | /* Null means that we don't have a target for this named | |
14100 | break/continue. In this case, we make the target to be the | |
14101 | label name, so that the error can be reported accuratly in | |
14102 | patch_bc_statement. */ | |
14103 | label_block_expr = EXPR_WFL_NODE (name); | |
14104 | } | |
14105 | /* Unlabeled break/continue will be handled during the | |
14106 | break/continue patch operation */ | |
14107 | break_continue | |
14108 | = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE); | |
14109 | ||
14110 | IS_BREAK_STMT_P (break_continue) = is_break; | |
14111 | TREE_SIDE_EFFECTS (break_continue) = 1; | |
14112 | EXPR_WFL_LINECOL (break_continue) = location; | |
14113 | break_continue = build_debugable_stmt (location, break_continue); | |
14114 | return break_continue; | |
14115 | } | |
14116 | ||
14117 | /* Verification of a break/continue statement. */ | |
14118 | ||
14119 | static tree | |
14120 | patch_bc_statement (node) | |
14121 | tree node; | |
14122 | { | |
14123 | tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt; | |
e85ac860 | 14124 | tree labeled_block = ctxp->current_labeled_block; |
8b27f225 PB |
14125 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); |
14126 | ||
8b27f225 | 14127 | /* Having an identifier here means that the target is unknown. */ |
e85ac860 | 14128 | if (bc_label != NULL_TREE && TREE_CODE (bc_label) == IDENTIFIER_NODE) |
8b27f225 PB |
14129 | { |
14130 | parse_error_context (wfl_operator, "No label definition found for `%s'", | |
14131 | IDENTIFIER_POINTER (bc_label)); | |
14132 | return error_mark_node; | |
14133 | } | |
e85ac860 | 14134 | if (! IS_BREAK_STMT_P (node)) |
8b27f225 | 14135 | { |
e85ac860 PB |
14136 | /* It's a continue statement. */ |
14137 | for (;; labeled_block = TREE_CHAIN (labeled_block)) | |
8b27f225 | 14138 | { |
e85ac860 PB |
14139 | if (labeled_block == NULL_TREE) |
14140 | { | |
14141 | if (bc_label == NULL_TREE) | |
14142 | parse_error_context (wfl_operator, | |
14143 | "`continue' must be in loop"); | |
14144 | else | |
1504b2b4 APB |
14145 | parse_error_context |
14146 | (wfl_operator, "continue label `%s' does not name a loop", | |
14147 | IDENTIFIER_POINTER (bc_label)); | |
e85ac860 PB |
14148 | return error_mark_node; |
14149 | } | |
14150 | if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block)) | |
14151 | == continue_identifier_node) | |
14152 | && (bc_label == NULL_TREE | |
14153 | || TREE_CHAIN (labeled_block) == bc_label)) | |
14154 | { | |
14155 | bc_label = labeled_block; | |
14156 | break; | |
14157 | } | |
8b27f225 | 14158 | } |
8b27f225 | 14159 | } |
e85ac860 | 14160 | else if (!bc_label) |
34f4db93 | 14161 | { |
e85ac860 | 14162 | for (;; labeled_block = TREE_CHAIN (labeled_block)) |
8b27f225 | 14163 | { |
e85ac860 PB |
14164 | if (labeled_block == NULL_TREE) |
14165 | { | |
14166 | parse_error_context (wfl_operator, | |
14167 | "`break' must be in loop or switch"); | |
14168 | return error_mark_node; | |
14169 | } | |
14170 | target_stmt = LABELED_BLOCK_BODY (labeled_block); | |
14171 | if (TREE_CODE (target_stmt) == SWITCH_EXPR | |
5cbdba64 | 14172 | || search_loop (target_stmt)) |
e85ac860 PB |
14173 | { |
14174 | bc_label = labeled_block; | |
14175 | break; | |
14176 | } | |
8b27f225 | 14177 | } |
8b27f225 PB |
14178 | } |
14179 | ||
e85ac860 | 14180 | EXIT_BLOCK_LABELED_BLOCK (node) = bc_label; |
12472854 PB |
14181 | CAN_COMPLETE_NORMALLY (bc_label) = 1; |
14182 | ||
8b27f225 PB |
14183 | /* Our break/continue don't return values. */ |
14184 | TREE_TYPE (node) = void_type_node; | |
14185 | /* Encapsulate the break within a compound statement so that it's | |
5cbdba64 | 14186 | expanded all the times by expand_expr (and not clobbered |
8b27f225 PB |
14187 | sometimes, like after a if statement) */ |
14188 | node = add_stmt_to_compound (NULL_TREE, void_type_node, node); | |
14189 | TREE_SIDE_EFFECTS (node) = 1; | |
14190 | return node; | |
14191 | } | |
14192 | ||
14193 | /* Process the exit expression belonging to a loop. Its type must be | |
14194 | boolean. */ | |
14195 | ||
14196 | static tree | |
14197 | patch_exit_expr (node) | |
14198 | tree node; | |
14199 | { | |
14200 | tree expression = TREE_OPERAND (node, 0); | |
14201 | TREE_TYPE (node) = error_mark_node; | |
14202 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
14203 | ||
14204 | /* The type of expression must be boolean */ | |
14205 | if (TREE_TYPE (expression) != boolean_type_node) | |
14206 | { | |
14207 | parse_error_context | |
14208 | (wfl_operator, | |
781b0558 | 14209 | "Incompatible type for loop conditional. Can't convert `%s' to `boolean'", |
8b27f225 PB |
14210 | lang_printable_name (TREE_TYPE (expression), 0)); |
14211 | return error_mark_node; | |
14212 | } | |
14213 | /* Now we know things are allright, invert the condition, fold and | |
14214 | return */ | |
14215 | TREE_OPERAND (node, 0) = | |
14216 | fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression)); | |
12472854 PB |
14217 | |
14218 | if (! integer_zerop (TREE_OPERAND (node, 0)) | |
14219 | && ctxp->current_loop != NULL_TREE | |
14220 | && TREE_CODE (ctxp->current_loop) == LOOP_EXPR) | |
14221 | CAN_COMPLETE_NORMALLY (ctxp->current_loop) = 1; | |
14222 | if (! integer_onep (TREE_OPERAND (node, 0))) | |
14223 | CAN_COMPLETE_NORMALLY (node) = 1; | |
14224 | ||
14225 | ||
8b27f225 PB |
14226 | TREE_TYPE (node) = void_type_node; |
14227 | return node; | |
14228 | } | |
14229 | ||
14230 | /* 14.9 Switch statement */ | |
14231 | ||
14232 | static tree | |
14233 | patch_switch_statement (node) | |
14234 | tree node; | |
14235 | { | |
c877974e | 14236 | tree se = TREE_OPERAND (node, 0), se_type; |
8b27f225 PB |
14237 | |
14238 | /* Complete the switch expression */ | |
14239 | se = TREE_OPERAND (node, 0) = java_complete_tree (se); | |
14240 | se_type = TREE_TYPE (se); | |
14241 | /* The type of the switch expression must be char, byte, short or | |
14242 | int */ | |
14243 | if (!JINTEGRAL_TYPE_P (se_type)) | |
14244 | { | |
14245 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); | |
781b0558 KG |
14246 | parse_error_context (wfl_operator, |
14247 | "Incompatible type for `switch'. Can't convert `%s' to `int'", | |
8b27f225 PB |
14248 | lang_printable_name (se_type, 0)); |
14249 | /* This is what java_complete_tree will check */ | |
14250 | TREE_OPERAND (node, 0) = error_mark_node; | |
14251 | return error_mark_node; | |
14252 | } | |
14253 | ||
12472854 | 14254 | TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1)); |
8b27f225 PB |
14255 | |
14256 | /* Ready to return */ | |
12472854 | 14257 | if (TREE_CODE (TREE_OPERAND (node, 1)) == ERROR_MARK) |
8b27f225 PB |
14258 | { |
14259 | TREE_TYPE (node) = error_mark_node; | |
14260 | return error_mark_node; | |
14261 | } | |
14262 | TREE_TYPE (node) = void_type_node; | |
14263 | TREE_SIDE_EFFECTS (node) = 1; | |
12472854 | 14264 | CAN_COMPLETE_NORMALLY (node) |
c877974e APB |
14265 | = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)) |
14266 | || ! SWITCH_HAS_DEFAULT (node); | |
8b27f225 PB |
14267 | return node; |
14268 | } | |
14269 | ||
8b27f225 PB |
14270 | /* 14.18 The try statement */ |
14271 | ||
8b27f225 | 14272 | static tree |
a7d8d81f | 14273 | build_try_statement (location, try_block, catches) |
8b27f225 | 14274 | int location; |
a7d8d81f PB |
14275 | tree try_block, catches; |
14276 | { | |
14277 | tree node = build (TRY_EXPR, NULL_TREE, try_block, catches); | |
8b27f225 | 14278 | EXPR_WFL_LINECOL (node) = location; |
a7d8d81f | 14279 | return node; |
8b27f225 PB |
14280 | } |
14281 | ||
a7d8d81f PB |
14282 | static tree |
14283 | build_try_finally_statement (location, try_block, finally) | |
14284 | int location; | |
14285 | tree try_block, finally; | |
8b27f225 | 14286 | { |
a7d8d81f PB |
14287 | tree node = build (TRY_FINALLY_EXPR, NULL_TREE, try_block, finally); |
14288 | EXPR_WFL_LINECOL (node) = location; | |
14289 | return node; | |
8b27f225 PB |
14290 | } |
14291 | ||
14292 | static tree | |
14293 | patch_try_statement (node) | |
14294 | tree node; | |
14295 | { | |
14296 | int error_found = 0; | |
14297 | tree try = TREE_OPERAND (node, 0); | |
14298 | /* Exception handlers are considered in left to right order */ | |
14299 | tree catch = nreverse (TREE_OPERAND (node, 1)); | |
8b27f225 PB |
14300 | tree current, caught_type_list = NULL_TREE; |
14301 | ||
14302 | /* Check catch clauses, if any. Every time we find an error, we try | |
14303 | to process the next catch clause. We process the catch clause before | |
14304 | the try block so that when processing the try block we can check thrown | |
14305 | exceptions againts the caught type list. */ | |
14306 | for (current = catch; current; current = TREE_CHAIN (current)) | |
14307 | { | |
14308 | tree carg_decl, carg_type; | |
14309 | tree sub_current, catch_block, catch_clause; | |
14310 | int unreachable; | |
14311 | ||
8b27f225 | 14312 | /* At this point, the structure of the catch clause is |
8b27f225 PB |
14313 | CATCH_EXPR (catch node) |
14314 | BLOCK (with the decl of the parameter) | |
14315 | COMPOUND_EXPR | |
63a212ed | 14316 | MODIFY_EXPR (assignment of the catch parameter) |
8b27f225 | 14317 | BLOCK (catch clause block) |
a7d8d81f PB |
14318 | */ |
14319 | catch_clause = TREE_OPERAND (current, 0); | |
8b27f225 PB |
14320 | carg_decl = BLOCK_EXPR_DECLS (catch_clause); |
14321 | carg_type = TREE_TYPE (TREE_TYPE (carg_decl)); | |
14322 | ||
14323 | /* Catch clauses can't have more than one parameter declared, | |
14324 | but it's already enforced by the grammar. Make sure that the | |
14325 | only parameter of the clause statement in of class Throwable | |
14326 | or a subclass of Throwable, but that was done earlier. The | |
14327 | catch clause parameter type has also been resolved. */ | |
14328 | ||
14329 | /* Just make sure that the catch clause parameter type inherits | |
14330 | from java.lang.Throwable */ | |
14331 | if (!inherits_from_p (carg_type, throwable_type_node)) | |
14332 | { | |
14333 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current); | |
14334 | parse_error_context (wfl_operator, | |
781b0558 | 14335 | "Can't catch class `%s'. Catch clause parameter type must be a subclass of class `java.lang.Throwable'", |
8b27f225 PB |
14336 | lang_printable_name (carg_type, 0)); |
14337 | error_found = 1; | |
14338 | continue; | |
14339 | } | |
14340 | ||
14341 | /* Partial check for unreachable catch statement: The catch | |
14342 | clause is reachable iff is no earlier catch block A in | |
14343 | the try statement such that the type of the catch | |
14344 | clause's parameter is the same as or a subclass of the | |
14345 | type of A's parameter */ | |
14346 | unreachable = 0; | |
14347 | for (sub_current = catch; | |
14348 | sub_current != current; sub_current = TREE_CHAIN (sub_current)) | |
14349 | { | |
14350 | tree sub_catch_clause, decl; | |
a7d8d81f | 14351 | sub_catch_clause = TREE_OPERAND (sub_current, 0); |
8b27f225 PB |
14352 | decl = BLOCK_EXPR_DECLS (sub_catch_clause); |
14353 | ||
14354 | if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl)))) | |
14355 | { | |
14356 | EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current); | |
14357 | parse_error_context | |
781b0558 KG |
14358 | (wfl_operator, |
14359 | "`catch' not reached because of the catch clause at line %d", | |
14360 | EXPR_WFL_LINENO (sub_current)); | |
8b27f225 PB |
14361 | unreachable = error_found = 1; |
14362 | break; | |
14363 | } | |
14364 | } | |
8b27f225 PB |
14365 | /* Complete the catch clause block */ |
14366 | catch_block = java_complete_tree (TREE_OPERAND (current, 0)); | |
14367 | if (catch_block == error_mark_node) | |
14368 | { | |
14369 | error_found = 1; | |
14370 | continue; | |
14371 | } | |
12472854 PB |
14372 | if (CAN_COMPLETE_NORMALLY (catch_block)) |
14373 | CAN_COMPLETE_NORMALLY (node) = 1; | |
8b27f225 | 14374 | TREE_OPERAND (current, 0) = catch_block; |
12472854 PB |
14375 | |
14376 | if (unreachable) | |
14377 | continue; | |
14378 | ||
14379 | /* Things to do here: the exception must be thrown */ | |
14380 | ||
14381 | /* Link this type to the caught type list */ | |
14382 | caught_type_list = tree_cons (NULL_TREE, carg_type, caught_type_list); | |
8b27f225 PB |
14383 | } |
14384 | ||
14385 | PUSH_EXCEPTIONS (caught_type_list); | |
14386 | if ((try = java_complete_tree (try)) == error_mark_node) | |
14387 | error_found = 1; | |
12472854 PB |
14388 | if (CAN_COMPLETE_NORMALLY (try)) |
14389 | CAN_COMPLETE_NORMALLY (node) = 1; | |
8b27f225 PB |
14390 | POP_EXCEPTIONS (); |
14391 | ||
8b27f225 PB |
14392 | /* Verification ends here */ |
14393 | if (error_found) | |
14394 | return error_mark_node; | |
14395 | ||
14396 | TREE_OPERAND (node, 0) = try; | |
14397 | TREE_OPERAND (node, 1) = catch; | |
8b27f225 PB |
14398 | TREE_TYPE (node) = void_type_node; |
14399 | return node; | |
14400 | } | |
14401 | ||
14402 | /* 14.17 The synchronized Statement */ | |
14403 | ||
14404 | static tree | |
14405 | patch_synchronized_statement (node, wfl_op1) | |
14406 | tree node, wfl_op1; | |
14407 | { | |
5a005d9e | 14408 | tree expr = java_complete_tree (TREE_OPERAND (node, 0)); |
8b27f225 | 14409 | tree block = TREE_OPERAND (node, 1); |
5a005d9e | 14410 | |
d8fccff5 | 14411 | tree enter, exit, expr_decl, assignment; |
5a005d9e PB |
14412 | |
14413 | if (expr == error_mark_node) | |
14414 | { | |
14415 | block = java_complete_tree (block); | |
14416 | return expr; | |
14417 | } | |
8b27f225 PB |
14418 | |
14419 | /* The TYPE of expr must be a reference type */ | |
5a005d9e | 14420 | if (!JREFERENCE_TYPE_P (TREE_TYPE (expr))) |
8b27f225 PB |
14421 | { |
14422 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); | |
781b0558 | 14423 | parse_error_context (wfl_operator, "Incompatible type for `synchronized'. Can't convert `%s' to `java.lang.Object'", |
8b27f225 PB |
14424 | lang_printable_name (TREE_TYPE (expr), 0)); |
14425 | return error_mark_node; | |
14426 | } | |
14427 | ||
ce6e9147 APB |
14428 | if (flag_emit_xref) |
14429 | { | |
14430 | TREE_OPERAND (node, 0) = expr; | |
14431 | TREE_OPERAND (node, 1) = java_complete_tree (block); | |
14432 | CAN_COMPLETE_NORMALLY (node) = 1; | |
14433 | return node; | |
14434 | } | |
14435 | ||
8b27f225 PB |
14436 | /* Generate a try-finally for the synchronized statement, except |
14437 | that the handler that catches all throw exception calls | |
14438 | _Jv_MonitorExit and then rethrow the exception. | |
14439 | The synchronized statement is then implemented as: | |
14440 | TRY | |
14441 | { | |
14442 | _Jv_MonitorEnter (expression) | |
14443 | synchronized_block | |
14444 | _Jv_MonitorExit (expression) | |
14445 | } | |
14446 | CATCH_ALL | |
14447 | { | |
14448 | e = _Jv_exception_info (); | |
14449 | _Jv_MonitorExit (expression) | |
14450 | Throw (e); | |
14451 | } */ | |
14452 | ||
5a005d9e PB |
14453 | expr_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (expr)); |
14454 | BUILD_MONITOR_ENTER (enter, expr_decl); | |
14455 | BUILD_MONITOR_EXIT (exit, expr_decl); | |
14456 | CAN_COMPLETE_NORMALLY (enter) = 1; | |
14457 | CAN_COMPLETE_NORMALLY (exit) = 1; | |
96847892 AH |
14458 | assignment = build (MODIFY_EXPR, NULL_TREE, expr_decl, expr); |
14459 | TREE_SIDE_EFFECTS (assignment) = 1; | |
5a005d9e PB |
14460 | node = build1 (CLEANUP_POINT_EXPR, NULL_TREE, |
14461 | build (COMPOUND_EXPR, NULL_TREE, | |
14462 | build (WITH_CLEANUP_EXPR, NULL_TREE, | |
14463 | build (COMPOUND_EXPR, NULL_TREE, | |
96847892 | 14464 | assignment, enter), |
5a005d9e PB |
14465 | NULL_TREE, exit), |
14466 | block)); | |
14467 | node = build_expr_block (node, expr_decl); | |
14468 | ||
14469 | return java_complete_tree (node); | |
8b27f225 PB |
14470 | } |
14471 | ||
14472 | /* 14.16 The throw Statement */ | |
14473 | ||
14474 | static tree | |
14475 | patch_throw_statement (node, wfl_op1) | |
14476 | tree node, wfl_op1; | |
14477 | { | |
14478 | tree expr = TREE_OPERAND (node, 0); | |
14479 | tree type = TREE_TYPE (expr); | |
14480 | int unchecked_ok = 0, tryblock_throws_ok = 0; | |
14481 | ||
14482 | /* Thrown expression must be assignable to java.lang.Throwable */ | |
14483 | if (!try_reference_assignconv (throwable_type_node, expr)) | |
14484 | { | |
14485 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); | |
781b0558 KG |
14486 | parse_error_context (wfl_operator, |
14487 | "Can't throw `%s'; it must be a subclass of class `java.lang.Throwable'", | |
8b27f225 PB |
14488 | lang_printable_name (type, 0)); |
14489 | /* If the thrown expression was a reference, we further the | |
14490 | compile-time check. */ | |
14491 | if (!JREFERENCE_TYPE_P (type)) | |
14492 | return error_mark_node; | |
14493 | } | |
14494 | ||
14495 | /* At least one of the following must be true */ | |
14496 | ||
14497 | /* The type of the throw expression is a not checked exception, | |
14498 | i.e. is a unchecked expression. */ | |
c877974e | 14499 | unchecked_ok = IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type)); |
8b27f225 PB |
14500 | |
14501 | /* Throw is contained in a try statement and at least one catch | |
14502 | clause can receive the thrown expression or the current method is | |
14503 | declared to throw such an exception. Or, the throw statement is | |
14504 | contained in a method or constructor declaration and the type of | |
14505 | the Expression is assignable to at least one type listed in the | |
14506 | throws clause the declaration. */ | |
14507 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); | |
14508 | if (!unchecked_ok) | |
f099f336 | 14509 | tryblock_throws_ok = check_thrown_exceptions_do (TREE_TYPE (expr)); |
8b27f225 PB |
14510 | if (!(unchecked_ok || tryblock_throws_ok)) |
14511 | { | |
14512 | /* If there is a surrounding try block that has no matching | |
14513 | clatch clause, report it first. A surrounding try block exits | |
14514 | only if there is something after the list of checked | |
14515 | exception thrown by the current function (if any). */ | |
14516 | if (IN_TRY_BLOCK_P ()) | |
781b0558 | 14517 | parse_error_context (wfl_operator, "Checked exception `%s' can't be caught by any of the catch clause(s) of the surrounding `try' block", |
8b27f225 PB |
14518 | lang_printable_name (type, 0)); |
14519 | /* If we have no surrounding try statement and the method doesn't have | |
14520 | any throws, report it now. FIXME */ | |
f099f336 APB |
14521 | |
14522 | /* We report that the exception can't be throw from a try block | |
14523 | in all circumstances but when the `throw' is inside a static | |
14524 | block. */ | |
8b27f225 PB |
14525 | else if (!EXCEPTIONS_P (currently_caught_type_list) |
14526 | && !tryblock_throws_ok) | |
f099f336 | 14527 | { |
7f1d4866 | 14528 | if (IS_CLINIT (current_function_decl)) |
781b0558 KG |
14529 | parse_error_context (wfl_operator, |
14530 | "Checked exception `%s' can't be thrown in initializer", | |
f099f336 APB |
14531 | lang_printable_name (type, 0)); |
14532 | else | |
781b0558 KG |
14533 | parse_error_context (wfl_operator, |
14534 | "Checked exception `%s' isn't thrown from a `try' block", | |
f099f336 APB |
14535 | lang_printable_name (type, 0)); |
14536 | } | |
8b27f225 PB |
14537 | /* Otherwise, the current method doesn't have the appropriate |
14538 | throws declaration */ | |
14539 | else | |
781b0558 | 14540 | parse_error_context (wfl_operator, "Checked exception `%s' doesn't match any of current method's `throws' declaration(s)", |
8b27f225 PB |
14541 | lang_printable_name (type, 0)); |
14542 | return error_mark_node; | |
14543 | } | |
14544 | ||
ce6e9147 | 14545 | if (! flag_emit_class_files && ! flag_emit_xref) |
12472854 | 14546 | BUILD_THROW (node, expr); |
ce6e9147 APB |
14547 | |
14548 | /* If doing xrefs, keep the location where the `throw' was seen. */ | |
14549 | if (flag_emit_xref) | |
14550 | EXPR_WFL_LINECOL (node) = EXPR_WFL_LINECOL (wfl_op1); | |
8b27f225 PB |
14551 | return node; |
14552 | } | |
14553 | ||
14554 | /* Check that exception said to be thrown by method DECL can be | |
14555 | effectively caught from where DECL is invoked. */ | |
14556 | ||
14557 | static void | |
14558 | check_thrown_exceptions (location, decl) | |
14559 | int location; | |
14560 | tree decl; | |
14561 | { | |
14562 | tree throws; | |
14563 | /* For all the unchecked exceptions thrown by DECL */ | |
14564 | for (throws = DECL_FUNCTION_THROWS (decl); throws; | |
14565 | throws = TREE_CHAIN (throws)) | |
14566 | if (!check_thrown_exceptions_do (TREE_VALUE (throws))) | |
14567 | { | |
59e4a38e PB |
14568 | #if 1 |
14569 | /* Temporary hack to suppresses errors about cloning arrays. FIXME */ | |
14570 | if (DECL_NAME (decl) == get_identifier ("clone")) | |
14571 | continue; | |
14572 | #endif | |
8b27f225 | 14573 | EXPR_WFL_LINECOL (wfl_operator) = location; |
7705e9db APB |
14574 | if (DECL_NAME (current_function_decl) == finit_identifier_node) |
14575 | parse_error_context | |
14576 | (wfl_operator, "Exception `%s' can't be thrown in initializer", | |
14577 | lang_printable_name (TREE_VALUE (throws), 0)); | |
14578 | else | |
14579 | { | |
14580 | parse_error_context | |
781b0558 | 14581 | (wfl_operator, "Exception `%s' must be caught, or it must be declared in the `throws' clause of `%s'", |
7705e9db APB |
14582 | lang_printable_name (TREE_VALUE (throws), 0), |
14583 | (DECL_NAME (current_function_decl) == init_identifier_node ? | |
14584 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) : | |
14585 | IDENTIFIER_POINTER (DECL_NAME (current_function_decl)))); | |
14586 | } | |
8b27f225 PB |
14587 | } |
14588 | } | |
14589 | ||
c877974e | 14590 | /* Return 1 if checked EXCEPTION is caught at the current nesting level of |
8b27f225 PB |
14591 | try-catch blocks, OR is listed in the `throws' clause of the |
14592 | current method. */ | |
14593 | ||
14594 | static int | |
14595 | check_thrown_exceptions_do (exception) | |
14596 | tree exception; | |
14597 | { | |
14598 | tree list = currently_caught_type_list; | |
c877974e | 14599 | resolve_and_layout (exception, NULL_TREE); |
8b27f225 PB |
14600 | /* First, all the nested try-catch-finally at that stage. The |
14601 | last element contains `throws' clause exceptions, if any. */ | |
c877974e APB |
14602 | if (IS_UNCHECKED_EXCEPTION_P (exception)) |
14603 | return 1; | |
8b27f225 PB |
14604 | while (list) |
14605 | { | |
14606 | tree caught; | |
14607 | for (caught = TREE_VALUE (list); caught; caught = TREE_CHAIN (caught)) | |
14608 | if (valid_ref_assignconv_cast_p (exception, TREE_VALUE (caught), 0)) | |
14609 | return 1; | |
14610 | list = TREE_CHAIN (list); | |
14611 | } | |
14612 | return 0; | |
14613 | } | |
14614 | ||
14615 | static void | |
14616 | purge_unchecked_exceptions (mdecl) | |
14617 | tree mdecl; | |
14618 | { | |
14619 | tree throws = DECL_FUNCTION_THROWS (mdecl); | |
14620 | tree new = NULL_TREE; | |
14621 | ||
14622 | while (throws) | |
14623 | { | |
14624 | tree next = TREE_CHAIN (throws); | |
c877974e | 14625 | if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws))) |
8b27f225 PB |
14626 | { |
14627 | TREE_CHAIN (throws) = new; | |
14628 | new = throws; | |
14629 | } | |
14630 | throws = next; | |
14631 | } | |
14632 | /* List is inverted here, but it doesn't matter */ | |
14633 | DECL_FUNCTION_THROWS (mdecl) = new; | |
14634 | } | |
22eed1e6 APB |
14635 | |
14636 | /* 15.24 Conditional Operator ?: */ | |
14637 | ||
14638 | static tree | |
14639 | patch_conditional_expr (node, wfl_cond, wfl_op1) | |
14640 | tree node, wfl_cond, wfl_op1; | |
14641 | { | |
14642 | tree cond = TREE_OPERAND (node, 0); | |
14643 | tree op1 = TREE_OPERAND (node, 1); | |
14644 | tree op2 = TREE_OPERAND (node, 2); | |
22eed1e6 | 14645 | tree resulting_type = NULL_TREE; |
ac825856 | 14646 | tree t1, t2, patched; |
22eed1e6 APB |
14647 | int error_found = 0; |
14648 | ||
ac825856 APB |
14649 | /* Operands of ?: might be StringBuffers crafted as a result of a |
14650 | string concatenation. Obtain a descent operand here. */ | |
14651 | if ((patched = patch_string (op1))) | |
14652 | TREE_OPERAND (node, 1) = op1 = patched; | |
14653 | if ((patched = patch_string (op2))) | |
14654 | TREE_OPERAND (node, 2) = op2 = patched; | |
14655 | ||
14656 | t1 = TREE_TYPE (op1); | |
14657 | t2 = TREE_TYPE (op2); | |
14658 | ||
22eed1e6 APB |
14659 | /* The first expression must be a boolean */ |
14660 | if (TREE_TYPE (cond) != boolean_type_node) | |
14661 | { | |
14662 | SET_WFL_OPERATOR (wfl_operator, node, wfl_cond); | |
781b0558 KG |
14663 | parse_error_context (wfl_operator, |
14664 | "Incompatible type for `?:'. Can't convert `%s' to `boolean'", | |
22eed1e6 APB |
14665 | lang_printable_name (TREE_TYPE (cond), 0)); |
14666 | error_found = 1; | |
14667 | } | |
14668 | ||
14669 | /* Second and third can be numeric, boolean (i.e. primitive), | |
14670 | references or null. Anything else results in an error */ | |
14671 | if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2)) | |
14672 | || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node) | |
14673 | && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node)) | |
14674 | || (t1 == boolean_type_node && t2 == boolean_type_node))) | |
14675 | error_found = 1; | |
14676 | ||
14677 | /* Determine the type of the conditional expression. Same types are | |
14678 | easy to deal with */ | |
14679 | else if (t1 == t2) | |
14680 | resulting_type = t1; | |
14681 | ||
14682 | /* There are different rules for numeric types */ | |
14683 | else if (JNUMERIC_TYPE_P (t1)) | |
14684 | { | |
14685 | /* if byte/short found, the resulting type is short */ | |
14686 | if ((t1 == byte_type_node && t2 == short_type_node) | |
14687 | || (t1 == short_type_node && t2 == byte_type_node)) | |
14688 | resulting_type = short_type_node; | |
14689 | ||
14690 | /* If t1 is a constant int and t2 is of type byte, short or char | |
14691 | and t1's value fits in t2, then the resulting type is t2 */ | |
14692 | else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1))) | |
14693 | && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2)) | |
14694 | resulting_type = t2; | |
14695 | ||
14696 | /* If t2 is a constant int and t1 is of type byte, short or char | |
14697 | and t2's value fits in t1, then the resulting type is t1 */ | |
14698 | else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2))) | |
14699 | && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1)) | |
14700 | resulting_type = t1; | |
14701 | ||
14702 | /* Otherwise, binary numeric promotion is applied and the | |
14703 | resulting type is the promoted type of operand 1 and 2 */ | |
14704 | else | |
93024893 | 14705 | resulting_type = binary_numeric_promotion (t1, t2, |
22eed1e6 APB |
14706 | &TREE_OPERAND (node, 1), |
14707 | &TREE_OPERAND (node, 2)); | |
14708 | } | |
14709 | ||
14710 | /* Cases of a reference and a null type */ | |
14711 | else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node) | |
14712 | resulting_type = t1; | |
14713 | ||
14714 | else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node) | |
14715 | resulting_type = t2; | |
14716 | ||
14717 | /* Last case: different reference types. If a type can be converted | |
14718 | into the other one by assignment conversion, the latter | |
14719 | determines the type of the expression */ | |
14720 | else if ((resulting_type = try_reference_assignconv (t1, op2))) | |
14721 | resulting_type = promote_type (t1); | |
14722 | ||
14723 | else if ((resulting_type = try_reference_assignconv (t2, op1))) | |
14724 | resulting_type = promote_type (t2); | |
14725 | ||
14726 | /* If we don't have any resulting type, we're in trouble */ | |
14727 | if (!resulting_type) | |
14728 | { | |
c2e3db92 | 14729 | char *t = xstrdup (lang_printable_name (t1, 0)); |
22eed1e6 | 14730 | SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); |
781b0558 KG |
14731 | parse_error_context (wfl_operator, |
14732 | "Incompatible type for `?:'. Can't convert `%s' to `%s'", | |
14733 | t, lang_printable_name (t2, 0)); | |
22eed1e6 APB |
14734 | free (t); |
14735 | error_found = 1; | |
14736 | } | |
14737 | ||
14738 | if (error_found) | |
14739 | { | |
14740 | TREE_TYPE (node) = error_mark_node; | |
14741 | return error_mark_node; | |
14742 | } | |
14743 | ||
14744 | TREE_TYPE (node) = resulting_type; | |
14745 | TREE_SET_CODE (node, COND_EXPR); | |
12472854 | 14746 | CAN_COMPLETE_NORMALLY (node) = 1; |
22eed1e6 APB |
14747 | return node; |
14748 | } | |
ac825856 | 14749 | |
5b09b33e PB |
14750 | /* Try to constant fold NODE. |
14751 | If NODE is not a constant expression, return NULL_EXPR. | |
14752 | CONTEXT is a static final VAR_DECL whose initializer we are folding. */ | |
14753 | ||
14754 | static tree | |
14755 | fold_constant_for_init (node, context) | |
14756 | tree node; | |
14757 | tree context; | |
14758 | { | |
14759 | tree op0, op1, val; | |
14760 | enum tree_code code = TREE_CODE (node); | |
14761 | ||
93024893 | 14762 | if (code == STRING_CST) |
5b09b33e | 14763 | return node; |
93024893 APB |
14764 | |
14765 | if (code == INTEGER_CST || code == REAL_CST) | |
14766 | return convert (TREE_TYPE (context), node); | |
8576f094 | 14767 | if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL) |
5b09b33e PB |
14768 | return NULL_TREE; |
14769 | ||
14770 | switch (code) | |
14771 | { | |
5b09b33e PB |
14772 | case PLUS_EXPR: |
14773 | case MINUS_EXPR: | |
bc3ca41b PB |
14774 | case MULT_EXPR: |
14775 | case TRUNC_MOD_EXPR: | |
14776 | case RDIV_EXPR: | |
5b09b33e PB |
14777 | case LSHIFT_EXPR: |
14778 | case RSHIFT_EXPR: | |
14779 | case URSHIFT_EXPR: | |
14780 | case BIT_AND_EXPR: | |
14781 | case BIT_XOR_EXPR: | |
14782 | case BIT_IOR_EXPR: | |
5b09b33e PB |
14783 | case TRUTH_ANDIF_EXPR: |
14784 | case TRUTH_ORIF_EXPR: | |
14785 | case EQ_EXPR: | |
14786 | case NE_EXPR: | |
14787 | case GT_EXPR: | |
14788 | case GE_EXPR: | |
14789 | case LT_EXPR: | |
14790 | case LE_EXPR: | |
14791 | op0 = TREE_OPERAND (node, 0); | |
14792 | op1 = TREE_OPERAND (node, 1); | |
14793 | val = fold_constant_for_init (op0, context); | |
14794 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
14795 | return NULL_TREE; | |
14796 | TREE_OPERAND (node, 0) = val; | |
14797 | val = fold_constant_for_init (op1, context); | |
14798 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
14799 | return NULL_TREE; | |
14800 | TREE_OPERAND (node, 1) = val; | |
14801 | return patch_binop (node, op0, op1); | |
14802 | ||
14803 | case UNARY_PLUS_EXPR: | |
14804 | case NEGATE_EXPR: | |
14805 | case TRUTH_NOT_EXPR: | |
14806 | case BIT_NOT_EXPR: | |
14807 | case CONVERT_EXPR: | |
14808 | op0 = TREE_OPERAND (node, 0); | |
14809 | val = fold_constant_for_init (op0, context); | |
14810 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
14811 | return NULL_TREE; | |
14812 | TREE_OPERAND (node, 0) = val; | |
5a005d9e | 14813 | return patch_unaryop (node, op0); |
5b09b33e PB |
14814 | break; |
14815 | ||
14816 | case COND_EXPR: | |
14817 | val = fold_constant_for_init (TREE_OPERAND (node, 0), context); | |
14818 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
14819 | return NULL_TREE; | |
14820 | TREE_OPERAND (node, 0) = val; | |
14821 | val = fold_constant_for_init (TREE_OPERAND (node, 1), context); | |
14822 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
14823 | return NULL_TREE; | |
14824 | TREE_OPERAND (node, 1) = val; | |
14825 | val = fold_constant_for_init (TREE_OPERAND (node, 2), context); | |
14826 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
14827 | return NULL_TREE; | |
14828 | TREE_OPERAND (node, 2) = val; | |
14829 | return integer_zerop (TREE_OPERAND (node, 0)) ? TREE_OPERAND (node, 1) | |
14830 | : TREE_OPERAND (node, 2); | |
14831 | ||
14832 | case VAR_DECL: | |
8576f094 APB |
14833 | case FIELD_DECL: |
14834 | if (! FIELD_FINAL (node) | |
5b09b33e PB |
14835 | || DECL_INITIAL (node) == NULL_TREE) |
14836 | return NULL_TREE; | |
14837 | val = DECL_INITIAL (node); | |
14838 | /* Guard against infinite recursion. */ | |
14839 | DECL_INITIAL (node) = NULL_TREE; | |
cd9643f7 | 14840 | val = fold_constant_for_init (val, node); |
5b09b33e PB |
14841 | DECL_INITIAL (node) = val; |
14842 | return val; | |
14843 | ||
14844 | case EXPR_WITH_FILE_LOCATION: | |
14845 | /* Compare java_complete_tree and resolve_expression_name. */ | |
14846 | if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */ | |
14847 | || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE) | |
14848 | { | |
14849 | tree name = EXPR_WFL_NODE (node); | |
14850 | tree decl; | |
14851 | if (PRIMARY_P (node)) | |
14852 | return NULL_TREE; | |
14853 | else if (! QUALIFIED_P (name)) | |
14854 | { | |
14855 | decl = lookup_field_wrapper (DECL_CONTEXT (context), name); | |
8576f094 APB |
14856 | if (decl == NULL_TREE |
14857 | || (! FIELD_STATIC (decl) && ! FIELD_FINAL (decl))) | |
5b09b33e PB |
14858 | return NULL_TREE; |
14859 | return fold_constant_for_init (decl, decl); | |
14860 | } | |
14861 | else | |
14862 | { | |
5b09b33e PB |
14863 | /* Wait until the USE_COMPONENT_REF re-write. FIXME. */ |
14864 | qualify_ambiguous_name (node); | |
14865 | if (resolve_field_access (node, &decl, NULL) | |
14866 | && decl != NULL_TREE) | |
14867 | return fold_constant_for_init (decl, decl); | |
5b09b33e PB |
14868 | return NULL_TREE; |
14869 | } | |
14870 | } | |
14871 | else | |
14872 | { | |
14873 | op0 = TREE_OPERAND (node, 0); | |
14874 | val = fold_constant_for_init (op0, context); | |
14875 | if (val == NULL_TREE || ! TREE_CONSTANT (val)) | |
14876 | return NULL_TREE; | |
14877 | TREE_OPERAND (node, 0) = val; | |
14878 | return val; | |
14879 | } | |
14880 | ||
bc3ca41b PB |
14881 | #ifdef USE_COMPONENT_REF |
14882 | case IDENTIFIER: | |
14883 | case COMPONENT_REF: | |
14884 | ?; | |
14885 | #endif | |
14886 | ||
5b09b33e PB |
14887 | default: |
14888 | return NULL_TREE; | |
14889 | } | |
14890 | } | |
bc3ca41b PB |
14891 | |
14892 | #ifdef USE_COMPONENT_REF | |
14893 | /* Context is 'T' for TypeName, 'P' for PackageName, | |
14894 | 'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */ | |
14895 | ||
14896 | tree | |
14897 | resolve_simple_name (name, context) | |
14898 | tree name; | |
14899 | int context; | |
14900 | { | |
14901 | } | |
14902 | ||
14903 | tree | |
14904 | resolve_qualified_name (name, context) | |
14905 | tree name; | |
14906 | int context; | |
14907 | { | |
14908 | } | |
14909 | #endif |