mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
tmp
This commit is contained in:
@@ -98,7 +98,7 @@ string IRGenerator::generate(ContractDefinition const& _contract)
|
||||
{
|
||||
auto type = m_context.analysis.annotation<TypeInference>(*_contract.fallbackFunction()).type;
|
||||
solAssert(type);
|
||||
type = m_context.analysis.typeSystem().env().resolve(*type);
|
||||
type = m_context.env->resolve(*type);
|
||||
code << IRNames::function(*_contract.fallbackFunction(), *type) << "()\n";
|
||||
m_context.enqueueFunctionDefinition(_contract.fallbackFunction(), *type);
|
||||
}
|
||||
@@ -121,6 +121,14 @@ string IRGenerator::generate(ContractDefinition const& _contract)
|
||||
|
||||
string IRGenerator::generate(FunctionDefinition const& _function, Type _type)
|
||||
{
|
||||
TypeEnvironment newEnv = m_context.env->clone();
|
||||
ScopedSaveAndRestore envRestore{m_context.env, &newEnv};
|
||||
auto type = m_context.analysis.annotation<TypeInference>(_function).type;
|
||||
solAssert(type);
|
||||
for (auto err: newEnv.unify(*type, _type))
|
||||
{
|
||||
solAssert(false, newEnv.typeToString(*type) + " <-> " + newEnv.typeToString(_type));
|
||||
}
|
||||
std::stringstream code;
|
||||
code << "function " << IRNames::function(_function, _type) << "(";
|
||||
if (_function.parameters().size() > 1)
|
||||
|
||||
@@ -196,9 +196,10 @@ bool IRGeneratorForStatements::visit(FunctionCall const& _functionCall)
|
||||
solAssert(false, "Complex function call expressions not supported.");
|
||||
|
||||
solAssert(functionDefinition);
|
||||
auto functionType = m_context.analysis.annotation<TypeInference>(_functionCall).type;
|
||||
auto functionType = m_context.analysis.annotation<TypeInference>(_functionCall.expression()).type;
|
||||
solAssert(functionType);
|
||||
functionType = m_context.analysis.typeSystem().env().resolve(*functionType);
|
||||
// TODO: get around resolveRecursive by passing the environment further down?
|
||||
functionType = m_context.env->resolveRecursive(*functionType);
|
||||
m_context.enqueueFunctionDefinition(functionDefinition, *functionType);
|
||||
m_code << "let " << IRNames::localVariable(_functionCall) << " := " << IRNames::function(*functionDefinition, *functionType) << "(";
|
||||
auto const& arguments = _functionCall.arguments();
|
||||
|
||||
Reference in New Issue
Block a user