Skip to content

Commit 42ab561

Browse files
author
Harlan Haskins
committed
[ParseableInterface] Clarify call to print accessors for single-entry pattern bindings
1 parent 0ec72a0 commit 42ab561

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,10 +2108,11 @@ void PrintAST::visitPatternBindingDecl(PatternBindingDecl *decl) {
21082108
}
21092109
}
21102110

2111-
// HACK: If we're just printing a single pattern and it has accessors,
2112-
// print the accessors here.
2113-
if (decl->getNumPatternEntries() == 1) {
2114-
printAccessors(vd);
2111+
// If we're just printing a single pattern and it has accessors,
2112+
// print the accessors here. It is an error to add accessors to a
2113+
// pattern binding with multiple entries.
2114+
if (auto var = decl->getSingleVar()) {
2115+
printAccessors(var);
21152116
}
21162117
}
21172118
}

0 commit comments

Comments
 (0)