174 writes to Source
Microsoft.AspNetCore.Razor.Language.UnitTests (20)
CodeGeneration\DesignTimeNodeWriterTest.cs (8)
57Source = originalSpan 93Source = originalSpan, 151Source = new SourceSpan("test.cshtml", 0, 0, 0, 3), 215Source = new SourceSpan("test.cshtml", 8, 0, 8, 3), 254Source = new SourceSpan("test.cshtml", 0, 0, 0, 3) 311Source = new SourceSpan("test.cshtml", 0, 0, 0, 13) 345Source = new SourceSpan("test.cshtml", 0, 0, 0, 17) 494Source = new SourceSpan(fileName, 0, 0, 0, 3)
CodeGeneration\RuntimeNodeWriterTest.cs (2)
55Source = new SourceSpan("test.cshtml", 0, 0, 0, 3) 86Source = new SourceSpan("test.cshtml", 0, 0, 0, 3),
Extensions\DefaultTagHelperTargetExtensionTest.cs (4)
576Source = Span, 637Source = Span, 720Source = Span, 928Source = Span,
Extensions\DesignTimeDirectiveTargetExtensionTest.cs (6)
48Source = new SourceSpan("test.cshtml", 0, 0, 0, 5), 89Source = new SourceSpan("test.cshtml", 0, 0, 0, 5), 130Source = new SourceSpan("test.cshtml", 0, 0, 0, 5), 171Source = new SourceSpan("test.cshtml", 0, 0, 0, 5), 177Source = new SourceSpan("test.cshtml", 0, 0, 0, 5), 229Source = new SourceSpan("test.cshtml", 0, 0, 0, 5),
Microsoft.CodeAnalysis.Razor.Compiler (154)
Language\Components\ComponentBindLoweringPass.cs (2)
518Source = targetNode.Source, 540Source = targetNode.Source,
Language\Components\ComponentDesignTimeNodeWriter.cs (5)
616WriteCSharpCode(context, new CSharpCodeIntermediateNode() { Source = renderMode.Source, Children = { renderMode.Children[0] } }); 1009Source = node.Source, 1102Source = node.Source, 1120Source = node.Source, 1139Source = node.Source,
Language\Components\ComponentDocumentClassifierPass.cs (1)
83@namespace.Source = computedNamespaceSpan;
Language\Components\ComponentEventHandlerLoweringPass.cs (1)
196Source = node.Source,
Language\Components\ComponentFormNameLoweringPass.cs (4)
48Source = node.Source 58Source = node.Source, 65Source = node.Source, 75result.Source = child.Source;
Language\Components\ComponentLoweringPass.cs (8)
351Source = node.Source, 447Source = node.Source, 575Source = source, 663Source = htmlValue.Source, 676Source = expressionValue.Source, 689Source = codeValue.Source, 786Source = node.Source, 823Source = content.Source,
Language\Components\ComponentPageDirectivePass.cs (1)
64@namespace.Children.Insert(index++, new RouteAttributeExtensionNode(routeToken.Content) { Source = routeToken.Source });
Language\Components\ComponentRenderModeDirectivePass.cs (1)
65Source = child.Source,
Language\Components\ComponentRenderModeLoweringPass.cs (1)
43var renderModeNode = new RenderModeIntermediateNode() { Source = node.Source, Children = { expression } };
Language\Components\ComponentRuntimeNodeWriter.cs (4)
596WriteCSharpCode(context, new CSharpCodeIntermediateNode() { Source = renderMode.Source, Children = { renderMode.Children[0] } }); 902Source = node.Source, 996Source = node.Source, 1010Source = node.Source,
Language\Components\ComponentSplatLoweringPass.cs (1)
39Source = node.Source,
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (43)
119Source = reference.Source, 358Source = BuildSourceSpanFromNode(node), 367Source = BuildSourceSpanFromNode(node), 399Source = BuildSourceSpanFromNode(node), 416Source = BuildSourceSpanFromNode(node), 425Source = BuildSourceSpanFromNode(node), 440Source = BuildSourceSpanFromNode(node), 455Source = BuildSourceSpanFromNode(node), 464Source = BuildSourceSpanFromNode(node), 479Source = BuildSourceSpanFromNode(node), 494Source = BuildSourceSpanFromNode(node), 503Source = BuildSourceSpanFromNode(node), 518Source = BuildSourceSpanFromNode(node), 703Source = BuildSourceSpanFromNode(node), 717Source = BuildSourceSpanFromNode(node), 725Source = BuildSourceSpanFromNode(node), 741Source = BuildSourceSpanFromNode(node), 756Source = BuildSourceSpanFromNode(node), 900node.Source = new SourceSpan( 1020node.Source = new SourceSpan( 1080Source = BuildSourceSpanFromNode(node), 1179Source = BuildSourceSpanFromNode(node), 1217Source = BuildSourceSpanFromNode(node), 1280Source = BuildSourceSpanFromNode(node), 1295Source = BuildSourceSpanFromNode(node), 1359Source = rewrittenSource, 1399var fallback = new HtmlContentIntermediateNode() { Source = fallbackSource }; 1409Source = BuildSourceSpanFromNode(node), 1491Source = BuildSourceSpanFromNode(node) 1593Source = source 1644Source = BuildSourceSpanFromNode(node), 1733Source = source, 1752Source = source, 1795Source = BuildSourceSpanFromNode(node), 1827Source = rewrittenSource, 1870Source = source, 1879Source = source, 1905Source = attrValueSource, 1910Source = attrValueSource, 1958Source = source, 1987Source = this.BuildSourceSpanFromNode(node), 2022Source = this.BuildSourceSpanFromNode(node), 2058Source = BuildSourceSpanFromNode(node)
Language\DefaultTagHelperResolutionPhase.ComponentTagHelperResolver.cs (23)
279directiveNode.Source = unresolvedAttr.ValueSourceSpan 303expr.Source = expr.Children.Count > 0 ? expr.Children[0].Source : directiveNode.Source; 360prop.Source = unresolvedAttr.ValueSourceSpan ?? (prop.Children.Count > 0 ? prop.Children[0].Source : null); 449var expr = new CSharpExpressionIntermediateNode() { Source = csharpExprAttrValue.Source }; 480var expr = new CSharpExpressionIntermediateNode() { Source = csharpExprAttrValue.Source }; 490var expr = new CSharpExpressionIntermediateNode() { Source = csharpCodeAttrValue.Source }; 646htmlContent.Source ??= mergedSource; 652htmlContent.Source ??= valueChild.Source; 676expr.Source = expr.Children.Count > 0 ? expr.Children[0].Source : unresolvedExpr.Source; 682var htmlContent = new HtmlContentIntermediateNode() { Source = token.Source }; 778htmlContent.Source = mergedSource ?? htmlAttrValue.Source; 787htmlContent.Source = htmlAttrValue.Source; 796var csharpCode = new CSharpCodeIntermediateNode() { Source = csharpCodeAttrValue.Source }; 798csharpCode.Source = csharpCode.Children.Count > 0 ? csharpCode.Children[0].Source : csharpCodeAttrValue.Source; 805var htmlContent = new HtmlContentIntermediateNode() { Source = markupBlock.Source }; 838expr.Source = expr.Children.Count > 0 ? expr.Children[0].Source : fallbackSource; 883Source = attributeValueSpan, 891Source = attributeValueSpan, 910Source = attributeValueSpan, 958Source = source.Source, 983mergedContent.Source = spanSource; 998Source = htmlValue.Source, 1139Source = elementNode.Source,
Language\DefaultTagHelperResolutionPhase.cs (12)
240Source = elementNode.Source, 435current.Source = MergeSourceSpans(cs, ns); 439current.Source = next.Source; 573htmlContent.Source ??= valueChild.Source; 585htmlContent.Source = MergeSourceSpans(fs, ls); 600Source = unresolvedLiteral.Source, 613Source = unresolvedExpr.Source, 618Source = unresolvedExpr.Source, 657var expr = new CSharpExpressionIntermediateNode() { Source = source }; 923expr.Source = expressionSource.WithLineIndex(exprLoc.Line) 967Source = source, 1278var htmlContent = new HtmlContentIntermediateNode() { Source = mergedSpan };
Language\DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs (25)
162prop.Source= unresolvedAttr.ValueSourceSpan ?? (prop.Children.Count > 0 ? prop.Children[0].Source : null); 192Source = null, 290Source = null, 302Source = ComputeValueSource(htmlAttr), 369var emptyHtml = new HtmlContentIntermediateNode() { Source = htmlAttr.Source }; 432var htmlContent = new HtmlContentIntermediateNode() { Source = tokenSource }; 500var htmlContent = new HtmlContentIntermediateNode() { Source = source }; 787var htmlContent = new HtmlContentIntermediateNode() { Source = tokenSource }; 795static (token) => new CSharpExpressionIntermediateNode() { Source = token.Source }); 800static (token) => new CSharpCodeIntermediateNode() { Source = token.Source }); 837var htmlContent = new HtmlContentIntermediateNode() { Source = htmlToken.Source }; 933var htmlContent = new HtmlContentIntermediateNode() { Source = source }; 1029var htmlContent = new HtmlContentIntermediateNode() { Source = htmlAttr.Source }; 1051var htmlContent = new HtmlContentIntermediateNode() { Source = htmlAttr.Source }; 1064var prefixHtml = new HtmlContentIntermediateNode() { Source = htmlAttr.Source }; 1075var hc = new HtmlContentIntermediateNode() { Source = tokenSource }; 1093var expr = new CSharpExpressionIntermediateNode() { Source = csharpToken.Source }; 1137current.Source = MergeSourceSpans(currentSource, nextSource); 1141current.Source = next.Source; 1322expr.Source = new SourceSpan(exprSource.FilePath, contentStart, openLoc.Line, openLoc.Character, contentLength, 0, closeLoc.Character + 1); 1337expr.Source = contentSpan; 1367expr.Source = tokenSpan; 1539expr.Source = expr.Children.Count > 0 ? expr.Children[0].Source : unresolvedExpr.Source; 1574var htmlContent = new HtmlContentIntermediateNode() { Source = pendingFirstSpan }; 1582htmlContent.Source = MergeSourceSpans(f, l);
Language\Extensions\AttributeDirectivePass.cs (1)
32Source = token.Source
Language\Extensions\DefaultTagHelperBodyIntermediateNode.cs (1)
25Source = bodyNode.Source;
Language\Extensions\DefaultTagHelperHtmlAttributeIntermediateNode.cs (1)
27Source = htmlAttributeNode.Source;
Language\Extensions\DefaultTagHelperPropertyIntermediateNode.cs (1)
29Source = propertyNode.Source;
Language\Extensions\PreallocatedTagHelperHtmlAttributeValueIntermediateNode.cs (1)
25Source = htmlAttributeNode.Source;
Language\Extensions\PreallocatedTagHelperPropertyIntermediateNode.cs (1)
31Source = propertyNode.Source;
Language\Intermediate\BaseTypeWithModel.cs (4)
30BaseType.Source = span[..greaterThanIndex]; 31GreaterThan.Source = span[greaterThanIndex..(greaterThanIndex + 1)]; 32ModelType.Source = span[(greaterThanIndex + 1)..^1]; 33LessThan.Source = span[^1..];
Language\Intermediate\ComponentAttributeIntermediateNode.cs (4)
61Source = attributeNode.Source; 85Source = propertyNode.Source; 103Source = node.Source; 123Source = node.Source;
Language\Intermediate\ComponentTypeArgumentIntermediateNode.cs (1)
21Source = node.Source;
Language\Intermediate\IntermediateToken.cs (2)
24Source = source; 35Source = source;
Language\Intermediate\ReferenceCaptureIntermediateNode.cs (1)
40Source = IdentifierToken.Source;
Language\Intermediate\SetKeyIntermediateNode.cs (1)
17Source = KeyValueToken.Source;
Mvc.Version2_X\RazorPageDocumentClassifierPass.cs (1)
103Source = pageDirective.Source,
Mvc\ModelDirective.cs (1)
104modelType.Source = null;
Mvc\RazorPageDocumentClassifierPass.cs (1)
122Source = pageDirective.Source,
331 references to Source
Microsoft.AspNetCore.Mvc.Razor.Extensions.UnitTests (13)
ModelDirectiveTest.cs (11)
88Assert.NotNull(baseType.BaseType.Source); 92Assert.NotNull(baseType.ModelType.Source); 117Assert.NotNull(baseType.BaseType.Source); 121Assert.NotNull(baseType.ModelType.Source); 145Assert.NotNull(baseType.BaseType.Source); 171Assert.NotNull(baseType.BaseType.Source); 175Assert.Null(baseType.ModelType.Source); 199Assert.Null(baseType.BaseType.Source); 203Assert.Null(baseType.ModelType.Source); 231Assert.Null(baseType.BaseType.Source); 235Assert.Null(baseType.ModelType.Source);
ModelExpressionPassTest.cs (2)
89var source = Assert.NotNull(originalNode.Source); 125var source = Assert.NotNull(originalNode.Source);
Microsoft.AspNetCore.Razor.Language.UnitTests (4)
Components\ComponentDuplicateAttributeDiagnosticPassTest.cs (3)
90Assert.Equal(node.Source, diagnostic.Span); 118Assert.Equal(node.Source, diagnostic.Span); 154Assert.Equal(node.Source, diagnostic.Span);
DefaultRazorIntermediateNodeLoweringPhaseIntegrationTest.cs (1)
188Assert.Equal(expectedSourceLocation, n.Source);
Microsoft.AspNetCore.Razor.Test.Common (2)
Language\IntegrationTests\IntermediateNodeWriter.cs (2)
310if (node.Source != null) 312WriteSourceRange(node.Source.Value);
Microsoft.CodeAnalysis.Razor.Compiler (312)
Language\CodeGeneration\CodeRenderingContext.cs (1)
116if (node.Source is not SourceSpan nodeSource)
Language\CodeGeneration\CodeWriterExtensions.cs (2)
514WritePropertyDeclarationPreamble(writer, modifiers, type.Content, name, type.Source, nameSpan: null, context); 781if (token.Source is { } source)
Language\CodeGeneration\DesignTimeNodeWriter.cs (10)
21if (node.Source is { FilePath: not null } sourceSpan) 58if (node.Source != null) 60using (context.BuildLinePragma(node.Source.Value)) 63context.CodeWriter.WritePadding(offset, node.Source, context); 108if (node.Source is SourceSpan nodeSource) 151if (firstChild.Source != null) 153using (context.BuildLinePragma(firstChild.Source.Value)) 156context.CodeWriter.WritePadding(offset, firstChild.Source, context); 183if (token.Source != null) 210if (token.Source is not SourceSpan tokenSource)
Language\CodeGeneration\RuntimeNodeWriter.cs (16)
39if (node.Source is { FilePath: not null } sourceSpan) 94using (context.BuildEnhancedLinePragma(firstCSharpChild?.Source, characterOffset)) 115using (context.BuildEnhancedLinePragma(csharpToken.Source)) 158using (context.BuildEnhancedLinePragma(token.Source)) 181var prefixLocation = node.Source.Value.AbsoluteIndex; 182var suffixLocation = node.Source.Value.AbsoluteIndex + node.Source.Value.Length - node.Suffix.Length; 207var prefixLocation = node.Source.Value.AbsoluteIndex; 208var valueLocation = node.Source.Value.AbsoluteIndex + node.Prefix.Length; 209var valueLength = node.Source.Value.Length; 243var prefixLocation = node.Source.Value.AbsoluteIndex; 253var valueLocation = node.Source.Value.AbsoluteIndex + node.Prefix.Length; 254var valueLength = node.Source.Value.Length - node.Prefix.Length; 269var prefixLocation = node.Source.Value.AbsoluteIndex; 270var valueLocation = node.Source.Value.AbsoluteIndex + node.Prefix.Length; 271var valueLength = node.Source.Value.Length - node.Prefix.Length;
Language\Components\ComponentBindLoweringPass.cs (12)
101node.Source, 116node.Source, 142node.Source, 149node.Source, 179node.Source, 201afterNode.Source, 355node.Source, 419bindNode.Source, 429bindGetNode.Source, 518Source = targetNode.Source, 540Source = targetNode.Source, 1021node.AddDiagnostic(ComponentDiagnosticFactory.Create_TemplateInvalidLocation(template.Source));
Language\Components\ComponentChildContentDiagnosticPass.cs (2)
41attribute.Source, 71node.Source,
Language\Components\ComponentDesignTimeNodeWriter.cs (16)
70if (node.Source is { FilePath: not null } sourceSpan) 112if (node.Source != null) 114using (context.BuildLinePragma(node.Source.Value)) 123context.CodeWriter.WritePadding(offset, node.Source, context); 185if (isWhiteSpace && node.Source is null) 192if (node.Source is SourceSpan nodeSource && !isWhiteSpace) 202writer.WritePadding(0, node.Source, context); 529using (context.BuildLinePragma(node.Source.AssumeNotNull())) 616WriteCSharpCode(context, new CSharpCodeIntermediateNode() { Source = renderMode.Source, Children = { renderMode.Children[0] } }); 1009Source = node.Source, 1102Source = node.Source, 1120Source = node.Source, 1139Source = node.Source, 1169if (token.Source?.FilePath == null) 1175using (context.BuildLinePragma(token.Source)) 1177context.CodeWriter.WritePadding(0, token.Source.Value, context);
Language\Components\ComponentDiagnosticFactory.cs (1)
100return RazorDiagnostic.Create(UnsupportedComplexContent, node.Source, attributeName, content);
Language\Components\ComponentDocumentClassifierPass.cs (3)
72ComponentDiagnosticFactory.Create_ComponentNamesCannotStartWithLowerCase(computedClass, documentNode.Source)); 122typeParameters.Add(new(name.Content, name.Source, constraints?.Content, constraints?.Source));
Language\Components\ComponentEventHandlerLoweringPass.cs (4)
131parent.Source, 150parent.Source, 196Source = node.Source, 239node.AddDiagnostic(ComponentDiagnosticFactory.Create_TemplateInvalidLocation(template.Source));
Language\Components\ComponentFormNameLoweringPass.cs (5)
35node.AddDiagnostic(ComponentDiagnosticFactory.CreateFormName_NotAForm(node.Source)); 48Source = node.Source 58Source = node.Source, 65Source = node.Source, 75result.Source = child.Source;
Language\Components\ComponentGenericTypePass.cs (2)
254node.AddDiagnostic(ComponentDiagnosticFactory.Create_GenericComponentTypeInferenceUnderspecified(node.Source, node, node.Component.GetTypeParameters())); 313node.AddDiagnostic(ComponentDiagnosticFactory.Create_GenericComponentMissingTypeArgument(node.Source, node, missing));
Language\Components\ComponentInjectDirectivePass.cs (3)
35var typeSpan = hasType ? tokens[0].Source : directive.Source?.GetZeroWidthEndSpan(); 40var memberSpan = hasMemberName ? tokens[1].Source : null;
Language\Components\ComponentLayoutDirectivePass.cs (1)
39IntermediateNodeFactory.CSharpToken(token.Content, documentNode.Options.DesignTime ? null : token.Source),
Language\Components\ComponentLoweringPass.cs (18)
142node.AddDiagnostic(ComponentDiagnosticFactory.Create_MultipleComponents(node.Source, node.TagName, matched)); 181node.Source, 351Source = node.Source, 389node.Source, 447Source = node.Source, 519_children.Add(RewriteChildContent(attribute, node.Source, node.Children)); 542var rewrittenChildContent = RewriteChildContent(attribute, child.Source, child.Children); 552child.AddDiagnostic(ComponentDiagnosticFactory.Create_ChildContentMixedWithExplicitChildContent(child.Source, _component)); 609childContent.AddDiagnostic(ComponentDiagnosticFactory.Create_ChildContentHasInvalidParameter(property.Source, property.AttributeName, attribute.Name)); 614childContent.AddDiagnostic(ComponentDiagnosticFactory.Create_ChildContentHasInvalidAttribute(property.Source, property.AttributeName, attribute.Name)); 619childContent.AddDiagnostic(ComponentDiagnosticFactory.Create_ChildContentHasInvalidAttribute(a.Source, a.AttributeName, attribute.Name)); 624childContent.AddDiagnostic(ComponentDiagnosticFactory.Create_ChildContentHasInvalidAttribute(directiveAttribute.Source, directiveAttribute.OriginalAttributeName, attribute.Name)); 663Source = htmlValue.Source, 676Source = expressionValue.Source, 689Source = codeValue.Source, 735_component.AddDiagnostic(ComponentDiagnosticFactory.Create_ChildContentHasInvalidParameterOnComponent(node.Source, node.AttributeName, _component.TagName)); 786Source = node.Source, 823Source = content.Source,
Language\Components\ComponentMarkupDiagnosticPass.cs (8)
52otherAttribute.Source ?? node.Source)); 59otherAttribute.Source ?? node.Source)); 96other.node.Source ?? node.Source)); 103other.node.Source ?? node.Source));
Language\Components\ComponentNodeWriter.cs (1)
67context.AddDiagnostic(ComponentDiagnosticFactory.Create_CodeBlockInAttribute(node.Source, content));
Language\Components\ComponentPageDirectivePass.cs (3)
36directive.Node.AddDiagnostic(ComponentDiagnosticFactory.CreatePageDirective_CannotBeImported(directive.Node.Source.GetValueOrDefault())); 59pageDirective.AddDiagnostic(ComponentDiagnosticFactory.CreatePageDirective_MustSpecifyRoute(pageDirective.Source)); 64@namespace.Children.Insert(index++, new RouteAttributeExtensionNode(routeToken.Content) { Source = routeToken.Source });
Language\Components\ComponentRenderModeDirectivePass.cs (2)
65Source = child.Source, 74? directiveToken.Source
Language\Components\ComponentRenderModeLoweringPass.cs (3)
33node.AddDiagnostic(ComponentDiagnosticFactory.CreateAttribute_ValidOnlyOnComponent(node.Source, node.OriginalAttributeName)); 43var renderModeNode = new RenderModeIntermediateNode() { Source = node.Source, Children = { expression } }; 49node.Source,
Language\Components\ComponentRuntimeNodeWriter.cs (9)
40if (node.Source is null && isWhitespaceStatement) 91using (context.BuildEnhancedLinePragma(firstCSharpChild?.Source, characterOffset)) 318if (node.Source is { FilePath: not null } sourceSpan) 596WriteCSharpCode(context, new CSharpCodeIntermediateNode() { Source = renderMode.Source, Children = { renderMode.Children[0] } }); 902Source = node.Source, 996Source = node.Source, 1010Source = node.Source, 1223if (token.Source?.FilePath == null) 1229using (context.BuildEnhancedLinePragma(token.Source))
Language\Components\ComponentSplatLoweringPass.cs (1)
39Source = node.Source,
Language\Components\ComponentTemplateDiagnosticPass.cs (1)
37parent.AddDiagnostic(ComponentDiagnosticFactory.Create_TemplateInvalidLocation(node.Source));
Language\Components\RouteAttributeExtensionNode.cs (1)
30using (context.BuildEnhancedLinePragma(Source))
Language\DefaultRazorCSharpLoweringPhase.cs (1)
141using (writer.BuildNamespace(node.Name, node.Source, _context))
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (15)
898if (node.Source is SourceSpan source) 1013.FirstOrDefault(child => child.Source != null) 1014?.Source; 1018var contentLength = node.Children.Sum(child => child.Source?.Length ?? 0); 1575if (existingHtmlContent.Source == null && source == null) 1582existingHtmlContent.Source != null && 1583existingHtmlContent.Source.Value.FilePath == source.Value.FilePath && 1584existingHtmlContent.Source.Value.AbsoluteIndex + existingHtmlContent.Source.Value.Length == source.Value.AbsoluteIndex) 1940if (existingHtmlContent.Source == null && source == null) 1947existingHtmlContent.Source != null && 1948existingHtmlContent.Source.Value.FilePath == source.Value.FilePath && 1949existingHtmlContent.Source.Value.AbsoluteIndex + existingHtmlContent.Source.Value.Length == source.Value.AbsoluteIndex) 2156ComponentDiagnosticFactory.Create_UnsupportedComponentImportContent(expressionNode.Source));
Language\DefaultTagHelperResolutionPhase.ComponentTagHelperResolver.cs (38)
36ComponentDiagnosticFactory.Create_UnexpectedMarkupElement(tagName, elementNode.StartTagSpan ?? elementNode.Source)); 60ComponentDiagnosticFactory.Create_UnexpectedMarkupElement(originalNode.TagName, originalNode.StartTagSpan ?? originalNode.Source)); 280?? (directiveNode.Children.Count > 0 ? directiveNode.Children[0].Source : null); 303expr.Source = expr.Children.Count > 0 ? expr.Children[0].Source : directiveNode.Source; 360prop.Source = unresolvedAttr.ValueSourceSpan ?? (prop.Children.Count > 0 ? prop.Children[0].Source : null); 442csharpExprAttrValue.Prefix + "@" + firstToken.Content, firstToken.Source); 449var expr = new CSharpExpressionIntermediateNode() { Source = csharpExprAttrValue.Source }; 456csharpExprAttrValue.Prefix + "@" + csharpToken.Content, csharpToken.Source)); 480var expr = new CSharpExpressionIntermediateNode() { Source = csharpExprAttrValue.Source }; 490var expr = new CSharpExpressionIntermediateNode() { Source = csharpCodeAttrValue.Source }; 497ConvertHtmlTokensToCSharp(child.Children, ref newChildren.AsRef(), child.Source, wrapLiteralsInCSharpExpression); 560if (csharpToken.Source is { } s) 573if (innerToken.Source is { } s) 643var mergedSource = ExtendSpanBackward(htmlToken.Source, prefix.Length); 652htmlContent.Source ??= valueChild.Source; 676expr.Source = expr.Children.Count > 0 ? expr.Children[0].Source : unresolvedExpr.Source; 682var htmlContent = new HtmlContentIntermediateNode() { Source = token.Source }; 751ConvertExpressionChildToCSharpExpression(node, i, csharpExprAttrValue.Prefix, csharpExprAttrValue.Children, csharpExprAttrValue.Source); 760ConvertExpressionChildToCSharpExpression(node, i, unresolvedExprAttrValue.Prefix, unresolvedExprAttrValue.Children, unresolvedExprAttrValue.Source); 775var mergedSource = ExtendSpanBackward(firstToken.Source, prefix.Length); 778htmlContent.Source = mergedSource ?? htmlAttrValue.Source; 787htmlContent.Source = htmlAttrValue.Source; 796var csharpCode = new CSharpCodeIntermediateNode() { Source = csharpCodeAttrValue.Source }; 798csharpCode.Source = csharpCode.Children.Count > 0 ? csharpCode.Children[0].Source : csharpCodeAttrValue.Source; 805var htmlContent = new HtmlContentIntermediateNode() { Source = markupBlock.Source }; 838expr.Source = expr.Children.Count > 0 ? expr.Children[0].Source : fallbackSource; 958Source = source.Source, 973var spanSource = firstValue.Source; 977var totalLength = source.Children[^1] is HtmlAttributeValueIntermediateNode lastValue && lastValue.Source is { } ls 998Source = htmlValue.Source, 1019if (htmlAttr.Source is not SourceSpan attrSource) 1051if (htmlAttr.Children is [{ Source: SourceSpan childSource }, ..]) 1061if (lastChild.Source is SourceSpan lastSource) 1076if (htmlAttr.Source is not SourceSpan attrSource) 1139Source = elementNode.Source,
Language\DefaultTagHelperResolutionPhase.cs (28)
240Source = elementNode.Source, 334var diagSource = elementNode.StartTagNameSpan ?? elementNode.Source; 354var diagSource = elementNode.StartTagNameSpan ?? elementNode.Source; 371var diagSource = elementNode.StartTagNameSpan ?? elementNode.Source; 432if (current.Source is SourceSpan cs && next.Source is SourceSpan ns) 437else if (current.Source == null) 439current.Source = next.Source; 507child.Source ?? SourceSpan.Undefined, childTagName, parentTagName, allowedChildrenString)); 522child.Source ?? SourceSpan.Undefined, childTagName, parentTagName, allowedChildrenString)); 534child.Source ?? SourceSpan.Undefined, parentTagName, allowedChildrenString)); 543child.Source ?? SourceSpan.Undefined, parentTagName, allowedChildrenString)); 573htmlContent.Source ??= valueChild.Source; 581var firstSrc = htmlContent.Children[0].Source; 582var lastSrc = htmlContent.Children[^1].Source; 600Source = unresolvedLiteral.Source, 613Source = unresolvedExpr.Source, 618Source = unresolvedExpr.Source, 704target.Children.Add(new CSharpIntermediateToken(token.Content, token.Source)); 788if (token.Source is SourceSpan tokenSource) 794else if (child.Source is SourceSpan childSource) 945var source = attrValue.Children.Count > 0 ? attrValue.Children[0].Source : attrValue.Source; 956? IntermediateNodeFactory.CSharpToken(htmlToken, static t => t.Content, htmlToken.Source) 957: new CSharpIntermediateToken(htmlToken.Content, htmlToken.Source); 1039if (htmlToken.Source is { } s) 1100var diagSource = elementNode.Source; 1157elementNode.Source ?? SourceSpan.Undefined,
Language\DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs (47)
162prop.Source= unresolvedAttr.ValueSourceSpan ?? (prop.Children.Count > 0 ? prop.Children[0].Source : null); 369var emptyHtml = new HtmlContentIntermediateNode() { Source = htmlAttr.Source }; 370emptyHtml.Children.Add(new HtmlIntermediateToken(string.Empty, htmlAttr.Source)); 573if (htmlAttr.Source is SourceSpan attrSource && sourceDocument != null) 627if (intermediateToken.Content == "@" && intermediateToken.Source is SourceSpan src) 633targetNode.Children.Add(new CSharpIntermediateToken(intermediateToken.Content, intermediateToken.Source)); 638targetNode.Children.Add(new CSharpIntermediateToken(intermediateToken.Content, intermediateToken.Source)); 655var tokenSource = htmlAttrValue.Children.Count > 0 ? htmlAttrValue.Children[0].Source : htmlAttrValue.Source; 687if (firstInnerChild.Source is SourceSpan innerSource) 700if (lastInnerChild.Source is SourceSpan lastSource) 720if (htmlAttr.Source is SourceSpan attrSource && sourceDocument != null) 754targetNode.Children.Add(new CSharpIntermediateToken(innerToken.Content, innerToken.Source)); 795static (token) => new CSharpExpressionIntermediateNode() { Source = token.Source }); 800static (token) => new CSharpCodeIntermediateNode() { Source = token.Source }); 837var htmlContent = new HtmlContentIntermediateNode() { Source = htmlToken.Source }; 853if (htmlAttr.Source is not SourceSpan attrSource) 931var source = htmlAttr.Source; 1029var htmlContent = new HtmlContentIntermediateNode() { Source = htmlAttr.Source }; 1030htmlContent.Children.Add(new HtmlIntermediateToken(attrContent, htmlAttr.Source)); 1051var htmlContent = new HtmlContentIntermediateNode() { Source = htmlAttr.Source }; 1052htmlContent.Children.Add(new HtmlIntermediateToken(attrContent, htmlAttr.Source)); 1064var prefixHtml = new HtmlContentIntermediateNode() { Source = htmlAttr.Source }; 1065prefixHtml.Children.Add(new HtmlIntermediateToken(prefix, htmlAttr.Source)); 1093var expr = new CSharpExpressionIntermediateNode() { Source = csharpToken.Source }; 1135if (current.Source is SourceSpan currentSource && next.Source is SourceSpan nextSource) 1139else if (current.Source == null) 1141current.Source = next.Source; 1213if (a.Source == null || b.Source == null) 1218if (a.Source is SourceSpan aSource && b.Source is SourceSpan bSource) 1296if (firstExpr.Source is { } exprSource && exprSource.Length > 1) 1305if (htmlAttr.Children[i] is UnresolvedAttributeValueIntermediateNode lit && lit.Source is { } litSrc) 1433if (i + 1 < htmlAttr.Children.Count && htmlAttr.Children[i + 1].Source is { } nextSrc) 1444if (unresolvedExpr.ContainsExpression && unresolvedExpr.Source is { Length: > 1 } exprSrc) 1491var mergedSource = ExtendSpanBackward(htmlToken.Source, prefix.Length); 1504pendingLiteralParts.Add((htmlToken.Content, htmlToken.Source)); 1505if (htmlToken.Source is { } s) 1539expr.Source = expr.Children.Count > 0 ? expr.Children[0].Source : unresolvedExpr.Source; 1602codeChild.Source ?? elementNode.Source ?? SourceSpan.Undefined, elementNode.TagName)); 1610var diagSource = exprChild.Source ?? elementNode.Source ?? SourceSpan.Undefined; 1644if (token.Source is { } s)
Language\Extensions\AttributeDirectivePass.cs (2)
32Source = token.Source 35node.Children.Add(IntermediateNodeFactory.CSharpToken(token.Content, token.Source));
Language\Extensions\DefaultTagHelperBodyIntermediateNode.cs (1)
25Source = bodyNode.Source;
Language\Extensions\DefaultTagHelperHtmlAttributeIntermediateNode.cs (1)
27Source = htmlAttributeNode.Source;
Language\Extensions\DefaultTagHelperPropertyIntermediateNode.cs (1)
29Source = propertyNode.Source;
Language\Extensions\DefaultTagHelperTargetExtension.cs (9)
365var firstMappedChild = node.Children.FirstOrDefault(child => child.Source != null) as IntermediateNode; 366var valueStart = firstMappedChild?.Source; 368using (context.BuildLinePragma(node.Source)) 379context.CodeWriter.WritePadding(assignmentPrefixLength, node.Source, context); 389context.CodeWriter.WritePadding(assignmentPrefixLength, node.Source, context); 404RenderTagHelperAttributeInline(context, node, node.Source); 430RenderTagHelperAttributeInline(context, node, node.Source); 532if (node.Source != null) 541using (context.BuildEnhancedLinePragma(token.Source))
Language\Extensions\DesignTimeDirectiveTargetExtension.cs (8)
39if (!node.Source.HasValue || 42node.Source.Value.FilePath, 77using (context.BuildLinePragma(node.Source)) 111using (context.BuildLinePragma(node.Source)) 143using (context.BuildLinePragma(node.Source)) 177using (context.BuildLinePragma(node.Source)) 205using (context.BuildLinePragma(node.Source)) 234using (context.BuildLinePragma(node.Source))
Language\Extensions\FunctionsDirectivePass.cs (2)
54return s_nullableIntComparer.Compare(n1.Node.Source?.AbsoluteIndex, n2.Node.Source?.AbsoluteIndex);
Language\Extensions\ImplementsDirectivePass.cs (1)
33var source = codeDocument.ParserOptions.DesignTime ? null : token.Source;
Language\Extensions\InheritsDirectivePass.cs (1)
28var source = codeDocument.ParserOptions.DesignTime ? null : token.Source;
Language\Extensions\MetadataAttributeTargetExtension.cs (2)
62if (node.Source.HasValue && !context.Options.DesignTime) 70using (context.BuildEnhancedLinePragma(node.Source))
Language\Extensions\PreallocatedTagHelperHtmlAttributeValueIntermediateNode.cs (1)
25Source = htmlAttributeNode.Source;
Language\Extensions\PreallocatedTagHelperPropertyIntermediateNode.cs (1)
31Source = propertyNode.Source;
Language\Intermediate\ComponentAttributeIntermediateNode.cs (4)
61Source = attributeNode.Source; 85Source = propertyNode.Source; 103Source = node.Source; 123Source = node.Source;
Language\Intermediate\ComponentTypeArgumentIntermediateNode.cs (3)
21Source = node.Source; 35source: t.Source) 36: new CSharpIntermediateToken(t.Content, t.Source),
Language\Intermediate\IntermediateNodeFormatter.cs (1)
106_builder.Append(node.Source?.ToString() ?? "(n/a)");
Language\Intermediate\ReferenceCaptureIntermediateNode.cs (1)
40Source = IdentifierToken.Source;
Language\Intermediate\SetKeyIntermediateNode.cs (1)
17Source = KeyValueToken.Source;
Mvc.Version2_X\InstrumentationPass.cs (6)
85if (node.Source != null) 87Items.Add(new InstrumentationItem(node, Parent!, isLiteral: true, source: node.Source.Value)); 95if (node.Source != null) 97Items.Add(new InstrumentationItem(node, Parent!, isLiteral: false, source: node.Source.Value)); 105if (node.Source != null) 107Items.Add(new InstrumentationItem(node, Parent!, isLiteral: false, source: node.Source.Value));
Mvc.Version2_X\NamespaceDirective.cs (1)
85var directiveSource = NormalizeDirectory(directive.Source?.FilePath);
Mvc.Version2_X\RazorPageDocumentClassifierPass.cs (2)
117RazorExtensionsDiagnosticFactory.CreatePageDirective_CannotBeImported(pageDirective.DirectiveNode.Source.AssumeNotNull())); 133RazorExtensionsDiagnosticFactory.CreatePageDirective_MustExistAtTheTopOfFile(pageDirective.DirectiveNode.Source.AssumeNotNull()));
Mvc\InjectDirective.cs (3)
74var typeSpan = hasType ? tokens[0].Source : directive.Source?.GetZeroWidthEndSpan(); 79var memberSpan = hasMemberName ? tokens[1].Source : null;
Mvc\InjectTargetExtension.cs (2)
52if (node.Source.HasValue) 54using (context.BuildLinePragma(node.Source.Value))
Mvc\ModelDirective.cs (1)
59return IntermediateNodeFactory.CSharpToken(tokens[0].Content, tokens[0].Source);
Mvc\PageDirective.cs (1)
71sourceSpan = tokens[0].Source;
Mvc\RazorPageDocumentClassifierPass.cs (2)
136RazorExtensionsDiagnosticFactory.CreatePageDirective_CannotBeImported(pageDirective.DirectiveNode.Source.AssumeNotNull())); 152RazorExtensionsDiagnosticFactory.CreatePageDirective_MustExistAtTheTopOfFile(pageDirective.DirectiveNode.Source.AssumeNotNull()));