Added method vptr condition
This commit is contained in:
@@ -412,13 +412,28 @@ impl ClassProcessedData {
|
||||
for method in &self.methods {
|
||||
match method.item.visibility {
|
||||
Visibility::Public => {
|
||||
if method.item.is_override.is_none() {
|
||||
gen_method_point(&method.item, ctx, cg);
|
||||
}
|
||||
let is_using_self = match method.item.params.0.get(0) {
|
||||
Some(VarDecl { name, .. }) => {
|
||||
if let Pattern::Path(_, v) = name {
|
||||
v.0.len() == 1 && v.0[0].0 == "self"
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
|
||||
let mut prefixed = method.clone();
|
||||
prefixed.item.name.0.insert_str(0, "__m_");
|
||||
prefixed.gen_rust(ctx, cg);
|
||||
if is_using_self {
|
||||
if method.item.is_override.is_none() {
|
||||
gen_method_point(&method.item, ctx, cg);
|
||||
}
|
||||
|
||||
let mut prefixed = method.clone();
|
||||
prefixed.item.name.0.insert_str(0, "__m_");
|
||||
prefixed.gen_rust(ctx, cg);
|
||||
} else {
|
||||
method.gen_rust(ctx, cg);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
method.gen_rust(ctx, cg);
|
||||
|
||||
@@ -19,7 +19,7 @@ pub class Animal<T> {
|
||||
|
||||
pub class Mammal<T> : Animal<T> {
|
||||
constructor() {
|
||||
super -> Super::new();
|
||||
super = Super::new();
|
||||
}
|
||||
|
||||
pub fn args_test(*self, x i32, y *str) {}
|
||||
@@ -31,7 +31,7 @@ pub class Mammal<T> : Animal<T> {
|
||||
|
||||
pub class Dog : Mammal<i32> {
|
||||
constructor() {
|
||||
super -> Super::new();
|
||||
super = Super::new();
|
||||
}
|
||||
|
||||
pub override(Animal<i32>) fn speak(*self) {
|
||||
|
||||
Reference in New Issue
Block a user