Преглед изворни кода

HackStudio: Use Node's name when inserting to the ClassView tree

Previously, when traversing the ClassView tree to find the parent of a
new node, we used the name of the node's declaration to find the path
to the parent in the tree.

However, some nodes in the tree do not have a matching declaration,
which caused a VERIFY failure.

To fix this, we now use the node's name when walking the tree.
We can do this because the node's name should be identical to the name
of its declaration.

Closes #7702.
Itamar пре 4 година
родитељ
комит
c1b2003687
1 измењених фајлова са 1 додато и 2 уклоњено
  1. 1 2
      Userland/DevTools/HackStudio/ClassViewWidget.cpp

+ 1 - 2
Userland/DevTools/HackStudio/ClassViewWidget.cpp

@@ -147,8 +147,7 @@ void ClassViewModel::add_declaration(const GUI::AutocompleteProvider::Declaratio
             auto& scope = scope_parts[i];
             ClassViewNode* next { nullptr };
             for (auto& child : parent->children) {
-                VERIFY(child.declaration);
-                if (child.declaration->name == scope) {
+                if (child.name == scope) {
                     next = &child;
                     break;
                 }