mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
streamlining of constructing script-level tables
This commit is contained in:
parent
d1d9b9a1be
commit
a11ee9038b
4 changed files with 52 additions and 27 deletions
11
src/Type.cc
11
src/Type.cc
|
@ -10,6 +10,7 @@
|
|||
#include <unordered_set>
|
||||
|
||||
#include "zeek/Attr.h"
|
||||
#include "zeek/CompHash.h"
|
||||
#include "zeek/Desc.h"
|
||||
#include "zeek/Expr.h"
|
||||
#include "zeek/Reporter.h"
|
||||
|
@ -478,8 +479,13 @@ TableType::TableType(TypeListPtr ind, TypePtr yield) : IndexType(TYPE_TABLE, std
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Tag() != TYPE_ERROR )
|
||||
RegenerateHash();
|
||||
}
|
||||
|
||||
TableType::~TableType() { delete table_hash; }
|
||||
|
||||
bool TableType::CheckExpireFuncCompatibility(const detail::AttrPtr& attr) {
|
||||
if ( reported_error )
|
||||
return false;
|
||||
|
@ -493,6 +499,11 @@ bool TableType::CheckExpireFuncCompatibility(const detail::AttrPtr& attr) {
|
|||
|
||||
TypePtr TableType::ShallowClone() { return make_intrusive<TableType>(indices, yield_type); }
|
||||
|
||||
void TableType::RegenerateHash() {
|
||||
delete table_hash;
|
||||
table_hash = new detail::CompositeHash(GetIndices());
|
||||
}
|
||||
|
||||
bool TableType::IsUnspecifiedTable() const {
|
||||
// Unspecified types have an empty list of indices.
|
||||
return indices->GetTypes().empty();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue