diff --git a/Directory.Packages.props b/Directory.Packages.props index 3d2f63a..1eba365 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -17,6 +17,6 @@ - + diff --git a/src/Zomp.SyncMethodGenerator/AsyncToSyncRewriter.cs b/src/Zomp.SyncMethodGenerator/AsyncToSyncRewriter.cs index 1ab3fb9..26576c1 100644 --- a/src/Zomp.SyncMethodGenerator/AsyncToSyncRewriter.cs +++ b/src/Zomp.SyncMethodGenerator/AsyncToSyncRewriter.cs @@ -166,9 +166,9 @@ BinaryExpressionSyntax CheckNull(ExpressionSyntax expr) => BinaryExpression( } else { - var argumentTypeExpr = ProcessSymbol(funcArgumentType); + var argumentTypeExpr = Qualify(funcArgumentType); - var separated = SeparatedList([MaybeNullableType(argumentTypeExpr), MaybeNullableType(ProcessSymbol(chain[^1].ReturnType))]); + var separated = SeparatedList([MaybeNullableType(argumentTypeExpr), MaybeNullableType(Qualify(chain[^1].ReturnType))]); var type = TypeArgumentList(separated); funcExpr = GenericName( @@ -203,7 +203,7 @@ BinaryExpressionSyntax CheckNull(ExpressionSyntax expr) => BinaryExpression( toCheckForNullExpr, IdentifierName(nameof(Nullable<>.HasValue)))) : CheckNull(toCheckForNullExpr); - var castTo = MaybeNullableType(ProcessSymbol(returnType), returnType.IsValueType); + var castTo = MaybeNullableType(Qualify(returnType), returnType.IsValueType); var conditional = ConditionalExpression( condition.AppendSpace(), @@ -223,7 +223,7 @@ BinaryExpressionSyntax CheckNull(ExpressionSyntax expr) => BinaryExpression( statements.Add(ifStatement); var toCheckForNull = Identifier($"check{i}"); - var localType = ProcessSymbol(returnType); // reduced will return generic + var localType = Qualify(returnType); // reduced will return generic var declarator = VariableDeclarator(toCheckForNull.AppendSpace(), null, EqualsValueClause(unwrappedExpr.PrependSpace())); var declaration = VariableDeclaration(localType.AppendSpace(), SeparatedList([declarator])); @@ -1144,7 +1144,7 @@ bool ShouldRemoveArgumentLocal(ArgumentSyntax arg, int index) { for (var i = 0; i < typeArgs.Length - 1; i++) { - list.Add(ProcessSymbol(typeArgs[i])); + list.Add(Qualify(typeArgs[i])); } var originalSeparators = gns.TypeArgumentList.Arguments.GetSeparators(); @@ -1260,8 +1260,8 @@ bool ShouldRemoveAttribute(AttributeSyntax attributeSyntax) protected override SimpleNameSyntax? MapSymbol(ISymbol symbol) => symbol switch { INamedTypeSymbol { IsEnumerator: true } s - => GenericName(IEnumerator).WithTypeArgumentList(TypeArgumentList(SeparatedList([ProcessSymbol(s.ContainingType.TypeArguments[0])], []))), - INamedTypeSymbol { IsTaskOrValueTask: true } s => s.IsGenericType ? ProcessSymbol(s.TypeArguments[0]) : IdentifierName("void"), + => GenericName(IEnumerator).WithTypeArgumentList(TypeArgumentList(SeparatedList([Qualify(s.ContainingType.TypeArguments[0])], []))), + INamedTypeSymbol { IsTaskOrValueTask: true } s => s.IsGenericType ? Qualify(s.TypeArguments[0]) : IdentifierName("void"), _ => null, }; @@ -1684,7 +1684,7 @@ private static List RemoveFirstEndIf(SyntaxTriviaList list) private TypeSyntax GetReturnType(TypeSyntax returnType, INamedTypeSymbol symbol) => (returnType switch { - IdentifierNameSyntax => ProcessSymbol(symbol), + IdentifierNameSyntax => Qualify(symbol), _ => returnType, }).WithTriviaFrom(returnType); @@ -1726,7 +1726,7 @@ private static List RemoveFirstEndIf(SyntaxTriviaList list) // Func => Action for (var i = 0; i < typeArgs.Length - 1; i++) { - list.Add(ProcessSymbol(typeArgs[i])); + list.Add(Qualify(typeArgs[i])); } var originalSeparators = (List)[.. gns.TypeArgumentList.Arguments.GetSeparators()]; @@ -1853,7 +1853,7 @@ private InvocationExpressionSyntax UnwrapExtension(InvocationExpressionSyntax ie var newName = reducedFrom.Name; newName = changeMemoryToSpan ? ReplaceWithSpan(reducedFrom) : RemoveAsync(newName); - var fullyQualifiedName = $"{SyncQueryableContainer(containingType, newName) ?? MakeType(containingType)}.{newName}"; + var fullyQualifiedName = $"{SyncQueryableContainer(containingType, newName) ?? FullyQualifiedName(containingType)}.{newName}"; var es = (ies.Expression switch {