Skip to content

Patch codegen issues enough to make tests pass in experimental analysis #14660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ bool IRGeneratorForStatements::visit(ElementaryTypeNameExpression const&)
void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
{
Type functionType = type(_functionCall.expression());
solUnimplementedAssert(m_expressionDeclaration.count(&_functionCall.expression()) != 0, "No support for calling functions pointers yet.");
auto declaration = m_expressionDeclaration.at(&_functionCall.expression());
if (auto builtin = std::get_if<Builtins>(&declaration))
{
Expand All @@ -322,7 +323,10 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
functionType = m_context.env->resolveRecursive(functionType);
m_context.enqueueFunctionDefinition(functionDefinition, functionType);
// TODO: account for return stack size
m_code << "let " << IRNames::localVariable(_functionCall) << " := " << IRNames::function(*m_context.env, *functionDefinition, functionType) << "(";
solAssert(!functionDefinition->returnParameterList());
if (functionDefinition->experimentalReturnExpression())
m_code << "let " << IRNames::localVariable(_functionCall) << " := ";
m_code << IRNames::function(*m_context.env, *functionDefinition, functionType) << "(";
auto const& arguments = _functionCall.arguments();
if (arguments.size() > 1)
for (auto arg: arguments | ranges::views::drop_last(1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ contract C {
// EVMVersion: >=constantinople
// compileViaYul: true
// ----
// UnimplementedFeatureError: No support for calling functions pointers yet.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
// Info 4164: (31-61): Inferred type: void
// Info 4164: (63-93): Inferred type: bool
Expand Down