Skip to content

Commit 3e45b32

Browse files
committed
Parse: Remove some bogus error recovery code for 'lazy'
1 parent 8047dda commit 3e45b32

File tree

3 files changed

+1
-34
lines changed

3 files changed

+1
-34
lines changed

lib/IDE/SourceEntityWalker.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -182,25 +182,6 @@ bool SemaAnnotator::walkToDeclPost(Decl *D) {
182182
if (shouldIgnore(D, ShouldVisitChildren))
183183
return true;
184184

185-
// FIXME: rdar://17671977 the initializer for a lazy property has already
186-
// been moved into its implicit getter.
187-
if (auto *PBD = dyn_cast<PatternBindingDecl>(D)) {
188-
if (auto *VD = PBD->getSingleVar()) {
189-
if (VD->getAttrs().hasAttribute<LazyAttr>()) {
190-
if (auto *Get = VD->getGetter()) {
191-
assert((Get->isImplicit() || Get->isInvalid())
192-
&& "lazy var getter must be either implicitly computed or invalid");
193-
194-
// Note that an implicit getter may not have the body synthesized
195-
// in case the owning PatternBindingDecl is invalid.
196-
if (auto *Body = Get->getBody()) {
197-
Body->walk(*this);
198-
}
199-
}
200-
}
201-
}
202-
}
203-
204185
if (isa<ExtensionDecl>(D)) {
205186
assert(ExtDecls.back() == D);
206187
ExtDecls.pop_back();

lib/Parse/ParseDecl.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4896,15 +4896,6 @@ Parser::parseDeclVarGetSet(Pattern *pattern, ParseDeclOptions Flags,
48964896
Invalid = true;
48974897
}
48984898

4899-
// Lazy var should not have explicit getter/setter.
4900-
// For error-recovery, we mark them as invalid.
4901-
if (Attributes.hasAttribute<LazyAttr>()){
4902-
if (accessors.Get)
4903-
accessors.Get->setInvalid();
4904-
if (accessors.Set)
4905-
accessors.Set->setInvalid();
4906-
}
4907-
49084899
accessors.record(*this, PrimaryVar, Invalid, Decls);
49094900

49104901
return makeParserResult(PrimaryVar);
@@ -5256,11 +5247,6 @@ Parser::parseDeclVar(ParseDeclOptions Flags,
52565247
// global, record it.
52575248
PBDEntries.back().setInitContext(initContext);
52585249

5259-
// If the attributes include @lazy, flag that on each initializer.
5260-
if (Attributes.hasAttribute<LazyAttr>()) {
5261-
PBDEntries.back().setInitializerSubsumed();
5262-
}
5263-
52645250
if (init.hasCodeCompletion()) {
52655251
Status |= init;
52665252
// If we are doing second pass of code completion, we don't want to

lib/Sema/CodeSynthesis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ synthesizeLazyGetterBody(AccessorDecl *Get, VarDecl *VD, VarDecl *Storage,
16251625
auto *InitValue = VD->getParentInitializer();
16261626
auto PBD = VD->getParentPatternBinding();
16271627
unsigned entryIndex = PBD->getPatternEntryIndexForVarDecl(VD);
1628-
assert(PBD->isInitializerSubsumed(entryIndex));
1628+
PBD->setInitializerSubsumed(entryIndex);
16291629

16301630
if (!PBD->isInitializerChecked(entryIndex))
16311631
TC.typeCheckPatternBinding(PBD, entryIndex);

0 commit comments

Comments
 (0)