mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Expr: check_and_promote_expr() returns IntrusivePtr
Instead of returning a pseudo-boolean integer, it now returns a referenced object or nullptr on error. The old API was very error prone because of its obscure reference counting semantics.
This commit is contained in:
parent
78e736621c
commit
097a362c80
4 changed files with 56 additions and 46 deletions
|
@ -925,7 +925,13 @@ IntrusivePtr<Expr> get_assign_expr(IntrusivePtr<Expr> op1,
|
|||
// types or a single type.
|
||||
//
|
||||
// Note, the type is not "const" because it can be ref'd.
|
||||
extern int check_and_promote_expr(Expr*& e, BroType* t);
|
||||
|
||||
/**
|
||||
* Returns nullptr if the expression cannot match or a promoted
|
||||
* expression.
|
||||
*/
|
||||
extern IntrusivePtr<Expr> check_and_promote_expr(Expr* e, BroType* t);
|
||||
|
||||
extern int check_and_promote_exprs(ListExpr* elements, TypeList* types);
|
||||
extern int check_and_promote_args(ListExpr* args, RecordType* types);
|
||||
extern int check_and_promote_exprs_to_type(ListExpr* elements, BroType* type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue