File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 2525#include < cstdint>
2626#include < functional>
2727#include < list>
28- #include < stack>
2928#include < string>
3029#include < type_traits>
3130#include < utility>
@@ -64,29 +63,29 @@ void visitAstNodes(T *ast, const TFunc &visitor)
6463
6564 // the size of 8 was determined in tests to be sufficient to avoid excess allocations. also add 1 as a buffer.
6665 // we might need to increase that value in the future.
67- std::stack<T *, SmallVector<T *, 8 + 1 > > tokens;
66+ SmallVector<T *, 8 + 1 > tokens;
6867 T *tok = ast;
6968 do {
7069 const ChildrenToVisit c = visitor (tok);
71-
7270 if (c == ChildrenToVisit::done)
7371 break ;
72+
7473 if (c == ChildrenToVisit::op2 || c == ChildrenToVisit::op1_and_op2) {
7574 T *t2 = tok->astOperand2 ();
7675 if (t2)
77- tokens.push (t2);
76+ tokens.push_back (t2);
7877 }
7978 if (c == ChildrenToVisit::op1 || c == ChildrenToVisit::op1_and_op2) {
8079 T *t1 = tok->astOperand1 ();
8180 if (t1)
82- tokens.push (t1);
81+ tokens.push_back (t1);
8382 }
8483
8584 if (tokens.empty ())
8685 break ;
8786
88- tok = tokens.top ();
89- tokens.pop ();
87+ tok = tokens.back ();
88+ tokens.pop_back ();
9089 } while (true );
9190}
9291
You can’t perform that action at this time.
0 commit comments