fix member access in interface methods, fixes bug 504338
authorJuerg Billeter <j@bitron.ch>
Wed, 26 Dec 2007 13:28:22 +0000 (13:28 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 26 Dec 2007 13:28:22 +0000 (13:28 +0000)
2007-12-26  Juerg Billeter  <j@bitron.ch>

* gobject/valaccodegeneratormemberaccess.vala: fix member access in
  interface methods, fixes bug 504338

* tests/Makefile.am, tests/interfaces-properties.exp,
  tests/interfaces-properties.vala: test interface properties

svn path=/trunk/; revision=794

ChangeLog
gobject/valaccodegeneratormemberaccess.vala
tests/Makefile.am
tests/interfaces-properties.exp [new file with mode: 0644]
tests/interfaces-properties.vala [new file with mode: 0644]

index 6732144..b3bfb86 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2007-12-26  Jürg Billeter  <j@bitron.ch>
 
+       * gobject/valaccodegeneratormemberaccess.vala: fix member access in
+         interface methods, fixes bug 504338
+
+       * tests/Makefile.am, tests/interfaces-properties.exp,
+         tests/interfaces-properties.vala: test interface properties
+
+2007-12-26  Jürg Billeter  <j@bitron.ch>
+
        * vala/valasymbolresolver.vala: fix crash on unresolved type name,
          fixes bug 504014
 
index e0b0e63..53bfb77 100644 (file)
@@ -201,6 +201,8 @@ public class Vala.CCodeGenerator {
                                /* base type is available if this is a type method */
                                if (current_type_symbol is Class) {
                                        base_type = new ClassType ((Class) current_type_symbol);
+                               } else if (current_type_symbol is Interface) {
+                                       base_type = new InterfaceType ((Interface) current_type_symbol);
                                } else {
                                        base_type = new ValueType (current_type_symbol);
                                        pub_inst = new CCodeIdentifier ("(*self)");
index c5d1f90..4bbfcae 100644 (file)
@@ -29,6 +29,7 @@ TESTS = \
        classes-signals.vala \
        structs.vala \
        interfaces.vala \
+       interfaces-properties.vala \
        enums.vala \
        delegates.vala \
        exceptions.vala \
@@ -69,6 +70,7 @@ EXTRA_DIST = \
        classes-signals.exp \
        structs.exp \
        interfaces.exp \
+       interfaces-properties.exp \
        enums.exp \
        delegates.exp \
        exceptions.exp \
diff --git a/tests/interfaces-properties.exp b/tests/interfaces-properties.exp
new file mode 100644 (file)
index 0000000..d5d0c6d
--- /dev/null
@@ -0,0 +1 @@
+Interface Properties Test: 1 2 3
diff --git a/tests/interfaces-properties.vala b/tests/interfaces-properties.vala
new file mode 100644 (file)
index 0000000..b65fc5f
--- /dev/null
@@ -0,0 +1,29 @@
+using GLib;
+
+interface Maman.Ibaz : Object {
+       public abstract int number { get; }
+
+       public void simple_method () {
+               int n = number;
+               stdout.printf (" %d", n);
+       }
+}
+
+class Maman.Baz : Object, Ibaz {
+       public int number {
+               get { return 2; }
+       }
+}
+
+class Maman.SubBaz : Baz {
+       static int main (string[] args) {
+               stdout.printf ("Interface Properties Test: 1");
+
+               Ibaz ibaz = new Baz ();
+               ibaz.simple_method ();
+       
+               stdout.printf (" 3\n");
+
+               return 0;
+       }
+}