mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix: Segfaults connected to paramater types.
parameterTypes does not return by const reference anymore.
This commit is contained in:
parent
15a1468c3f
commit
39f57a9c71
@ -950,7 +950,7 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
|
|||||||
else
|
else
|
||||||
_functionCall.annotation().type = make_shared<TupleType>(functionType->returnParameterTypes());
|
_functionCall.annotation().type = make_shared<TupleType>(functionType->returnParameterTypes());
|
||||||
|
|
||||||
TypePointers const& parameterTypes = functionType->parameterTypes();
|
TypePointers parameterTypes = functionType->parameterTypes();
|
||||||
if (!functionType->takesArbitraryParameters() && parameterTypes.size() != arguments.size())
|
if (!functionType->takesArbitraryParameters() && parameterTypes.size() != arguments.size())
|
||||||
{
|
{
|
||||||
string msg =
|
string msg =
|
||||||
@ -1079,7 +1079,7 @@ void TypeChecker::endVisit(NewExpression const& _newExpression)
|
|||||||
);
|
);
|
||||||
|
|
||||||
auto contractType = make_shared<ContractType>(*contract);
|
auto contractType = make_shared<ContractType>(*contract);
|
||||||
TypePointers const& parameterTypes = contractType->constructorType()->parameterTypes();
|
TypePointers parameterTypes = contractType->constructorType()->parameterTypes();
|
||||||
_newExpression.annotation().type = make_shared<FunctionType>(
|
_newExpression.annotation().type = make_shared<FunctionType>(
|
||||||
parameterTypes,
|
parameterTypes,
|
||||||
TypePointers{contractType},
|
TypePointers{contractType},
|
||||||
|
@ -85,7 +85,7 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const&
|
|||||||
CompilerContext::LocationSetter locationSetter(m_context, _varDecl);
|
CompilerContext::LocationSetter locationSetter(m_context, _varDecl);
|
||||||
FunctionType accessorType(_varDecl);
|
FunctionType accessorType(_varDecl);
|
||||||
|
|
||||||
TypePointers const& paramTypes = accessorType.parameterTypes();
|
TypePointers paramTypes = accessorType.parameterTypes();
|
||||||
|
|
||||||
// retrieve the position of the variable
|
// retrieve the position of the variable
|
||||||
auto const& location = m_context.storageLocationOfVariable(_varDecl);
|
auto const& location = m_context.storageLocationOfVariable(_varDecl);
|
||||||
@ -380,7 +380,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
|||||||
else
|
else
|
||||||
functionType = dynamic_pointer_cast<FunctionType const>(_functionCall.expression().annotation().type);
|
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<Expression const>> const& callArguments = _functionCall.arguments();
|
||||||
vector<ASTPointer<ASTString>> const& callArgumentNames = _functionCall.names();
|
vector<ASTPointer<ASTString>> const& callArgumentNames = _functionCall.names();
|
||||||
if (!functionType->takesArbitraryParameters())
|
if (!functionType->takesArbitraryParameters())
|
||||||
|
@ -278,9 +278,9 @@ void CommandLineInterface::handleGasEstimation(string const& _contract)
|
|||||||
gas = GasEstimator::functionalEstimation(*items, entry, *it);
|
gas = GasEstimator::functionalEstimation(*items, entry, *it);
|
||||||
FunctionType type(*it);
|
FunctionType type(*it);
|
||||||
cout << " " << it->name() << "(";
|
cout << " " << it->name() << "(";
|
||||||
auto end = type.parameterTypes().end();
|
auto paramTypes = type.parameterTypes();
|
||||||
for (auto it = type.parameterTypes().begin(); it != end; ++it)
|
for (auto it = paramTypes.begin(); it != paramTypes.end(); ++it)
|
||||||
cout << (*it)->toString() << (it + 1 == end ? "" : ",");
|
cout << (*it)->toString() << (it + 1 == paramTypes.end() ? "" : ",");
|
||||||
cout << "):\t" << gas << endl;
|
cout << "):\t" << gas << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,9 +103,9 @@ Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract)
|
|||||||
gas = GasEstimator::functionalEstimation(*items, entry, *it);
|
gas = GasEstimator::functionalEstimation(*items, entry, *it);
|
||||||
FunctionType type(*it);
|
FunctionType type(*it);
|
||||||
string sig = it->name() + "(";
|
string sig = it->name() + "(";
|
||||||
auto end = type.parameterTypes().end();
|
auto paramTypes = type.parameterTypes();
|
||||||
for (auto it = type.parameterTypes().begin(); it != end; ++it)
|
for (auto it = paramTypes.begin(); it != paramTypes.end(); ++it)
|
||||||
sig += (*it)->toString() + (it + 1 == end ? "" : ",");
|
sig += (*it)->toString() + (it + 1 == paramTypes.end() ? "" : ",");
|
||||||
sig += ")";
|
sig += ")";
|
||||||
internalFunctions[sig] = gasToJson(gas);
|
internalFunctions[sig] = gasToJson(gas);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user