Skip to content

Commit

Permalink
fix: Sort variables in the macro tracer
Browse files Browse the repository at this point in the history
  • Loading branch information
slavek-kucera authored Dec 19, 2022
1 parent ca544f1 commit 94b3acd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions clients/vscode-hlasmplugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Missing references and hover text in model statements
- Do not display messages related to Bridge for Git configuration unless it is actively utilized
- Sequence symbol location is incorrect when discovered in the lookahead mode
- Sort variables in the macro tracer

#### Changed
- Macro label is the preferred go to definition target unless the request is made from the label itself
Expand Down
6 changes: 6 additions & 0 deletions parser_library/src/debugging/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,13 @@ class debugger::impl final : public processing::statement_analyzer
if (const auto* sym = std::get_if<context::symbol>(&it.second))
ordinary_symbols.push_back(std::make_unique<ordinary_symbol_variable>(*sym));

constexpr auto compare_variables = [](const variable_ptr& l, const variable_ptr& r) {
return l->get_name() < r->get_name();
};

std::sort(globals.begin(), globals.end(), compare_variables);
std::sort(scope_vars.begin(), scope_vars.end(), compare_variables);
std::sort(ordinary_symbols.begin(), ordinary_symbols.end(), compare_variables);

scopes_.emplace_back("Globals", add_variable(std::move(globals)), source(opencode_source_uri_));
scopes_.emplace_back("Locals", add_variable(std::move(scope_vars)), source(opencode_source_uri_));
Expand Down
6 changes: 3 additions & 3 deletions parser_library/src/debugging/ordinary_symbol_variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ bool ordinary_symbol_variable::is_scalar() const
std::vector<variable_ptr> ordinary_symbol_variable::values() const
{
std::vector<std::unique_ptr<variable>> vars;
if (symbol_.attributes().is_defined(context::data_attr_kind::L))
vars.emplace_back(std::make_unique<attribute_variable>(
"L", std::to_string(symbol_.attributes().get_attribute_value(context::data_attr_kind::L))));
if (symbol_.attributes().is_defined(context::data_attr_kind::I))
vars.emplace_back(std::make_unique<attribute_variable>(
"I", std::to_string(symbol_.attributes().get_attribute_value(context::data_attr_kind::I))));
if (symbol_.attributes().is_defined(context::data_attr_kind::L))
vars.emplace_back(std::make_unique<attribute_variable>(
"L", std::to_string(symbol_.attributes().get_attribute_value(context::data_attr_kind::L))));
if (symbol_.attributes().is_defined(context::data_attr_kind::S))
vars.emplace_back(std::make_unique<attribute_variable>(
"S", std::to_string(symbol_.attributes().get_attribute_value(context::data_attr_kind::S))));
Expand Down

0 comments on commit 94b3acd

Please sign in to comment.