Commit 9be7529d by Jeff Sturm Committed by Jeff Sturm

parse.y (fix_constructors): Test if a CALL_EXPR invokes `this'.

	* java/parse.y (fix_constructors): Test if a CALL_EXPR invokes
	`this'.  If so, don't build instance initializers.

From-SVN: r43743
parent 1abd48ad
2001-07-03 Jeff Sturm <jsturm@one-point.com>
* parse.y (fix_constructors): Test if a CALL_EXPR invokes
`this'. If so, don't build instance initializers.
2001-06-28 Gabriel Dos Reis <gdr@codesourcery.com> 2001-06-28 Gabriel Dos Reis <gdr@codesourcery.com>
* lang.c: #include diagnostic.h * lang.c: #include diagnostic.h
......
...@@ -8558,6 +8558,7 @@ fix_constructors (mdecl) ...@@ -8558,6 +8558,7 @@ fix_constructors (mdecl)
else else
{ {
int found = 0; int found = 0;
int invokes_this = 0;
tree found_call = NULL_TREE; tree found_call = NULL_TREE;
tree main_block = BLOCK_EXPR_BODY (body); tree main_block = BLOCK_EXPR_BODY (body);
tree ii; /* Instance Initializer */ tree ii; /* Instance Initializer */
...@@ -8567,6 +8568,8 @@ fix_constructors (mdecl) ...@@ -8567,6 +8568,8 @@ fix_constructors (mdecl)
{ {
case CALL_EXPR: case CALL_EXPR:
found = CALL_EXPLICIT_CONSTRUCTOR_P (body); found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
if (CALL_THIS_CONSTRUCTOR_P (body))
invokes_this = 1;
body = NULL_TREE; body = NULL_TREE;
break; break;
case COMPOUND_EXPR: case COMPOUND_EXPR:
...@@ -8601,7 +8604,7 @@ fix_constructors (mdecl) ...@@ -8601,7 +8604,7 @@ fix_constructors (mdecl)
} }
/* Insert the instance initializer block right after. */ /* Insert the instance initializer block right after. */
if ((ii = build_instance_initializer (mdecl))) if (!invokes_this && (ii = build_instance_initializer (mdecl)))
compound = add_stmt_to_compound (compound, NULL_TREE, ii); compound = add_stmt_to_compound (compound, NULL_TREE, ii);
/* Fix the constructor main block if we're adding extra stmts */ /* Fix the constructor main block if we're adding extra stmts */
......
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