diff options
author | Alexandre Petit-Bianco <apbianco@redhat.com> | 2002-03-02 09:58:05 -0800 |
---|---|---|
committer | Alexandre Petit-Bianco <apbianco@gcc.gnu.org> | 2002-03-02 09:58:05 -0800 |
commit | 4f647d52ec4534ff30bdb0729217ffd8ee899010 (patch) | |
tree | fb4b01019fd8d7005ba7344b0bc91da071cdedb9 /gcc/java/parse.y | |
parent | 86855e8c182e8ca97b9fa622b41bb697b9aee5da (diff) | |
download | gcc-4f647d52ec4534ff30bdb0729217ffd8ee899010.zip gcc-4f647d52ec4534ff30bdb0729217ffd8ee899010.tar.gz gcc-4f647d52ec4534ff30bdb0729217ffd8ee899010.tar.bz2 |
Fix for PR java/5758, java/5632:
2002-02-28 Alexandre Petit-Bianco <apbianco@redhat.com>
Fix for PR java/5758, java/5632:
* jcf-parse.c (load_class): Renamed local variable, consider `.' an
inner-class separator too.
* parse.y (do_resolve_class): New local `decl_result.'
Progressively build a name for what can have been loaded.
From-SVN: r50228
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r-- | gcc/java/parse.y | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y index d005b4e..0b5be092 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -5745,6 +5745,7 @@ do_resolve_class (enclosing, class_type, decl, cl) { tree new_class_decl = NULL_TREE, super = NULL_TREE; tree saved_enclosing_type = enclosing ? TREE_TYPE (enclosing) : NULL_TREE; + tree decl_result; struct hash_table _ht, *circularity_hash = &_ht; /* This hash table is used to register the classes we're going @@ -5841,9 +5842,32 @@ do_resolve_class (enclosing, class_type, decl, cl) if (check_pkg_class_access (TYPE_NAME (class_type), cl, true)) return NULL_TREE; } - + /* 6- Last call for a resolution */ - return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); + decl_result = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); + + /* The final lookup might have registered a.b.c into a.b$c If we + failed at the first lookup, progressively change the name if + applicable and use the matching DECL instead. */ + if (!decl_result && QUALIFIED_P (TYPE_NAME (class_type))) + { + tree name = TYPE_NAME (class_type); + char *separator; + do { + + /* Reach the last '.', and if applicable, replace it by a `$' and + see if this exists as a type. */ + if ((separator = strrchr (IDENTIFIER_POINTER (name), '.'))) + { + int c = *separator; + *separator = '$'; + name = get_identifier (IDENTIFIER_POINTER (name)); + *separator = c; + decl_result = IDENTIFIER_CLASS_VALUE (name); + } + } while (!decl_result && separator); + } + return decl_result; } static tree |