MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / GetDescendants

Method GetDescendants

LuaParser/src/Ast/LuaSyntaxNode.cpp:94–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94std::vector<LuaSyntaxNode> LuaSyntaxNode::GetDescendants(const LuaSyntaxTree &t) const {
95 std::vector<LuaSyntaxNode> results;
96 if (t.GetFirstChild(_index) == 0) {
97 return results;
98 }
99
100 int accessIndex = -1;
101 LuaSyntaxNode node = *this;
102 do {
103 if (node.IsNode(t)) {
104 for (auto child = node.GetFirstChild(t); !child.IsNull(t); child.ToNext(t)) {
105 results.emplace_back(child);
106 }
107 }
108 accessIndex++;
109 } while (accessIndex < static_cast<int>(results.size()));
110 return results;
111}
112
113std::vector<LuaSyntaxNode> LuaSyntaxNode::GetChildren(const LuaSyntaxTree &t) const {
114 std::vector<LuaSyntaxNode> results;

Callers

nothing calls this directly

Calls 5

ToNextMethod · 0.80
GetFirstChildMethod · 0.45
IsNodeMethod · 0.45
IsNullMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected