mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] NFC: Formalize Decl validation tracking via RAII
After this change, RAII ensures that the validation state is accurate as possible.
This commit is contained in:
@@ -2103,7 +2103,11 @@ void ValueDecl::setInterfaceType(Type type) {
|
||||
}
|
||||
|
||||
bool ValueDecl::hasValidSignature() const {
|
||||
return hasInterfaceType() && !isBeingValidated();
|
||||
if (!hasInterfaceType())
|
||||
return false;
|
||||
// FIXME -- The build blows up if the correct code is used:
|
||||
// return getValidationState() > ValidationState::CheckingWithValidSignature;
|
||||
return getValidationState() != ValidationState::Checking;
|
||||
}
|
||||
|
||||
Optional<ObjCSelector> ValueDecl::getObjCRuntimeName() const {
|
||||
@@ -2707,7 +2711,7 @@ SourceRange TypeAliasDecl::getSourceRange() const {
|
||||
}
|
||||
|
||||
void TypeAliasDecl::setUnderlyingType(Type underlying) {
|
||||
setValidationStarted();
|
||||
setValidationToChecked();
|
||||
|
||||
// lldb creates global typealiases containing archetypes
|
||||
// sometimes...
|
||||
@@ -2925,7 +2929,7 @@ void ClassDecl::addImplicitDestructor() {
|
||||
auto *DD = new (ctx) DestructorDecl(getLoc(), selfDecl, this);
|
||||
|
||||
DD->setImplicit();
|
||||
DD->setValidationStarted();
|
||||
DD->setValidationToChecked();
|
||||
|
||||
// Create an empty body for the destructor.
|
||||
DD->setBody(BraceStmt::create(ctx, getLoc(), { }, getLoc(), true));
|
||||
@@ -4507,7 +4511,7 @@ ParamDecl *ParamDecl::createSelf(SourceLoc loc, DeclContext *DC,
|
||||
Identifier(), loc, C.Id_self, Type(), DC);
|
||||
selfDecl->setImplicit();
|
||||
selfDecl->setInterfaceType(selfInterfaceType);
|
||||
selfDecl->setValidationStarted();
|
||||
selfDecl->setValidationToChecked();
|
||||
return selfDecl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user