Skip to content

Optimize generated code #16675

@rolfbjarne

Description

@rolfbjarne

There are numerous places where we can improve the generated code.

Example:

[MonoPInvokeCallback (typeof (DQLPreviewReplyDataCreationHandler))]
static unsafe IntPtr Invoke (IntPtr block, IntPtr reply, ref IntPtr error) {
    var descriptor = (BlockLiteral *) block;
    var del = (global::QuickLook.QLPreviewReplyDataCreationHandler) (descriptor->Target);
    var __xamarin_pref1 = Runtime.GetINativeObject<NSError> (error, false);
    Foundation.NSData retval = del ( Runtime.GetNSObject<QLPreviewReply> (reply), ref __xamarin_pref1);
    error = __xamarin_pref1 is null ? IntPtr.Zero : __xamarin_pref1.Handle;
    return retval.GetHandle ();
}
  • Runtime.GetINativeObject<NSError> should be GetNSObject
  • error = __xamarin_pref1 is null ? IntPtr.Zero : __xamarin_pref1.Handle; should be error = __xamarin_pref1.GetHandle ()`;

We should look at the generated code to find more opportunities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    app-sizeenhancementThe issue or pull request is an enhancementgeneratorIssues affecting the generatorgood first issueThis is a good first issue for someone to start working with our codeperformanceIf an issue or pull request is related to performance

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions