Skip to content

Commit

Permalink
Fix private class methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwalchadha committed Oct 14, 2021
1 parent 66f4c01 commit d2fb501
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/cswinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1093,16 +1093,17 @@ namespace cswinrt
}

bool is_private = is_implemented_as_private_method(w, class_type, method);
auto static_method_params = call_static_method.has_value() ? std::optional(std::pair(call_static_method.value(), method)) : std::nullopt;
if (!is_private)
{
write_method(w, signature, method.Name(), return_type, interface_member, access_spec, method_spec, platform_attribute,
call_static_method.has_value() ? std::optional(std::pair(call_static_method.value(), method)) : std::nullopt);
static_method_params);
}

if (is_overridable || !is_exclusive_to(method.Parent()))
{
w.write(R"(
%% %.%(%) => %(%);)",
%% %.%(%) => %;)",
platform_attribute,
bind<write_projection_return_type>(signature),
bind<write_type_name>(method.Parent(), typedef_name_type::CCW, false),
Expand All @@ -1112,15 +1113,23 @@ namespace cswinrt
{
if (is_private)
{
w.write("%.%", interface_member, method.Name());
if (static_method_params.has_value())
{
w.write("%", bind<write_abi_static_method_call>(static_method_params.value().first, static_method_params.value().second,
w.write_temp("%.Value", bind<write_objref_type_name>(static_method_params.value().first))));
}
else
{
w.write("%.%", interface_member, method.Name());
w.write("(%)", bind_list<write_parameter_name_with_modifier>(", ", signature.params()));
}
}
else
{
w.write(method.Name());
w.write("(%)", bind_list<write_parameter_name_with_modifier>(", ", signature.params()));
}
}),
bind_list<write_parameter_name_with_modifier>(", ", signature.params())
);
}));
}
}

Expand Down

0 comments on commit d2fb501

Please sign in to comment.