浏览代码

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;
                 }