Change lookup_ID() to return a const-reference

This commit is contained in:
Jon Siwek 2020-05-12 22:41:52 -07:00
parent 8f95a2a0bb
commit 0af7f8141b
9 changed files with 32 additions and 28 deletions

View file

@ -117,9 +117,9 @@ TraversalCode Scope::Traverse(TraversalCallback* cb) const
}
IntrusivePtr<ID> lookup_ID(const char* name, const char* curr_module,
bool no_global, bool same_module_only,
bool check_export)
const IntrusivePtr<ID>& lookup_ID(const char* name, const char* curr_module,
bool no_global, bool same_module_only,
bool check_export)
{
std::string fullname = make_full_var_name(curr_module, name);
@ -148,7 +148,8 @@ IntrusivePtr<ID> lookup_ID(const char* name, const char* curr_module,
return global_scope()->Find(globalname);
}
return nullptr;
static IntrusivePtr<ID> nil;
return nil;
}
IntrusivePtr<ID> install_ID(const char* name, const char* module_name,