mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Iterative type checker: compute inherited protocols of a protocol.
Introduce a type check request for computing inherited protocols and start using it in a few places. Swift SVN r32562
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#define SWIFT_SEMA_ITERATIVE_TYPE_CHECKER_H
|
||||
|
||||
#include "swift/Sema/TypeCheckRequest.h"
|
||||
#include "swift/AST/DiagnosticEngine.h"
|
||||
#include "swift/Basic/LLVM.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
|
||||
@@ -54,6 +55,15 @@ class IterativeTypeChecker {
|
||||
public:
|
||||
IterativeTypeChecker(TypeChecker &tc) : TC(tc) { }
|
||||
|
||||
ASTContext &getASTContext() const;
|
||||
|
||||
DiagnosticEngine &getDiags() const;
|
||||
|
||||
template<typename ...ArgTypes>
|
||||
InFlightDiagnostic diagnose(ArgTypes &&...Args) {
|
||||
return getDiags().diagnose(std::forward<ArgTypes>(Args)...);
|
||||
}
|
||||
|
||||
/// Determine whether the given request has already been satisfied.
|
||||
bool isSatisfied(TypeCheckRequest request);
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace swift {
|
||||
class ClassDecl;
|
||||
class EnumDecl;
|
||||
class ExtensionDecl;
|
||||
class ProtocolDecl;
|
||||
class TypeDecl;
|
||||
|
||||
/// A request to the type checker to compute some particular kind of
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
TYPE_CHECK_REQUEST_PAYLOAD(Class, ClassDecl *)
|
||||
TYPE_CHECK_REQUEST_PAYLOAD(Enum, EnumDecl *)
|
||||
TYPE_CHECK_REQUEST_PAYLOAD(InheritedClauseEntry, std::pair<llvm::PointerUnion<TypeDecl *, ExtensionDecl *>, unsigned>)
|
||||
TYPE_CHECK_REQUEST_PAYLOAD(Protocol, ProtocolDecl *)
|
||||
|
||||
/// Perform type checking on an entry in the inherited clause of a
|
||||
/// type or extension.
|
||||
@@ -48,5 +49,8 @@ TYPE_CHECK_REQUEST(TypeCheckSuperclass, Class)
|
||||
/// Perform type checking on the raw type of a particular enum.
|
||||
TYPE_CHECK_REQUEST(TypeCheckRawType, Enum)
|
||||
|
||||
/// Compute the set of inherited protocols for a given protocl
|
||||
TYPE_CHECK_REQUEST(InheritedProtocols, Protocol)
|
||||
|
||||
#undef TYPE_CHECK_REQUEST_PAYLOAD
|
||||
#undef TYPE_CHECK_REQUEST
|
||||
|
||||
Reference in New Issue
Block a user