Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put generated files to disk: #47047

Merged
merged 12 commits into from
Sep 25, 2020
Prev Previous commit
Next Next commit
Use ToList not ToImmutableArray
chsienki committed Sep 25, 2020

Verified

This commit was signed with the committer’s verified signature.
addaleax Anna Henningsen
commit 2113030733ac9ea42e3f1b53f4c2e74ba7951729
6 changes: 3 additions & 3 deletions src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs
Original file line number Diff line number Diff line change
@@ -966,10 +966,10 @@ private void CompileAndEmit(
bool hasAnalyzerConfigs = !Arguments.AnalyzerConfigPaths.IsEmpty;
bool hasGeneratedOutputPath = !string.IsNullOrWhiteSpace(Arguments.GeneratedFilesDirectory);

var generatedSyntaxTrees = compilation.SyntaxTrees.Skip(Arguments.SourceFiles.Length).ToImmutableArray();
var generatedSyntaxTrees = compilation.SyntaxTrees.Skip(Arguments.SourceFiles.Length).ToList();
Copy link
Member

@jasonmalinowski jasonmalinowski Sep 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no surprises here about other things adding trees? Nothing funky on the VB side of things around My since I think that implicitly adds trees, but probably not to the arguments compilation's SyntaxTrees collection?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing funky for C#. VB and My trees is a good thought, but the generators wont get loaded in that case, so this code will never execute.


var analyzerOptionsBuilder = hasAnalyzerConfigs ? ArrayBuilder<AnalyzerConfigOptionsResult>.GetInstance(generatedSyntaxTrees.Length) : null;
var embeddedTextBuilder = ArrayBuilder<EmbeddedText>.GetInstance(generatedSyntaxTrees.Length);
var analyzerOptionsBuilder = hasAnalyzerConfigs ? ArrayBuilder<AnalyzerConfigOptionsResult>.GetInstance(generatedSyntaxTrees.Count) : null;
var embeddedTextBuilder = ArrayBuilder<EmbeddedText>.GetInstance(generatedSyntaxTrees.Count);
try
{
foreach (var tree in generatedSyntaxTrees)