File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ class PatternBindingInitializer : public Initializer {
104
104
105
105
// / If this initializes a single @lazy variable, lazily create a self
106
106
// / declaration for it to refer to.
107
- ParamDecl *getImplicitSelfDecl ();
107
+ ParamDecl *getImplicitSelfDecl () const ;
108
108
109
109
static bool classof (const DeclContext *DC) {
110
110
if (auto init = dyn_cast<Initializer>(DC))
Original file line number Diff line number Diff line change @@ -1543,7 +1543,7 @@ PatternBindingDecl *PatternBindingDecl::createDeserialized(
1543
1543
return PBD;
1544
1544
}
1545
1545
1546
- ParamDecl *PatternBindingInitializer::getImplicitSelfDecl () {
1546
+ ParamDecl *PatternBindingInitializer::getImplicitSelfDecl () const {
1547
1547
if (SelfParam)
1548
1548
return SelfParam;
1549
1549
@@ -1555,12 +1555,14 @@ ParamDecl *PatternBindingInitializer::getImplicitSelfDecl() {
1555
1555
: ParamSpecifier::InOut);
1556
1556
1557
1557
ASTContext &C = DC->getASTContext ();
1558
- SelfParam = new (C) ParamDecl (SourceLoc (), SourceLoc (),
1558
+ auto *mutableThis = const_cast <PatternBindingInitializer *>(this );
1559
+ auto *LazySelfParam = new (C) ParamDecl (SourceLoc (), SourceLoc (),
1559
1560
Identifier (), singleVar->getLoc (),
1560
- C.Id_self , this );
1561
- SelfParam->setImplicit ();
1562
- SelfParam->setSpecifier (specifier);
1563
- SelfParam->setInterfaceType (DC->getSelfInterfaceType ());
1561
+ C.Id_self , mutableThis);
1562
+ LazySelfParam->setImplicit ();
1563
+ LazySelfParam->setSpecifier (specifier);
1564
+ LazySelfParam->setInterfaceType (DC->getSelfInterfaceType ());
1565
+ mutableThis->SelfParam = LazySelfParam;
1564
1566
}
1565
1567
}
1566
1568
You can’t perform that action at this time.
0 commit comments