f3343b3571
Added class support to the parser, prettyprinter, fold, and visit. (See Issue 1726.) This is WIP -- the test case is xfailed, and attempting to compile it will error out in resolve.
29 lines
464 B
Rust
29 lines
464 B
Rust
// xfail-test
|
|
class cat {
|
|
priv {
|
|
let mutable meows : uint;
|
|
fn meow() {
|
|
#error("Meow");
|
|
meows += 1;
|
|
if meows % 5 == 0 {
|
|
how_hungry += 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
let how_hungry : int;
|
|
|
|
new(in_x : uint, in_y : int) { meows = in_x; how_hungry = in_y; }
|
|
|
|
fn speak() { meow(); }
|
|
|
|
fn eat() {
|
|
if how_hungry > 0 {
|
|
#error("OM NOM NOM");
|
|
how_hungry -= 2;
|
|
}
|
|
else {
|
|
#error("Not hungry!");
|
|
}
|
|
}
|
|
} |