Created
September 2, 2018 20:00
-
-
Save ghassanpl/c2e83cf4bc8dfea14420e6f1de1c2901 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void LookupTypeName(const AST::TypeName & tn, EntitySet & entity_list) | |
| { | |
| std::vector<TypePart> parts = ConvertToList(*this, tn); | |
| EntitySet possible_places; | |
| Entity* context = this; | |
| do | |
| { | |
| possible_places.insert(context); | |
| } | |
| while (context = context->ParentEntity); | |
| for (auto& part : parts) | |
| { | |
| EntitySet new_possible_places; | |
| for (auto& place : possible_places) | |
| { | |
| EntitySet named; | |
| place->GetChildEntities(part.Name, named); | |
| for (auto& name : named) | |
| { | |
| if (name->IsTemplated()) | |
| { | |
| auto templ = dynamic_cast<TemplateEntity*>(name); | |
| if (templ->CanInstantiateWith(part.TemplateArguments)) | |
| { | |
| auto instantiation = templ->CreateOrGetInstantiation(part.TemplateArguments); | |
| new_possible_places.insert(instantiation); | |
| } | |
| } | |
| else if (part.TemplateArguments.size() == 0 && !name->IsTemplated()) | |
| { | |
| new_possible_places.insert(name); | |
| } | |
| } | |
| } | |
| possible_places = std::move(new_possible_places); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment