mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SILGen: Support mutable consuming parameters.
Emit a box like we would for a local variable, and move the parameter value into the box, as part of the prolog.
This commit is contained in:
@@ -6387,9 +6387,9 @@ Type VarDecl::getType() const {
|
||||
/// is a let member in an initializer.
|
||||
bool VarDecl::isSettable(const DeclContext *UseDC,
|
||||
const DeclRefExpr *base) const {
|
||||
// Only inout parameters are settable.
|
||||
// Parameters are settable or not depending on their ownership convention.
|
||||
if (auto *PD = dyn_cast<ParamDecl>(this))
|
||||
return PD->isInOut();
|
||||
return !PD->isImmutableInFunctionBody();
|
||||
|
||||
// If this is a 'var' decl, then we're settable if we have storage or a
|
||||
// setter.
|
||||
|
||||
Reference in New Issue
Block a user