mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Thread operator lookup through Module to ModuleLoader...
...even though Swift modules don't provide this lookup yet, and Clang modules never will. Swift SVN r5173
This commit is contained in:
@@ -35,6 +35,7 @@ namespace swift {
|
||||
class BraceStmt;
|
||||
class Component;
|
||||
class Decl;
|
||||
enum class DeclKind : uint8_t;
|
||||
class ExtensionDecl;
|
||||
class IdentifierType;
|
||||
class InfixOperatorDecl;
|
||||
@@ -316,6 +317,19 @@ public:
|
||||
// Inherited from Module.
|
||||
ArrayRef<ExtensionDecl*> lookupExtensions(Type T);
|
||||
|
||||
/// Look up an operator declaration.
|
||||
///
|
||||
/// \param name The operator name ("+", ">>", etc.)
|
||||
///
|
||||
/// \param fixity One of PrefixOperator, InfixOperator, or PostfixOperator.
|
||||
OperatorDecl *lookupOperator(Identifier name, DeclKind fixity);
|
||||
|
||||
/// Look up an operator declaration.
|
||||
template <typename T>
|
||||
T *lookupOperator(Identifier name) {
|
||||
static_assert((T*){}, "Must specify prefix, postfix, or infix operator");
|
||||
}
|
||||
|
||||
static bool classof(const DeclContext *DC) {
|
||||
return DC->getContextKind() >= DeclContextKind::First_LoadedModule &&
|
||||
DC->getContextKind() <= DeclContextKind::Last_LoadedModule;
|
||||
@@ -341,6 +355,18 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
PrefixOperatorDecl *
|
||||
LoadedModule::lookupOperator<PrefixOperatorDecl>(Identifier name);
|
||||
|
||||
template <>
|
||||
PostfixOperatorDecl *
|
||||
LoadedModule::lookupOperator<PostfixOperatorDecl>(Identifier name);
|
||||
|
||||
template <>
|
||||
InfixOperatorDecl *
|
||||
LoadedModule::lookupOperator<InfixOperatorDecl>(Identifier name);
|
||||
|
||||
|
||||
} // end namespace swift
|
||||
|
||||
|
||||
Reference in New Issue
Block a user