Table defaults capture closures.

This commit is contained in:
Zeke Medley 2019-06-27 14:38:38 -07:00
parent d7a73c270d
commit 28253b24f9
13 changed files with 459 additions and 364 deletions

View file

@ -328,10 +328,7 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
Frame* f = new Frame(frame_size, this, args);
if ( closure )
{
assert(outer_ids);
f = new ClosureFrame(this->closure, f, this->outer_ids);
}
// Hand down any trigger.
if ( parent )
@ -485,7 +482,6 @@ void BroFunc::AddBody(Stmt* new_body, id_list* new_inits, int new_frame_size,
void BroFunc::AddClosure(std::shared_ptr<id_list> ids, Frame* f)
{
// Order matters here.
this->SetOuterIDs(ids);
this->SetClosureFrame(f);
}
@ -515,11 +511,8 @@ Func* BroFunc::DoClone()
other->frame_size = frame_size;
if (closure)
{
other->closure = closure->Clone();
other->outer_ids = outer_ids;
}
other->closure = closure->Clone();
other->outer_ids = outer_ids;
return other;
}