girparser: Fix unowned keyword in metadata types
[vala-lang.git] / tests / objects / fields.vala
blob5d490c0909bb699890d205cbe0133d731810ea45
1 using GLib;
3 [Compact]
4 class CompactTest {
5 public int initialized_field = 24;
8 class Maman.Foo : Object {
9 public int public_base_field = 2;
10 public class int public_class_field = 23;
13 class Maman.Bar : Foo {
14 public int public_field = 3;
15 private int private_field = 4;
16 private static int private_static_field = 5;
17 public static int public_static_field = 6;
18 private class int private_class_field;
19 public class int public_class_field;
21 class construct {
22 private_class_field = 7;
24 static construct {
25 public_class_field = 8;
28 void do_action () {
29 stdout.printf (" %d %d %d %d %d %d %d", public_base_field, public_field,
30 private_field, private_static_field, public_static_field,
31 private_class_field, public_class_field);
32 public_base_field = 9;
33 public_field = 10;
34 private_field = 11;
35 lock (private_static_field) {
36 private_static_field = 12;
38 lock (public_static_field) {
39 public_static_field = 13;
41 lock (private_class_field) {
42 private_class_field = 14;
44 lock (public_class_field) {
45 public_class_field = 15;
47 stdout.printf (" %d %d %d %d %d %d %d", public_base_field, public_field,
48 private_field, private_static_field, public_static_field,
49 private_class_field, public_class_field);
52 class void do_action_class () {
53 stdout.printf (" %d %d %d %d", private_static_field, public_static_field,
54 private_class_field, public_class_field);
55 lock (private_static_field) {
56 private_static_field = 12;
58 lock (public_static_field) {
59 public_static_field = 13;
61 lock (private_class_field) {
62 private_class_field = 14;
64 lock (public_class_field) {
65 public_class_field = 15;
67 stdout.printf (" %d %d %d %d", private_static_field, public_static_field,
68 private_class_field, public_class_field);
71 public static int main () {
72 stdout.printf ("Field Test: 1");
74 var bar = new Bar ();
75 bar.do_action ();
76 bar.do_action_class ();
78 bar.public_base_field = 16;
79 bar.public_field = 17;
80 bar.private_field = 18;
81 bar.private_static_field = 19;
82 bar.public_static_field = 20;
83 bar.private_class_field = 21;
84 ((Foo)bar).public_class_field = 22;
85 stdout.printf (" %d %d %d %d %d %d %d", bar.public_base_field, bar.public_field,
86 bar.private_field, bar.private_static_field, bar.public_static_field,
87 bar.private_class_field, ((Foo)bar).public_class_field);
89 var foo = new Foo ();
90 stdout.printf (" %d", foo.public_class_field);
92 var compact = new CompactTest ();
93 stdout.printf (" %d", compact.initialized_field);
95 stdout.printf (" 25\n");
97 return 0;
101 void main () {
102 Maman.Bar.main ();