1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-05 16:15:50 +03:00

chore(execplan): name PT walker function types

This commit is contained in:
drrtuy
2025-06-27 17:43:20 +00:00
parent 2776e193d1
commit cd857f60dd

View File

@@ -42,7 +42,15 @@ class Row;
namespace execplan namespace execplan
{ {
// class Operator;
using ParseTreeWalker = void (*)(ParseTree* n);
using ParseTreeConstWalker = void (*)(const ParseTree* n);
using ParseTreePrinter = void (*)(const ParseTree* n, std::ostream& output);
using ParseTreeWalkerWithContext = void (*)(ParseTree* n, void* obj);
using ParseTreeConstWalkerWithContext = void (*)(const ParseTree* n, void* obj);
// class ParseTree;
/** /**
* @brief A template class template to represent an expression tree * @brief A template class template to represent an expression tree
* *
@@ -133,31 +141,31 @@ class ParseTree
* *
* postfix walking of a const tree * postfix walking of a const tree
*/ */
inline void walk(void (*fn)(ParseTree* n)) const; inline void walk(ParseTreeWalker fn) const;
/** walk the tree /** walk the tree
* *
* postfix walking of a non-const tree. This is for deleting the tree * postfix walking of a non-const tree. This is for deleting the tree
*/ */
inline void walk(void (*fn)(const ParseTree* n)) const; inline void walk(ParseTreeConstWalker fn) const;
/** output the tree /** output the tree
* *
* take ostream argument to walk and output the tree * take ostream argument to walk and output the tree
*/ */
inline void walk(void (*fn)(const ParseTree* n, std::ostream& output), std::ostream& output) const; inline void walk(ParseTreePrinter fn, std::ostream& output) const;
/** output the tree /** output the tree
* *
* take user argument to walk and output the tree * take user argument to walk and output the tree
*/ */
inline void walk(void (*fn)(const ParseTree* n, void* obj), void* object) const; inline void walk(ParseTreeConstWalkerWithContext fn, void* object) const;
/** output the tree /** output the tree
* *
* take user argument to walk and output the tree * take user argument to walk and output the tree
*/ */
inline void walk(void (*fn)(ParseTree* n, void* obj), void* object) const; inline void walk(ParseTreeWalkerWithContext fn, void* object) const;
/** output the tree to string /** output the tree to string
* for debug purpose * for debug purpose
@@ -448,7 +456,7 @@ inline ParseTree::~ParseTree()
} }
} }
inline void ParseTree::walk(void (*fn)(ParseTree* n)) const inline void ParseTree::walk(ParseTreeWalker fn) const
{ {
DFSStack stack; DFSStack stack;
stack.emplace_back(const_cast<ParseTree*>(this)); stack.emplace_back(const_cast<ParseTree*>(this));
@@ -477,7 +485,7 @@ inline void ParseTree::walk(void (*fn)(ParseTree* n)) const
} }
} }
inline void ParseTree::walk(void (*fn)(const ParseTree* n)) const inline void ParseTree::walk(ParseTreeConstWalker fn) const
{ {
DFSStack stack; DFSStack stack;
stack.emplace_back(const_cast<ParseTree*>(this)); stack.emplace_back(const_cast<ParseTree*>(this));
@@ -506,7 +514,7 @@ inline void ParseTree::walk(void (*fn)(const ParseTree* n)) const
} }
} }
inline void ParseTree::walk(void (*fn)(const ParseTree* n, std::ostream& output), std::ostream& output) const inline void ParseTree::walk(ParseTreePrinter fn, std::ostream& output) const
{ {
DFSStack stack; DFSStack stack;
stack.emplace_back(const_cast<ParseTree*>(this)); stack.emplace_back(const_cast<ParseTree*>(this));
@@ -535,7 +543,7 @@ inline void ParseTree::walk(void (*fn)(const ParseTree* n, std::ostream& output)
} }
} }
inline void ParseTree::walk(void (*fn)(const ParseTree* n, void* obj), void* obj) const inline void ParseTree::walk(ParseTreeConstWalkerWithContext fn, void* obj) const
{ {
DFSStack stack; DFSStack stack;
stack.emplace_back(const_cast<ParseTree*>(this)); stack.emplace_back(const_cast<ParseTree*>(this));
@@ -571,7 +579,7 @@ inline std::string ParseTree::toString() const
return oss.str(); return oss.str();
} }
inline void ParseTree::walk(void (*fn)(ParseTree* n, void* obj), void* obj) const inline void ParseTree::walk(ParseTreeWalkerWithContext fn, void* obj) const
{ {
DFSStack stack; DFSStack stack;
stack.emplace_back(const_cast<ParseTree*>(this)); stack.emplace_back(const_cast<ParseTree*>(this));