mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Deprecate TableVal::Attrs(), replace with GetAttrs()
This commit is contained in:
parent
dc03f0bb83
commit
ad224419ad
3 changed files with 7 additions and 3 deletions
|
@ -3757,8 +3757,7 @@ IntrusivePtr<Val> TableCoerceExpr::Fold(Val* v) const
|
||||||
if ( tv->Size() > 0 )
|
if ( tv->Size() > 0 )
|
||||||
RuntimeErrorWithCallStack("coercion of non-empty table/set");
|
RuntimeErrorWithCallStack("coercion of non-empty table/set");
|
||||||
|
|
||||||
return make_intrusive<TableVal>(GetType<TableType>(),
|
return make_intrusive<TableVal>(GetType<TableType>(), tv->GetAttrs());
|
||||||
IntrusivePtr{NewRef{}, tv->Attrs()});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCoerceExpr::VectorCoerceExpr(IntrusivePtr<Expr> arg_op,
|
VectorCoerceExpr::VectorCoerceExpr(IntrusivePtr<Expr> arg_op,
|
||||||
|
|
|
@ -915,8 +915,13 @@ public:
|
||||||
|
|
||||||
void SetAttrs(IntrusivePtr<Attributes> attrs);
|
void SetAttrs(IntrusivePtr<Attributes> attrs);
|
||||||
Attr* FindAttr(attr_tag t) const;
|
Attr* FindAttr(attr_tag t) const;
|
||||||
|
|
||||||
|
[[deprecated("Remove in v4.1. Use GetAttrs().")]]
|
||||||
Attributes* Attrs() { return attrs.get(); }
|
Attributes* Attrs() { return attrs.get(); }
|
||||||
|
|
||||||
|
const IntrusivePtr<Attributes>& GetAttrs() const
|
||||||
|
{ return attrs; }
|
||||||
|
|
||||||
// Returns the size of the table.
|
// Returns the size of the table.
|
||||||
int Size() const;
|
int Size() const;
|
||||||
int RecursiveSize() const;
|
int RecursiveSize() const;
|
||||||
|
|
|
@ -104,7 +104,7 @@ function Option::set%(ID: string, val: any, location: string &default=""%): bool
|
||||||
// Just coerce an empty/unspecified table to the right type.
|
// Just coerce an empty/unspecified table to the right type.
|
||||||
auto tv = make_intrusive<TableVal>(
|
auto tv = make_intrusive<TableVal>(
|
||||||
cast_intrusive<TableType>(i->GetType()),
|
cast_intrusive<TableType>(i->GetType()),
|
||||||
IntrusivePtr{NewRef{}, i->GetVal()->AsTableVal()->Attrs()});
|
i->GetVal()->AsTableVal()->GetAttrs());
|
||||||
auto rval = call_option_handlers_and_set_value(ID, i, std::move(tv), location);
|
auto rval = call_option_handlers_and_set_value(ID, i, std::move(tv), location);
|
||||||
return val_mgr->Bool(rval);
|
return val_mgr->Bool(rval);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue