summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2017-02-27 16:59:32 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2017-03-05 15:45:38 +0100
commit540154b27e24fc1b5986293bf3f2132ea49dbf31 (patch)
treec75f680603cbeda56f0346244966fccbfc0ecd17
parent972d5686467c6518c27fd9bbf98b1d45ac202698 (diff)
downloadvala-540154b27e24fc1b5986293bf3f2132ea49dbf31.tar.gz
memberaccess: Don't resolve base_method/property twice
https://bugzilla.gnome.org/show_bug.cgi?id=779219
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/objects/bug779219.vala18
-rw-r--r--vala/valamemberaccess.vala31
3 files changed, 25 insertions, 25 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2d0b2ed8c..67baf08bd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -214,6 +214,7 @@ TESTS = \
objects/bug615830-2.test \
objects/bug766739.vala \
objects/bug778632.vala \
+ objects/bug779219.vala \
errors/errors.vala \
errors/bug567181.vala \
errors/bug579101.vala \
diff --git a/tests/objects/bug779219.vala b/tests/objects/bug779219.vala
new file mode 100644
index 000000000..c0c4baab0
--- /dev/null
+++ b/tests/objects/bug779219.vala
@@ -0,0 +1,18 @@
+interface IFoo : GLib.Object {
+ public abstract int foo { get; }
+}
+
+abstract class Foo : GLib.Object, IFoo {
+ public abstract int foo { get; }
+}
+
+class Bar : Foo {
+ public override int foo { get { return 42; } }
+ public Bar () {
+ }
+}
+
+void main () {
+ var bar = new Bar ();
+ assert (bar.foo == 42);
+}
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 6911bef65..23ca8d68b 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -823,37 +823,18 @@ public class Vala.MemberAccess : Expression {
}
if (symbol_reference is Method) {
+ var method = (Method) symbol_reference;
if (target_type != null) {
value_type.value_owned = target_type.value_owned;
}
-
- Method base_method;
- if (m.base_method != null) {
- base_method = m.base_method;
- } else if (m.base_interface_method != null) {
- base_method = m.base_interface_method;
- } else {
- base_method = m;
- }
-
- if (instance && base_method.parent_symbol is TypeSymbol) {
- inner.target_type = SemanticAnalyzer.get_data_type_for_symbol ((TypeSymbol) base_method.parent_symbol);
- inner.target_type.value_owned = base_method.this_parameter.variable_type.value_owned;
+ if (instance && method.parent_symbol is TypeSymbol) {
+ inner.target_type = SemanticAnalyzer.get_data_type_for_symbol ((TypeSymbol) method.parent_symbol);
+ inner.target_type.value_owned = method.this_parameter.variable_type.value_owned;
}
} else if (symbol_reference is Property) {
var prop = (Property) symbol_reference;
-
- Property base_property;
- if (prop.base_property != null) {
- base_property = prop.base_property;
- } else if (prop.base_interface_property != null) {
- base_property = prop.base_interface_property;
- } else {
- base_property = prop;
- }
-
- if (instance && base_property.parent_symbol != null) {
- inner.target_type = SemanticAnalyzer.get_data_type_for_symbol ((TypeSymbol) base_property.parent_symbol);
+ if (instance && prop.parent_symbol != null) {
+ inner.target_type = SemanticAnalyzer.get_data_type_for_symbol ((TypeSymbol) prop.parent_symbol);
}
} else if ((symbol_reference is Field
|| symbol_reference is Signal)