Fix bug in call statement generator

This commit is contained in:
Bhargava Shastry
2021-06-09 18:38:25 +02:00
parent 954bcf95ea
commit a0197138d9
+8 -6
View File
@@ -715,10 +715,6 @@ string FunctionCallGenerator::callStmt(shared_ptr<FunctionState> _callee)
string rhsExpr;
bool callValid = true;
// Create lhs expression only if function outputs non-zero return values.
if (!_callee->outputs.empty())
lhsExpr = lhs(_callee->outputs);
// Create arguments only if function contains non-zero input parameters.
if (!_callee->inputs.empty())
{
@@ -734,9 +730,15 @@ string FunctionCallGenerator::callStmt(shared_ptr<FunctionState> _callee)
rhsExpr = (_callee->type->functionScope() ? "" : "this.") + _callee->name + "();";
if (callValid)
{
// Create lhs expression only if function outputs non-zero return values.
if (!_callee->outputs.empty())
lhsExpr = lhs(_callee->outputs);
callStmtStream << indentation()
<< lhsExpr
<< rhsExpr;
<< lhsExpr
<< rhsExpr;
}
callStmtStream << "\n";
return callStmtStream.str();
}