Added more diagnostic errors to source generators
このコミットが含まれているのは:
1 親
0200e867bb
コミット
922b65668c
3ファイル変更
+540
-1
検索条件に一致するファイルはありません
@@ -13,4 +13,25 @@ CMPS0005 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator,
|
||||
CMPS0006 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0007 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0008 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0009 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0009 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0010 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0011 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0012 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0013 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0014 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0015 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0016 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0017 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0018 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0019 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0020 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0021 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0022 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0023 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0024 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0025 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0026 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0027 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0028 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0029 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0030 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
@@ -150,5 +150,281 @@ namespace ComputeSharp.SourceGenerators.Diagnostics
|
||||
isEnabledByDefault: true,
|
||||
description: "The WarpIds type can only be used within the main body of a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for an invalid object creation expression.
|
||||
/// <para>
|
||||
/// Format: <c>"The type {0} cannot be created in a compute shader"</c>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor InvalidObjectCreationExpression { get; } = new(
|
||||
id: "CMPS0010",
|
||||
title: "Invalid object creation expression",
|
||||
messageFormat: "The type {0} cannot be created in a compute shader (only unmanaged types are supported)",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "Only unmanaged value type objects can be created in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for an anonymous object creation expression.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor AnonymousObjectCreationExpression { get; } = new(
|
||||
id: "CMPS0011",
|
||||
title: "Anonymous object creation expression",
|
||||
messageFormat: "An anonymous object cannot be created in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "An anonymous object cannot be created in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for an async modifier on a method or function.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor AsyncModifierOnMethodOrFunction { get; } = new(
|
||||
id: "CMPS0012",
|
||||
title: "Async modifier on method or function",
|
||||
messageFormat: "The async modifier cannot be used in methods or functions used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "The async modifier cannot be used in methods or functions used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for an await expression.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor AwaitExpression { get; } = new(
|
||||
id: "CMPS0013",
|
||||
title: "Await expression",
|
||||
messageFormat: "The await expression cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "The await expression cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a checked expression.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor CheckedExpression { get; } = new(
|
||||
id: "CMPS0014",
|
||||
title: "Checked expression",
|
||||
messageFormat: "A checked expression cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A checked expression cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a checked statement.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor CheckedStatement { get; } = new(
|
||||
id: "CMPS0015",
|
||||
title: "Checked statement",
|
||||
messageFormat: "A checked statement cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A checked statement cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a fixed statement.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor FixedStatement { get; } = new(
|
||||
id: "CMPS0016",
|
||||
title: "Fixed statement",
|
||||
messageFormat: "A fixed statement cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A fixed statement cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a foreach statement.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor ForEachStatement { get; } = new(
|
||||
id: "CMPS0017",
|
||||
title: "Foreach statement",
|
||||
messageFormat: "A foreach statement cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A foreach statement cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a lock statement.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor LockStatement { get; } = new(
|
||||
id: "CMPS0018",
|
||||
title: "Foreach statement",
|
||||
messageFormat: "A lock statement cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A lock statement cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a query statement.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor QueryExpression { get; } = new(
|
||||
id: "CMPS0019",
|
||||
title: "Foreach statement",
|
||||
messageFormat: "A LINQ query expression cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A LINQ query expression cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a range expression.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor RangeExpression { get; } = new(
|
||||
id: "CMPS0020",
|
||||
title: "Range expression",
|
||||
messageFormat: "A range expression cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A range expression cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a recursive pattern.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor RecursivePattern { get; } = new(
|
||||
id: "CMPS0021",
|
||||
title: "Recursive pattern",
|
||||
messageFormat: "A recursive pattern cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A recursive pattern cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a ref type.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor RefType { get; } = new(
|
||||
id: "CMPS0022",
|
||||
title: "Ref type",
|
||||
messageFormat: "A compute shader cannot have a ref type declaration",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A compute shader cannot have a ref type declaration.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a relational pattern.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor RelationalPattern { get; } = new(
|
||||
id: "CMPS0023",
|
||||
title: "Relational pattern",
|
||||
messageFormat: "A relational pattern cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A relational pattern cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a sizeof expression.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor SizeOfExpression { get; } = new(
|
||||
id: "CMPS0024",
|
||||
title: "Sizeof expression",
|
||||
messageFormat: "A sizeof expression cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A sizeof expression cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a stackalloc expression.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor StackAllocArrayCreationExpression { get; } = new(
|
||||
id: "CMPS0025",
|
||||
title: "Stackalloc expression",
|
||||
messageFormat: "A stackalloc expression cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A stackalloc expression cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a throw expression or statement.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor ThrowExpressionOrStatement { get; } = new(
|
||||
id: "CMPS0026",
|
||||
title: "Throw expression or statement",
|
||||
messageFormat: "Throw expressions and statements cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "Throw expressions and statements cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a try statement.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor TryStatement { get; } = new(
|
||||
id: "CMPS0027",
|
||||
title: "Try statement",
|
||||
messageFormat: "A try statement cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A try statement cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a tuple type.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor TupleType { get; } = new(
|
||||
id: "CMPS0028",
|
||||
title: "Tuple type",
|
||||
messageFormat: "A compute shader cannot have a tuple type declaration",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A compute shader cannot have a tuple type declaration.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a using statement or declaration.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor UsingStatementOrDeclaration { get; } = new(
|
||||
id: "CMPS0029",
|
||||
title: "Using statement or declaration",
|
||||
messageFormat: "Using statements and declarations cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "Using statements and declarations cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for a yield statement.
|
||||
/// </summary>
|
||||
public static DiagnosticDescriptor YieldStatement { get; } = new(
|
||||
id: "CMPS0030",
|
||||
title: "Yield statement",
|
||||
messageFormat: "A yield statement cannot be used in a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "A yield statement cannot be used in a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
}
|
||||
}
|
||||
@@ -154,6 +154,14 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
|
||||
var updatedNode = (MethodDeclarationSyntax?)base.Visit(node);
|
||||
|
||||
|
||||
if (node!.Modifiers.Contains(Token(SyntaxKind.AsyncKeyword)))
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.AsyncModifierOnMethodOrFunction,
|
||||
node.GetLocation()));
|
||||
}
|
||||
|
||||
if (updatedNode is not null)
|
||||
{
|
||||
var implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray());
|
||||
@@ -201,6 +209,13 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
{
|
||||
var updatedNode = ((LocalDeclarationStatementSyntax)base.VisitLocalDeclarationStatement(node)!);
|
||||
|
||||
if (this.semanticModel.GetOperation(node) is IOperation { Kind: OperationKind.UsingDeclaration })
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.UsingStatementOrDeclaration,
|
||||
node.GetLocation()));
|
||||
}
|
||||
|
||||
return updatedNode.ReplaceAndTrackType(updatedNode.Declaration.Type, node.Declaration.Type, this.semanticModel, this.discoveredTypes);
|
||||
}
|
||||
|
||||
@@ -209,6 +224,14 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
{
|
||||
var updatedNode = (ObjectCreationExpressionSyntax)base.VisitObjectCreationExpression(node)!;
|
||||
|
||||
if (this.semanticModel.GetTypeInfo(node).Type is ITypeSymbol { IsUnmanagedType: false } type)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.InvalidObjectCreationExpression,
|
||||
node.GetLocation(),
|
||||
type));
|
||||
}
|
||||
|
||||
updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.Type, node, this.semanticModel, this.discoveredTypes);
|
||||
|
||||
// New objects use the default HLSL cast syntax, eg. (float4)0
|
||||
@@ -220,6 +243,18 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
return InvocationExpression(updatedNode.Type, updatedNode.ArgumentList);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node)
|
||||
{
|
||||
var updatedNode = (AnonymousObjectCreationExpressionSyntax)base.VisitAnonymousObjectCreationExpression(node)!;
|
||||
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.AnonymousObjectCreationExpression,
|
||||
node.GetLocation()));
|
||||
|
||||
return updatedNode;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node)
|
||||
{
|
||||
@@ -318,6 +353,13 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
.WithAttributeLists(List<AttributeListSyntax>())
|
||||
.WithIdentifier(Identifier($"__{this.currentMethod!.Identifier.Text}__{node.Identifier.Text}"));
|
||||
|
||||
if (node.Modifiers.Contains(Token(SyntaxKind.AsyncKeyword)))
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.AsyncModifierOnMethodOrFunction,
|
||||
node.GetLocation()));
|
||||
}
|
||||
|
||||
this.localFunctionDepth--;
|
||||
|
||||
// HLSL doesn't support local functions, so we first process them as usual and then remove
|
||||
@@ -555,6 +597,206 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
return updatedNode;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitAwaitExpression(AwaitExpressionSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.AwaitExpression,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitAwaitExpression(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitCheckedExpression(CheckedExpressionSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.CheckedExpression,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitCheckedExpression(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitCheckedStatement(CheckedStatementSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.CheckedStatement,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitCheckedStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitFixedStatement(FixedStatementSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.FixedStatement,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitFixedStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitForEachStatement(ForEachStatementSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.ForEachStatement,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitForEachStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitForEachVariableStatement(ForEachVariableStatementSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.ForEachStatement,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitForEachVariableStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitLockStatement(LockStatementSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.LockStatement,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitLockStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitQueryExpression(QueryExpressionSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.QueryExpression,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitQueryExpression(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitRangeExpression(RangeExpressionSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.RangeExpression,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitRangeExpression(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitRecursivePattern(RecursivePatternSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.RecursivePattern,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitRecursivePattern(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitRefType(RefTypeSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.RefType,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitRefType(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitRelationalPattern(RelationalPatternSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.RelationalPattern,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitRelationalPattern(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitSizeOfExpression(SizeOfExpressionSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.SizeOfExpression,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitSizeOfExpression(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.StackAllocArrayCreationExpression,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitStackAllocArrayCreationExpression(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitThrowExpression(ThrowExpressionSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.ThrowExpressionOrStatement,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitThrowExpression(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitThrowStatement(ThrowStatementSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.ThrowExpressionOrStatement,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitThrowStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitTryStatement(TryStatementSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.TryStatement,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitTryStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitTupleType(TupleTypeSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.TupleType,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitTupleType(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitUsingStatement(UsingStatementSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.UsingStatementOrDeclaration,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitUsingStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitYieldStatement(YieldStatementSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.YieldStatement,
|
||||
node.GetLocation()));
|
||||
|
||||
return base.VisitYieldStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxToken VisitToken(SyntaxToken token)
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする