1
0
mirror of synced 2024-11-28 09:30:51 +01:00

patterns: Make global scope available for use in custom types

This commit is contained in:
WerWolv 2021-10-11 22:01:15 +02:00
parent aac1a37a3f
commit b12cd66679
2 changed files with 15 additions and 2 deletions

View File

@ -1501,10 +1501,19 @@ namespace hex::pl {
}
[[nodiscard]] std::vector<PatternData*> createPatterns(Evaluator *evaluator) const override {
std::vector<PatternData*> searchScope;
PatternData *currPattern = nullptr;
s32 scopeIndex = 0;
auto searchScope = *evaluator->getScope(scopeIndex).scope;
PatternData *currPattern = nullptr;
if (!evaluator->isGlobalScope()){
auto globalScope = evaluator->getGlobalScope().scope;
std::copy(globalScope->begin(), globalScope->end(), std::back_inserter(searchScope));
}
{
auto currScope = evaluator->getScope(scopeIndex).scope;
std::copy(currScope->begin(), currScope->end(), std::back_inserter(searchScope));
}
for (const auto &part : this->getPath()) {

View File

@ -55,6 +55,10 @@ namespace hex::pl {
return this->m_scopes.front();
}
bool isGlobalScope() {
return this->m_scopes.size() == 1;
}
void setProvider(prv::Provider *provider) {
this->m_provider = provider;
}