aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/parse.y
diff options
context:
space:
mode:
authorAlexandre Petit-Bianco <apbianco@cygnus.com>1998-10-20 11:16:37 +0000
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>1998-10-20 04:16:37 -0700
commitb351b287b70b47f67c310858202042d6b270938a (patch)
treedfc31a7ace81e0e453bad8eb1c3f339df92a71cb /gcc/java/parse.y
parent2331d640cee930caa1464c0d754846d339168bc8 (diff)
downloadgcc-b351b287b70b47f67c310858202042d6b270938a.zip
gcc-b351b287b70b47f67c310858202042d6b270938a.tar.gz
gcc-b351b287b70b47f67c310858202042d6b270938a.tar.bz2
class.c (is_compiled_class): New local variable seen_in_zip.
Tue Oct 20 09:15:38 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> * class.c (is_compiled_class): New local variable seen_in_zip. Identify classes found in currently compiled source file(s). * decl.c (complete_start_java_method): Fixed typo. * java-tree.h (CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P, HAS_BEEN_ALREADY_PARSED_P, IS_A_COMMAND_LINE_FILENAME_P): New macros. (CLASS_P): Moved around. (java_parse_abort_on_error): Macro moved from jcf-parse.c * jcf-parse.c (java_parse_abort_on_error): Macro moved to java-parse.h (jcf_parse_source): Changed leading comment. Removed unnecessary fclose and CLASS_FROM_SOURCE_P marking. (parse_source_file): New local variables remember_for_generation and filename. Mark parsed file name identifier node. Removed block executed when parse_only was null. Set remember_for_generation. Use it as an argument to java_pop_parser_context. (yyparse): New local variables several_files, list, next node and current_file_list. Split ampersand separated file names into current_file_list. Iterate through the list and parse accordingly. * parse.h (java_pop_parser_context): New function prototype. * parse.y (ctxp_for_generation): New static global variable. (java_pop_parser_context): New argument generate. Link popped ctxp to ctxp_for_generation list accordingly. (java_complete_expand_methods): Fixed indentation. (java_expand_classes): New function. Add support for the use of `&' as a file separator on the jc1 command line. From-SVN: r23201
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r--gcc/java/parse.y39
1 files changed, 36 insertions, 3 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 93d1f81..d552871 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -77,6 +77,9 @@ int java_warning_count;
/* The current parser context */
static struct parser_ctxt *ctxp;
+/* List of things that were anlyzed for which code will be generated */
+static struct parser_ctxt *ctxp_for_generation = NULL;
+
/* binop_lookup maps token to tree_code. It is used where binary
operations are involved and required by the parser. RDIV_EXPR
covers both integral/floating point division. The code is changed
@@ -2097,7 +2100,8 @@ java_parser_context_restore_global ()
}
void
-java_pop_parser_context ()
+java_pop_parser_context (generate)
+ int generate;
{
tree current;
struct parser_ctxt *toFree = ctxp;
@@ -2121,7 +2125,13 @@ java_pop_parser_context ()
for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1;
- free (toFree);
+ if (generate)
+ {
+ toFree->next = ctxp_for_generation;
+ ctxp_for_generation = toFree;
+ }
+ else
+ free (toFree);
}
/* Reporting JDK1.1 features not implemented */
@@ -2522,6 +2532,8 @@ maybe_create_class_interface_decl (decl, qualified_name, cl)
DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
+ CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl)) =
+ IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
ctxp->current_parsed_class = decl;
@@ -4815,7 +4827,8 @@ java_complete_expand_methods ()
{
make_class_data (current_class);
register_class ();
- rest_of_decl_compilation (TYPE_NAME (current_class), (char*) 0, 1, 0);
+ rest_of_decl_compilation (TYPE_NAME (current_class),
+ (char*) 0, 1, 0);
}
}
}
@@ -4910,6 +4923,26 @@ java_expand_finals ()
{
}
+/* Generate code for all context remembered for code generation */
+
+void
+java_expand_classes ()
+{
+ for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
+ {
+ ctxp = ctxp_for_generation;
+ lang_init_source (2); /* Error msgs have method prototypes */
+ java_complete_expand_methods (); /* Complete and expand method bodies */
+ java_parse_abort_on_error ();
+ java_expand_finals (); /* Expand and check the finals */
+ java_parse_abort_on_error ();
+ java_check_final (); /* Check unitialized final */
+ java_parse_abort_on_error ();
+ }
+ if (! flag_emit_class_files)
+ emit_register_class ();
+}
+
/* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
a tree list node containing RIGHT. Fore coming RIGHTs will be
chained to this hook. LOCATION contains the location of the