Factor static-local nil IntrusivePtrs to global locations

Minor optimization to remove any run-time impact.
This commit is contained in:
Jon Siwek 2020-05-21 17:22:39 -07:00
parent a384bb8b81
commit ea878208ba
8 changed files with 21 additions and 23 deletions

View file

@ -14,7 +14,6 @@ typedef PList<Scope> scope_list;
static scope_list scopes;
static Scope* top_scope;
static IntrusivePtr<ID> nil_id;
Scope::Scope(IntrusivePtr<ID> id, attr_list* al)
: scope_id(std::move(id))
@ -64,7 +63,7 @@ const IntrusivePtr<ID>& Scope::Find(std::string_view name) const
if ( entry != local.end() )
return entry->second;
return nil_id;
return ID::nil;
}
IntrusivePtr<ID> Scope::Remove(std::string_view name)
@ -172,7 +171,7 @@ const IntrusivePtr<ID>& lookup_ID(const char* name, const char* curr_module,
return global_scope()->Find(globalname);
}
return nil_id;
return ID::nil;
}
IntrusivePtr<ID> install_ID(const char* name, const char* module_name,