Added error for declarations of invalid type
このコミットが含まれているのは:
1 親
922b65668c
コミット
d55d5009c6
3ファイル変更
+36
-1
検索条件に一致するファイルはありません
@@ -787,6 +787,24 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
return base.VisitUsingStatement(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitVariableDeclarator(VariableDeclaratorSyntax node)
|
||||
{
|
||||
var updatedNode = (VariableDeclaratorSyntax)base.VisitVariableDeclarator(node)!;
|
||||
|
||||
if (node.Initializer is null &&
|
||||
node.Parent is VariableDeclarationSyntax declaration &&
|
||||
this.semanticModel.GetTypeInfo(declaration.Type).Type is ITypeSymbol { IsUnmanagedType: false } type)
|
||||
{
|
||||
this.context.ReportDiagnostic(Diagnostic.Create(
|
||||
DiagnosticDescriptors.InvalidObjectDeclaration,
|
||||
node.GetLocation(),
|
||||
type));
|
||||
}
|
||||
|
||||
return updatedNode;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode? VisitYieldStatement(YieldStatementSyntax node)
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする