Commit 8119c720 by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

parse.y (expression_statement:): Call function to report improper invocation of a constructor.

Fri Oct 29 14:23:32 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* parse.y (expression_statement:): Call function to report
 	improper invocation of a constructor.
	(parse_ctor_invocation_error): New function.

From-SVN: r30267
parent 7281a327
Fri Oct 29 14:23:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (expression_statement:): Call function to report
improper invocation of a constructor.
(parse_ctor_invocation_error): New function.
1999-10-26 Mark Mitchell <mark@codesourcery.com> 1999-10-26 Mark Mitchell <mark@codesourcery.com>
* decl.c (poplevel): Don't set BLOCK_TYPE_TAGS or call * decl.c (poplevel): Don't set BLOCK_TYPE_TAGS or call
......
...@@ -427,10 +427,13 @@ add_method_1 (handle_class, access_flags, name, function_type) ...@@ -427,10 +427,13 @@ add_method_1 (handle_class, access_flags, name, function_type)
if (access_flags & ACC_PUBLIC) METHOD_PUBLIC (fndecl) = 1; if (access_flags & ACC_PUBLIC) METHOD_PUBLIC (fndecl) = 1;
if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1; if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1;
if (access_flags & ACC_PRIVATE) METHOD_PRIVATE (fndecl) = 1; if (access_flags & ACC_PRIVATE)
METHOD_PRIVATE (fndecl) = DECL_INLINE (fndecl) = 1;
if (access_flags & ACC_NATIVE) METHOD_NATIVE (fndecl) = 1; if (access_flags & ACC_NATIVE) METHOD_NATIVE (fndecl) = 1;
if (access_flags & ACC_STATIC) METHOD_STATIC (fndecl) = 1; if (access_flags & ACC_STATIC)
if (access_flags & ACC_FINAL) METHOD_FINAL (fndecl) = 1; METHOD_STATIC (fndecl) = DECL_INLINE (fndecl) = 1;
if (access_flags & ACC_FINAL)
METHOD_FINAL (fndecl) = DECL_INLINE (fndecl) = 1;
if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1; if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1;
if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1; if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1;
if (access_flags & ACC_TRANSIENT) METHOD_TRANSIENT (fndecl) = 1; if (access_flags & ACC_TRANSIENT) METHOD_TRANSIENT (fndecl) = 1;
......
...@@ -93,6 +93,7 @@ static tree method_declarator PROTO ((tree, tree)); ...@@ -93,6 +93,7 @@ static tree method_declarator PROTO ((tree, tree));
static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...)) static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...))
ATTRIBUTE_PRINTF_2; ATTRIBUTE_PRINTF_2;
static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list)); static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list));
static void parse_ctor_invocation_error PROTO ((void));
static tree parse_jdk1_1_error PROTO ((const char *)); static tree parse_jdk1_1_error PROTO ((const char *));
static void complete_class_report_errors PROTO ((jdep *)); static void complete_class_report_errors PROTO ((jdep *));
static int process_imports PROTO ((void)); static int process_imports PROTO ((void));
...@@ -1343,16 +1344,14 @@ expression_statement: ...@@ -1343,16 +1344,14 @@ expression_statement:
{yyerror ("')' expected"); RECOVER;} {yyerror ("')' expected"); RECOVER;}
| this_or_super OP_TK CP_TK error | this_or_super OP_TK CP_TK error
{ {
yyerror ("Constructor invocation must be first " parse_ctor_invocation_error ();
"thing in a constructor");
RECOVER; RECOVER;
} }
| this_or_super OP_TK argument_list error | this_or_super OP_TK argument_list error
{yyerror ("')' expected"); RECOVER;} {yyerror ("')' expected"); RECOVER;}
| this_or_super OP_TK argument_list CP_TK error | this_or_super OP_TK argument_list CP_TK error
{ {
yyerror ("Constructor invocation must be first " parse_ctor_invocation_error ();
"thing in a constructor");
RECOVER; RECOVER;
} }
| name DOT_TK SUPER_TK error | name DOT_TK SUPER_TK error
...@@ -2434,7 +2433,17 @@ java_pop_parser_context (generate) ...@@ -2434,7 +2433,17 @@ java_pop_parser_context (generate)
free (toFree); free (toFree);
} }
/* Reporting JDK1.1 features not implemented */ /* Reporting an constructor invocation error. */
static void
parse_ctor_invocation_error ()
{
if (DECL_CONSTRUCTOR_P (current_function_decl))
yyerror ("Constructor invocation must be first thing in a constructor");
else
yyerror ("Only constructors can invoke constructors");
}
/* Reporting JDK1.1 features not implemented. */
static tree static tree
parse_jdk1_1_error (msg) parse_jdk1_1_error (msg)
......
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