mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Introduce and adopt DeclContext::isInSwiftinterface().
Checking whether a declaration is in a `.swiftinterface` is a very common query that is made somewhat awkward because declarations are not always in source files. To make these checks more ergonomic, expose a convenience on DeclContext.
This commit is contained in:
@@ -1335,9 +1335,8 @@ static bool shouldAttemptInitializerSynthesis(const NominalTypeDecl *decl) {
|
||||
return false;
|
||||
|
||||
// Don't add implicit constructors in module interfaces.
|
||||
if (auto *SF = decl->getParentSourceFile())
|
||||
if (SF->Kind == SourceFileKind::Interface)
|
||||
return false;
|
||||
if (decl->getDeclContext()->isInSwiftinterface())
|
||||
return false;
|
||||
|
||||
// Don't attempt if we know the decl is invalid.
|
||||
if (decl->isInvalid())
|
||||
|
||||
Reference in New Issue
Block a user