Added some more errorsand unit test pass
このコミットが含まれているのは:
1 親
5a2fcbf418
コミット
944ea0e6a0
7ファイル変更
+1219
-10
検索条件に一致するファイルはありません
@@ -155,12 +155,16 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
|
||||
var updatedNode = (MethodDeclarationSyntax?)base.Visit(node);
|
||||
|
||||
|
||||
if (node!.Modifiers.Contains(Token(SyntaxKind.AsyncKeyword)))
|
||||
if (node!.Modifiers.Any(m => m.IsKind(SyntaxKind.AsyncKeyword)))
|
||||
{
|
||||
this.context.ReportDiagnostic(AsyncModifierOnMethodOrFunction, node);
|
||||
}
|
||||
|
||||
if (node!.Modifiers.Any(m => m.IsKind(SyntaxKind.UnsafeKeyword)))
|
||||
{
|
||||
this.context.ReportDiagnostic(UnsafeModifierOnMethodOrFunction, node);
|
||||
}
|
||||
|
||||
if (updatedNode is not null)
|
||||
{
|
||||
var implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray());
|
||||
@@ -252,6 +256,11 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
{
|
||||
var updatedNode = (ImplicitObjectCreationExpressionSyntax)base.VisitImplicitObjectCreationExpression(node)!;
|
||||
|
||||
if (this.semanticModel.GetTypeInfo(node).Type is ITypeSymbol { IsUnmanagedType: false } type)
|
||||
{
|
||||
this.context.ReportDiagnostic(InvalidObjectCreationExpression, node, type);
|
||||
}
|
||||
|
||||
TypeSyntax explicitType = IdentifierName("").ReplaceAndTrackType(node, this.semanticModel, this.discoveredTypes);
|
||||
|
||||
// Mutate the syntax like with explicit object creation expressions
|
||||
@@ -345,11 +354,16 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
.WithAttributeLists(List<AttributeListSyntax>())
|
||||
.WithIdentifier(Identifier($"__{this.currentMethod!.Identifier.Text}__{node.Identifier.Text}"));
|
||||
|
||||
if (node.Modifiers.Contains(Token(SyntaxKind.AsyncKeyword)))
|
||||
if (node.Modifiers.Any(m => m.IsKind(SyntaxKind.AsyncKeyword)))
|
||||
{
|
||||
this.context.ReportDiagnostic(AsyncModifierOnMethodOrFunction, node);
|
||||
}
|
||||
|
||||
if (node.Modifiers.Any(m => m.IsKind(SyntaxKind.UnsafeKeyword)))
|
||||
{
|
||||
this.context.ReportDiagnostic(UnsafeModifierOnMethodOrFunction, node);
|
||||
}
|
||||
|
||||
this.localFunctionDepth--;
|
||||
|
||||
// HLSL doesn't support local functions, so we first process them as usual and then remove
|
||||
@@ -762,6 +776,30 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
return base.VisitYieldStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitFunctionPointerType(FunctionPointerTypeSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(DiagnosticDescriptors.FunctionPointer, node);
|
||||
|
||||
return base.VisitFunctionPointerType(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitPointerType(PointerTypeSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(DiagnosticDescriptors.PointerType, node);
|
||||
|
||||
return base.VisitPointerType(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitUnsafeStatement(UnsafeStatementSyntax node)
|
||||
{
|
||||
this.context.ReportDiagnostic(DiagnosticDescriptors.UnsafeStatement, node);
|
||||
|
||||
return base.VisitUnsafeStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxToken VisitToken(SyntaxToken token)
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする