summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono/eolian/mono/function_definition.hh
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-12-14 20:39:09 -0200
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2018-12-14 20:47:46 -0200
commit9603cc07eb6e04bec8aef6b4facf9865d9b9a479 (patch)
treee230baf664529d2d312b36f59795e027f3def6e7 /src/bin/eolian_mono/eolian/mono/function_definition.hh
parentdd5c23035312f5da3358cb30ec9359e40314e0ad (diff)
efl-mono: Fix call of virtual methods after new API
Summary: After the new API, the virtual wrapper classes (*NativeInherit) just declared the wrappers for the current class. But as they didn't have any inheritance information, reimplementing methods from a parent Eo class wouldn't work. (e.g. Efl.Ui.Button reimplementing Efl.Object FinalizeAdd). This commit changes these NativeInherit classes to mimic the inheritance chain of their regular/abstract counterparts, reusing the virtual wrapper implementations. In order to access the correct Eo class created, the methods on it were changed from static to instance methods. The instance will be held as a class member of the regular/abstract API class to keep the delegates alive and allow getting C Function pointers from them. The class_initializer method was also split in two. The method collecting the wrapper delegates was extracted in order to call the parent ones. Also avoid exception in cached strings queries as TryGetValue requires non-null keys. Test Plan: Run test suite. Reviewers: vitor.sousa, felipealmeida Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7460
Diffstat (limited to 'src/bin/eolian_mono/eolian/mono/function_definition.hh')
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_definition.hh15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh b/src/bin/eolian_mono/eolian/mono/function_definition.hh
index 2821360..7561360 100644
--- a/src/bin/eolian_mono/eolian/mono/function_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh
@@ -75,7 +75,7 @@ struct native_function_definition_generator
75 75
76 if(!as_generator 76 if(!as_generator
77 (scope_tab 77 (scope_tab
78 << " private static " 78 << " private "
79 << eolian_mono::marshall_type(true) << " " 79 << eolian_mono::marshall_type(true) << " "
80 << string 80 << string
81 << "(System.IntPtr obj, System.IntPtr pd" 81 << "(System.IntPtr obj, System.IntPtr pd"
@@ -98,7 +98,7 @@ struct native_function_definition_generator
98 << eolian_mono::native_function_definition_epilogue(*klass) 98 << eolian_mono::native_function_definition_epilogue(*klass)
99 << scope_tab << scope_tab << "} else {\n" 99 << scope_tab << scope_tab << "} else {\n"
100 << scope_tab << scope_tab << scope_tab << (return_type != " void" ? "return " : "") << string 100 << scope_tab << scope_tab << scope_tab << (return_type != " void" ? "return " : "") << string
101 << "(Efl.Eo.Globals.efl_super(obj, " << klass_inherit_name << ".klass)" << *(", " << argument) << ");\n" 101 << "(Efl.Eo.Globals.efl_super(obj, " << "EoKlass)" << *(", " << argument) << ");\n"
102 << scope_tab << scope_tab << "}\n" 102 << scope_tab << scope_tab << "}\n"
103 << scope_tab << "}\n" 103 << scope_tab << "}\n"
104 ) 104 )
@@ -114,13 +114,10 @@ struct native_function_definition_generator
114 , context)) 114 , context))
115 return false; 115 return false;
116 116
117 if(!as_generator 117 // This is the delegate that will be passed to Eo to be called from C.
118 (scope_tab << "private static " 118 if(!as_generator(
119 << string 119 scope_tab << "private " << f.c_name << "_delegate " << f.c_name << "_static_delegate;\n"
120 << "_delegate " 120 ).generate(sink, attributes::unused, context))
121 << string << "_static_delegate = new " << string << "_delegate(" << name_helpers::klass_native_inherit_name(*klass) << "." << string << ");\n"
122 )
123 .generate(sink, std::make_tuple(f.c_name, f.c_name, f.c_name, escape_keyword(f.name)), context))
124 return false; 121 return false;
125 return true; 122 return true;
126 } 123 }