mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
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:
parent
7f7c77ab07
commit
46334f8b59
21 changed files with 318 additions and 20 deletions
|
@ -114,11 +114,15 @@ ID::ID(const char* arg_name, IDScope arg_scope, bool arg_is_export)
|
|||
scope = arg_scope;
|
||||
is_export = arg_is_export;
|
||||
is_option = false;
|
||||
is_blank = name && extract_var_name(name) == "_";
|
||||
is_const = false;
|
||||
is_enum_const = false;
|
||||
is_type = false;
|
||||
offset = 0;
|
||||
|
||||
if ( is_blank )
|
||||
SetType(base_type(TYPE_ANY));
|
||||
|
||||
opt_info = new IDOptInfo(this);
|
||||
|
||||
infer_return_type = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue