mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
bug fix for empty table constructors with &default attributes (plus a typo)
This commit is contained in:
parent
aa8f11fa17
commit
18fe9d84f6
2 changed files with 9 additions and 1 deletions
|
@ -2407,6 +2407,14 @@ void TableVal::InitDefaultFunc(detail::Frame* f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto& ytype = GetType()->Yield();
|
const auto& ytype = GetType()->Yield();
|
||||||
|
|
||||||
|
if ( ! ytype )
|
||||||
|
// This happens for empty table() constructors. Don't
|
||||||
|
// instantiate a default value at this point, as we'll
|
||||||
|
// first need to type-check the attribute when the value
|
||||||
|
// is finally used.
|
||||||
|
return;
|
||||||
|
|
||||||
const auto& dtype = def_attr->GetExpr()->GetType();
|
const auto& dtype = def_attr->GetExpr()->GetType();
|
||||||
|
|
||||||
if ( dtype->Tag() == TYPE_RECORD && ytype->Tag() == TYPE_RECORD && ! same_type(dtype, ytype) &&
|
if ( dtype->Tag() == TYPE_RECORD && ytype->Tag() == TYPE_RECORD && ! same_type(dtype, ytype) &&
|
||||||
|
|
|
@ -935,7 +935,7 @@ public:
|
||||||
void InitTimer(double delay);
|
void InitTimer(double delay);
|
||||||
void DoExpire(double t);
|
void DoExpire(double t);
|
||||||
|
|
||||||
// If the &default attribute is not a function, or the functon has
|
// If the &default attribute is not a function, or the function has
|
||||||
// already been initialized, this does nothing. Otherwise, evaluates
|
// already been initialized, this does nothing. Otherwise, evaluates
|
||||||
// the function in the frame allowing it to capture its closure.
|
// the function in the frame allowing it to capture its closure.
|
||||||
void InitDefaultFunc(detail::Frame* f);
|
void InitDefaultFunc(detail::Frame* f);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue