mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Deprecate Scope::ScopeID(), replace with GetID()
This commit is contained in:
parent
8b6de5852c
commit
b0c95e30d0
3 changed files with 9 additions and 5 deletions
|
@ -881,7 +881,7 @@ function_ingredients::function_ingredients(IntrusivePtr<Scope> scope, IntrusiveP
|
||||||
inits = scope->GetInits();
|
inits = scope->GetInits();
|
||||||
|
|
||||||
this->scope = std::move(scope);
|
this->scope = std::move(scope);
|
||||||
id = {NewRef{}, this->scope->ScopeID()};
|
id = this->scope->GetID();
|
||||||
|
|
||||||
const auto& attrs = this->scope->Attrs();
|
const auto& attrs = this->scope->Attrs();
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,12 @@ public:
|
||||||
|
|
||||||
IntrusivePtr<ID> Remove(std::string_view name);
|
IntrusivePtr<ID> Remove(std::string_view name);
|
||||||
|
|
||||||
|
[[deprecated("Remove in v4.1. Use GetID().")]]
|
||||||
ID* ScopeID() const { return scope_id.get(); }
|
ID* ScopeID() const { return scope_id.get(); }
|
||||||
|
|
||||||
|
const IntrusivePtr<ID>& GetID() const
|
||||||
|
{ return scope_id; }
|
||||||
|
|
||||||
const std::unique_ptr<std::vector<IntrusivePtr<Attr>>>& Attrs() const
|
const std::unique_ptr<std::vector<IntrusivePtr<Attr>>>& Attrs() const
|
||||||
{ return attrs; }
|
{ return attrs; }
|
||||||
|
|
||||||
|
|
|
@ -1414,21 +1414,21 @@ ReturnStmt::ReturnStmt(IntrusivePtr<Expr> arg_e)
|
||||||
{
|
{
|
||||||
Scope* s = current_scope();
|
Scope* s = current_scope();
|
||||||
|
|
||||||
if ( ! s || ! s->ScopeID() )
|
if ( ! s || ! s->GetID() )
|
||||||
{
|
{
|
||||||
Error("return statement outside of function/event");
|
Error("return statement outside of function/event");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FuncType* ft = s->ScopeID()->GetType()->AsFuncType();
|
FuncType* ft = s->GetID()->GetType()->AsFuncType();
|
||||||
const auto& yt = ft->Yield();
|
const auto& yt = ft->Yield();
|
||||||
|
|
||||||
if ( s->ScopeID()->DoInferReturnType() )
|
if ( s->GetID()->DoInferReturnType() )
|
||||||
{
|
{
|
||||||
if ( e )
|
if ( e )
|
||||||
{
|
{
|
||||||
ft->SetYieldType(e->GetType());
|
ft->SetYieldType(e->GetType());
|
||||||
s->ScopeID()->SetInferReturnType(false);
|
s->GetID()->SetInferReturnType(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue