fix: In variables resetting on evaluation
This commit is contained in:
parent
cc29707bb1
commit
8448c3367b
@ -403,10 +403,14 @@ namespace hex::plugin::builtin {
|
|||||||
if (this->m_hasUnevaluatedChanges && this->m_runningEvaluators == 0 && this->m_runningParsers == 0) {
|
if (this->m_hasUnevaluatedChanges && this->m_runningEvaluators == 0 && this->m_runningParsers == 0) {
|
||||||
this->m_hasUnevaluatedChanges = false;
|
this->m_hasUnevaluatedChanges = false;
|
||||||
|
|
||||||
|
|
||||||
|
std::thread([this, code = this->m_textEditor.GetText()]{
|
||||||
|
this->parsePattern(code);
|
||||||
|
|
||||||
if (this->m_runAutomatically)
|
if (this->m_runAutomatically)
|
||||||
this->evaluatePattern(this->m_textEditor.GetText());
|
this->evaluatePattern(code);
|
||||||
else
|
}).detach();
|
||||||
std::thread([this, code = this->m_textEditor.GetText()] { this->parsePattern(code); }).detach();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,8 +771,6 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewPatternEditor::parsePattern(const std::string &code) {
|
void ViewPatternEditor::parsePattern(const std::string &code) {
|
||||||
auto task = ImHexApi::Tasks::createTask("hex.builtin.view.pattern_editor.evaluating", 1);
|
|
||||||
|
|
||||||
this->m_runningParsers++;
|
this->m_runningParsers++;
|
||||||
|
|
||||||
auto ast = this->m_parserRuntime->parseString(code);
|
auto ast = this->m_parserRuntime->parseString(code);
|
||||||
@ -821,8 +823,6 @@ namespace hex::plugin::builtin {
|
|||||||
for (const auto &[id, name, value, type] : this->m_envVarEntries)
|
for (const auto &[id, name, value, type] : this->m_envVarEntries)
|
||||||
envVars.insert({ name, value });
|
envVars.insert({ name, value });
|
||||||
|
|
||||||
this->parsePattern(code);
|
|
||||||
|
|
||||||
std::map<std::string, pl::core::Token::Literal> inVariables;
|
std::map<std::string, pl::core::Token::Literal> inVariables;
|
||||||
for (auto &[name, variable] : this->m_patternVariables) {
|
for (auto &[name, variable] : this->m_patternVariables) {
|
||||||
if (variable.inVariable)
|
if (variable.inVariable)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user