Always emit diagnostics directly on arguments

このコミットが含まれているのは:
Sergio Pedri committed 2024-11-25 21:42:20 -08:00
1 親 2834eb67dd
コミット 7a3dd640b1
2ファイル変更
+9 -9

検索条件に一致するファイルはありません

@@ -59,7 +59,7 @@ public sealed class InvalidD2DInputArgumentAnalyzer : DiagnosticAnalyzer
// Second cheap inital filter: we only care about invocations with a constant 'int' argument in first position.
// While we're validating this, let's also get the 'index' parameter, since we need to validate it anyway.
if (operation.Arguments is not [{ Value.ConstantValue: { HasValue: true, Value: int index } }, ..])
if (operation.Arguments is not [{ Value.ConstantValue: { HasValue: true, Value: int index } } firstArgument, ..])
{
return;
}
@@ -95,7 +95,7 @@ public sealed class InvalidD2DInputArgumentAnalyzer : DiagnosticAnalyzer
{
context.ReportDiagnostic(Diagnostic.Create(
IndexOutOfRangeForD2DIntrinsic,
operation.Syntax.GetLocation(),
firstArgument.Syntax.GetLocation(),
targetMethodSymbol.Name,
index,
typeSymbol,
@@ -106,7 +106,7 @@ public sealed class InvalidD2DInputArgumentAnalyzer : DiagnosticAnalyzer
// Second validation: the input type must match
context.ReportDiagnostic(Diagnostic.Create(
InvalidInputTypeForD2DIntrinsic,
operation.Syntax.GetLocation(),
firstArgument.Syntax.GetLocation(),
targetMethodSymbol.Name,
index));
}
@@ -1307,7 +1307,7 @@ public class Test_D2DPixelShaderDescriptorGenerator_Analyzers
{
public float4 Execute()
{
return {|CMPSD2D0083:D2D.GetInput({{index}})|};
return D2D.GetInput({|CMPSD2D0083:{{index}}|});
}
}
""";
@@ -1331,7 +1331,7 @@ public class Test_D2DPixelShaderDescriptorGenerator_Analyzers
{
public float4 Execute()
{
return {|CMPSD2D0083:D2D.GetInput({{index}})|};
return D2D.GetInput({|CMPSD2D0083:{{index}}|});
}
}
""";
@@ -1382,10 +1382,10 @@ public class Test_D2DPixelShaderDescriptorGenerator_Analyzers
{
public float4 Execute()
{
{|CMPSD2D0084:D2D.GetInputCoordinate(0)|};
{|CMPSD2D0084:D2D.SampleInput(0, 0)|};
{|CMPSD2D0084:D2D.SampleInputAtOffset(0, 0)|};
{|CMPSD2D0084:D2D.SampleInputAtPosition(0, 0)|};
D2D.GetInputCoordinate({|CMPSD2D0084:0|});
D2D.SampleInput({|CMPSD2D0084:0|}, 0);
D2D.SampleInputAtOffset({|CMPSD2D0084:0|}, 0);
D2D.SampleInputAtPosition({|CMPSD2D0084:0|}, 0);
return 0;
}