Introduce special treatment for the blank identifier _

Mostly: Do not instantiate variables within for loops and allow
reusing differently typed blanks which previously wasn't possible.

This may be missing some corner-cases, but the added tests seem
to work as expected and nothing else fell apart it seems.
This commit is contained in:
Arne Welzel 2022-09-30 17:38:00 +02:00
parent 7f7c77ab07
commit 46334f8b59
21 changed files with 318 additions and 20 deletions

View file

@ -105,6 +105,7 @@ public:
void SetOption();
bool IsOption() const { return is_option; }
bool IsBlank() const { return is_blank; };
void SetEnumConst() { is_enum_const = true; }
bool IsEnumConst() const { return is_enum_const; }
@ -162,7 +163,7 @@ protected:
bool is_export;
bool infer_return_type;
TypePtr type;
bool is_const, is_enum_const, is_type, is_option;
bool is_const, is_enum_const, is_type, is_option, is_blank;
int offset;
ValPtr val;
AttributesPtr attrs;