mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Two small infrastructure extensions for passing information into the
logging framework. - To enable passing a type into a bif, there's now a new BroType-derived class TypeType and a corresponding TYPE_TYPE tag. With that, a Val can now have a type as its value. This is experimental for now. - RecordVal's get a new method CoerceTo() to coerce their value into a another record type with the usual semantics. Most of the code in there was previously in RecordContructorExpr::InitVal(), which is now calling the new CoerceTo() method.
This commit is contained in:
parent
ffa494e428
commit
9d407d882c
5 changed files with 119 additions and 40 deletions
|
@ -95,6 +95,7 @@ BroType::BroType(TypeTag t, bool arg_base_type)
|
|||
case TYPE_FUNC:
|
||||
case TYPE_FILE:
|
||||
case TYPE_VECTOR:
|
||||
case TYPE_TYPE:
|
||||
internal_tag = TYPE_INTERNAL_OTHER;
|
||||
break;
|
||||
|
||||
|
@ -1426,6 +1427,9 @@ int same_type(const BroType* t1, const BroType* t2, int is_init)
|
|||
case TYPE_FILE:
|
||||
return same_type(t1->YieldType(), t2->YieldType(), is_init);
|
||||
|
||||
case TYPE_TYPE:
|
||||
return same_type(t1, t2, is_init);
|
||||
|
||||
case TYPE_UNION:
|
||||
error("union type in same_type()");
|
||||
}
|
||||
|
@ -1514,6 +1518,7 @@ int is_assignable(BroType* t)
|
|||
case TYPE_VECTOR:
|
||||
case TYPE_FILE:
|
||||
case TYPE_TABLE:
|
||||
case TYPE_TYPE:
|
||||
return 1;
|
||||
|
||||
case TYPE_VOID:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue