mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
Simplify some IntrusivePtr operations in Expr::Duplicate/Inline
This commit is contained in:
parent
70ff4ef678
commit
fa418cb179
1 changed files with 5 additions and 15 deletions
|
@ -320,27 +320,21 @@ ExprPtr ArithCoerceExpr::Duplicate()
|
||||||
ExprPtr RecordCoerceExpr::Duplicate()
|
ExprPtr RecordCoerceExpr::Duplicate()
|
||||||
{
|
{
|
||||||
auto op_dup = op->Duplicate();
|
auto op_dup = op->Duplicate();
|
||||||
auto rt = GetType()->AsRecordType();
|
return SetSucc(new RecordCoerceExpr(op_dup, GetType<RecordType>()));
|
||||||
RecordTypePtr rt_p = {NewRef{}, rt};
|
|
||||||
return SetSucc(new RecordCoerceExpr(op_dup, rt_p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ExprPtr TableCoerceExpr::Duplicate()
|
ExprPtr TableCoerceExpr::Duplicate()
|
||||||
{
|
{
|
||||||
auto op_dup = op->Duplicate();
|
auto op_dup = op->Duplicate();
|
||||||
auto tt = GetType()->AsTableType();
|
return SetSucc(new TableCoerceExpr(op_dup, GetType<TableType>()));
|
||||||
TableTypePtr tt_p = {NewRef{}, tt};
|
|
||||||
return SetSucc(new TableCoerceExpr(op_dup, tt_p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ExprPtr VectorCoerceExpr::Duplicate()
|
ExprPtr VectorCoerceExpr::Duplicate()
|
||||||
{
|
{
|
||||||
auto op_dup = op->Duplicate();
|
auto op_dup = op->Duplicate();
|
||||||
auto vt = GetType()->AsVectorType();
|
return SetSucc(new VectorCoerceExpr(op_dup, GetType<VectorType>()));
|
||||||
VectorTypePtr vt_p = {NewRef{}, vt};
|
|
||||||
return SetSucc(new VectorCoerceExpr(op_dup, vt_p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -387,9 +381,7 @@ ExprPtr CallExpr::Inline(Inliner* inl)
|
||||||
|
|
||||||
// We're not inlining, but perhaps our elements should be.
|
// We're not inlining, but perhaps our elements should be.
|
||||||
func = func->Inline(inl);
|
func = func->Inline(inl);
|
||||||
|
args = cast_intrusive<ListExpr>(args->Inline(inl));
|
||||||
auto new_args = args->Inline(inl);
|
|
||||||
args = {NewRef{}, new_args->AsListExpr()};
|
|
||||||
|
|
||||||
return ThisPtr();
|
return ThisPtr();
|
||||||
}
|
}
|
||||||
|
@ -417,9 +409,7 @@ ExprPtr EventExpr::Duplicate()
|
||||||
|
|
||||||
ExprPtr EventExpr::Inline(Inliner* inl)
|
ExprPtr EventExpr::Inline(Inliner* inl)
|
||||||
{
|
{
|
||||||
auto el = args->Inline(inl)->AsListExpr();
|
args = cast_intrusive<ListExpr>(args->Inline(inl));
|
||||||
args = {NewRef{}, el};
|
|
||||||
|
|
||||||
return ThisPtr();
|
return ThisPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue