summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-09 18:45:27 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-13 16:59:58 +0100
commit37d2d378ec2e2d1f9a3941372ef4d818996291c7 (patch)
treee100879fbdc9ce0d2ce810be81977be97125603b /src/bin/eolian_mono
parent3b2a5a429be16e5b8e5d322b7a077a2c849586b8 (diff)
eolian: drop class function overriding
Until this commit eo did class functions as part of the vtable, which enabled those functions to be overwritten in classes inheriting another class. However in task T7675 we decided that this is not really good for bindings, as most OOP languages do not support this sort of feature. After this commit eolian realizes class function completly outside of the vtable, the c-symbol that is the class funciton is now just directly redirecting to a implementation, without the involvement of the vtable. This also means a change to the syntax created by eo: Calling before: class_function(CLASS_A); Calling after: class_function(); Implementation before: class_function(const Eo *obj, void *pd) { ... } Implementation after: class_function(void) { ... } This fixes T7675. Co-authored-by: lauromauro <lauromoura@expertisesolutions.com.br> Reviewed-by: Daniel Kolesa <daniel@octaforge.org> Differential Revision: https://phab.enlightenment.org/D7901
Diffstat (limited to 'src/bin/eolian_mono')
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_definition.hh15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh b/src/bin/eolian_mono/eolian/mono/function_definition.hh
index f89ac95..9fef462 100644
--- a/src/bin/eolian_mono/eolian/mono/function_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh
@@ -147,11 +147,12 @@ struct function_definition_generator
147 << (do_super ? " protected " : " private ") << "static extern " 147 << (do_super ? " protected " : " private ") << "static extern "
148 << eolian_mono::marshall_type(true) 148 << eolian_mono::marshall_type(true)
149 << " " << string 149 << " " << string
150 << "(System.IntPtr obj" 150 << "(" << (f.is_static ? "" : "System.IntPtr obj")
151 << *grammar::attribute_reorder<-1, -1> 151 << ((!f.is_static && (f.parameters.size() > 0)) ? ", " : "")
152 << (grammar::attribute_reorder<-1, -1>
152 ( 153 (
153 (", " << marshall_annotation << " " << marshall_parameter) 154 (marshall_annotation << " " << marshall_parameter)
154 ) 155 ) % ",")
155 << ");\n") 156 << ");\n")
156 .generate(sink, std::make_tuple(f.return_type, f.return_type, f.c_name, f.parameters), context)) 157 .generate(sink, std::make_tuple(f.return_type, f.return_type, f.c_name, f.parameters), context))
157 return false; 158 return false;
@@ -170,14 +171,14 @@ struct function_definition_generator
170 if (do_super && !f.is_static) 171 if (do_super && !f.is_static)
171 self = "(inherited ? Efl.Eo.Globals.efl_super(" + self + ", this.NativeClass) : " + self + ")"; 172 self = "(inherited ? Efl.Eo.Globals.efl_super(" + self + ", this.NativeClass) : " + self + ")";
172 else if (f.is_static) 173 else if (f.is_static)
173 self = name_helpers::klass_get_full_name(f.klass) + "()"; 174 self = "";
174 175
175 if(!as_generator 176 if(!as_generator
176 (scope_tab << ((do_super && !f.is_static) ? "virtual " : "") << "public " << (f.is_static ? "static " : "") << return_type << " " << string << "(" << (parameter % ", ") 177 (scope_tab << ((do_super && !f.is_static) ? "virtual " : "") << "public " << (f.is_static ? "static " : "") << return_type << " " << string << "(" << (parameter % ", ")
177 << ") {\n " 178 << ") {\n "
178 << eolian_mono::function_definition_preamble() << string << "(" 179 << eolian_mono::function_definition_preamble() << string << "("
179 << self 180 << self << ((!f.is_static && (f.parameters.size() > 0)) ? "," : "")
180 << *(", " << argument_invocation ) << ");\n" 181 << (argument_invocation % ", ") << ");\n"
181 << eolian_mono::function_definition_epilogue() 182 << eolian_mono::function_definition_epilogue()
182 << " }\n") 183 << " }\n")
183 .generate(sink, std::make_tuple(name_helpers::managed_method_name(f), f.parameters, f, f.c_name, f.parameters, f), context)) 184 .generate(sink, std::make_tuple(name_helpers::managed_method_name(f), f.parameters, f, f.c_name, f.parameters, f), context))