#include "scope.h" #include "storage.h" void FlowGraph::LocalScope::push_back(std::shared_ptr data) { m_variables.push_back(data); } void FlowGraph::LocalScope::append(const FlowGraph::LocalScope& other) { m_variables.insert(m_variables.end(), other.m_variables.begin(), other.m_variables.end()); } index_t FlowGraph::LocalScope::indexOfStorage(const TemporaryStorage& storage) const { for (index_t i = 0; i < m_variables.size(); i++) { FlowGraph::Storage& i_storage {*(m_variables[i]->storage())}; if (typeid(i_storage) == typeid(FlowGraph::TemporaryStorage)) { FlowGraph::TemporaryStorage& temporaryStorage{dynamic_cast(i_storage)}; if (&temporaryStorage == &storage) // compare addresses return i; } } throw std::runtime_error("ICE: Storage not found"); }