diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-17 12:38:40 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-17 12:38:40 +0100 |
commit | 927eb99e75325164a541c2638e1e607294019381 (patch) | |
tree | 5b5476456f0f957fc7492465ff08ace54e1a9e48 /flowgraph/scope.cpp | |
parent | c9cb051fae190acfc36813e4a23759fb9b9c3df3 (diff) |
Complete hierarchical evaluation (unittest and systemtest fixed)
Diffstat (limited to 'flowgraph/scope.cpp')
-rw-r--r-- | flowgraph/scope.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/flowgraph/scope.cpp b/flowgraph/scope.cpp index 54a3cca..dd6c62c 100644 --- a/flowgraph/scope.cpp +++ b/flowgraph/scope.cpp @@ -2,6 +2,14 @@ #include "storage.h" +FlowGraph::LocalScope::LocalScope() +{ +} + +FlowGraph::LocalScope::~LocalScope() +{ +} + void FlowGraph::LocalScope::push_back(std::shared_ptr<Data> data) { m_variables.push_back(data); @@ -9,18 +17,22 @@ void FlowGraph::LocalScope::push_back(std::shared_ptr<Data> data) void FlowGraph::LocalScope::append(const FlowGraph::LocalScope& other) { + // actually move variables to new scope m_variables.insert(m_variables.end(), other.m_variables.begin(), other.m_variables.end()); } -index_t FlowGraph::LocalScope::indexOfStorage(const Storage& storage) const +index_t FlowGraph::LocalScope::indexOfData(const FlowGraph::Data& data) const { - std::cout << "DEBUG: " << m_variables.size() << std::endl; for (index_t i = 0; i < m_variables.size(); i++) { - FlowGraph::Storage& i_storage {*(m_variables[i]->storage())}; - - if (&i_storage == &storage) // compare addresses + if (*m_variables[i] == data) return i; } - throw std::runtime_error("ICE: Storage not found"); + throw std::runtime_error("ICE: Data not found"); } + +size_t FlowGraph::LocalScope::size() const +{ + return m_variables.size(); +} + |