aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-parse.in
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-05-16 06:34:34 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-05-16 06:34:34 +0000
commit0b1cdaf229cff4b90492fcbfe25c98642368f185 (patch)
tree7460d879c8e10f3aaf4d73f4fe217dc1499cf88b /gcc/c-parse.in
parent4c521bad98510915b9bae91033f03a525a7fe5bd (diff)
downloadgcc-0b1cdaf229cff4b90492fcbfe25c98642368f185.zip
gcc-0b1cdaf229cff4b90492fcbfe25c98642368f185.tar.gz
gcc-0b1cdaf229cff4b90492fcbfe25c98642368f185.tar.bz2
c-parse.in (methodtype): New production.
* c-parse.in (methodtype): New production. (methoddef, methodproto): Collapse separate '-' and '+' handlers into 1. From-SVN: r42133
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r--gcc/c-parse.in63
1 files changed, 17 insertions, 46 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index cee2637..3eda45c 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -2947,44 +2947,27 @@ ivar_declarator:
}
;
-methoddef:
+methodtype:
'+'
- {
- objc_pq_context = 1;
- if (objc_implementation_context)
- objc_inherit_code = CLASS_METHOD_DECL;
- else
- fatal_error ("method definition not in class context");
- }
- methoddecl
- {
- objc_pq_context = 0;
- add_class_method (objc_implementation_context, $3);
- start_method_def ($3);
- objc_method_context = $3;
- }
- optarglist
- {
- continue_method_def ();
- }
- compstmt_or_error
- {
- finish_method_def ();
- objc_method_context = NULL_TREE;
- }
-
+ { objc_inherit_code = CLASS_METHOD_DECL; }
| '-'
+ { objc_inherit_code = INSTANCE_METHOD_DECL; }
+ ;
+
+methoddef:
+ methodtype
{
objc_pq_context = 1;
- if (objc_implementation_context)
- objc_inherit_code = INSTANCE_METHOD_DECL;
- else
+ if (!objc_implementation_context)
fatal_error ("method definition not in class context");
}
methoddecl
{
objc_pq_context = 0;
- add_instance_method (objc_implementation_context, $3);
+ if (objc_inherit_code == CLASS_METHOD_DECL)
+ add_class_method (objc_implementation_context, $3);
+ else
+ add_instance_method (objc_implementation_context, $3);
start_method_def ($3);
objc_method_context = $3;
}
@@ -3021,31 +3004,19 @@ semi_or_error:
;
methodproto:
- '+'
+ methodtype
{
/* Remember protocol qualifiers in prototypes. */
objc_pq_context = 1;
- objc_inherit_code = CLASS_METHOD_DECL;
}
methoddecl
{
/* Forget protocol qualifiers here. */
objc_pq_context = 0;
- add_class_method (objc_interface_context, $3);
- }
- semi_or_error
-
- | '-'
- {
- /* Remember protocol qualifiers in prototypes. */
- objc_pq_context = 1;
- objc_inherit_code = INSTANCE_METHOD_DECL;
- }
- methoddecl
- {
- /* Forget protocol qualifiers here. */
- objc_pq_context = 0;
- add_instance_method (objc_interface_context, $3);
+ if (objc_inherit_code == CLASS_METHOD_DECL)
+ add_class_method (objc_interface_context, $3);
+ else
+ add_instance_method (objc_interface_context, $3);
}
semi_or_error
;