Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ namespace System.Runtime.CompilerServices
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
file sealed class InterceptsLocationAttribute : Attribute
{
public InterceptsLocationAttribute(string filePath, int line, int column) { }
public InterceptsLocationAttribute(int version, string data) { }
}
}
"""
Expand Down Expand Up @@ -496,10 +496,11 @@ when namedReturnType2.AllInterfaces.Prepend(namedReturnType2)
};

// Output the interceptor method signature preceded by the [InterceptsLocation] attribute.
var startPosition = operatorSyntax.SyntaxTree.GetLineSpan(memberAccessSyntax.Name.Span, cancellationToken).StartLinePosition;
var interceptorName = $"Query{queryNum}_{memberAccessSyntax.Name}{operatorNum}";
code.AppendLine(
$"""[InterceptsLocation(@"{operatorSyntax.SyntaxTree.FilePath.Replace("\"", "\"\"")}", {startPosition.Line + 1}, {startPosition.Character + 1})]""");
var invocationSyntax = (InvocationExpressionSyntax)operatorSyntax;
var interceptableLocation = semanticModel.GetInterceptableLocation(invocationSyntax, cancellationToken)
?? throw new InvalidOperationException("Couldn't get interceptable location for: " + operatorSyntax);
code.AppendLine(interceptableLocation.GetInterceptsLocationAttributeSyntax());
GenerateInterceptorMethodSignature();
code.AppendLine("{").IncrementIndent();

Expand Down
Loading