mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fixes for double-delete and reducing '?' operator with constant alternatives
This commit is contained in:
parent
77f6a658e6
commit
06ffd97749
1 changed files with 3 additions and 1 deletions
|
@ -1407,6 +1407,8 @@ ExprPtr CondExpr::Reduce(Reducer* c, StmtPtr& red_stmt)
|
||||||
auto op2_t = op2->IsOne();
|
auto op2_t = op2->IsOne();
|
||||||
ASSERT(op2_t != op3->IsOne());
|
ASSERT(op2_t != op3->IsOne());
|
||||||
|
|
||||||
|
red_stmt = MergeStmts(op1_red_stmt, red_stmt);
|
||||||
|
|
||||||
if ( op2_t )
|
if ( op2_t )
|
||||||
// This is "var ? T : F", which can be replaced by var.
|
// This is "var ? T : F", which can be replaced by var.
|
||||||
return op1;
|
return op1;
|
||||||
|
@ -1821,7 +1823,7 @@ ExprPtr FieldExpr::Duplicate()
|
||||||
|
|
||||||
ExprPtr HasFieldExpr::Duplicate()
|
ExprPtr HasFieldExpr::Duplicate()
|
||||||
{
|
{
|
||||||
return SetSucc(new HasFieldExpr(op->Duplicate(), field_name));
|
return SetSucc(new HasFieldExpr(op->Duplicate(), util::copy_string(field_name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExprPtr RecordConstructorExpr::Duplicate()
|
ExprPtr RecordConstructorExpr::Duplicate()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue