mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Add is_assignable() overload taking TypeTag
This commit is contained in:
parent
457c08f531
commit
863f02744e
3 changed files with 6 additions and 4 deletions
|
@ -1984,7 +1984,7 @@ RefExpr::RefExpr(IntrusivePtr<Expr> arg_op)
|
||||||
if ( IsError() )
|
if ( IsError() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! ::is_assignable(op->GetType().get()) )
|
if ( ! ::is_assignable(op->GetType()->Tag()) )
|
||||||
ExprError("illegal assignment target");
|
ExprError("illegal assignment target");
|
||||||
else
|
else
|
||||||
SetType(op->GetType());
|
SetType(op->GetType());
|
||||||
|
|
|
@ -1644,9 +1644,9 @@ BroType* flatten_type(BroType* t)
|
||||||
return (BroType*) flatten_type((const BroType*) t);
|
return (BroType*) flatten_type((const BroType*) t);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_assignable(BroType* t)
|
bool is_assignable(TypeTag t)
|
||||||
{
|
{
|
||||||
switch ( t->Tag() ) {
|
switch ( t ) {
|
||||||
case TYPE_BOOL:
|
case TYPE_BOOL:
|
||||||
case TYPE_INT:
|
case TYPE_INT:
|
||||||
case TYPE_COUNT:
|
case TYPE_COUNT:
|
||||||
|
|
|
@ -867,7 +867,9 @@ inline bool is_atomic_type(const IntrusivePtr<BroType>& t)
|
||||||
{ return is_atomic_type(*t); }
|
{ return is_atomic_type(*t); }
|
||||||
|
|
||||||
// True if the given type tag corresponds to type that can be assigned to.
|
// True if the given type tag corresponds to type that can be assigned to.
|
||||||
extern bool is_assignable(BroType* t);
|
extern bool is_assignable(TypeTag t);
|
||||||
|
inline bool is_assignable(BroType* t)
|
||||||
|
{ return ::is_assignable(t->Tag()); }
|
||||||
|
|
||||||
// True if the given type tag corresponds to an integral type.
|
// True if the given type tag corresponds to an integral type.
|
||||||
inline bool IsIntegral(TypeTag t) { return (t == TYPE_INT || t == TYPE_COUNT || t == TYPE_COUNTER); }
|
inline bool IsIntegral(TypeTag t) { return (t == TYPE_INT || t == TYPE_COUNT || t == TYPE_COUNTER); }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue