mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
employ explicit conversions to/from "any" and "vector of any" types
This commit is contained in:
parent
292bd1b671
commit
8044926e00
3 changed files with 85 additions and 14 deletions
16
src/Expr.h
16
src/Expr.h
|
@ -72,7 +72,7 @@ enum BroExprTag : int {
|
|||
// ASTs produced by parsing .zeek script files.
|
||||
EXPR_INDEX_ASSIGN, EXPR_FIELD_LHS_ASSIGN,
|
||||
EXPR_APPEND_TO,
|
||||
EXPR_TO_ANY_COERCE, EXPR_FROM_ANY_COERCE,
|
||||
EXPR_TO_ANY_COERCE, EXPR_FROM_ANY_COERCE, EXPR_FROM_ANY_VEC_COERCE,
|
||||
EXPR_ANY_INDEX,
|
||||
|
||||
EXPR_NOP,
|
||||
|
@ -1622,6 +1622,20 @@ protected:
|
|||
ExprPtr Duplicate() override;
|
||||
};
|
||||
|
||||
// ... and for conversion from a "vector of any" type.
|
||||
class CoerceFromAnyVecExpr : public UnaryExpr {
|
||||
public:
|
||||
// to_type is yield type, not VectorType.
|
||||
CoerceFromAnyVecExpr(ExprPtr op, TypePtr to_type);
|
||||
|
||||
// Can't use UnaryExpr's Eval() because it will do folding
|
||||
// over the individual vector elements.
|
||||
ValPtr Eval(Frame* f) const override;
|
||||
|
||||
protected:
|
||||
ExprPtr Duplicate() override;
|
||||
};
|
||||
|
||||
// Expression used to explicitly capture [a, b, c, ...] = x assignments.
|
||||
class AnyIndexExpr : public UnaryExpr {
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue