diff options
author | Andrew Haley <aph@redhat.com> | 2003-02-03 17:44:55 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2003-02-03 17:44:55 +0000 |
commit | 2d7b3505f7681f374ed3d409bb7cc00c9f2ec8d0 (patch) | |
tree | ccb75f2a0f09f50abdb6af21cc3eba16af931737 /gcc/java | |
parent | cea9c57b5961403d4363f542989bf3c53783707a (diff) | |
download | gcc-2d7b3505f7681f374ed3d409bb7cc00c9f2ec8d0.zip gcc-2d7b3505f7681f374ed3d409bb7cc00c9f2ec8d0.tar.gz gcc-2d7b3505f7681f374ed3d409bb7cc00c9f2ec8d0.tar.bz2 |
parse.y (java_expand_classes): Scan the whole class list looking for access methods that haven't yet been expanded.
2003-01-31 Andrew Haley <aph@redhat.com>
* parse.y (java_expand_classes): Scan the whole class list looking
for access methods that haven't yet been expanded.
From-SVN: r62329
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/parse.y | 59 |
2 files changed, 64 insertions, 0 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 3343824..34a11f4 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2003-01-31 Andrew Haley <aph@redhat.com> + + * parse.y (java_expand_classes): Scan the whole class list looking + for access methods that haven't yet been expanded. + 2003-01-31 Adrian Bunk <bunk@fs.tum.de> Fix for java/4269: diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 2096a8e..480668e 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -8888,6 +8888,65 @@ java_expand_classes (void) } } + /* Expanding the constructors of anonymous classes generates access + methods. Scan all the methods looking for null DECL_RESULTs -- + this will be the case if a method hasn't been expanded. */ + for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next) + { + tree current; + ctxp = cur_ctxp; + for (current = ctxp->class_list; current; current = TREE_CHAIN (current)) + { + tree d; + current_class = TREE_TYPE (current); + for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d)) + { + if (DECL_RESULT (d) == NULL_TREE) + { + restore_line_number_status (1); + java_complete_expand_method (d); + restore_line_number_status (0); + } + } + } + } + + /* ??? Instead of all this we could iterate around the list of + classes until there were no more un-expanded methods. It would + take a little longer -- one pass over the whole list of methods + -- but it would be simpler. Like this: */ +#if 0 + { + int something_changed; + + do + { + something_changed = 0; + for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next) + { + tree current; + ctxp = cur_ctxp; + for (current = ctxp->class_list; current; current = TREE_CHAIN (current)) + { + tree d; + current_class = TREE_TYPE (current); + for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d)) + { + if (DECL_RESULT (d) == NULL_TREE) + { + something_changed = 1; + restore_line_number_status (1); + java_complete_expand_method (d); + restore_line_number_status (0); + } + } + } + } + } + while (something_changed); + } +#endif + /* If we've found error at that stage, don't try to generate anything, unless we're emitting xrefs or checking the syntax only (but not using -fsyntax-only for the purpose of generating |