aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/pseudo/lib/Forest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/pseudo/lib/Forest.cpp')
-rw-r--r--clang-tools-extra/pseudo/lib/Forest.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/clang-tools-extra/pseudo/lib/Forest.cpp b/clang-tools-extra/pseudo/lib/Forest.cpp
index 6948422..073a651 100644
--- a/clang-tools-extra/pseudo/lib/Forest.cpp
+++ b/clang-tools-extra/pseudo/lib/Forest.cpp
@@ -74,16 +74,13 @@ std::string ForestNode::dumpRecursive(const Grammar &G,
} else if (P->kind() == Sequence) {
Children = P->elements();
if (Abbreviated) {
- if (P->startTokenIndex() == End)
- return;
- for (size_t I = 0; I < Children.size(); ++I)
- if (Children[I]->startTokenIndex() == P->startTokenIndex() &&
- EndOfElement(I) == End) {
- return Dump(
- Children[I], End,
- /*ElidedParent=*/ElidedParent.getValueOr(P->symbol()),
- LineDec);
- }
+ if (Children.size() == 1) {
+ assert(Children[0]->startTokenIndex() == P->startTokenIndex() &&
+ EndOfElement(0) == End);
+ return Dump(Children[0], End,
+ /*ElidedParent=*/ElidedParent.getValueOr(P->symbol()),
+ LineDec);
+ }
}
}