Add minimal support for fixed-point types in assembly.

This commit is contained in:
Alexander Arlt 2021-07-27 09:32:34 -05:00
parent fe29385dc7
commit 7b8279966e
3 changed files with 11 additions and 3 deletions

View File

@ -806,8 +806,6 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
}
}
solAssert(!dynamic_cast<FixedPointType const*>(var->type()), "FixedPointType not implemented.");
if (!identifierInfo.suffix.empty())
{
string const& suffix = identifierInfo.suffix;

View File

@ -3741,7 +3741,7 @@ string YulUtilFunctions::cleanupFunction(Type const& _type)
templ("body", "cleaned := iszero(iszero(value))");
break;
case Type::Category::FixedPoint:
solUnimplemented("Fixed point types not implemented.");
templ("body", "cleaned := " + cleanupFunction(*dynamic_cast<FixedPointType const&>(_type).asIntegerType()) + "(value)");
break;
case Type::Category::Function:
switch (dynamic_cast<FunctionType const&>(_type).kind())

View File

@ -0,0 +1,10 @@
contract A {
function f() public pure returns (fixed x) {
assembly { x := 1000 }
}
}
// ====
// compileToEwasm: also
// compileViaYul: also
// ----
// f() -> 1000