Fixed type mapping for return types

このコミットが含まれているのは:
Sergio Pedri committed 2021-02-23 02:16:36 +01:00
1 親 97d023387d
コミット ab43075351
3ファイル変更
+33 -1

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

+6
ファイルの表示
@@ -58,6 +58,12 @@ namespace ComputeSharp.SourceGenerators.Extensions
_ => semanticModel.GetTypeInfo(sourceType).Type!
};
// Do nothing if the type is just void
if (typeSymbol.SpecialType == SpecialType.System_Void)
{
return node;
}
string typeName = typeSymbol.ToDisplayString(ISymbolExtensions.FullyQualifiedWithoutGlobalFormat);
discoveredTypes.Add((INamedTypeSymbol)typeSymbol);
+5 -1
ファイルの表示
@@ -153,7 +153,9 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
{
this.currentMethod = node;
var updatedNode = (MethodDeclarationSyntax?)base.Visit(node);
var updatedNode = (MethodDeclarationSyntax?)base.Visit(node)!;
updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.ReturnType, node!.ReturnType, this.semanticModel, this.discoveredTypes);
if (node!.Modifiers.Any(m => m.IsKind(SyntaxKind.AsyncKeyword)))
{
@@ -358,6 +360,8 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
.WithAttributeLists(List<AttributeListSyntax>())
.WithIdentifier(Identifier($"__{this.currentMethod!.Identifier.Text}__{node.Identifier.Text}"));
updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.ReturnType, node!.ReturnType, this.semanticModel, this.discoveredTypes);
if (node.Modifiers.Any(m => m.IsKind(SyntaxKind.AsyncKeyword)))
{
this.context.ReportDiagnostic(AsyncModifierOnMethodOrFunction, node);