[ParseableInterface] Go through pattern binding for all variables with storage

Instead of only printing through the pattern binding, and potentially missing stored properties with property observers, defer to the pattern binding for all stored properties, and print accessors if applicable while printing pattern bindings.
This commit is contained in:
Harlan Haskins
2018-12-12 16:52:41 -08:00
parent 579f0188e0
commit 7fe74b2b26
3 changed files with 12 additions and 3 deletions

View File

@@ -3230,7 +3230,7 @@ bool Decl::shouldPrintInContext(const PrintOptions &PO) const {
// Stored variables in Swift source will be picked up by the
// PatternBindingDecl.
if (auto *VD = dyn_cast<VarDecl>(this)) {
if (!VD->hasClangNode() && VD->getImplInfo().isSimpleStored())
if (!VD->hasClangNode() && VD->hasStorage())
return false;
}
@@ -3241,7 +3241,7 @@ bool Decl::shouldPrintInContext(const PrintOptions &PO) const {
auto pattern =
pbd->getPatternList()[0].getPattern()->getSemanticsProvidingPattern();
if (auto named = dyn_cast<NamedPattern>(pattern)) {
if (!named->getDecl()->getImplInfo().isSimpleStored())
if (!named->getDecl()->hasStorage())
return false;
}
}