summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-05-16 17:35:21 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2018-05-17 16:55:52 -0300
commitbafa91be2026d03efc379a7944ead14594c90e78 (patch)
tree4abca1749294346510785c06a0f8db84b5498f52 /src/bin/eolian_mono
parent42baaa046dee716d469a5f2ea05493c049dbda6d (diff)
efl_mono: Fix generation of event arguments
Summary: Event argument was getting its type name from another path, different from the type_generator. In later commits the other functions from name_helpers should use the type_generator too. Reviewers: felipealmeida Reviewed By: felipealmeida Subscribers: cedric, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6170
Diffstat (limited to 'src/bin/eolian_mono')
-rw-r--r--src/bin/eolian_mono/eolian/mono/events.hh9
-rw-r--r--src/bin/eolian_mono/eolian/mono/name_helpers.hh19
2 files changed, 7 insertions, 21 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/events.hh b/src/bin/eolian_mono/eolian/mono/events.hh
index 1d56db7dd2..2da287b8e7 100644
--- a/src/bin/eolian_mono/eolian/mono/events.hh
+++ b/src/bin/eolian_mono/eolian/mono/events.hh
@@ -81,7 +81,12 @@ struct event_argument_wrapper_generator
81 return true; 81 return true;
82 82
83 std::string evt_name = name_helpers::managed_event_name(evt.name); 83 std::string evt_name = name_helpers::managed_event_name(evt.name);
84 std::string arg_type = (*etype).original_type.visit(name_helpers::get_csharp_type_visitor{}); 84 std::string arg_type;
85 if (!as_generator(type).generate(std::back_inserter(arg_type), *etype, efl::eolian::grammar::context_null()))
86 {
87 EINA_CXX_DOM_LOG_ERR(eolian_mono::domain) << "Failed to get argument type for event " << evt.name;
88 return false;
89 }
85 90
86 return as_generator("///<summary>Event argument wrapper for event " << evt_name << ".</summary>\n" 91 return as_generator("///<summary>Event argument wrapper for event " << evt_name << ".</summary>\n"
87 << "public class " << name_helpers::managed_event_args_short_name(evt) << " : EventArgs {\n" 92 << "public class " << name_helpers::managed_event_args_short_name(evt) << " : EventArgs {\n"
@@ -177,7 +182,7 @@ struct event_definition_generator
177 { 182 {
178 wrapper_args_type = name_helpers::managed_event_args_name(evt); 183 wrapper_args_type = name_helpers::managed_event_args_name(evt);
179 wrapper_args_template = "<" + wrapper_args_type + ">"; 184 wrapper_args_template = "<" + wrapper_args_type + ">";
180 std::string arg_initializer = wrapper_args_type + " args = new " + wrapper_args_type + "();\n"; // = (*etype).original_type.visit(get_csharp_type_visitor{}); 185 std::string arg_initializer = wrapper_args_type + " args = new " + wrapper_args_type + "();\n";
181 186
182 arg_initializer += " args.arg = "; 187 arg_initializer += " args.arg = ";
183 188
diff --git a/src/bin/eolian_mono/eolian/mono/name_helpers.hh b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
index 6dd0cc567c..912909b4a8 100644
--- a/src/bin/eolian_mono/eolian/mono/name_helpers.hh
+++ b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
@@ -291,25 +291,6 @@ inline std::string translate_inherited_event_name(const attributes::event_def &e
291 return join_namespaces(klass.namespaces, '_') + klass.cxx_name + "_" + managed_event_name(evt.name); 291 return join_namespaces(klass.namespaces, '_') + klass.cxx_name + "_" + managed_event_name(evt.name);
292} 292}
293 293
294// Type visistor
295struct get_csharp_type_visitor
296{
297 typedef get_csharp_type_visitor visitor_type;
298 typedef std::string result_type;
299 std::string operator()(attributes::regular_type_def const& type) const
300 {
301 return type_full_managed_name(type);
302 }
303 std::string operator()(attributes::klass_name const& name) const
304 {
305 return klass_full_interface_name(name);
306 }
307 std::string operator()(attributes::complex_type_def const&) const
308 {
309 return "UNSUPPORTED";
310 }
311};
312
313// Open/close namespaces 294// Open/close namespaces
314template<typename OutputIterator, typename Context> 295template<typename OutputIterator, typename Context>
315bool open_namespaces(OutputIterator sink, std::vector<std::string> namespaces, Context context) 296bool open_namespaces(OutputIterator sink, std::vector<std::string> namespaces, Context context)