mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Parse] Check the SourceFile to see if bodies can be delayed
Remove the `DelayBodyParsing` flag from the parser and instead query the source file.
This commit is contained in:
@@ -1954,6 +1954,23 @@ bool SourceFile::canBeParsedInFull() const {
|
||||
llvm_unreachable("unhandled kind");
|
||||
}
|
||||
|
||||
bool SourceFile::hasDelayedBodyParsing() const {
|
||||
if (ParsingOpts.contains(ParsingFlags::DisableDelayedBodies))
|
||||
return false;
|
||||
|
||||
// Not supported right now.
|
||||
if (Kind == SourceFileKind::REPL || Kind == SourceFileKind::SIL)
|
||||
return false;
|
||||
if (hasInterfaceHash())
|
||||
return false;
|
||||
if (shouldCollectToken())
|
||||
return false;
|
||||
if (shouldBuildSyntaxTree())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileUnit::walk(ASTWalker &walker) {
|
||||
SmallVector<Decl *, 64> Decls;
|
||||
getTopLevelDecls(Decls);
|
||||
|
||||
Reference in New Issue
Block a user