static void process_zip_dir PARAMS ((FILE *));
static void parse_source_file_1 PARAMS ((tree, FILE *));
static void parse_source_file_2 PARAMS ((void));
-static void jcf_parse_source PARAMS ((void));
static void parse_class_file PARAMS ((void));
static void set_source_filename PARAMS ((JCF *, int));
static int predefined_filename_p PARAMS ((tree));
tree save_current_class = current_class;
const char *save_input_filename = input_filename;
JCF *save_current_jcf = current_jcf;
+ int generate;
if ((icv = IDENTIFIER_CLASS_VALUE (name)) != NULL_TREE)
{
current_jcf = jcf;
+ java_parser_context_save_global ();
+ java_push_parser_context ();
if (current_jcf->java_source)
- jcf_parse_source ();
- else {
- java_parser_context_save_global ();
- java_push_parser_context ();
- input_filename = current_jcf->filename;
- current_class = class;
- if (JCF_SEEN_IN_ZIP (current_jcf))
- read_zip_member(current_jcf, current_jcf->zipd, current_jcf->zipd->zipf);
- jcf_parse (current_jcf);
- load_inner_classes (current_class);
- java_pop_parser_context (0);
- java_parser_context_restore_global ();
- }
-
- if (! JCF_SEEN_IN_ZIP (current_jcf))
- JCF_FINISH (current_jcf);
+ {
+ const char *filename = current_jcf->filename;
+ tree file;
+ FILE *finput;
+
+ BUILD_FILENAME_IDENTIFIER_NODE (file, filename);
+ generate = IS_A_COMMAND_LINE_FILENAME_P (file);
+ if (wfl_operator == NULL_TREE)
+ wfl_operator = build_expr_wfl (NULL_TREE, NULL, 0, 0);
+ EXPR_WFL_FILENAME_NODE (wfl_operator) = file;
+ input_filename = ggc_strdup (filename);
+ current_class = NULL_TREE;
+ current_function_decl = NULL_TREE;
+ if (!HAS_BEEN_ALREADY_PARSED_P (file))
+ {
+ if (!(finput = fopen (input_filename, "r")))
+ fatal_io_error ("can't reopen %s", input_filename);
+ parse_source_file_1 (file, finput);
+ parse_source_file_2 ();
+ if (fclose (finput))
+ fatal_io_error ("can't close %s", input_filename);
+ }
+ JCF_FINISH (current_jcf);
+ }
+ else
+ {
+ input_filename = current_jcf->filename;
+ current_class = class;
+ if (class == NULL_TREE || ! CLASS_PARSED_P (class))
+ {
+ if (JCF_SEEN_IN_ZIP (current_jcf))
+ read_zip_member(current_jcf,
+ current_jcf->zipd, current_jcf->zipd->zipf);
+ jcf_parse (current_jcf);
+ }
+ layout_class (current_class);
+ load_inner_classes (current_class);
+ generate = 0;
+ }
+ java_pop_parser_context (generate);
+ java_parser_context_restore_global ();
current_class = save_current_class;
input_filename = save_input_filename;
error ("Cannot find file for class %s.", IDENTIFIER_POINTER (name));
}
-/* Parse a source file when JCF refers to a source file. */
-
-static void
-jcf_parse_source ()
-{
- tree file;
- FILE *finput;
-
- java_parser_context_save_global ();
- java_push_parser_context ();
- BUILD_FILENAME_IDENTIFIER_NODE (file, current_jcf->filename);
- if (wfl_operator == NULL_TREE)
- wfl_operator = build_expr_wfl (NULL_TREE, NULL, 0, 0);
- EXPR_WFL_FILENAME_NODE (wfl_operator) = file;
- input_filename = ggc_strdup (current_jcf->filename);
- current_class = NULL_TREE;
- current_function_decl = NULL_TREE;
- if (!HAS_BEEN_ALREADY_PARSED_P (file))
- {
- if (!(finput = fopen (input_filename, "r")))
- fatal_io_error ("can't reopen %s", input_filename);
- parse_source_file_1 (file, finput);
- parse_source_file_2 ();
- if (fclose (finput))
- fatal_io_error ("can't close %s", input_filename);
- }
- java_pop_parser_context (IS_A_COMMAND_LINE_FILENAME_P (file));
- java_parser_context_restore_global ();
-}
-
/* Parse the .class file JCF. */
void
fprintf (stderr, " %s %s",
(jcf->access_flags & ACC_INTERFACE) ? "interface" : "class",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
- if (CLASS_LOADED_P (current_class))
- return;
- CLASS_LOADED_P (current_class) = 1;
+ if (CLASS_PARSED_P (current_class))
+ {
+ /* FIXME - where was first time */
+ fatal_error ("reading class %s for the second time from %s",
+ IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))),
+ jcf->filename);
+ }
+ CLASS_PARSED_P (current_class) = 1;
for (i = 1; i < JPOOL_SIZE(jcf); i++)
{
if (current_class != class_type_node && current_class != object_type_node)
TYPE_FIELDS (current_class) = nreverse (TYPE_FIELDS (current_class));
- layout_class (current_class);
if (current_class == object_type_node)
{
layout_class_methods (object_type_node);
{
current_class = TREE_PURPOSE (node);
current_jcf = TYPE_JCF (current_class);
+ layout_class (current_class);
load_inner_classes (current_class);
parse_class_file ();
+ JCF_FINISH (current_jcf);
}
}
input_filename = main_input_filename;
if ( !CLASS_LOADED_P (class))
{
- read_zip_member(current_jcf, zdir, localToFile);
- jcf_parse (current_jcf);
+ if (! CLASS_PARSED_P (class))
+ {
+ read_zip_member(current_jcf, zdir, localToFile);
+ jcf_parse (current_jcf);
+ }
+ layout_class (current_class);
load_inner_classes (current_class);
}
{
int osb = pop_current_osb (ctxp);
tree t = build_java_array_type (($1), -1);
- CLASS_LOADED_P (t) = 1;
while (--osb)
t = build_unresolved_array_type (t);
$$ = t;
if (JPRIMITIVE_TYPE_P (type))
{
type = build_java_array_type (type, -1);
- CLASS_LOADED_P (type) = 1;
more_dims--;
}
/* Otherwise, if we have a WFL for this type, use it (the type
/* TYPE_OR_WFL might be an array on a resolved type. In this case,
just create a array type */
if (TREE_CODE (type_or_wfl) == RECORD_TYPE)
- {
- tree type = build_java_array_type (type_or_wfl, -1);
- CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl);
- return type;
- }
+ return build_java_array_type (type_or_wfl, -1);
obstack_1grow (&temporary_obstack, '[');
obstack_grow0 (&temporary_obstack,
else
DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
+ CLASS_PARSED_P (TREE_TYPE (decl)) = 1;
CLASS_FROM_CURRENTLY_COMPILED_P (TREE_TYPE (decl)) =
IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
current_class = save_current_class;
input_filename = save_input_filename;
lineno = save_lineno;
- CLASS_LOADED_P (class) = 1;
}
static tree
while (base != name)
{
resolved_type = build_java_array_type (resolved_type, -1);
- CLASS_LOADED_P (resolved_type) = 1;
name--;
}
/* A TYPE_NAME that is a TYPE_DECL was set in
current_class = TREE_TYPE (TREE_VALUE (current));
layout_class (current_class);
- /* From now on, the class is considered completely loaded */
- CLASS_LOADED_P (current_class) = 1;
-
/* Error reported by the caller */
if (java_error_count)
return;
if (decl == error_mark_node)
return 1;
*type_found = type = QUAL_DECL_TYPE (decl);
- CLASS_LOADED_P (type) = 1;
continue;
case CONVERT_EXPR:
&& !CLASS_LOADED_P (field_decl_type)
&& !TYPE_ARRAY_P (field_decl_type))
resolve_and_layout (field_decl_type, NULL_TREE);
- if (TYPE_ARRAY_P (field_decl_type))
- CLASS_LOADED_P (field_decl_type) = 1;
/* Check on accessibility here */
if (not_accessible_p (current_class, field_decl,
IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
return NULL_TREE;
}
- else
- {
- CLASS_LOADED_P (TREE_TYPE (type_decl)) = 1;
- return TREE_TYPE (type_decl);
- }
+ return TREE_TYPE (type_decl);
}
return type;
}