mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix string literal assignment to storage.
This commit is contained in:
parent
5c92c2eb81
commit
f1d28b1d17
@ -241,6 +241,10 @@ void IRGeneratorForStatements::initializeStateVar(VariableDeclaration const& _va
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_varDecl.value()->accept(*this);
|
_varDecl.value()->accept(*this);
|
||||||
|
|
||||||
|
Type const* rightIntermediateType = _varDecl.value()->annotation().type->closestTemporaryType(_varDecl.type());
|
||||||
|
solAssert(rightIntermediateType, "");
|
||||||
|
IRVariable value = convert(*_varDecl.value(), *rightIntermediateType);
|
||||||
writeToLValue(
|
writeToLValue(
|
||||||
_varDecl.immutable() ?
|
_varDecl.immutable() ?
|
||||||
IRLValue{*_varDecl.annotation().type, IRLValue::Immutable{&_varDecl}} :
|
IRLValue{*_varDecl.annotation().type, IRLValue::Immutable{&_varDecl}} :
|
||||||
@ -248,7 +252,7 @@ void IRGeneratorForStatements::initializeStateVar(VariableDeclaration const& _va
|
|||||||
util::toCompactHexWithPrefix(m_context.storageLocationOfStateVariable(_varDecl).first),
|
util::toCompactHexWithPrefix(m_context.storageLocationOfStateVariable(_varDecl).first),
|
||||||
m_context.storageLocationOfStateVariable(_varDecl).second
|
m_context.storageLocationOfStateVariable(_varDecl).second
|
||||||
}},
|
}},
|
||||||
*_varDecl.value()
|
value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (langutil::UnimplementedFeatureError const& _error)
|
catch (langutil::UnimplementedFeatureError const& _error)
|
||||||
|
@ -5,5 +5,7 @@ contract C {
|
|||||||
return data[0];
|
return data[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
// ----
|
// ----
|
||||||
// f() -> "a"
|
// f() -> "a"
|
||||||
|
@ -8,5 +8,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
// ----
|
// ----
|
||||||
// f() -> 0x40, 0x80, 0x3, "ray", 0x2, "mi"
|
// f() -> 0x40, 0x80, 0x3, "ray", 0x2, "mi"
|
||||||
|
Loading…
Reference in New Issue
Block a user