mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10180 from ethereum/convertDuringStoring
[SolYul] Convert properly during storing.
This commit is contained in:
commit
e0529989da
@ -2192,8 +2192,9 @@ string YulUtilFunctions::updateStorageValueFunction(
|
||||
solAssert(_toType.storageBytes() > 0, "Invalid storage bytes size.");
|
||||
|
||||
return Whiskers(R"(
|
||||
function <functionName>(slot, <offset>value) {
|
||||
sstore(slot, <update>(sload(slot), <offset><prepare>(value)))
|
||||
function <functionName>(slot, <offset><fromValues>) {
|
||||
let <toValues> := <convert>(<fromValues>)
|
||||
sstore(slot, <update>(sload(slot), <offset><prepare>(<toValues>)))
|
||||
}
|
||||
|
||||
)")
|
||||
@ -2204,6 +2205,9 @@ string YulUtilFunctions::updateStorageValueFunction(
|
||||
updateByteSliceFunctionDynamic(_toType.storageBytes())
|
||||
)
|
||||
("offset", _offset.has_value() ? "" : "offset, ")
|
||||
("convert", conversionFunction(_fromType, _toType))
|
||||
("fromValues", suffixedVariableNameList("value_", 0, _fromType.sizeOnStack()))
|
||||
("toValues", suffixedVariableNameList("convertedValue_", 0, _toType.sizeOnStack()))
|
||||
("prepare", prepareStoreFunction(_toType))
|
||||
.render();
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test_store_ok() -> 1
|
||||
// x() -> 0
|
||||
|
@ -18,6 +18,8 @@ contract D {
|
||||
return (stateBool, stateDecimal, stateBytes);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// stateBool() -> true
|
||||
// stateBool() -> right(true)
|
||||
|
Loading…
Reference in New Issue
Block a user