Skip to content

Commit 84a83b7

Browse files
committed
Rename to GeneratedOnlyMappings
1 parent 65e6d16 commit 84a83b7

File tree

11 files changed

+24
-25
lines changed

11 files changed

+24
-25
lines changed

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeRenderingContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public abstract class CodeRenderingContext : IDisposable
3737

3838
public abstract void AddSourceMappingFor(SourceSpan node);
3939

40-
public abstract void AddComponentMapping(int length);
40+
public abstract void AddGeneratedOnlyMapping(int length);
4141

4242
public abstract void RenderNode(IntermediateNode node);
4343

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ public static CSharpCodeWritingScope BuildClassDeclaration(
422422
}
423423

424424
writer.Write("class ");
425-
context.AddComponentMapping(name.Length);
425+
context.AddGeneratedOnlyMapping(name.Length);
426426
writer.Write(name);
427427

428428
if (typeParameters != null && typeParameters.Count > 0)

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultCodeRenderingContext.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal class DefaultCodeRenderingContext : CodeRenderingContext
1919
private readonly List<ScopeInternal> _scopes;
2020

2121
private readonly PooledObject<ImmutableArray<SourceMapping>.Builder> _sourceMappingsBuilder;
22-
private readonly PooledObject<ImmutableArray<SourceSpan>.Builder> _componentMappingsBuilder;
22+
private readonly PooledObject<ImmutableArray<SourceSpan>.Builder> _generatedOnlyMappingsBuilder;
2323

2424
public DefaultCodeRenderingContext(
2525
CodeWriter codeWriter,
@@ -62,7 +62,7 @@ public DefaultCodeRenderingContext(
6262
Diagnostics = new RazorDiagnosticCollection();
6363
Items = new ItemCollection();
6464
_sourceMappingsBuilder = ArrayBuilderPool<SourceMapping>.GetPooledObject();
65-
_componentMappingsBuilder = ArrayBuilderPool<SourceSpan>.GetPooledObject();
65+
_generatedOnlyMappingsBuilder = ArrayBuilderPool<SourceSpan>.GetPooledObject();
6666
LinePragmas = new List<LinePragma>();
6767

6868
var diagnostics = _documentNode.GetAllDiagnostics();
@@ -102,7 +102,7 @@ public DefaultCodeRenderingContext(
102102

103103
public ImmutableArray<SourceMapping>.Builder SourceMappings => _sourceMappingsBuilder.Object;
104104

105-
public ImmutableArray<SourceSpan>.Builder ComponentMappings => _componentMappingsBuilder.Object;
105+
public ImmutableArray<SourceSpan>.Builder GeneratedOnlyMappings => _generatedOnlyMappingsBuilder.Object;
106106

107107
internal List<LinePragma> LinePragmas { get; }
108108

@@ -146,9 +146,9 @@ public override void AddSourceMappingFor(SourceSpan source)
146146
SourceMappings.Add(sourceMapping);
147147
}
148148

149-
public override void AddComponentMapping(int length)
149+
public override void AddGeneratedOnlyMapping(int length)
150150
{
151-
ComponentMappings.Add(new SourceSpan(CodeWriter.Location, length));
151+
GeneratedOnlyMappings.Add(new SourceSpan(CodeWriter.Location, length));
152152
}
153153

154154
public override void RenderChildren(IntermediateNode node)
@@ -229,7 +229,7 @@ public override void AddLinePragma(LinePragma linePragma)
229229
public override void Dispose()
230230
{
231231
_sourceMappingsBuilder.Dispose();
232-
_componentMappingsBuilder.Dispose();
232+
_generatedOnlyMappingsBuilder.Dispose();
233233
}
234234

235235
private struct ScopeInternal

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultDocumentWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument
5353
_options,
5454
allOrderedDiagnostics.ToArray(),
5555
context.SourceMappings.DrainToImmutable(),
56-
context.ComponentMappings.DrainToImmutable(),
56+
context.GeneratedOnlyMappings.DrainToImmutable(),
5757
context.LinePragmas.ToArray());
5858
}
5959

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpDocument.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal class DefaultRazorCSharpDocument : RazorCSharpDocument
1515
private readonly string _generatedCode;
1616
private readonly RazorDiagnostic[] _diagnostics;
1717
private readonly ImmutableArray<SourceMapping> _sourceMappings;
18-
private readonly ImmutableArray<SourceSpan> _componentMappings;
18+
private readonly ImmutableArray<SourceSpan> _generatedOnlyMappings;
1919
private readonly LinePragma[] _linePragmas;
2020
private readonly RazorCodeGenerationOptions _options;
2121
private readonly RazorCodeDocument _codeDocument;
@@ -26,7 +26,7 @@ public DefaultRazorCSharpDocument(
2626
RazorCodeGenerationOptions options,
2727
RazorDiagnostic[] diagnostics,
2828
ImmutableArray<SourceMapping> sourceMappings,
29-
ImmutableArray<SourceSpan> componentMappings,
29+
ImmutableArray<SourceSpan> generatedOnlyMappings,
3030
LinePragma[] linePragmas)
3131
{
3232
if (generatedCode == null)
@@ -45,9 +45,8 @@ public DefaultRazorCSharpDocument(
4545

4646
_diagnostics = diagnostics ?? Array.Empty<RazorDiagnostic>();
4747
_sourceMappings = sourceMappings;
48-
_componentMappings = componentMappings;
48+
_generatedOnlyMappings = generatedOnlyMappings;
4949
_linePragmas = linePragmas ?? Array.Empty<LinePragma>();
50-
_componentMappings = componentMappings;
5150
}
5251

5352
public override IReadOnlyList<RazorDiagnostic> Diagnostics => _diagnostics;
@@ -56,7 +55,7 @@ public DefaultRazorCSharpDocument(
5655

5756
public override ImmutableArray<SourceMapping> SourceMappings => _sourceMappings;
5857

59-
public override ImmutableArray<SourceSpan> ComponentMappings => _componentMappings;
58+
public override ImmutableArray<SourceSpan> GeneratedOnlyMappings => _generatedOnlyMappings;
6059

6160
internal override IReadOnlyList<LinePragma> LinePragmas => _linePragmas;
6261

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/IRazorGeneratedDocument.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ internal interface IRazorGeneratedDocument
1010
string GeneratedCode { get; }
1111
RazorCodeGenerationOptions Options { get; }
1212
ImmutableArray<SourceMapping> SourceMappings { get; }
13-
ImmutableArray<SourceSpan> ComponentMappings { get; }
13+
ImmutableArray<SourceSpan> GeneratedOnlyMappings { get; }
1414
RazorCodeDocument? CodeDocument { get; }
1515
}

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Unshipped.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*REMOVED*~Microsoft.AspNetCore.Razor.Language.TagHelperDescriptor.TagMatchingRules.get -> System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Razor.Language.TagMatchingRuleDescriptor>
99
*REMOVED*~Microsoft.AspNetCore.Razor.Language.TagMatchingRuleDescriptor.Attributes.get -> System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Razor.Language.RequiredAttributeDescriptor>
1010
*REMOVED*~virtual Microsoft.AspNetCore.Razor.Language.BoundAttributeDescriptor.BoundAttributeParameters.get -> System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Razor.Language.BoundAttributeParameterDescriptor>
11-
abstract Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeRenderingContext.AddComponentMapping(int length) -> void
11+
abstract Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeRenderingContext.AddGeneratedOnlyMapping(int length) -> void
1212
abstract Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeRenderingContext.AddSourceMappingFor(Microsoft.AspNetCore.Razor.Language.SourceSpan node) -> void
1313
abstract Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeRenderingContext.Dispose() -> void
1414
abstract Microsoft.AspNetCore.Razor.Language.MetadataCollection.ContainsKey(string! key) -> bool
@@ -18,7 +18,7 @@ abstract Microsoft.AspNetCore.Razor.Language.MetadataCollection.Keys.get -> Syst
1818
abstract Microsoft.AspNetCore.Razor.Language.MetadataCollection.this[string! key].get -> string?
1919
abstract Microsoft.AspNetCore.Razor.Language.MetadataCollection.TryGetValue(string! key, out string? value) -> bool
2020
abstract Microsoft.AspNetCore.Razor.Language.MetadataCollection.Values.get -> System.Collections.Generic.IEnumerable<string?>!
21-
abstract Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.ComponentMappings.get -> System.Collections.Immutable.ImmutableArray<Microsoft.AspNetCore.Razor.Language.SourceSpan>
21+
abstract Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.GeneratedOnlyMappings.get -> System.Collections.Immutable.ImmutableArray<Microsoft.AspNetCore.Razor.Language.SourceSpan>
2222
abstract Microsoft.AspNetCore.Razor.Language.RazorSourceDocumentProperties.FilePath.get -> string?
2323
abstract Microsoft.AspNetCore.Razor.Language.RazorSourceDocumentProperties.RelativePath.get -> string?
2424
abstract Microsoft.AspNetCore.Razor.Language.TagHelperCollector<T>.Collect(Microsoft.CodeAnalysis.ISymbol! symbol, System.Collections.Generic.ICollection<Microsoft.AspNetCore.Razor.Language.TagHelperDescriptor!>! results) -> void
@@ -367,7 +367,7 @@ virtual Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.OnInitialized()
367367
~static Microsoft.AspNetCore.Razor.Language.RazorCodeDocumentExtensions.SetImportSyntaxTrees(this Microsoft.AspNetCore.Razor.Language.RazorCodeDocument document, System.Collections.Immutable.ImmutableArray<Microsoft.AspNetCore.Razor.Language.RazorSyntaxTree> syntaxTrees) -> void
368368
~static Microsoft.AspNetCore.Razor.Language.RazorCodeDocumentExtensions.SetPreTagHelperSyntaxTree(this Microsoft.AspNetCore.Razor.Language.RazorCodeDocument document, Microsoft.AspNetCore.Razor.Language.RazorSyntaxTree syntaxTree) -> void
369369
~static Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.Create(Microsoft.AspNetCore.Razor.Language.RazorCodeDocument codeDocument, string generatedCode, Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptions options, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Razor.Language.RazorDiagnostic> diagnostics) -> Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument
370-
~static Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.Create(Microsoft.AspNetCore.Razor.Language.RazorCodeDocument codeDocument, string generatedCode, Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptions options, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Razor.Language.RazorDiagnostic> diagnostics, System.Collections.Immutable.ImmutableArray<Microsoft.AspNetCore.Razor.Language.SourceMapping> sourceMappings, System.Collections.Immutable.ImmutableArray<Microsoft.AspNetCore.Razor.Language.SourceSpan> componentMappings, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Razor.Language.CodeGeneration.LinePragma> linePragmas) -> Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument
370+
~static Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.Create(Microsoft.AspNetCore.Razor.Language.RazorCodeDocument codeDocument, string generatedCode, Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptions options, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Razor.Language.RazorDiagnostic> diagnostics, System.Collections.Immutable.ImmutableArray<Microsoft.AspNetCore.Razor.Language.SourceMapping> sourceMappings, System.Collections.Immutable.ImmutableArray<Microsoft.AspNetCore.Razor.Language.SourceSpan> generatedOnlyMappings, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Razor.Language.CodeGeneration.LinePragma> linePragmas) -> Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument
371371
~static Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.Create(string generatedCode, Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptions options, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Razor.Language.RazorDiagnostic> diagnostics, System.Collections.Immutable.ImmutableArray<Microsoft.AspNetCore.Razor.Language.SourceMapping> sourceMappings, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Razor.Language.CodeGeneration.LinePragma> linePragmas) -> Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument
372372
~static Microsoft.AspNetCore.Razor.Language.TagHelperDescriptorBuilderExtensions.SetMetadata(this Microsoft.AspNetCore.Razor.Language.TagHelperDescriptorBuilder builder, System.Collections.Generic.KeyValuePair<string, string> pair) -> void
373373
~static Microsoft.AspNetCore.Razor.Language.TagHelperDescriptorBuilderExtensions.SetMetadata(this Microsoft.AspNetCore.Razor.Language.TagHelperDescriptorBuilder builder, System.Collections.Generic.KeyValuePair<string, string> pair1, System.Collections.Generic.KeyValuePair<string, string> pair2) -> void

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/RazorCSharpDocument.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public abstract class RazorCSharpDocument : IRazorGeneratedDocument
2323
/// <remarks>
2424
/// Used to map the component class name, so go-to-definition navigates to the .razor file.
2525
/// </remarks>
26-
public abstract ImmutableArray<SourceSpan> ComponentMappings { get; }
26+
public abstract ImmutableArray<SourceSpan> GeneratedOnlyMappings { get; }
2727

2828
public abstract IReadOnlyList<RazorDiagnostic> Diagnostics { get; }
2929

@@ -58,7 +58,7 @@ public static RazorCSharpDocument Create(RazorCodeDocument codeDocument, string
5858
throw new ArgumentNullException(nameof(diagnostics));
5959
}
6060

61-
return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings: ImmutableArray<SourceMapping>.Empty, componentMappings: ImmutableArray<SourceSpan>.Empty, linePragmas: null);
61+
return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings: ImmutableArray<SourceMapping>.Empty, generatedOnlyMappings: ImmutableArray<SourceSpan>.Empty, linePragmas: null);
6262
}
6363

6464
public static RazorCSharpDocument Create(
@@ -67,7 +67,7 @@ public static RazorCSharpDocument Create(
6767
RazorCodeGenerationOptions options,
6868
IEnumerable<RazorDiagnostic> diagnostics,
6969
ImmutableArray<SourceMapping> sourceMappings,
70-
ImmutableArray<SourceSpan> componentMappings,
70+
ImmutableArray<SourceSpan> generatedOnlyMappings,
7171
IEnumerable<LinePragma> linePragmas)
7272
{
7373
if (generatedCode == null)
@@ -85,6 +85,6 @@ public static RazorCSharpDocument Create(
8585
throw new ArgumentNullException(nameof(diagnostics));
8686
}
8787

88-
return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings, componentMappings, linePragmas.ToArray());
88+
return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings, generatedOnlyMappings, linePragmas.ToArray());
8989
}
9090
}

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal abstract class RazorHtmlDocument : IRazorGeneratedDocument
1616

1717
public abstract ImmutableArray<SourceMapping> SourceMappings { get; }
1818

19-
public ImmutableArray<SourceSpan> ComponentMappings => ImmutableArray<SourceSpan>.Empty;
19+
public ImmutableArray<SourceSpan> GeneratedOnlyMappings => ImmutableArray<SourceSpan>.Empty;
2020

2121
public abstract RazorCodeDocument CodeDocument { get; }
2222

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public bool TryMapToHostDocumentPosition(IRazorGeneratedDocument generatedDocume
332332
return true;
333333
}
334334

335-
foreach (var mapping in generatedDocument.ComponentMappings)
335+
foreach (var mapping in generatedDocument.GeneratedOnlyMappings)
336336
{
337337
var generatedAbsoluteIndex = mapping.AbsoluteIndex;
338338
var distanceIntoGeneratedSpan = generatedDocumentIndex - generatedAbsoluteIndex;

0 commit comments

Comments
 (0)