Skip to content

Commit

Permalink
Forward-declare non-flat uniffi enums
Browse files Browse the repository at this point in the history
Resolves #46

Signed-off-by: Stephane Raux <sraux@amazon.com>
  • Loading branch information
stefunctional committed Sep 19, 2024
1 parent 1521029 commit 736d659
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bindgen/src/bindings/cpp/templates/wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ namespace {{ namespace }} {
{%- match typ %}
{%- when Type::Enum { module_path, name } %}
{%- let e = ci|get_enum_definition(name) %}
{%- if ci.is_name_used_as_error(name) %}
{%- if ci.is_name_used_as_error(name) || !e.is_flat() %}
struct {{ name }};
{%- else %}
{%- if e.is_flat() %}
enum class {{ name }};
{%- endif %}
{%- endif %}
{%- when Type::Record { module_path, name } %}
{%- when Type::Record { module_path, name } %}
struct {{ name }};
{%- when Type::Object { module_path, name, imp } %}
struct {{ name }};
Expand Down

0 comments on commit 736d659

Please sign in to comment.