diff options
author | Alexandre Petit-Bianco <apbianco@cygnus.com> | 2000-06-26 07:26:08 +0000 |
---|---|---|
committer | Alexandre Petit-Bianco <apbianco@gcc.gnu.org> | 2000-06-26 00:26:08 -0700 |
commit | d6baf6f524a514758cab989ab90bb953a2bac735 (patch) | |
tree | 0f40a3342e4840f9dffd7ec064975186fb944fc8 /gcc/java | |
parent | cab10d564e648f23384495df4801d81f7fe780db (diff) | |
download | gcc-d6baf6f524a514758cab989ab90bb953a2bac735.zip gcc-d6baf6f524a514758cab989ab90bb953a2bac735.tar.gz gcc-d6baf6f524a514758cab989ab90bb953a2bac735.tar.bz2 |
parse.y (do_resolve_class): Minor optimiztion in the package list search.
2000-06-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (do_resolve_class): Minor optimiztion in the package
list search. Removed unecessary test and return statement.
(valid_ref_assignconv_cast_p): Order of arguments to
enclosing_context_p fixed.
From-SVN: r34705
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/java/parse.c | 12 | ||||
-rw-r--r-- | gcc/java/parse.y | 12 |
3 files changed, 21 insertions, 10 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 9510996..8b202a9 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,10 @@ +2000-06-25 Alexandre Petit-Bianco <apbianco@cygnus.com> + + * parse.y (do_resolve_class): Minor optimiztion in the package + list search. Removed unecessary test and return statement. + (valid_ref_assignconv_cast_p): Order of arguments to + enclosing_context_p fixed. + 2000-06-24 Tom Tromey <tromey@cygnus.com> * expr.c (lookup_field): Print error and return error_mark_node if diff --git a/gcc/java/parse.c b/gcc/java/parse.c index c28407e..dc04793 100644 --- a/gcc/java/parse.c +++ b/gcc/java/parse.c @@ -8195,7 +8195,12 @@ do_resolve_class (enclosing, class_type, decl, cl) if (!QUALIFIED_P (TYPE_NAME (class_type))) { tree package; - for (package = package_list; package; package = TREE_CHAIN (package)) + + /* If there is a current package (ctxp->package), it's the first + element of package_list and we can skip it. */ + for (package = (ctxp->package ? + TREE_CHAIN (package_list) : package_list); + package; package = TREE_CHAIN (package)) if ((new_class_decl = qualify_and_find (class_type, TREE_PURPOSE (package), TYPE_NAME (class_type)))) @@ -8208,9 +8213,6 @@ do_resolve_class (enclosing, class_type, decl, cl) (cl ? cl : lookup_cl (decl)))) return NULL_TREE; - if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) - return new_class_decl; - /* 6- Last call for a resolution */ return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); } @@ -14738,7 +14740,7 @@ valid_ref_assignconv_cast_p (source, dest, cast) if (TYPE_CLASS_P (dest)) return (source == dest || inherits_from_p (source, dest) - || enclosing_context_p (dest, source /*source, dest*/) + || enclosing_context_p (source, dest) || (cast && inherits_from_p (dest, source))); if (TYPE_INTERFACE_P (dest)) { diff --git a/gcc/java/parse.y b/gcc/java/parse.y index a24c3a0..5429d41 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -5497,7 +5497,12 @@ do_resolve_class (enclosing, class_type, decl, cl) if (!QUALIFIED_P (TYPE_NAME (class_type))) { tree package; - for (package = package_list; package; package = TREE_CHAIN (package)) + + /* If there is a current package (ctxp->package), it's the first + element of package_list and we can skip it. */ + for (package = (ctxp->package ? + TREE_CHAIN (package_list) : package_list); + package; package = TREE_CHAIN (package)) if ((new_class_decl = qualify_and_find (class_type, TREE_PURPOSE (package), TYPE_NAME (class_type)))) @@ -5510,9 +5515,6 @@ do_resolve_class (enclosing, class_type, decl, cl) (cl ? cl : lookup_cl (decl)))) return NULL_TREE; - if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) - return new_class_decl; - /* 6- Last call for a resolution */ return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); } @@ -12040,7 +12042,7 @@ valid_ref_assignconv_cast_p (source, dest, cast) if (TYPE_CLASS_P (dest)) return (source == dest || inherits_from_p (source, dest) - || enclosing_context_p (dest, source /*source, dest*/) + || enclosing_context_p (source, dest) || (cast && inherits_from_p (dest, source))); if (TYPE_INTERFACE_P (dest)) { |