Created
February 8, 2017 05:50
-
-
Save paulosuzart/320c2f10903020dcf9b1995eeaddd2cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private: | |
StackContextEntry* getFromContext(StackElements element) { | |
// as we emplace back in the stack, we should find from back to front | |
for (auto it = m_stack.rbegin(); it != m_stack.rend(); it++) { | |
if ((*it).elementType == element) { | |
return &(*it); | |
} | |
} | |
return NULL; | |
} | |
void addToStack(StackElements element, const ast::Node& value) { | |
m_stack.emplace_back(StackContextEntry { element, &value } ); | |
} | |
void popContext() { | |
m_stack.pop_back(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment