aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-12-10 22:47:35 +0800
committerchriseth <c@ethdev.com>2015-12-10 22:47:35 +0800
commit08cb74a1de1d32168e2b7ef988180896861192e0 (patch)
treeafff76b10d8c44bf6aa924ac1a368f9086b97f86
parentca10971291710038662c74660dd07249d5be8bf5 (diff)
parent39f57a9c718159448b0f9df199c3a0a019f32ca2 (diff)
downloaddexon-solidity-08cb74a1de1d32168e2b7ef988180896861192e0.tar
dexon-solidity-08cb74a1de1d32168e2b7ef988180896861192e0.tar.gz
dexon-solidity-08cb74a1de1d32168e2b7ef988180896861192e0.tar.bz2
dexon-solidity-08cb74a1de1d32168e2b7ef988180896861192e0.tar.lz
dexon-solidity-08cb74a1de1d32168e2b7ef988180896861192e0.tar.xz
dexon-solidity-08cb74a1de1d32168e2b7ef988180896861192e0.tar.zst
dexon-solidity-08cb74a1de1d32168e2b7ef988180896861192e0.zip
Merge pull request #290 from chriseth/fix_gas_iterator
Fix: Segfaults connected to paramater types.
-rw-r--r--libsolidity/analysis/TypeChecker.cpp4
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp4
-rw-r--r--solc/CommandLineInterface.cpp6
-rw-r--r--solc/jsonCompiler.cpp6
4 files changed, 10 insertions, 10 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 851266bd..425f9299 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -950,7 +950,7 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
else
_functionCall.annotation().type = make_shared<TupleType>(functionType->returnParameterTypes());
- TypePointers const& parameterTypes = functionType->parameterTypes();
+ TypePointers parameterTypes = functionType->parameterTypes();
if (!functionType->takesArbitraryParameters() && parameterTypes.size() != arguments.size())
{
string msg =
@@ -1079,7 +1079,7 @@ void TypeChecker::endVisit(NewExpression const& _newExpression)
);
auto contractType = make_shared<ContractType>(*contract);
- TypePointers const& parameterTypes = contractType->constructorType()->parameterTypes();
+ TypePointers parameterTypes = contractType->constructorType()->parameterTypes();
_newExpression.annotation().type = make_shared<FunctionType>(
parameterTypes,
TypePointers{contractType},
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index a090a28c..dcdab2a7 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -85,7 +85,7 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const&
CompilerContext::LocationSetter locationSetter(m_context, _varDecl);
FunctionType accessorType(_varDecl);
- TypePointers const& paramTypes = accessorType.parameterTypes();
+ TypePointers paramTypes = accessorType.parameterTypes();
// retrieve the position of the variable
auto const& location = m_context.storageLocationOfVariable(_varDecl);
@@ -380,7 +380,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
else
functionType = dynamic_pointer_cast<FunctionType const>(_functionCall.expression().annotation().type);
- TypePointers const& parameterTypes = functionType->parameterTypes();
+ TypePointers parameterTypes = functionType->parameterTypes();
vector<ASTPointer<Expression const>> const& callArguments = _functionCall.arguments();
vector<ASTPointer<ASTString>> const& callArgumentNames = _functionCall.names();
if (!functionType->takesArbitraryParameters())
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 376196e1..fe760fdf 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -278,9 +278,9 @@ void CommandLineInterface::handleGasEstimation(string const& _contract)
gas = GasEstimator::functionalEstimation(*items, entry, *it);
FunctionType type(*it);
cout << " " << it->name() << "(";
- auto end = type.parameterTypes().end();
- for (auto it = type.parameterTypes().begin(); it != end; ++it)
- cout << (*it)->toString() << (it + 1 == end ? "" : ",");
+ auto paramTypes = type.parameterTypes();
+ for (auto it = paramTypes.begin(); it != paramTypes.end(); ++it)
+ cout << (*it)->toString() << (it + 1 == paramTypes.end() ? "" : ",");
cout << "):\t" << gas << endl;
}
}
diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp
index cb3eeefd..a5d86aad 100644
--- a/solc/jsonCompiler.cpp
+++ b/solc/jsonCompiler.cpp
@@ -103,9 +103,9 @@ Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract)
gas = GasEstimator::functionalEstimation(*items, entry, *it);
FunctionType type(*it);
string sig = it->name() + "(";
- auto end = type.parameterTypes().end();
- for (auto it = type.parameterTypes().begin(); it != end; ++it)
- sig += (*it)->toString() + (it + 1 == end ? "" : ",");
+ auto paramTypes = type.parameterTypes();
+ for (auto it = paramTypes.begin(); it != paramTypes.end(); ++it)
+ sig += (*it)->toString() + (it + 1 == paramTypes.end() ? "" : ",");
sig += ")";
internalFunctions[sig] = gasToJson(gas);
}