parse.y (do_resolve_class): Minor optimiztion in the package list search.
authorAlexandre Petit-Bianco <apbianco@cygnus.com>
Mon, 26 Jun 2000 07:26:08 +0000 (07:26 +0000)
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>
Mon, 26 Jun 2000 07:26:08 +0000 (00:26 -0700)
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

gcc/java/ChangeLog
gcc/java/parse.c
gcc/java/parse.y

index 95109964926ebb78e0cbeebca24e3cde17ba4151..8b202a9d4218f88aba0ce49356803f7f13eb9446 100644 (file)
@@ -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
index c28407e79c53c08866967d3f9131109d3e3536ba..dc047935b8b60538f0fb36bcb31a7be77b3c1ae4 100644 (file)
@@ -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))
        {
index a24c3a016ea999f516d227398a4aa0b5d935b0a0..5429d41a9941b1653f040c3c38c4c9cefd124799 100644 (file)
@@ -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))
        {