-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move some more helpers from shared code to generated helpers #4675
base: feature/v3
Are you sure you want to change the base?
Move some more helpers from shared code to generated helpers #4675
Conversation
@@ -28,9 +27,10 @@ namespace AutoRest.CSharp.Generation.Writers | |||
{ | |||
internal static class RequestWriterHelpers | |||
{ | |||
public static void WriteRequestAndUriCreation(CodeWriter writer, RestClientMethod clientMethod, string methodAccessibility, ClientFields fields, string? responseClassifierType, bool writeSDKUserAgent, IReadOnlyList<Parameter>? clientParameters = null) | |||
// This only serves the MPG now | |||
public static void WriteRequestAndUriCreation(CodeWriter writer, RestClientMethod clientMethod, ClientFields fields, string? responseClassifierType, bool writeSDKUserAgent, IReadOnlyList<Parameter>? clientParameters = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this methodAccessibility
parameter because in everywhere it is getting invoked, we are always passing in internal
.
@@ -72,7 +72,7 @@ public static IEnumerable<MethodBodyStatement> BuildMultipartSerializationMethod | |||
/*return BinaryData.FromStream(stream);*/ | |||
Return(BinaryDataExpression.FromStream(stream, false)), | |||
/*return new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position));*/ | |||
Return(New.Instance(typeof(BinaryData), new[]{ new InvokeInstanceMethodExpression((new StreamExpression(stream)).GetBuffer, "AsMemory", new[] { Literal(0), new CastExpression(stream.Property("Position"), typeof(int)) }, null, false) })) | |||
Return(New.Instance(typeof(BinaryData), new[]{ new InvokeInstanceMethodExpression(new StreamExpression(stream).GetBuffer(), "AsMemory", new[] { Literal(0), new CastExpression(stream.Property("Position"), typeof(int)) }, null, false) })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GetBuffer
on Stream
class is a method, therefore our expression should express it as a method even if it takes no arguments.
@@ -457,7 +457,7 @@ private static ValueExpression DeserializeValue(XmlValueSerialization serializat | |||
|
|||
if (frameworkType == typeof(object)) | |||
{ | |||
return element.GetObjectValue(serialization.Format.ToFormatSpecifier()); | |||
return element.Value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the extension, the XElement.GetObjectValue
method is just calling element.Value
, therefore we just remove it to call this directly
cfde916
to
cfa16cb
Compare
cfa16cb
to
b0260d3
Compare
5d9e020
to
46c7a81
Compare
46c7a81
to
65402be
Compare
ca93a0d
to
a827900
Compare
a827900
to
4871229
Compare
Description
Add your description here!
Checklist
To ensure a quick review and merge, please ensure:
Ready to Land?