Skip to content

Instantly share code, notes, and snippets.

@paulosuzart
Created February 8, 2017 05:50
Show Gist options
  • Save paulosuzart/320c2f10903020dcf9b1995eeaddd2cd to your computer and use it in GitHub Desktop.
Save paulosuzart/320c2f10903020dcf9b1995eeaddd2cd to your computer and use it in GitHub Desktop.
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