Make ClosureFrame safe & cleanup

TODO: make anonymous-funcs associated with tables capture closures,
implement copy constructor for Frame, & other cleanup.
This commit is contained in:
Zeke Medley 2019-06-26 15:05:57 -07:00
parent 670816ad48
commit 8ed18ca194
10 changed files with 150 additions and 149 deletions

View file

@ -943,7 +943,7 @@ public:
protected:
friend class Expr;
CallExpr() { func = 0; args = 0; }
CallExpr() { func = 0; args = 0; }
void ExprDescribe(ODesc* d) const override;
@ -951,16 +951,16 @@ protected:
ListExpr* args;
};
/*
Class to handle the creation of anonymous functions with closures.
Facts:
- LambdaExpr creates a new BroFunc on every call to Eval.
- LambdaExpr must be given all the information to create a BroFunc on
construction except for the closure.
- The closure for created BroFuncs is the frame that the LambdaExpr is
evaluated in.
*/
// Class to handle the creation of anonymous functions with closures.
// Facts:
// - LambdaExpr creates a new BroFunc on every call to Eval.
// - LambdaExpr must be given all the information to create a BroFunc on
// construction except for the closure.
// - The closure for created BroFuncs is the frame that the LambdaExpr is
// evaluated in.
class LambdaExpr : public Expr {
public:
LambdaExpr(std::unique_ptr<function_ingredients> ingredients,