Skip to content

Commit

Permalink
remove unused parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
koros committed May 23, 2024
1 parent 9b27708 commit d61a5be
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/Kiota.Builder/Refiners/TypeScriptRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ private static List<CodeElement> GetCodeFileElementsForComposedType(CodeInterfac
};

ReplaceFactoryMethodForComposedType(codeInterface, codeNamespace, composedType, children);
ReplaceSerializerMethodForComposedType(codeInterface, codeNamespace, composedType, children);
ReplaceDeserializerMethodForComposedType(codeInterface, codeNamespace, composedType, children);
ReplaceSerializerMethodForComposedType(codeInterface, codeNamespace, children);
ReplaceDeserializerMethodForComposedType(codeInterface, codeNamespace, children);

return children;
}
Expand All @@ -324,12 +324,12 @@ private static void ReplaceFactoryMethodForComposedType(CodeInterface codeInterf
}
}

private static void ReplaceSerializerMethodForComposedType(CodeInterface codeInterface, CodeNamespace codeNamespace, CodeComposedTypeBase composedType, List<CodeElement> children)
private static void ReplaceSerializerMethodForComposedType(CodeInterface codeInterface, CodeNamespace codeNamespace, List<CodeElement> children)
{
var function = children.OfType<CodeFunction>().FirstOrDefault(function => function.OriginalLocalMethod.Kind is CodeMethodKind.Serializer);
if (function is not null)
{
var method = CreateSerializerMethodForComposedType(codeInterface, composedType, function);
var method = CreateSerializerMethodForComposedType(codeInterface, function);
var serializerFunction = new CodeFunction(method) { Name = method.Name };
serializerFunction.AddUsing(function.Usings.ToArray());

Expand All @@ -339,7 +339,7 @@ private static void ReplaceSerializerMethodForComposedType(CodeInterface codeInt
}
}

private static void ReplaceDeserializerMethodForComposedType(CodeInterface codeInterface, CodeNamespace codeNamespace, CodeComposedTypeBase composedType, List<CodeElement> children)
private static void ReplaceDeserializerMethodForComposedType(CodeInterface codeInterface, CodeNamespace codeNamespace, List<CodeElement> children)
{
var deserializerMethod = children.OfType<CodeFunction>().FirstOrDefault(function => function.OriginalLocalMethod.Kind is CodeMethodKind.Deserializer);
if (deserializerMethod is not null)
Expand All @@ -363,7 +363,7 @@ private static CodeMethod CreateFactoryMethodForComposedType(CodeInterface codeI
return method;
}

private static CodeMethod CreateSerializerMethodForComposedType(CodeInterface codeInterface, CodeComposedTypeBase composedType, CodeFunction function)
private static CodeMethod CreateSerializerMethodForComposedType(CodeInterface codeInterface, CodeFunction function)
{
var method = CreateCodeMethod(codeInterface, function);
// Add the key parameter if the composed type is a union of primitive values
Expand Down Expand Up @@ -442,11 +442,7 @@ private static CodeParameter CreateKeyParameter()

public static CodeComposedTypeBase? GetOriginalComposedType(CodeInterface codeInterface)
{
if (codeInterface?.OriginalClass is CodeClass originalClass)
{
return GetOriginalComposedType(originalClass);
}
return null;
return codeInterface?.OriginalClass is CodeClass originalClass ? GetOriginalComposedType(originalClass) : null;
}

public static CodeComposedTypeBase? GetOriginalComposedType(CodeClass codeClass)
Expand Down

0 comments on commit d61a5be

Please sign in to comment.