mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Make SourceFile a DeclContext, but don't actually do anything with it yet.
Swift SVN r9646
This commit is contained in:
@@ -340,7 +340,7 @@ public:
|
||||
/// the REPL). Since it contains raw source, it must be parsed and name-bound
|
||||
/// before being used for anything; a full type-check is also necessary for
|
||||
/// IR generation.
|
||||
class SourceFile {
|
||||
class SourceFile : public DeclContext {
|
||||
friend class Module;
|
||||
|
||||
public:
|
||||
@@ -362,6 +362,7 @@ private:
|
||||
|
||||
public:
|
||||
/// The translation unit that this file is a part of.
|
||||
// FIXME: Redundant with the decl context parent, but definitely convenient.
|
||||
TranslationUnit &TU;
|
||||
|
||||
/// The list of top-level declarations in the source file.
|
||||
@@ -462,6 +463,10 @@ public:
|
||||
/// \param options Options controlling the printing process.
|
||||
void print(raw_ostream &os, const PrintOptions &options);
|
||||
|
||||
static bool classof(const DeclContext *DC) {
|
||||
return DC->getContextKind() == DeclContextKind::SourceFile;
|
||||
}
|
||||
|
||||
private:
|
||||
// Make placement new and vanilla new/delete illegal for SourceFiles.
|
||||
void *operator new(size_t Bytes) throw() = delete;
|
||||
|
||||
Reference in New Issue
Block a user