mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
Merge remote-tracking branch 'origin/topic/zeke/gh-1890'
* origin/topic/zeke/gh-1890: Consistently warn about mixing vector and scalar operand depreciaton
This commit is contained in:
commit
5b1691f162
4 changed files with 90 additions and 3 deletions
19
src/Expr.h
19
src/Expr.h
|
@ -622,6 +622,14 @@ protected:
|
|||
|
||||
void ExprDescribe(ODesc* d) const override;
|
||||
|
||||
// Reports on if this BinaryExpr involves a scalar and aggregate
|
||||
// type (vec, list, table, record).
|
||||
bool IsScalarAggregateOp() const;
|
||||
|
||||
// Warns about depreciated scalar vector operations like `[1, 2,
|
||||
// 3] == 1` or `["a", "b", "c"] + "a"`.
|
||||
void CheckScalarAggOp() const;
|
||||
|
||||
ExprPtr op1;
|
||||
ExprPtr op2;
|
||||
};
|
||||
|
@ -1801,5 +1809,16 @@ inline bool is_vector(const ExprPtr& e)
|
|||
return is_vector(e.get());
|
||||
}
|
||||
|
||||
// True if the given Expr* has a list type
|
||||
inline bool is_list(Expr* e)
|
||||
{
|
||||
return e->GetType()->Tag() == TYPE_LIST;
|
||||
}
|
||||
|
||||
inline bool is_list(const ExprPtr& e)
|
||||
{
|
||||
return is_list(e.get());
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace zeek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue