66 lines
1.3 KiB
Vala
66 lines
1.3 KiB
Vala
class Foo {
|
|
public void f () {
|
|
stdout.printf ("Hello, world!\n");
|
|
}
|
|
}
|
|
|
|
Foo? newf () {
|
|
return new Foo ();
|
|
}
|
|
|
|
void fff (string [] s) {
|
|
stdout.printf ("%s\n", s[0]);
|
|
}
|
|
|
|
class AA11 {
|
|
public enum Enum1 {
|
|
E1 = 1,
|
|
E2 = 2
|
|
}
|
|
|
|
public uint i;
|
|
public string s { get; set; default = "AA11"; }
|
|
public Enum1 enum1 { get; set; default = Enum1.E2; }
|
|
}
|
|
|
|
class BB11 {
|
|
public AA11 aa11 = new AA11 ();
|
|
public List<int> list = new List<int> ();
|
|
public Node<int> node = new Node<int> ();
|
|
public Gee.ArrayList<int> alist { get; set; default = new Gee.ArrayList<int> (); }
|
|
}
|
|
|
|
void main () {
|
|
var foo = newf ();
|
|
|
|
foo.f();
|
|
|
|
string [] s = {"Unowned string"};
|
|
unowned string [] us = s;
|
|
fff (us);
|
|
|
|
string str = "Hello, world!";
|
|
stdout.printf ("%s\n", str.substring(3));
|
|
|
|
var a = new AA11 ();
|
|
stdout.printf ("-----------\n");
|
|
stdout.printf ("%s, %u, %u\n", a.s, a.i, a.enum1);
|
|
|
|
var b = new BB11 ();
|
|
stdout.printf ("-----------\n");
|
|
stdout.printf ("%s, %u, %u\n", b.aa11.s, b.aa11.i, b.aa11.enum1);
|
|
b.list.append (3);
|
|
b.list.append (3);
|
|
b.list.append (3);
|
|
b.list.append (3);
|
|
b.node.insert (0, new Node<int> (3));
|
|
b.node.insert (0, new Node<int> (3));
|
|
stdout.printf ("%u\n", b.alist.size);
|
|
stdout.printf ("%u, %u\n", b.list.length(), b.node.n_nodes(TraverseFlags.ALL));
|
|
|
|
List<int> l = new List<int> ();
|
|
l.append (3);
|
|
|
|
var tmp = "";
|
|
}
|