Support typedef overwrites in class scopes

It is possible to declare a new typedef that shadows an existing typedef in
a higher level scope. E.g.

```
typedef int T;
class C;
  typedef real T;
endclass
```

In the current implementation this works for scopes that are not class
scopes.

Update the parser to also support this in class scopes by re-using the
existing parser rule that is used for the other scopes.

Reusing the existing rule also adds support for class forward typedes
inside classes.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-03-22 14:33:29 +01:00
parent 23e1143ad6
commit b30d3fc8d7
1 changed files with 2 additions and 5 deletions

View File

@ -916,11 +916,8 @@ class_item /* IEEE1800-2005: A.1.8 */
/* IEEEE1800-2017: A.1.9 Class items: class_item ::= { property_qualifier} data_declaration */
| property_qualifier_opt K_typedef data_type IDENTIFIER dimensions_opt ';'
{ perm_string name = lex_strings.make($4);
delete[]$4;
pform_set_typedef(name, $3, $5);
}
/* TODO: Restrict the access based on the property qualifier. */
| property_qualifier_opt type_declaration
/* IEEE1800-1017: A.1.9 Class items: Class methods... */