From 4ab07c6dd3b36d036da40a24da32bab56dd7a79d Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 6 May 2015 13:56:40 +0200 Subject: [PATCH] Use std::array. --- libsolidity/StructuralGasEstimator.cpp | 6 +++--- libsolidity/StructuralGasEstimator.h | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libsolidity/StructuralGasEstimator.cpp b/libsolidity/StructuralGasEstimator.cpp index 2cf8c2a81..c90981a72 100644 --- a/libsolidity/StructuralGasEstimator.cpp +++ b/libsolidity/StructuralGasEstimator.cpp @@ -31,7 +31,7 @@ using namespace dev; using namespace dev::eth; using namespace dev::solidity; -map StructuralGasEstimator::performEstimation( +StructuralGasEstimator::ASTGasConsumptionSelfAccumulated StructuralGasEstimator::performEstimation( AssemblyItems const& _items, vector const& _ast ) @@ -42,7 +42,7 @@ map StructuralGasEstimator::perform for (auto const& item: _items) particularCosts[item.getLocation()] += meter.estimateMax(item); - map gasCosts; + ASTGasConsumptionSelfAccumulated gasCosts; auto onNode = [&](ASTNode const& _node) { gasCosts[&_node][0] = gasCosts[&_node][1] = particularCosts[_node.getLocation()]; @@ -60,7 +60,7 @@ map StructuralGasEstimator::perform } map StructuralGasEstimator::breakToStatementLevel( - map const& _gasCosts, + ASTGasConsumptionSelfAccumulated const& _gasCosts, vector const& _roots ) { diff --git a/libsolidity/StructuralGasEstimator.h b/libsolidity/StructuralGasEstimator.h index b9e976432..df1ae509d 100644 --- a/libsolidity/StructuralGasEstimator.h +++ b/libsolidity/StructuralGasEstimator.h @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -37,11 +38,13 @@ class StructuralGasEstimator { public: using ASTGasConsumption = std::map; + using ASTGasConsumptionSelfAccumulated = + std::map>; /// Estimates the gas consumption for every assembly item in the given assembly and stores /// it by source location. /// @returns a mapping from each AST node to a pair of its particular and syntactically accumulated gas costs. - std::map performEstimation( + ASTGasConsumptionSelfAccumulated performEstimation( eth::AssemblyItems const& _items, std::vector const& _ast ); @@ -50,7 +53,7 @@ public: /// 1. source locations of statements that do not contain other statements /// 2. maximal source locations that do not overlap locations coming from the first rule ASTGasConsumption breakToStatementLevel( - std::map const& _gasCosts, + ASTGasConsumptionSelfAccumulated const& _gasCosts, std::vector const& _roots ); };