mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #290 from chriseth/fix_gas_iterator
Fix: Segfaults connected to paramater types.
This commit is contained in:
commit
08cb74a1de
@ -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},
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user