Skip to content

Commit

Permalink
colocate imports with related templates
Browse files Browse the repository at this point in the history
Signed-off-by: Chloe McKnight <[email protected]>
  • Loading branch information
cmcknight-bb committed Jan 14, 2025
1 parent 9817a00 commit be1c6e5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions bindgen/templates/Async.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ self.add_import("System.Threading.Tasks")}}

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void UniFfiFutureCallback(IntPtr continuationHandle, byte pollResult);

Expand Down
1 change: 1 addition & 0 deletions bindgen/templates/ObjectTemplate.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{#/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */#}
{{- self.add_import("System.Threading")}}

{%- let obj = ci.get_object_definition(name).unwrap() %}
{%- if self.include_once_check("ObjectRuntime.cs") %}{% include "ObjectRuntime.cs" %}{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions bindgen/templates/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@
{%- endfor %}

{%- if ci.has_async_fns() %}
{{ self.add_import("System.Threading.Tasks")}}
{%- endif %}
{% include "Async.cs" %}
{%- endif %}
5 changes: 0 additions & 5 deletions bindgen/templates/wrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
{{- self.add_import("System.IO") }}
{{- self.add_import("System.Linq") }}
{{- self.add_import("System.Runtime.InteropServices") }}
{{- self.add_import("System.Threading")}}

{%- for imported_class in self.imports() %}
using {{ imported_class }};
Expand All @@ -46,10 +45,6 @@ namespace {{ config.namespace() }};
// and the FFI Function declarations in a com.sun.jna.Library.
{% include "NamespaceLibraryTemplate.cs" %}

{%- if ci.has_async_fns() %}
{% include "Async.cs" %}
{%- endif %}

// Public interface members begin here.
{# details/1-empty-list-as-default-method-parameter.md #}
#pragma warning disable 8625
Expand Down

0 comments on commit be1c6e5

Please sign in to comment.