mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge branch 't/gh-4448' of https://github.com/AmazingPP/zeek
* 't/gh-4448' of https://github.com/AmazingPP/zeek: Fix `&ordered` attribute not preserved in table initializer assignments
This commit is contained in:
commit
2468fe2355
7 changed files with 63 additions and 2 deletions
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
|||
8.0.0-dev.382 | 2025-06-06 17:33:39 +0200
|
||||
|
||||
* Fix `&ordered` attribute not preserved in table initializer assignments (赵富鹏)
|
||||
|
||||
8.0.0-dev.380 | 2025-06-06 10:26:17 +0200
|
||||
|
||||
* docker: Add `net-tools` and `procps` dependencies (Edoardo Mich)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
8.0.0-dev.380
|
||||
8.0.0-dev.382
|
||||
|
|
|
@ -142,7 +142,7 @@ static ExprPtr initialize_var(const IDPtr& id, InitClass c, ExprPtr init) {
|
|||
ExprPtr assignment;
|
||||
|
||||
if ( c == INIT_FULL )
|
||||
assignment = make_intrusive<AssignExpr>(lhs, init, false);
|
||||
assignment = make_intrusive<AssignExpr>(lhs, init, false, nullptr, id->GetAttrs());
|
||||
else if ( c == INIT_EXTRA )
|
||||
assignment = make_intrusive<AddToExpr>(lhs, init);
|
||||
else if ( c == INIT_REMOVE )
|
||||
|
|
|
@ -23,3 +23,21 @@ copy(ordered_sset)
|
|||
3
|
||||
4
|
||||
5
|
||||
ordered_sset2
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
copy(ordered_sset2)
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
tbl
|
||||
2
|
||||
1
|
||||
3
|
||||
tbl2
|
||||
1
|
||||
2
|
||||
3
|
||||
tbl3
|
||||
4
|
||||
5
|
||||
6
|
||||
1
|
||||
2
|
||||
3
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
|
||||
global sset: set[string];
|
||||
global ordered_sset: set[string] &ordered;
|
||||
global ordered_sset2: set[string] = {
|
||||
"foo",
|
||||
"bar",
|
||||
} &ordered &redef;
|
||||
|
||||
redef ordered_sset2 += { "baz" };
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
|
@ -12,6 +18,7 @@ event zeek_init()
|
|||
{
|
||||
add sset[cat(i)];
|
||||
add ordered_sset[cat(i)];
|
||||
add ordered_sset2[cat(i)];
|
||||
}
|
||||
|
||||
print "sset";
|
||||
|
@ -29,4 +36,12 @@ event zeek_init()
|
|||
print "copy(ordered_sset)";
|
||||
for ( s in copy(ordered_sset) )
|
||||
print s;
|
||||
|
||||
print "ordered_sset2";
|
||||
for ( s in ordered_sset2 )
|
||||
print s;
|
||||
|
||||
print "copy(ordered_sset2)";
|
||||
for ( s in copy(ordered_sset2) )
|
||||
print s;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
|
||||
global tbl: table[count] of count;
|
||||
global tbl2: table[count] of count &ordered;
|
||||
global tbl3: table[count] of count = {
|
||||
[4] = 4,
|
||||
[5] = 5,
|
||||
} &ordered &redef;
|
||||
|
||||
redef tbl3 += { [6] = 6 };
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
|
@ -13,15 +19,24 @@ event zeek_init()
|
|||
++i;
|
||||
tbl[i] = i;
|
||||
tbl2[i] = i;
|
||||
tbl3[i] = i;
|
||||
}
|
||||
|
||||
print "tbl";
|
||||
for ( [k], v in tbl )
|
||||
{
|
||||
print(v);
|
||||
}
|
||||
|
||||
print "tbl2";
|
||||
for ( [k], v in tbl2 )
|
||||
{
|
||||
print(v);
|
||||
}
|
||||
|
||||
print "tbl3";
|
||||
for ( [k], v in tbl3 )
|
||||
{
|
||||
print(v);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue