mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
script optimization for record operations sourced (in part) from other records
This commit is contained in:
parent
eb5ea66012
commit
4b719ef45a
21 changed files with 953 additions and 50 deletions
13
src/Expr.cc
13
src/Expr.cc
|
@ -99,11 +99,14 @@ const char* expr_name(ExprTag t) {
|
|||
"vec+=",
|
||||
"[]=",
|
||||
"$=",
|
||||
"from_any_vec_coerce ",
|
||||
"$=$",
|
||||
"$+=$",
|
||||
"[=+$]",
|
||||
"from_any_vec_coerce",
|
||||
"any[]",
|
||||
"ZAM-builtin()",
|
||||
"nop",
|
||||
|
||||
"nop", // don't add after this, it's used to compute NUM_EXPRS
|
||||
};
|
||||
|
||||
if ( int(t) >= NUM_EXPRS ) {
|
||||
|
@ -2916,7 +2919,8 @@ RecordConstructorExpr::RecordConstructorExpr(ListExprPtr constructor_list)
|
|||
Error("bad type in record constructor", constructor_error_expr);
|
||||
}
|
||||
|
||||
RecordConstructorExpr::RecordConstructorExpr(RecordTypePtr known_rt, ListExprPtr constructor_list)
|
||||
RecordConstructorExpr::RecordConstructorExpr(RecordTypePtr known_rt, ListExprPtr constructor_list,
|
||||
bool check_mandatory_fields)
|
||||
: Expr(EXPR_RECORD_CONSTRUCTOR), op(std::move(constructor_list)) {
|
||||
if ( IsError() )
|
||||
return;
|
||||
|
@ -2957,6 +2961,9 @@ RecordConstructorExpr::RecordConstructorExpr(RecordTypePtr known_rt, ListExprPtr
|
|||
if ( IsError() )
|
||||
return;
|
||||
|
||||
if ( ! check_mandatory_fields )
|
||||
return;
|
||||
|
||||
auto n = known_rt->NumFields();
|
||||
for ( i = 0; i < n; ++i )
|
||||
if ( fields_seen.count(i) == 0 ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue