summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--codegen/valaccodememberaccessmodule.vala12
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/objects/bug702736.vala27
3 files changed, 37 insertions, 3 deletions
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index e9aefd5c9..6becb1976 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -167,16 +167,22 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
}
if (expr.inner is BaseAccess) {
+ var base_prop = prop;
if (prop.base_property != null) {
- var base_class = (Class) prop.base_property.parent_symbol;
+ base_prop = prop.base_property;
+ } else if (prop.base_interface_property != null) {
+ base_prop = prop.base_interface_property;
+ }
+ if (base_prop.parent_symbol is Class) {
+ var base_class = (Class) base_prop.parent_symbol;
var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_class, null))));
vcast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (get_ccode_lower_case_name (current_class, null))));
var ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (vcast, "get_%s".printf (prop.name)));
ccall.add_argument (get_cvalue (expr.inner));
set_cvalue (expr, ccall);
- } else if (prop.base_interface_property != null) {
- var base_iface = (Interface) prop.base_interface_property.parent_symbol;
+ } else if (base_prop.parent_symbol is Interface) {
+ var base_iface = (Interface) base_prop.parent_symbol;
string parent_iface_var = "%s_%s_parent_iface".printf (get_ccode_lower_case_name (current_class), get_ccode_lower_case_name (base_iface));
var ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (new CCodeIdentifier (parent_iface_var), "get_%s".printf (prop.name)));
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d9c7c9689..5b16544af 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -136,6 +136,7 @@ TESTS = \
objects/bug683646.vala \
objects/bug695671.vala \
objects/bug701978.vala \
+ objects/bug702736.vala \
errors/errors.vala \
errors/bug567181.vala \
errors/bug579101.vala \
diff --git a/tests/objects/bug702736.vala b/tests/objects/bug702736.vala
new file mode 100644
index 000000000..71695014a
--- /dev/null
+++ b/tests/objects/bug702736.vala
@@ -0,0 +1,27 @@
+public abstract class ClassA : Object {
+ public abstract int flags { get; }
+}
+
+public class ClassB : ClassA {
+ public override int flags { get { return 1; } }
+}
+
+public class ClassC : ClassB {
+ public void foo() {
+ }
+}
+
+public class ClassD : ClassC {
+ public override int flags {
+ get {
+ var old_flags = base.flags;
+
+ return old_flags | 2;
+ }
+ }
+}
+
+void main () {
+ var d = new ClassD ();
+ assert (d.flags == 3);
+}