Commit 7e1376a1 by Bryce McKinlay Committed by Bryce McKinlay

parse.y (resolve_expression_name): Permit instance variables from enclosing…

parse.y (resolve_expression_name): Permit instance variables from enclosing context in super constructor call.

	* parse.y (resolve_expression_name): Permit instance variables from
	enclosing context in super constructor call.
	(resolve_qualified_expression_name): Permit enclosing class's
	qualified "this" in super constructor call.

From-SVN: r38892
parent ada6635f
2001-01-11 Bryce McKinlay <bryce@albatross.co.nz>
* parse.y (resolve_expression_name): Permit instance variables from
enclosing context in super constructor call.
(resolve_qualified_expression_name): Permit enclosing class's qualified
"this" in super constructor call.
2001-01-10 Mark Mitchell <mark@codesourcery.com> 2001-01-10 Mark Mitchell <mark@codesourcery.com>
* class.c (build_utf8_ref): Remove last argument in call to * class.c (build_utf8_ref): Remove last argument in call to
......
...@@ -8954,7 +8954,8 @@ resolve_expression_name (id, orig) ...@@ -8954,7 +8954,8 @@ resolve_expression_name (id, orig)
} }
/* Instance variables can't appear as an argument of /* Instance variables can't appear as an argument of
an explicit constructor invocation */ an explicit constructor invocation */
if (!fs && ctxp->explicit_constructor_p) if (!fs && ctxp->explicit_constructor_p
&& !enclosing_context_p (DECL_CONTEXT (decl), current_class))
{ {
parse_error_context parse_error_context
(id, "Can't reference `%s' before the superclass constructor has been called", IDENTIFIER_POINTER (name)); (id, "Can't reference `%s' before the superclass constructor has been called", IDENTIFIER_POINTER (name));
...@@ -9320,7 +9321,8 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) ...@@ -9320,7 +9321,8 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
(wfl, "Keyword `this' used outside allowed context"); (wfl, "Keyword `this' used outside allowed context");
return 1; return 1;
} }
if (ctxp->explicit_constructor_p) if (ctxp->explicit_constructor_p
&& type == current_class)
{ {
parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called"); parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called");
return 1; return 1;
......
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