Simplify class end label parser rule
The current class end label parser rule gets the data type from the TYPE_IDENTIFIER, casts that to a class_type_t and gets the name from that. This code was written when the TYPE_IDENTIFIER only provided the data type. But these days it provides both the data type and the name. Simplify the code to get the name directly from the TYPE_IDENTIIFER. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
0a2cbcb4b7
commit
20d82bbdcb
17
parse.y
17
parse.y
|
|
@ -824,20 +824,9 @@ class_identifier
|
|||
the class name is detected by the lexor as a TYPE_IDENTIFIER if it
|
||||
does indeed match a name. */
|
||||
class_declaration_endlabel_opt
|
||||
: ':' TYPE_IDENTIFIER
|
||||
{ class_type_t*tmp = dynamic_cast<class_type_t*> ($2.type);
|
||||
if (tmp == 0) {
|
||||
yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", $2.text);
|
||||
$$ = 0;
|
||||
} else {
|
||||
$$ = strdupnew(tmp->name.str());
|
||||
}
|
||||
delete[]$2.text;
|
||||
}
|
||||
| ':' IDENTIFIER
|
||||
{ $$ = $2; }
|
||||
|
|
||||
{ $$ = 0; }
|
||||
: ':' TYPE_IDENTIFIER { $$ = $2.text; }
|
||||
| ':' IDENTIFIER { $$ = $2; }
|
||||
| { $$ = 0; }
|
||||
;
|
||||
|
||||
/* This rule implements [ extends class_type ] in the
|
||||
|
|
|
|||
Loading…
Reference in New Issue