mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 07:08:19 +00:00
Add version of Frame::SetElement() taking IntrusivePtr<ID>
Expect the version using raw ID* could go away eventually, but this is convenience for the meantime.
This commit is contained in:
parent
2cee468eac
commit
0d19e8fb4c
3 changed files with 5 additions and 3 deletions
|
@ -273,7 +273,7 @@ void NameExpr::Assign(Frame* f, IntrusivePtr<Val> v)
|
||||||
if ( id->IsGlobal() )
|
if ( id->IsGlobal() )
|
||||||
id->SetVal(std::move(v));
|
id->SetVal(std::move(v));
|
||||||
else
|
else
|
||||||
f->SetElement(id.get(), std::move(v));
|
f->SetElement(id, std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NameExpr::IsPure() const
|
bool NameExpr::IsPure() const
|
||||||
|
|
|
@ -66,6 +66,8 @@ public:
|
||||||
* @param v the value to associate it with
|
* @param v the value to associate it with
|
||||||
*/
|
*/
|
||||||
void SetElement(const ID* id, IntrusivePtr<Val> v);
|
void SetElement(const ID* id, IntrusivePtr<Val> v);
|
||||||
|
void SetElement(const IntrusivePtr<ID>& id, IntrusivePtr<Val> v)
|
||||||
|
{ SetElement(id.get(), std::move(v)); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value associated with *id* and returns it. Returns
|
* Gets the value associated with *id* and returns it. Returns
|
||||||
|
|
|
@ -1191,7 +1191,7 @@ IntrusivePtr<Val> ForStmt::DoExec(Frame* f, Val* v, stmt_flow_type& flow) const
|
||||||
delete k;
|
delete k;
|
||||||
|
|
||||||
if ( value_var )
|
if ( value_var )
|
||||||
f->SetElement(value_var.get(), current_tev->GetVal());
|
f->SetElement(value_var, current_tev->GetVal());
|
||||||
|
|
||||||
for ( int i = 0; i < ind_lv->Length(); i++ )
|
for ( int i = 0; i < ind_lv->Length(); i++ )
|
||||||
f->SetElement((*loop_vars)[i], ind_lv->Idx(i));
|
f->SetElement((*loop_vars)[i], ind_lv->Idx(i));
|
||||||
|
@ -1663,7 +1663,7 @@ IntrusivePtr<Val> InitStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
f->SetElement(aggr.get(), std::move(v));
|
f->SetElement(aggr, std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue