Convert class methods to impl methods. Stop parsing class methods
This commit is contained in:
parent
bea6fe0ec1
commit
93d3b8aa6b
52 changed files with 400 additions and 197 deletions
|
@ -5,17 +5,13 @@ use to_str::ToStr;
|
|||
struct cat {
|
||||
priv {
|
||||
mut meows : uint,
|
||||
fn meow() {
|
||||
error!("Meow");
|
||||
self.meows += 1u;
|
||||
if self.meows % 5u == 0u {
|
||||
self.how_hungry += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mut how_hungry : int,
|
||||
name : ~str,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
|
||||
fn speak() { self.meow(); }
|
||||
|
||||
|
@ -32,6 +28,16 @@ struct cat {
|
|||
}
|
||||
}
|
||||
|
||||
priv impl cat {
|
||||
fn meow() {
|
||||
error!("Meow");
|
||||
self.meows += 1u;
|
||||
if self.meows % 5u == 0u {
|
||||
self.how_hungry += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
|
||||
cat {
|
||||
meows: in_x,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue