Fixed returning
This commit is contained in:
@@ -614,7 +614,7 @@ pub fn gen_method_point(method: &FunctionDecl, ctx: &mut Context, cg: &mut RustC
|
|||||||
param.name.gen_rust(ctx, cg);
|
param.name.gen_rust(ctx, cg);
|
||||||
}
|
}
|
||||||
|
|
||||||
cg.addln(");");
|
cg.addln(")");
|
||||||
|
|
||||||
cg.indent -= 1;
|
cg.indent -= 1;
|
||||||
cg.add_indentedln("}");
|
cg.add_indentedln("}");
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ pub class Mammal<T> : Animal<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn args_test(*self, x i32, y *str) {}
|
pub fn args_test(*self, x i32, y *str) {}
|
||||||
|
|
||||||
|
pub fn returning<'a>(*self) *'a str {
|
||||||
|
"Mammal"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub class Dog : Mammal<i32> {
|
pub class Dog : Mammal<i32> {
|
||||||
@@ -35,6 +39,10 @@ pub class Dog : Mammal<i32> {
|
|||||||
pub override(Animal<i32>) fn speak(*self) {
|
pub override(Animal<i32>) fn speak(*self) {
|
||||||
println!("Woof!");
|
println!("Woof!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub override fn returning(*self) *str {
|
||||||
|
"Dog"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_tests() {
|
pub fn run_tests() {
|
||||||
@@ -43,4 +51,6 @@ pub fn run_tests() {
|
|||||||
dawg.args_test(10, "hello");
|
dawg.args_test(10, "hello");
|
||||||
|
|
||||||
dawg.test_speak();
|
dawg.test_speak();
|
||||||
|
|
||||||
|
println!("{}", dawg.returning());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user