Skip to content

Make IntermediateNodeCollection implement IReadOnlyList<IntermediateNode>#13006

Merged
chsienki merged 2 commits intomainfrom
copilot/make-intermediate-node-collection-implement-ireado
Apr 3, 2026
Merged

Make IntermediateNodeCollection implement IReadOnlyList<IntermediateNode>#13006
chsienki merged 2 commits intomainfrom
copilot/make-intermediate-node-collection-implement-ireado

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

Summary of the changes

  • IntermediateNodeCollection already had Count and an indexed getter but didn't declare IReadOnlyList<IntermediateNode>, blocking standard LINQ and list-pattern usage on Children collections.

  • Added IReadOnlyList<IntermediateNode> to the interface list — no new members needed, purely additive.

Enables patterns like:

// Previously required custom helpers
node.Children.All(c => c is HtmlIntermediateToken)

// Or list patterns
if (node.Children is [HtmlIntermediateToken])

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • st8vsblobprodcus339.vsblob.vsassets.io
    • Triggering command: /usr/share/dotnet/dotnet dotnet build src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Microsoft.CodeAnalysis.Razor.Compiler.csproj (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Implement IReadOnlyList<IntermediateNode> in IntermediateNodeCollection Make IntermediateNodeCollection implement IReadOnlyList<IntermediateNode> Apr 3, 2026
Copilot AI requested a review from chsienki April 3, 2026 01:13
@chsienki chsienki marked this pull request as ready for review April 3, 2026 01:17
@chsienki chsienki requested a review from a team as a code owner April 3, 2026 01:17
namespace Microsoft.AspNetCore.Razor.Language.Intermediate;

public sealed class IntermediateNodeCollection : IList<IntermediateNode>
public sealed class IntermediateNodeCollection : IList<IntermediateNode>, IReadOnlyList<IntermediateNode>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are there some places we can change to take advantage of this, or is that coming later?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah there are places. It'll be a follow up just because of the way I broke up the github issues.

@chsienki chsienki enabled auto-merge (squash) April 3, 2026 01:24
@chsienki chsienki merged commit d496432 into main Apr 3, 2026
10 checks passed
@chsienki chsienki deleted the copilot/make-intermediate-node-collection-implement-ireado branch April 3, 2026 01:53
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make IntermediateNodeCollection implement IReadOnlyList<IntermediateNode>

3 participants