diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-07 22:26:59 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-07 22:26:59 +0100 |
commit | dd2a994fbbe946fa751b689e92c85696469e5e5c (patch) | |
tree | 8ac9693b8f921d9111d362dc044745eb9bba33b5 /cpp.cpp | |
parent | 7b6fc865d9871a63c7377ca8d9ebc57dd854d15c (diff) |
Fill mCPPContext.graph with first node! To be converted to asm
Diffstat (limited to 'cpp.cpp')
-rw-r--r-- | cpp.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -405,7 +405,8 @@ std::unordered_map<std::string, std::function<std::any(index_t)>> CPP::getNodeEv FlowGraph::Data value0 {std::any_cast<FlowGraph::Data>(getValue(index, 0))}; FlowGraph::Data value1 {std::any_cast<FlowGraph::Data>(getValue(index, 1))}; - return std::make_shared<FlowGraph::BinaryOperation>(FlowGraph::BinaryOperationType::Add, destination, value0, value1); + std::shared_ptr<FlowGraph::Node> node {std::make_shared<FlowGraph::BinaryOperation>(FlowGraph::BinaryOperationType::Add, destination, value0, value1)}; + return node; } throw std::runtime_error("ICE: Unsupported childs: "s + ruleString(index)); // TODO } @@ -499,8 +500,11 @@ std::unordered_map<std::string, std::function<std::any(index_t)>> CPP::getNodeEv }, { "expression", [&](index_t index) -> std::any { - if (childTypesOfNodeMatch(index, {"assignment-expression", ""}) && !getValue(index, 1).has_value()) + if (childTypesOfNodeMatch(index, {"assignment-expression", ""}) && !getValue(index, 1).has_value()) { + std::shared_ptr<FlowGraph::Node> node {std::any_cast<std::shared_ptr<FlowGraph::Node>>(getValue(index, 0))}; + mCPPContext.graph.push_back(node); return getValue(index, 0); + } throw std::runtime_error("ICE: Unsupported childs: "s + ruleString(index)); // TODO } }, |