Skip to content

Commit a102dfd

Browse files
committed
Record unnamed { } scopes in symbol/scope table
1 parent 9b05898 commit a102dfd

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

source/sema.h

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -903,29 +903,27 @@ class sema
903903

904904
auto start(compound_statement_node const& n, int) -> void
905905
{
906-
if (!active_selections.empty()) {
907-
assert (active_selections.back());
908-
if (active_selections.back()->true_branch.get() == &n) {
909-
symbols.emplace_back( scope_depth, compound_sym{ true, &n, true } );
906+
symbols.emplace_back(
907+
scope_depth,
908+
compound_sym{
909+
true,
910+
&n,
911+
!active_selections.empty() && active_selections.back()->true_branch.get() == &n
910912
}
911-
else if (active_selections.back()->false_branch.get() == &n) {
912-
symbols.emplace_back( scope_depth, compound_sym{ true, &n, false } );
913-
}
914-
}
913+
);
915914
++scope_depth;
916915
}
917916

918917
auto end(compound_statement_node const& n, int) -> void
919918
{
920-
if (!active_selections.empty()) {
921-
assert (active_selections.back());
922-
if (active_selections.back()->true_branch.get() == &n) {
923-
symbols.emplace_back( scope_depth, compound_sym{ false, &n, true } );
919+
symbols.emplace_back(
920+
scope_depth,
921+
compound_sym{
922+
false,
923+
&n,
924+
!active_selections.empty() && active_selections.back()->true_branch.get() == &n
924925
}
925-
else if (active_selections.back()->false_branch.get() == &n) {
926-
symbols.emplace_back( scope_depth, compound_sym{ false, &n, false } );
927-
}
928-
}
926+
);
929927
--scope_depth;
930928
}
931929

0 commit comments

Comments
 (0)