diff --git a/StructuralGasEstimator.cpp b/StructuralGasEstimator.cpp index 2cf8c2a81..c90981a72 100644 --- a/StructuralGasEstimator.cpp +++ b/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/StructuralGasEstimator.h b/StructuralGasEstimator.h index b9e976432..df1ae509d 100644 --- a/StructuralGasEstimator.h +++ b/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 ); };