summaryrefslogtreecommitdiff
path: root/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'codegen')
-rw-r--r--codegen/valaccodememberaccessmodule.vala24
-rw-r--r--codegen/valaccodemethodcallmodule.vala22
2 files changed, 38 insertions, 8 deletions
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 0e995d3c9..a3d8ef0f8 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -68,8 +68,16 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
if (!method_has_wrapper (m.base_method)) {
var base_class = (Class) m.base_method.parent_symbol;
if (!base_class.is_compact) {
- var vclass = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (base_class)));
- vclass.add_argument (pub_inst);
+ CCodeFunctionCall vclass;
+ if (base_class.external_package) {
+ vclass = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_INSTANCE_GET_CLASS"));
+ vclass.add_argument (pub_inst);
+ vclass.add_argument (new CCodeIdentifier (get_ccode_type_id (base_class)));
+ vclass.add_argument (new CCodeIdentifier (get_ccode_type_name (base_class)));
+ } else {
+ vclass = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (base_class)));
+ vclass.add_argument (pub_inst);
+ }
set_cvalue (expr, new CCodeMemberAccess.pointer (vclass, get_ccode_vfunc_name (m)));
} else {
set_cvalue (expr, new CCodeMemberAccess.pointer (pub_inst, get_ccode_vfunc_name (m)));
@@ -80,8 +88,16 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
} else if (m.base_interface_method != null) {
if (m.base_interface_method.get_attribute ("NoWrapper") != null) {
var base_iface = (Interface) m.base_interface_method.parent_symbol;
- var vclass = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (base_iface)));
- vclass.add_argument (pub_inst);
+ CCodeFunctionCall vclass;
+ if (base_iface.external_package) {
+ vclass = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_INSTANCE_GET_INTERFACE"));
+ vclass.add_argument (pub_inst);
+ vclass.add_argument (new CCodeIdentifier (get_ccode_type_id (base_iface)));
+ vclass.add_argument (new CCodeIdentifier (get_ccode_type_name (base_iface)));
+ } else {
+ vclass = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (base_iface)));
+ vclass.add_argument (pub_inst);
+ }
set_cvalue (expr, new CCodeMemberAccess.pointer (vclass, get_ccode_vfunc_name (m)));
} else {
set_cvalue (expr, new CCodeIdentifier (get_ccode_name (m.base_interface_method)));
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 358a9896b..48d11eb67 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -119,12 +119,26 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
CCodeFunctionCall? vcast = null;
if (m.parent_symbol is Class) {
unowned Class base_class = (Class) m.parent_symbol;
- vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (base_class)));
- vcast.add_argument (pub_inst);
+ if (base_class.external_package) {
+ vcast = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_INSTANCE_GET_CLASS"));
+ vcast.add_argument (pub_inst);
+ vcast.add_argument (new CCodeIdentifier (get_ccode_type_id (base_class)));
+ vcast.add_argument (new CCodeIdentifier (get_ccode_type_name (base_class)));
+ } else {
+ vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (base_class)));
+ vcast.add_argument (pub_inst);
+ }
} else if (m.parent_symbol is Interface) {
unowned Interface base_iface = (Interface) m.parent_symbol;
- vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (base_iface)));
- vcast.add_argument (pub_inst);
+ if (base_iface.external_package) {
+ vcast = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_INSTANCE_GET_INTERFACE"));
+ vcast.add_argument (pub_inst);
+ vcast.add_argument (new CCodeIdentifier (get_ccode_type_id (base_iface)));
+ vcast.add_argument (new CCodeIdentifier (get_ccode_type_name (base_iface)));
+ } else {
+ vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (base_iface)));
+ vcast.add_argument (pub_inst);
+ }
}
if (vcast != null) {
async_call.call = new CCodeMemberAccess.pointer (vcast, get_ccode_vfunc_name (m));