mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Implement SE-0075: CanImport
This implementation required a compromise between parser performance and AST structuring. On the one hand, Parse must be fast in order to keep things in the IDE zippy, on the other we must hit the disk to properly resolve 'canImport' conditions and inject members of the active clause into the AST. Additionally, a Parse-only pass may not provide platform-specific information to the compiler invocation and so may mistakenly activate or de-activate branches in the if-configuration decl. The compromise is to perform condition evaluation only when continuing on to semantic analysis. This keeps the parser quick and avoids the unpacking that parse does for active conditions while still retaining the ability to see through to an active condition when we know we're moving on to semantic analysis anyways.
This commit is contained in:
@@ -1366,7 +1366,7 @@ SourceFile *SwiftLangSupport::getSyntacticSourceFile(
|
||||
Error = "Compiler invocation set up failed";
|
||||
return nullptr;
|
||||
}
|
||||
ParseCI.performParseOnly();
|
||||
ParseCI.performParseOnly(/*EvaluateConditionals*/true);
|
||||
|
||||
SourceFile *SF = nullptr;
|
||||
unsigned BufferID = ParseCI.getInputBufferIDs().back();
|
||||
|
||||
Reference in New Issue
Block a user