mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Move AST transforms out of the Frontend
Move the playground and debugger transforms out of the Frontend and into `performTypeChecking`, as we'd want them to be applied if `performTypeChecking` was called lazily.
This commit is contained in:
@@ -520,19 +520,21 @@ bool SwiftASTManager::initCompilerInvocation(
|
||||
ImporterOpts.DetailedPreprocessingRecord = true;
|
||||
|
||||
assert(!Invocation.getModuleName().empty());
|
||||
Invocation.getLangOptions().AttachCommentsToDecls = true;
|
||||
Invocation.getLangOptions().DiagnosticsEditorMode = true;
|
||||
Invocation.getLangOptions().CollectParsedToken = true;
|
||||
auto &FrontendOpts = Invocation.getFrontendOptions();
|
||||
if (FrontendOpts.PlaygroundTransform) {
|
||||
|
||||
auto &LangOpts = Invocation.getLangOptions();
|
||||
LangOpts.AttachCommentsToDecls = true;
|
||||
LangOpts.DiagnosticsEditorMode = true;
|
||||
LangOpts.CollectParsedToken = true;
|
||||
if (LangOpts.PlaygroundTransform) {
|
||||
// The playground instrumenter changes the AST in ways that disrupt the
|
||||
// SourceKit functionality. Since we don't need the instrumenter, and all we
|
||||
// actually need is the playground semantics visible to the user, like
|
||||
// silencing the "expression resolves to an unused l-value" error, disable it.
|
||||
FrontendOpts.PlaygroundTransform = false;
|
||||
LangOpts.PlaygroundTransform = false;
|
||||
}
|
||||
|
||||
// Disable the index-store functionality for the sourcekitd requests.
|
||||
auto &FrontendOpts = Invocation.getFrontendOptions();
|
||||
FrontendOpts.IndexStorePath.clear();
|
||||
ImporterOpts.IndexStorePath.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user