120 instantiations of SourceSpan
Microsoft.CodeAnalysis.Razor.Compiler (119)
CSharp\TextSpanExtensions.cs (1)
15return new SourceSpan(filePath: null, absoluteIndex: textSpan.Start, lineIndex: -1, characterIndex: -1, length: textSpan.Length);
Language\CodeGeneration\CodeRenderingContext.cs (1)
141var generatedLocation = new SourceSpan(
Language\Components\ComponentBindLoweringPass.cs (1)
1099return new SourceSpan(span.FilePath,
Language\DefaultDirectiveSyntaxTreePass.cs (1)
85var error = RazorDiagnosticFactory.CreateParsing_SectionsCannotBeNested(new SourceSpan(directiveStart, errorLength));
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (5)
900node.Source = new SourceSpan( 932return new SourceSpan( 945return new SourceSpan( 961return new SourceSpan( 1020node.Source = new SourceSpan(
Language\DefaultTagHelperResolutionPhase.cs (6)
821return new SourceSpan( 852new SourceSpan(filePath, exprStart, atLoc.Line, atLoc.Character, 1, 0, atLoc.Character + 1))); 863new SourceSpan(filePath, exprStart, loc.Line, loc.Character, exprLength, 0, loc.Character + exprLength))); 884new SourceSpan(filePath, parenStart, openLoc.Line, openLoc.Character, 1, 0, openLoc.Character + 1))); 896new SourceSpan(filePath, innerStart, innerLoc.Line, innerLoc.Character, innerLen, 0, innerLoc.Character + innerLen))); 904new SourceSpan(filePath, closePos, closeLoc.Line, closeLoc.Character, 1, 0, closeLoc.Character + 1)));
Language\DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs (12)
598var valueSource = new SourceSpan( 676var emptySource = new SourceSpan(atSrc.FilePath, transAbsIdx, atSrc.LineIndex, transCharIdx, 0, 0, transCharIdx); 679var transSource = new SourceSpan(atSrc.FilePath, transAbsIdx, atSrc.LineIndex, transCharIdx, 1, 0, transCharIdx + 1); 691var openSource = new SourceSpan(innerSource.FilePath, openAbsIndex, innerSource.LineIndex, openCharIndex, 1, 0, openCharIndex + 1); 704var closeSource = new SourceSpan(lastSource.FilePath, closeAbsIndex, lastSource.LineIndex, closeCharIndex, 1, 0, closeCharIndex + 1); 740var openParenSource = new SourceSpan( 766var closeParenSource = new SourceSpan( 864return new SourceSpan( 1342expr.Source = new SourceSpan(exprSource.FilePath, contentStart, openLoc.Line, openLoc.Character, contentLength, 0, closeLoc.Character + 1); 1348var contentSpan = new SourceSpan( 1456emptySpan = new SourceSpan(nextSrc.FilePath, nextSrc.AbsoluteIndex, loc.Line, loc.Character, 0, 0, loc.Character); 1633diagSource = new SourceSpan(
Language\Legacy\CSharpCodeParser.cs (40)
354new SourceSpan(CurrentStart, CurrentToken.Content.Length)); 412new SourceSpan(CurrentStart, CurrentToken.Content.Length))); 418new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); 424new SourceSpan(CurrentStart, CurrentToken.Content.Length), 468new SourceSpan(block.Start, contentLength: 1 /* ( */), block.Name, ")", "(")); 725new SourceSpan(block.Start, contentLength: 1 /* { OR } */), block.Name, "}", "{")); 852new SourceSpan(location, contentLength: 1 /* @ */))); 885new SourceSpan(block.Start, contentLength: 1 /* { OR } */), block.Name, "}", "{")); 947new SourceSpan(CurrentStart, contentLength: 1 /* { */))); 1072new SourceSpan(CurrentStart, contentLength: 1 /* @ */))); 1148new SourceSpan(CurrentStart, contentLength: 1 /* @ */))); 1209new SourceSpan(CurrentStart, currentDirective.Length), currentDirective)); 1233new SourceSpan(directiveStart, errorLength), 1345new SourceSpan(keywordStartLocation, keywordLength), keyword)); 1367new SourceSpan(valueStartLocation.Value, rawValue.Length), keyword)); 1456new SourceSpan(directiveLocation, Math.Max(text?.Length ?? 0, 1)), text ?? string.Empty)); 1512new SourceSpan(directiveLocation, prefix.Length), 1572new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1625new SourceSpan(CurrentStart, contentLength: 1), 1639new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1651new SourceSpan(CurrentStart, identifierLength), descriptor.Directive)); 1668new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1683new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1698new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1716new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1737new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive, CurrentToken.Content, lastSeenMemberIdentifier ?? string.Empty)); 1767new SourceSpan(CurrentStart, CurrentToken.Content.Length), 1790new SourceSpan(CurrentStart, identifierLength), descriptor.Directive)); 1830new SourceSpan(CurrentStart, CurrentToken.Content.Length), 1945new SourceSpan(directiveStart, errorLength), descriptor.Directive)); 2018new SourceSpan(CurrentStart, contentLength: 1 /* { */), descriptor.Directive, "{")); 2024new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive, "{")); 2054new SourceSpan(startingBraceLocation, contentLength: 1 /* } */), descriptor.Directive, "}", "{")); 2216new SourceSpan(CurrentStart, CurrentToken.Content.Length))); 2224new SourceSpan(CurrentStart, contentLength: 2 /* @: */))); 2232new SourceSpan(CurrentStart, contentLength: 2 /* @@ */))); 2494new SourceSpan(block.Start, block.Name.Length))); 2739new SourceSpan(CurrentStart, CurrentToken.Content.Length), CurrentToken.Content)); 2921new SourceSpan(start, contentLength: 1 /* { OR } */), 2998new SourceSpan(start, contentLength: 1 /* { OR } */),
Language\Legacy\HtmlMarkupParser.cs (8)
160new SourceSpan(CurrentStart, CurrentToken.Content.Length))); 338new SourceSpan( 553new SourceSpan(SourceLocationTracker.Advance(endTagStartLocation, "</"), Math.Max(endTagName.Length, 1)), endTagName)); 569new SourceSpan( 689new SourceSpan( 815new SourceSpan(textLocation, contentLength: 4 /* text */))); 970new SourceSpan(textLocation, contentLength: 4 /* text */))); 1547new SourceSpan(SourceLocationTracker.Advance(tagStart, "</"), ScriptTagName.Length),
Language\Legacy\NativeCSharpTokenizer.cs (3)
561new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); 591new SourceSpan(CurrentStart, contentLength: 1 /* " */))); 608new SourceSpan(CurrentStart, contentLength: 1 /* end of file */)));
Language\Legacy\RoslynCSharpTokenizer.cs (7)
393new SourceSpan(CurrentStart, contentLength: expectedPrefix?.Length ?? 0 /* " */))); 500new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); 528new SourceSpan(CurrentStart, contentLength: trivia.FullSpan.Length))); 546new SourceSpan(CurrentStart, contentLength: trivia.FullSpan.Length))); 556new SourceSpan(CurrentStart, contentLength: directiveTrivia.FullSpan.Length))); 590new SourceSpan( 603new SourceSpan(
Language\Legacy\TagHelperBlockRewriter.cs (3)
113var location = new SourceSpan(codeBlock.GetSourceLocation(source), codeBlock.Width); 190var errorLocation = new SourceSpan(attributeNameLocation, result.AttributeName.Length); 200var errorLocation = new SourceSpan(attributeNameLocation, result.AttributeName.Length);
Language\Legacy\TagHelperParseTreeRewriter.cs (9)
142var source = new SourceSpan(SourceLocationTracker.Advance(startTag.GetSourceLocation(_source), "<"), tagName.Length); 187new SourceSpan(SourceLocationTracker.Advance(endTag.GetSourceLocation(_source), "</"), tagName.Length), tagName)); 368new SourceSpan(SourceLocationTracker.Advance(endTag.GetSourceLocation(_source), "</"), tagName.Length), 493new SourceSpan(tagBlock.GetSourceLocation(_source), tagBlock.Width), 515new SourceSpan(errorStart, tagName.Length), tagName)); 532new SourceSpan(errorStart, tagName.Length), tagName)); 587new SourceSpan(errorStart, length), 705new SourceSpan(errorStart, tagName.Length), 723new SourceSpan(errorStart, tagName.Length),
Language\Legacy\TokenizerBackedParser.cs (2)
385new SourceSpan(start, contentLength: 2 /* @* */)); 395new SourceSpan(start, contentLength: 2 /* @* */));
Language\SourceChange.cs (1)
31Span = new SourceSpan(absoluteIndex, length);
Language\SourceSpan.cs (10)
14public static readonly SourceSpan Undefined = new SourceSpan(SourceLocation.Undefined, 0); 101return new SourceSpan(FilePath, AbsoluteIndex + Length, LineIndex, characterIndex: EndCharacterIndex, length: 0, lineCount: 0, EndCharacterIndex); 106return new SourceSpan(FilePath, AbsoluteIndex + startIndex, LineIndex, CharacterIndex + startIndex, length, LineCount, endCharacterIndex: CharacterIndex + startIndex + length); 130public readonly SourceSpan WithFilePath(string filePath) => new(filePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 131public readonly SourceSpan WithAbsoluteIndex(int absoluteIndex) => new(FilePath, absoluteIndex, LineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 132public readonly SourceSpan WithLineIndex(int lineIndex) => new(FilePath, AbsoluteIndex, lineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 133public readonly SourceSpan WithCharacterIndex(int characterIndex) => new(FilePath, AbsoluteIndex, LineIndex, characterIndex, Length, LineCount, EndCharacterIndex); 134public readonly SourceSpan WithLength(int length) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, length, LineCount, EndCharacterIndex); 135public readonly SourceSpan WithLineCount(int lineCount) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, lineCount, EndCharacterIndex); 136public readonly SourceSpan WithEndCharacterIndex(int endCharacterIndex) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, LineCount, endCharacterIndex);
Language\SpanComputer.cs (1)
115return new SourceSpan(source.FilePath, absoluteIndex: start, startLinePosition.Line, startLinePosition.Character, length, lineCount, endLinePosition.Character);
Language\Syntax\SyntaxNodeExtensions.cs (2)
123return new SourceSpan(location.FilePath, location.AbsoluteIndex, location.LineIndex, location.CharacterIndex, node.Width, lineCount, endLocation.Character); 131return new SourceSpan(location.FilePath, location.AbsoluteIndex, location.LineIndex, location.CharacterIndex, token.Width, lineCount, endLocation.Character);
Mvc\InjectDirective.cs (1)
92typeSpan = new SourceSpan(typeSpan.Value.FilePath, typeSpan.Value.AbsoluteIndex, typeSpan.Value.LineIndex, typeSpan.Value.CharacterIndex, typeSpan.Value.Length - tModel.Length, typeSpan.Value.LineCount, typeSpan.Value.EndCharacterIndex - tModel.Length);
Mvc\RazorExtensionsDiagnosticFactory.cs (5)
22new SourceSpan(SourceLocation.Undefined, contentLength: 0), 35new SourceSpan(SourceLocation.Undefined, contentLength: 0), 48new SourceSpan(SourceLocation.Undefined, contentLength: 0), 61new SourceSpan(SourceLocation.Undefined, contentLength: 0), 73new SourceSpan(SourceLocation.Undefined, contentLength: 0),
rzc (1)
Json\ObjectReaders.cs (1)
26var span = new SourceSpan(filePath, absoluteIndex, lineIndex, characterIndex, length);
348 references to SourceSpan
Microsoft.CodeAnalysis.Razor.Compiler (341)
CSharp\SourceSpanExtensions.cs (1)
13public static TextSpan AsTextSpan(this SourceSpan sourceSpan)
CSharp\TextSpanExtensions.cs (1)
13public static SourceSpan AsSourceSpan(this TextSpan textSpan)
Language\CodeGeneration\CodeRenderingContext.cs (3)
116if (node.Source is not SourceSpan nodeSource) 124public void AddSourceMappingFor(SourceSpan source, int offset = 0) 141var generatedLocation = new SourceSpan(
Language\CodeGeneration\CodeRenderingContextExtensions.cs (8)
12this CodeRenderingContext context, SourceSpan? span, bool suppressLineDefaultAndHidden = false) 15return span is SourceSpan spanValue && !spanValue.FilePath.IsNullOrEmpty() 21this CodeRenderingContext context, SourceSpan? span, int characterOffset = 0, bool suppressLineDefaultAndHidden = false) 24return span is SourceSpan spanValue && !spanValue.FilePath.IsNullOrEmpty() 32private readonly SourceSpan _span; 39SourceSpan span, 53public static LinePragmaScope Standard(CodeRenderingContext context, SourceSpan span, bool suppressLineDefaultAndHidden) 65public static LinePragmaScope Enhanced(CodeRenderingContext context, SourceSpan span, int characterOffset, bool suppressLineDefaultAndHidden)
Language\CodeGeneration\CodeWriterExtensions.cs (10)
80public static CodeWriter WritePadding(this CodeWriter writer, int offset, SourceSpan? span, CodeRenderingContext context) 303public static CodeWriter WriteEnhancedLineNumberDirective(this CodeWriter writer, SourceSpan span, int characterOffset, bool ensurePathBackslashes) 325public static CodeWriter WriteLineNumberDirective(this CodeWriter writer, SourceSpan span, bool ensurePathBackslashes) 526SourceSpan? typeSpan = null, 527SourceSpan? nameSpan = null, 556SourceSpan? typeSpan, 557SourceSpan? nameSpan, 566static void WriteToken(CodeWriter writer, string content, SourceSpan? span, CodeRenderingContext context) 658public static CSharpCodeWritingScope BuildNamespace(this CodeWriter writer, string? name, SourceSpan? span, CodeRenderingContext context) 796static void WriteWithPragma(string content, CodeRenderingContext context, SourceSpan source)
Language\Components\ComponentBindLoweringPass.cs (2)
1084private static SourceSpan? GetOriginalPropertySpan(IntermediateNode node) 1095if (originalSpan is SourceSpan span)
Language\Components\ComponentDiagnosticFactory.cs (42)
23public static RazorDiagnostic Create_UnsupportedTagHelperDirective(SourceSpan? source) 33public static RazorDiagnostic Create_CodeBlockInAttribute(SourceSpan? source, string expression) 41public static RazorDiagnostic Create_UnclosedTag(SourceSpan? span, string tagName) 49public static RazorDiagnostic Create_UnexpectedClosingTag(SourceSpan? span, string tagName) 57public static RazorDiagnostic Create_UnexpectedClosingTagForVoidElement(SourceSpan? span, string tagName) 65public static RazorDiagnostic Create_InvalidHtmlContent(SourceSpan? span, string text) 73public static RazorDiagnostic Create_MultipleComponents(SourceSpan? span, string tagName, IEnumerable<TagHelperDescriptor> components) 86public static RazorDiagnostic Create_AmbiguousComponentSelection(SourceSpan? span, string tagName, TagHelperDescriptor genericComponent, TagHelperDescriptor nonGenericComponent) 108public static RazorDiagnostic CreatePageDirective_CannotBeImported(SourceSpan source) 120public static RazorDiagnostic CreatePageDirective_MustSpecifyRoute(SourceSpan? source) 129SourceSpan? source, string attribute, IEnumerable<TagHelperDirectiveAttributeIntermediateNode> attributes) 141public static RazorDiagnostic CreateEventHandler_Duplicates(SourceSpan? source, string attribute, TagHelperDirectiveAttributeIntermediateNode[] attributes) 154public static RazorDiagnostic CreateBindAttribute_InvalidSyntax(SourceSpan? source, string attribute) 164public static RazorDiagnostic Create_DisallowedScriptTag(SourceSpan? source) 172public static RazorDiagnostic Create_TemplateInvalidLocation(SourceSpan? source) 180public static RazorDiagnostic Create_ChildContentSetByAttributeAndBody(SourceSpan? source, string attribute) 189public static RazorDiagnostic Create_ChildContentMixedWithExplicitChildContent(SourceSpan? source, ComponentIntermediateNode component) 201public static RazorDiagnostic Create_ChildContentHasInvalidAttribute(SourceSpan? source, string attribute, string element) 209public static RazorDiagnostic Create_ChildContentHasInvalidParameter(SourceSpan? source, string attribute, string element) 219SourceSpan? source, 245SourceSpan? source, 262SourceSpan? source, 277public static RazorDiagnostic Create_ChildContentHasInvalidParameterOnComponent(SourceSpan? source, string attribute, string element) 285public static RazorDiagnostic Create_UnsupportedComponentImportContent(SourceSpan? source) 293public static RazorDiagnostic CreateBindAttributeParameter_MissingBind(SourceSpan? source, string attribute) 304public static RazorDiagnostic Create_DuplicateMarkupAttribute(string attributeName, SourceSpan? source = null) 313public static RazorDiagnostic Create_DuplicateMarkupAttributeDirective(string attributeName, string directiveAttributeName, SourceSpan? source = null) 321public static RazorDiagnostic Create_DuplicateComponentParameter(string attributeName, SourceSpan? source = null) 330public static RazorDiagnostic Create_DuplicateComponentParameterDirective(string attributeName, string directiveAttributeName, SourceSpan? source = null) 338public static RazorDiagnostic Create_ComponentNamesCannotStartWithLowerCase(string componentName, SourceSpan? source = null) 346public static RazorDiagnostic Create_UnexpectedMarkupElement(string elementName, SourceSpan? source = null) 354public static RazorDiagnostic Create_InconsistentStartAndEndTagName(string startTagName, string endTagName, SourceSpan? source = null) 362public static RazorDiagnostic CreateEventHandlerParameter_Duplicates(SourceSpan? source, string attribute, TagHelperDirectiveAttributeParameterIntermediateNode[] attributes) 374public static RazorDiagnostic CreateBindAttributeParameter_UseBindGet(SourceSpan? source, string attribute) 383public static RazorDiagnostic CreateBindAttributeParameter_MissingBindGet(SourceSpan? source, string attribute) 391public static RazorDiagnostic CreateBindAttribute_MissingBindSet(SourceSpan? source, string attributeGet, string attributeSet) 399public static RazorDiagnostic CreateBindAttributeParameter_InvalidSyntaxBindAndBindGet(SourceSpan? source, string attribute) 407public static RazorDiagnostic CreateBindAttributeParameter_InvalidSyntaxBindSetAfter(SourceSpan? source, string attribute) 415public static RazorDiagnostic CreateBindAttributeParameter_UnsupportedSyntaxBindGetSet(SourceSpan? source, string attribute) 425public static RazorDiagnostic CreateFormName_NotAForm(SourceSpan? source) 433public static RazorDiagnostic CreateAttribute_ValidOnlyOnComponent(SourceSpan? source, string attribute) 441public static RazorDiagnostic CreateRenderModeAttribute_ComponentDeclaredRenderMode(SourceSpan? source, string component)
Language\Components\ComponentInjectIntermediateNode.cs (4)
22public ComponentInjectIntermediateNode(string typeName, string memberName, SourceSpan? typeSpan, SourceSpan? memberSpan) 34public SourceSpan? TypeSpan { get; } 36public SourceSpan? MemberSpan { get; }
Language\Components\ComponentLoweringPass.cs (1)
570private ComponentChildContentIntermediateNode RewriteChildContent(BoundAttributeDescriptor attribute, SourceSpan? source, IntermediateNodeCollection children)
Language\Components\ComponentNodeWriter.cs (2)
385var attributeSourceSpan = (SourceSpan)(attribute.PropertySpan ?? attribute.OriginalAttributeSpan);
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (5)
266public UsingReference(string @namespace, SourceSpan? source, bool hasExplicitSemicolon) 274public SourceSpan? Source { get; } 529protected SourceSpan? BuildSourceSpanFromNode(SyntaxNode node) 898if (node.Source is SourceSpan source) 916protected SourceSpan? ComputeAttributeValueSourceSpan(MarkupAttributeBlockSyntax node)
Language\DefaultTagHelperResolutionPhase.ComponentTagHelperResolver.cs (14)
67SourceSpan? valueSourceSpan, 196if (directiveNameSpan is SourceSpan ns && attributeName.StartsWith('@')) 205if (match.IsParameterMatch && directiveAttributeName.HasParameter && parameterOriginalSpan is SourceSpan ps) 552SourceSpan? firstSpan = null; 553SourceSpan? lastSpan = null; 583SourceSpan? mergedSpan = null; 823SourceSpan? fallbackSource) 869if (directiveNameSpan is SourceSpan nameSpan && attributeName.StartsWith('@')) 1017private static SourceSpan? ComputeAttributeNameSpan(HtmlAttributeIntermediateNode htmlAttr) 1019if (htmlAttr.Source is not SourceSpan attrSource) 1048private static SourceSpan? ComputeAttributeValueSpan(HtmlAttributeIntermediateNode htmlAttr) 1051if (htmlAttr.Children is [{ Source: SourceSpan childSource }, ..]) 1061if (lastChild.Source is SourceSpan lastSource) 1076if (htmlAttr.Source is not SourceSpan attrSource)
Language\DefaultTagHelperResolutionPhase.cs (38)
330if (diagSource is SourceSpan ds) 337if (elementNode is { HasMissingEndCloseAngle: true, EndTagSpan: SourceSpan endDs }) 350if (diagSource is SourceSpan ds) 367if (diagSource is SourceSpan ds) 430if (current.Source is SourceSpan cs && next.Source is SourceSpan ns) 505child.Source ?? SourceSpan.Undefined, childTagName, parentTagName, allowedChildrenString)); 520child.Source ?? SourceSpan.Undefined, childTagName, parentTagName, allowedChildrenString)); 532child.Source ?? SourceSpan.Undefined, parentTagName, allowedChildrenString)); 541child.Source ?? SourceSpan.Undefined, parentTagName, allowedChildrenString)); 650SourceSpan? source, 775private static SourceSpan? ComputeValueSource(HtmlAttributeIntermediateNode htmlAttr) 777SourceSpan? result = null; 786if (token.Source is SourceSpan tokenSource) 792else if (child.Source is SourceSpan childSource) 800private static SourceSpan MergeSpans(SourceSpan a, SourceSpan b) 804var first = a.AbsoluteIndex <= b.AbsoluteIndex ? a : b; 805var last = a.AbsoluteIndex + a.Length >= b.AbsoluteIndex + b.Length ? a : b; 817internal static SourceSpan MergeSourceSpans(SourceSpan first, SourceSpan last) 914SourceSpan expressionSource, 932private static (string Content, SourceSpan? Source) CollectAttributeValueContent(HtmlAttributeValueIntermediateNode attrValue) 961private static HtmlContentIntermediateNode CreateEmptyHtmlContent(SourceSpan? source) 973private static CSharpIntermediateToken CreateEmptyCSharpToken(SourceSpan? source) 999private static SourceSpan? ExtendSpanBackward(SourceSpan? source, int prefixLength) 1015private static (string Content, SourceSpan? MergedSpan) CollectUnresolvedLiteralContent( 1017SourceSpan? valueSourceSpan) 1020SourceSpan? firstSpan = null; 1021SourceSpan? lastSpan = null; 1099if (elementNode.EndTagSpan is SourceSpan ets) 1108if (diagSource is SourceSpan ds) 1155elementNode.Source ?? SourceSpan.Undefined, 1262SourceSpan? valueSourceSpan, 1304SourceSpan? valueSourceSpan,
Language\DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs (43)
21SourceSpan? valueSourceSpan, 159unresolvedAttr.AttributeNameSpan ?? SourceSpan.Undefined, attributeName, tagHelperNode.TagName, propertyType!)); 184unresolvedAttr.AttributeNameSpan ?? SourceSpan.Undefined, attributeName, tagHelperNode.TagName, propertyType!)); 573if (htmlAttr.Source is SourceSpan attrSource && sourceDocument != null) 598var valueSource = new SourceSpan( 617SourceSpan? lastAtTokenSource = null; 627if (intermediateToken.Content == "@" && intermediateToken.Source is SourceSpan src) 629if (lastAtTokenSource is SourceSpan last && last.AbsoluteIndex == src.AbsoluteIndex) 656if (attrContent == "@" && tokenSource is SourceSpan ats) 658if (lastAtTokenSource is SourceSpan last && last.AbsoluteIndex == ats.AbsoluteIndex) 671if (lastAtTokenSource is SourceSpan atSrc) 676var emptySource = new SourceSpan(atSrc.FilePath, transAbsIdx, atSrc.LineIndex, transCharIdx, 0, 0, transCharIdx); 679var transSource = new SourceSpan(atSrc.FilePath, transAbsIdx, atSrc.LineIndex, transCharIdx, 1, 0, transCharIdx + 1); 687if (firstInnerChild.Source is SourceSpan innerSource) 691var openSource = new SourceSpan(innerSource.FilePath, openAbsIndex, innerSource.LineIndex, openCharIndex, 1, 0, openCharIndex + 1); 700if (lastInnerChild.Source is SourceSpan lastSource) 704var closeSource = new SourceSpan(lastSource.FilePath, closeAbsIndex, lastSource.LineIndex, closeCharIndex, 1, 0, closeCharIndex + 1); 720if (htmlAttr.Source is SourceSpan attrSource && sourceDocument != null) 740var openParenSource = new SourceSpan( 766var closeParenSource = new SourceSpan( 851private static SourceSpan? ComputeEmptyValueSource(HtmlAttributeIntermediateNode htmlAttr) 853if (htmlAttr.Source is not SourceSpan attrSource) 1155if (current.Source is SourceSpan currentSource && next.Source is SourceSpan nextSource) 1238if (a.Source is SourceSpan aSource && b.Source is SourceSpan bSource) 1250SourceSpan? valueSourceSpan, 1348var contentSpan = new SourceSpan( 1364SourceSpan? firstSpan = null; 1365SourceSpan? lastSpan = null; 1412SourceSpan vss, 1452SourceSpan? emptySpan = null; 1492using var pendingLiteralParts = new PooledArrayBuilder<(string text, SourceSpan? source)>(); 1493SourceSpan? pendingFirstSpan = null; 1494SourceSpan? pendingLastSpan = null; 1585ref PooledArrayBuilder<(string text, SourceSpan? source)> pendingParts, 1586ref SourceSpan? pendingFirstSpan, 1587ref SourceSpan? pendingLastSpan) 1622codeChild.Source ?? elementNode.Source ?? SourceSpan.Undefined, elementNode.TagName)); 1630var diagSource = exprChild.Source ?? elementNode.Source ?? SourceSpan.Undefined; 1658ref SourceSpan? firstSpan, 1659ref SourceSpan? lastSpan)
Language\Extensions\DefaultTagHelperTargetExtension.cs (2)
407SourceSpan? span) 420SourceSpan? span)
Language\Intermediate\BaseTypeWithModel.cs (2)
17public BaseTypeWithModel(string baseType, SourceSpan? location = null) 27if (location is SourceSpan span)
Language\Intermediate\ComponentAttributeIntermediateNode.cs (2)
40public SourceSpan? PropertySpan { get; set; } 44public SourceSpan? OriginalAttributeSpan { get; set; }
Language\Intermediate\ComponentIntermediateNode.cs (1)
52public SourceSpan StartTagSpan { get; init; }
Language\Intermediate\ComponentTypeArgumentIntermediateNode.cs (5)
52SourceSpan? firstSpan = null; 53SourceSpan? lastSpan = null; 57SourceSpan? mergedSpan = null; 70private static void AppendTokens(IntermediateNode node, StringBuilder sb, ref SourceSpan? firstSpan, ref SourceSpan? lastSpan)
Language\Intermediate\CSharpIntermediateToken.cs (2)
8public CSharpIntermediateToken(string content, SourceSpan? source) 13internal CSharpIntermediateToken(LazyContent content, SourceSpan? source)
Language\Intermediate\HtmlIntermediateToken.cs (2)
8public HtmlIntermediateToken(string content, SourceSpan? source) 13internal HtmlIntermediateToken(LazyContent content, SourceSpan? source)
Language\Intermediate\IntermediateNode.cs (1)
22public SourceSpan? Source { get; set; }
Language\Intermediate\IntermediateNodeFactory.cs (4)
10public static CSharpIntermediateToken CSharpToken(string content, SourceSpan? source = null) 13public static CSharpIntermediateToken CSharpToken<T>(T arg, Func<T, string> contentFactory, SourceSpan? source = null) 16public static HtmlIntermediateToken HtmlToken(string content, SourceSpan? source = null) 19public static HtmlIntermediateToken HtmlToken<T>(T arg, Func<T, string> contentFactory, SourceSpan? source = null)
Language\Intermediate\IntermediateToken.cs (2)
17protected IntermediateToken(string content, SourceSpan? source) 28private protected IntermediateToken(LazyContent content, SourceSpan? source)
Language\Intermediate\TagHelperDirectiveAttributeIntermediateNode.cs (1)
16public SourceSpan? OriginalAttributeSpan { get; init; }
Language\Intermediate\TagHelperDirectiveAttributeParameterIntermediateNode.cs (1)
14public SourceSpan? OriginalAttributeSpan { get; init; }
Language\Intermediate\TagHelperIntermediateNode.cs (1)
16public SourceSpan? StartTagSpan { get; init; }
Language\Intermediate\TagHelperPropertyIntermediateNode.cs (1)
13public SourceSpan? OriginalAttributeSpan { get; init; }
Language\Intermediate\TypeParameter.cs (2)
21public TypeParameter(string name, SourceSpan? nameSource, string? constraints, SourceSpan? constraintsSource)
Language\Intermediate\UnresolvedAttributeIntermediateNode.cs (2)
27public SourceSpan? ValueSourceSpan { get; set; } 39public SourceSpan? AttributeNameSpan { get; set; }
Language\Intermediate\UnresolvedElementIntermediateNode.cs (3)
32public SourceSpan? EndTagSpan { get; set; } 38public SourceSpan? StartTagNameSpan { get; set; } 41public SourceSpan? StartTagSpan { get; set; }
Language\Legacy\ClassifiedSpanInternal.cs (4)
12public ClassifiedSpanInternal(SourceSpan span, SourceSpan blockSpan, SpanKindInternal spanKind, BlockKindInternal blockKind, AcceptedCharactersInternal acceptedCharacters) 28public SourceSpan BlockSpan { get; } 30public SourceSpan Span { get; }
Language\Legacy\ClassifiedSpanVisitor.cs (8)
23private SourceSpan? _currentBlockSpan; 232var sourceSpan = spanComputer.ToSourceSpan(_source); 269var sourceSpan = spanComputer.ToSourceSpan(_source); 398private readonly SourceSpan? _previousBlockSpan = visitor._currentBlockSpan; 409private SourceSpan CurrentBlockSpan 421var nodeSpan = node.GetSourceSpan(_source); 439var tokenSpan = token.GetSourceSpan(_source); 444private void AddSpan(SourceSpan span, SpanKindInternal kind, AcceptedCharactersInternal acceptedCharacters)
Language\Legacy\TagHelperBlockRewriter.cs (4)
113var location = new SourceSpan(codeBlock.GetSourceLocation(source), codeBlock.Width); 126var location = contentChild.GetSourceSpan(source); 190var errorLocation = new SourceSpan(attributeNameLocation, result.AttributeName.Length); 200var errorLocation = new SourceSpan(attributeNameLocation, result.AttributeName.Length);
Language\Legacy\TagHelperParseTreeRewriter.cs (1)
142var source = new SourceSpan(SourceLocationTracker.Advance(startTag.GetSourceLocation(_source), "<"), tagName.Length);
Language\Legacy\TagHelperSpanInternal.cs (1)
6internal readonly record struct TagHelperSpanInternal(SourceSpan Span, TagHelperBinding Binding)
Language\NamespaceComputer.cs (6)
24out SourceSpan? namespaceSpan) 37if (TryGetNamespaceFromDirective(codeDocument, considerImports, out var directiveNamespaceName, out var directiveNamespaceSpan)) 184out SourceSpan namespaceSpan) 221private SourceSpan _lastNamespaceSpan; 226out SourceSpan namespaceSpan) 237namespaceSpan = SourceSpan.Undefined;
Language\RazorCodeDocument.cs (1)
303out SourceSpan? namespaceSpan)
Language\RazorCodeDocumentExtensions.cs (1)
42out SourceSpan? namespaceSpan)
Language\RazorDiagnostic.cs (7)
18public SourceSpan Span { get; } 22private RazorDiagnostic(RazorDiagnosticDescriptor descriptor, SourceSpan? span, object[]? args) 25Span = span ?? SourceSpan.Undefined; 32public static RazorDiagnostic Create(RazorDiagnosticDescriptor descriptor, SourceSpan? span) 38public static RazorDiagnostic Create(RazorDiagnosticDescriptor descriptor, SourceSpan? span, params object[] args) 57var span = Span; 115var span = diagnostic.Span;
Language\RazorDiagnosticFactory.cs (60)
36public static RazorDiagnostic CreateParsing_UnterminatedStringLiteral(SourceSpan location) 44public static RazorDiagnostic CreateParsing_BlockCommentNotTerminated(SourceSpan location) 52public static RazorDiagnostic CreateParsing_HelperDirectiveNotAvailable(SourceSpan location) 60public static RazorDiagnostic CreateParsing_UnexpectedWhiteSpaceAtStartOfCodeBlock(SourceSpan location) 68public static RazorDiagnostic CreateParsing_UnexpectedEndOfFileAtStartOfCodeBlock(SourceSpan location) 76public static RazorDiagnostic CreateParsing_UnexpectedCharacterAtStartOfCodeBlock(SourceSpan location, string content) 84public static RazorDiagnostic CreateParsing_ExpectedEndOfBlockBeforeEOF(SourceSpan location, string blockName, string closeBlock, string openBlock) 92public static RazorDiagnostic CreateParsing_ReservedWord(SourceSpan location, string content) 100public static RazorDiagnostic CreateParsing_SingleLineControlFlowStatementsCannotContainMarkup(SourceSpan location) 108public static RazorDiagnostic CreateParsing_AtInCodeMustBeFollowedByColonParenOrIdentifierStart(SourceSpan location) 116public static RazorDiagnostic CreateParsing_UnexpectedNestedCodeBlock(SourceSpan location) 124public static RazorDiagnostic CreateParsing_DirectiveTokensMustBeSeparatedByWhitespace(SourceSpan location, string directiveName) 132public static RazorDiagnostic CreateParsing_UnexpectedEOFAfterDirective(SourceSpan location, string directiveName, string expectedToken) 140public static RazorDiagnostic CreateParsing_DirectiveExpectsTypeName(SourceSpan location, string directiveName) 148public static RazorDiagnostic CreateParsing_DirectiveExpectsNamespace(SourceSpan location, string directiveName) 156public static RazorDiagnostic CreateParsing_DirectiveExpectsIdentifier(SourceSpan location, string directiveName) 164public static RazorDiagnostic CreateParsing_DirectiveExpectsQuotedStringLiteral(SourceSpan location, string directiveName) 172public static RazorDiagnostic CreateParsing_UnexpectedDirectiveLiteral(SourceSpan location, string directiveName, string expected) 180public static RazorDiagnostic CreateParsing_DirectiveMustHaveValue(SourceSpan location, string directiveName) 188public static RazorDiagnostic CreateParsing_IncompleteQuotesAroundDirective(SourceSpan location, string directiveName) 196public static RazorDiagnostic CreateParsing_InvalidTagHelperPrefixValue(SourceSpan location, string directiveName, char character, string prefix) 204public static RazorDiagnostic CreateParsing_MarkupBlockMustStartWithTag(SourceSpan location) 212public static RazorDiagnostic CreateParsing_OuterTagMissingName(SourceSpan location) 220public static RazorDiagnostic CreateParsing_TextTagCannotContainAttributes(SourceSpan location) 228public static RazorDiagnostic CreateParsing_UnfinishedTag(SourceSpan location, string tagName) 236public static RazorDiagnostic CreateParsing_MissingEndTag(SourceSpan location, string tagName) 244public static RazorDiagnostic CreateParsing_UnexpectedEndTag(SourceSpan location, string tagName) 252public static RazorDiagnostic CreateParsing_ExpectedCloseBracketBeforeEOF(SourceSpan location, string openBrace, string closeBrace) 260public static RazorDiagnostic CreateParsing_RazorCommentNotTerminated(SourceSpan location) 268public static RazorDiagnostic CreateParsing_TagHelperIndexerAttributeNameMustIncludeKey(SourceSpan location, string attributeName, string tagName) 276public static RazorDiagnostic CreateParsing_TagHelperAttributeListMustBeWellFormed(SourceSpan location) 284public static RazorDiagnostic CreateParsing_TagHelpersCannotHaveCSharpInTagDeclaration(SourceSpan location, string tagName) 292public static RazorDiagnostic CreateParsing_TagHelperAttributesMustHaveAName(SourceSpan location, string tagName) 300public static RazorDiagnostic CreateParsing_TagHelperMustNotHaveAnEndTag(SourceSpan location, string tagName, string displayName, TagStructure tagStructure) 308public static RazorDiagnostic CreateParsing_TagHelperFoundMalformedTagHelper(SourceSpan location, string tagName) 316public static RazorDiagnostic CreateParsing_TagHelperMissingCloseAngle(SourceSpan location, string tagName) 324public static RazorDiagnostic CreateParsing_InvalidTagHelperLookupText(SourceSpan location, string lookupText) 332public static RazorDiagnostic CreateParsing_DirectiveExpectsCSharpAttribute(SourceSpan location, string directiveName) 340public static RazorDiagnostic CreateParsing_DirectiveExpectsBooleanLiteral(SourceSpan location, string directiveName) 348public static RazorDiagnostic CreateParsing_GenericTypeParameterIdentifierMismatch(SourceSpan location, string directiveName, string constraintIdentifier, string originalMember) 356public static RazorDiagnostic CreateParsing_UnexpectedIdentifier(SourceSpan location, string content, params string[] options) 364public static RazorDiagnostic CreateParsing_DirectiveExpectsIdentifierOrExpression(SourceSpan location, string directiveName) 372public static RazorDiagnostic CreateParsing_VoidElement(SourceSpan location, string tagName) 380public static RazorDiagnostic CreateParsing_PreprocessorDirectivesMustBeAtTheStartOfLine(SourceSpan location) 388public static RazorDiagnostic CreateParsing_PossibleMisplacedPreprocessorDirective(SourceSpan location) 396public static RazorDiagnostic CreateParsing_DefineAndUndefNotAllowed(SourceSpan location) 418public static RazorDiagnostic CreateParsing_DuplicateDirective(SourceSpan location, string directive) 426public static RazorDiagnostic CreateParsing_SectionsCannotBeNested(SourceSpan location) 434public static RazorDiagnostic CreateParsing_InlineMarkupBlocksCannotBeNested(SourceSpan location) 442public static RazorDiagnostic CreateParsing_NamespaceImportAndTypeAliasCannotExistWithinCodeBlock(SourceSpan location) 450public static RazorDiagnostic CreateParsing_DirectiveMustAppearAtStartOfLine(SourceSpan location, string directiveName) 458public static RazorDiagnostic CreateTagHelper_CodeBlocksNotSupportedInAttributes(SourceSpan? location) 466public static RazorDiagnostic CreateTagHelper_InlineMarkupBlocksNotSupportedInAttributes(SourceSpan? location, string expectedTypeName) 474public static RazorDiagnostic CreateTagHelper_EmptyBoundAttribute(SourceSpan location, string attributeName, string tagName, string propertyTypeName) 482public static RazorDiagnostic CreateTagHelper_CannotHaveNonTagContent(SourceSpan location, string tagName, string allowedChildren) 490public static RazorDiagnostic CreateTagHelper_InvalidNestedTag(SourceSpan location, string tagName, string parent, string allowedChildren) 498public static RazorDiagnostic CreateTagHelper_InconsistentTagStructure(SourceSpan location, string firstDescriptor, string secondDescriptor, string tagName) 512public static RazorDiagnostic CreateComponent_EditorRequiredParameterNotSpecified(SourceSpan? location, string tagName, string parameterName) 675public static RazorDiagnostic CreateRewriter_InsufficientStack(SourceSpan? location = null) 689public static RazorDiagnostic CreateCssRewriting_ImportNotAllowed(SourceSpan location)
Language\SourceChange.cs (2)
35public SourceChange(SourceSpan span, string newText) 52public SourceSpan Span { get; }
Language\SourceLocation.cs (1)
90public static SourceLocation FromSpan(SourceSpan? span)
Language\SourceMapping.cs (4)
14public SourceMapping(SourceSpan originalSpan, SourceSpan generatedSpan) 20public SourceSpan OriginalSpan { get; } 22public SourceSpan GeneratedSpan { get; }
Language\SourceSpan.cs (18)
12public readonly struct SourceSpan : IEquatable<SourceSpan> 14public static readonly SourceSpan Undefined = new SourceSpan(SourceLocation.Undefined, 0); 61public bool Equals(SourceSpan other) 73return obj is SourceSpan span && Equals(span); 99internal readonly SourceSpan GetZeroWidthEndSpan() 104internal readonly SourceSpan Slice(int startIndex, int length) 109public static bool operator ==(SourceSpan left, SourceSpan right) 114public static bool operator !=(SourceSpan left, SourceSpan right) 119public readonly int CompareByStartThenLength(SourceSpan other) 130public readonly SourceSpan WithFilePath(string filePath) => new(filePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 131public readonly SourceSpan WithAbsoluteIndex(int absoluteIndex) => new(FilePath, absoluteIndex, LineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 132public readonly SourceSpan WithLineIndex(int lineIndex) => new(FilePath, AbsoluteIndex, lineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 133public readonly SourceSpan WithCharacterIndex(int characterIndex) => new(FilePath, AbsoluteIndex, LineIndex, characterIndex, Length, LineCount, EndCharacterIndex); 134public readonly SourceSpan WithLength(int length) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, length, LineCount, EndCharacterIndex); 135public readonly SourceSpan WithLineCount(int lineCount) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, lineCount, EndCharacterIndex); 136public readonly SourceSpan WithEndCharacterIndex(int endCharacterIndex) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, LineCount, endCharacterIndex);
Language\SpanComputer.cs (2)
11/// Helper that can be used to efficiently build up a <see cref="SourceSpan"/> or 94public readonly SourceSpan ToSourceSpan(RazorSourceDocument source)
Language\Syntax\SyntaxNodeExtensions.cs (2)
118public static SourceSpan GetSourceSpan(this SyntaxNode node, RazorSourceDocument source) 126public static SourceSpan GetSourceSpan(this SyntaxToken token, RazorSourceDocument source)
Mvc.Version2_X\InstrumentationPass.cs (2)
57public InstrumentationItem(IntermediateNode node, IntermediateNode parent, bool isLiteral, SourceSpan source) 71public SourceSpan Source { get; }
Mvc\InjectIntermediateNode.cs (2)
17public SourceSpan? TypeSource { get; set; } 21public SourceSpan? MemberSource { get; set; }
Mvc\PageDirective.cs (3)
27private PageDirective(string routeTemplate, IntermediateNode directiveNode, SourceSpan? source) 38public SourceSpan? Source { get; } 67SourceSpan? sourceSpan = null;
Mvc\RazorExtensionsDiagnosticFactory.cs (2)
83public static RazorDiagnostic CreatePageDirective_CannotBeImported(SourceSpan source) 95public static RazorDiagnostic CreatePageDirective_MustExistAtTheTopOfFile(SourceSpan source)
SourceGenerators\Diagnostics\RazorDiagnostics.cs (2)
107var span = razorDiagnostic.Span; 110if (span == SourceSpan.Undefined)
rzc (7)
Json\ObjectReaders.cs (6)
19var filePath = reader.ReadStringOrNull(nameof(SourceSpan.FilePath)); 20var absoluteIndex = reader.ReadInt32OrZero(nameof(SourceSpan.AbsoluteIndex)); 21var lineIndex = reader.ReadInt32OrZero(nameof(SourceSpan.LineIndex)); 22var characterIndex = reader.ReadInt32OrZero(nameof(SourceSpan.CharacterIndex)); 23var length = reader.ReadInt32OrZero(nameof(SourceSpan.Length)); 26var span = new SourceSpan(filePath, absoluteIndex, lineIndex, characterIndex, length);
Json\ObjectWriters.cs (1)
20var span = value.Span;