Implement assert as a global function

This commit is contained in:
Alex Beregszaszi committed 2017-02-10 13:29:17 +00:00
1 parent af8e31b023
commit f8461e9e31
4 files changed
+16 -4

No files matched your search

@@ -863,6 +863,14 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
m_context << Instruction::POP;
break;
}
case Location::Assert:
{
arguments.front()->accept(*this);
utils().convertType(*arguments.front()->annotation().type, *function.parameterTypes().front(), true);
m_context << Instruction::ISZERO;
m_context.appendConditionalJumpTo(m_context.errorTag());
break;
}
default:
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid function type."));
}