Commit 2c56429a by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

[multiple changes]

Fri Jun 25 13:35:19 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.y (resolve_package): Fixed bogus return statement.
	(patch_method_invocation): Resolve method invocation beginning with
 	a package name qualifier.
Thu Jun 24 13:12:15 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.y (java_complete_lhs): When doing cross referencing, don't
 	try to keep file location on a WFL expanded as a CALL_EXPR.
Wed Jun 23 14:37:15 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.y (finish_method_declaration): Insert a RETURN_EXPR when
 	compiling to class file a void method with an empty method body.
  	As a side effect, the bytecode backend will generate the
 	appropriate `return' instruction.
Tue Jun 22 20:43:49 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.y (lookup_package_type_and_set_next): New function prototype.
	(resolve_package): Search current and imported packages.
	(lookup_package_type_and_set_next): New function.

From-SVN: r27773
parent 7dda3e3a
Fri Jun 25 13:35:19 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (resolve_package): Fixed bogus return statement.
(patch_method_invocation): Resolve method invocation beginning with
a package name qualifier.
1999-06-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Make-lang.in (java.stage1): Depend on stage1-start.
......@@ -5,6 +11,24 @@
(java.stage3): Likewise for stage3-start.
(java.stage4): Likewise for stage4-start.
Thu Jun 24 13:12:15 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (java_complete_lhs): When doing cross referencing, don't
try to keep file location on a WFL expanded as a CALL_EXPR.
Wed Jun 23 14:37:15 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (finish_method_declaration): Insert a RETURN_EXPR when
compiling to class file a void method with an empty method body.
As a side effect, the bytecode backend will generate the
appropriate `return' instruction.
Tue Jun 22 20:43:49 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (lookup_package_type_and_set_next): New function prototype.
(resolve_package): Search current and imported packages.
(lookup_package_type_and_set_next): New function.
1999-06-22 Andrew Haley <aph@cygnus.com>
* verify.c (verify_jvm_instructions): Check for pending blocks
......
......@@ -100,6 +100,7 @@ static int find_in_imports PROTO ((tree));
static int check_pkg_class_access PROTO ((tree, tree));
static tree resolve_package PROTO ((tree, tree *));
static tree lookup_package_type PROTO ((char *, int));
static tree lookup_package_type_and_set_next PROTO ((char *, int, tree *));
static tree resolve_class PROTO ((tree, tree, tree));
static void declare_local_variables PROTO ((int, tree, tree));
static void source_start_java_method PROTO ((tree));
......@@ -3542,6 +3543,12 @@ finish_method_declaration (method_body)
method_body = NULL_TREE;
}
if (flag_emit_class_files && method_body
&& TREE_CODE (method_body) == NOP_EXPR
&& TREE_TYPE (current_function_decl)
&& TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node)
method_body = build1 (RETURN_EXPR, void_type_node, NULL);
BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body;
maybe_absorb_scoping_blocks ();
/* Exit function's body */
......@@ -5237,6 +5244,7 @@ static tree
resolve_package (pkg, next)
tree pkg, *next;
{
tree current;
tree type_name = NULL_TREE;
char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg));
......@@ -5256,9 +5264,63 @@ resolve_package (pkg, next)
*next = TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg)));
type_name = lookup_package_type (name, 9);
}
else
return NULL_TREE; /* FIXME, search all imported packages. */
/* If we found something here, return */
if (type_name)
return type_name;
*next = EXPR_WFL_QUALIFICATION (pkg);
/* Try the current package. */
if (ctxp->package && !strncmp (name, IDENTIFIER_POINTER (ctxp->package),
IDENTIFIER_LENGTH (ctxp->package)))
{
type_name =
lookup_package_type_and_set_next (name,
IDENTIFIER_LENGTH (ctxp->package),
next );
if (type_name)
return type_name;
}
/* Search in imported package */
for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
{
tree current_pkg_name = EXPR_WFL_NODE (TREE_PURPOSE (current));
int len = IDENTIFIER_LENGTH (current_pkg_name);
if (!strncmp (name, IDENTIFIER_POINTER (current_pkg_name), len))
{
tree left, dummy;
breakdown_qualified (&left, &dummy, current_pkg_name);
len = IDENTIFIER_LENGTH (left);
type_name = lookup_package_type_and_set_next (name, len, next);
if (type_name)
break;
}
}
return type_name;
}
static tree
lookup_package_type_and_set_next (name, len, next)
char *name;
int len;
tree *next;
{
char *ptr;
tree type_name = lookup_package_type (name, len);
if (!type_name)
return NULL;
ptr = IDENTIFIER_POINTER (type_name);
while (ptr && (ptr = strchr (ptr, '.')))
{
*next = TREE_CHAIN (*next);
ptr++;
}
return type_name;
}
......@@ -6872,18 +6934,36 @@ patch_method_invocation (patch, primary, where, is_static, ret_decl)
as a MethodName. We need to qualify what's before */
qualify_ambiguous_name (wfl);
/* Package resolution are erroneous */
/* Package resolution */
if (RESOLVE_PACKAGE_NAME_P (wfl))
{
tree remainder;
breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl));
parse_error_context (wfl, "Can't search method `%s' in package "
"`%s'",IDENTIFIER_POINTER (identifier),
IDENTIFIER_POINTER (remainder));
PATCH_METHOD_RETURN_ERROR ();
tree next, decl, name = resolve_package (wfl, &next);
if (!name)
{
tree remainder;
breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl));
parse_error_context (wfl, "Can't search method `%s' in package "
"`%s'",IDENTIFIER_POINTER (identifier),
IDENTIFIER_POINTER (remainder));
PATCH_METHOD_RETURN_ERROR ();
}
RESOLVE_PACKAGE_NAME_P (wfl) = 0;
if ((decl = resolve_no_layout (name, QUAL_WFL (next))))
{
QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl)) = decl;
RESOLVE_EXPRESSION_NAME_P (wfl) = 0;
RESOLVE_TYPE_NAME_P (wfl) = 1;
}
else
{
RESOLVE_EXPRESSION_NAME_P (wfl) = 1;
RESOLVE_TYPE_NAME_P (wfl) = 0;
}
}
/* We're resolving a call from a type */
else if (RESOLVE_TYPE_NAME_P (wfl))
if (RESOLVE_TYPE_NAME_P (wfl))
{
tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl));
tree name = DECL_NAME (decl);
......@@ -7630,7 +7710,6 @@ qualify_ambiguous_name (id)
/* Do one more interation to set things up */
super_found = again = 1;
}
} while (again);
/* If name appears within the scope of a location variable
......@@ -8108,7 +8187,7 @@ java_complete_lhs (node)
return node;
/* Keep line number information somewhere were it doesn't
disrupt the completion process. */
if (flag_emit_xref)
if (flag_emit_xref && TREE_CODE (node) != CALL_EXPR)
{
EXPR_WFL_NODE (wfl) = TREE_OPERAND (node, 1);
TREE_OPERAND (node, 1) = wfl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment