Skip to content

Commit

Permalink
remove further occurances of callback_guard
Browse files Browse the repository at this point in the history
  • Loading branch information
vhdirk committed Jun 24, 2018
1 parent 899ed75 commit 573f58b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
27 changes: 18 additions & 9 deletions src/codegen/subclass/class_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,15 @@ pub fn generate_impl(
// start impl trait
try!(writeln!(w));

if object_analysis.is_interface{

// TODO: Can I use a generic parent 'T' here, too? That'd be easier
try!(writeln!(
w,
"pub trait {}: AnyImpl + 'static {{",
object_analysis.subclass_impl_trait_name
));
}else{
// if object_analysis.is_interface{
//
// // TODO: Can I use a generic parent 'T' here, too? That'd be easier
// try!(writeln!(
// w,
// "pub trait {}: AnyImpl + 'static {{",
// object_analysis.subclass_impl_trait_name
// ));
// }else{

let parent_impls: Vec<String> = subclass_info.get_parents(env)
.iter()
Expand All @@ -327,13 +327,22 @@ pub fn generate_impl(

let parent_objs = parent_impls.join("");

// if object_analysis.is_interface{
// try!(writeln!(
// w,
// "pub trait {}: AnyImpl + 'static {{",
// object_analysis.subclass_impl_trait_name
// ));
//
// }else{
try!(writeln!(
w,
"pub trait {}<T: {}>:{} ObjectImpl<T> + AnyImpl + 'static {{",
object_analysis.subclass_impl_trait_name,
object_analysis.subclass_base_trait_name,
parent_objs
));
// }
}


Expand Down
6 changes: 0 additions & 6 deletions src/codegen/subclass/virtual_method_body_chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ impl Builder {
pub fn generate_object_extern_c_func(&self, env: &Env) -> Chunk {
let mut body = Vec::new();

body.push(self.callback_guard());
body.push(self.floating_reference_guard("gptr"));

body.push(Chunk::Let {
Expand Down Expand Up @@ -245,10 +244,6 @@ impl Builder {
Chunk::Chunks(body)
}

fn callback_guard(&self) -> Chunk {
Chunk::Custom("callback_guard!();".to_owned())
}

fn floating_reference_guard(&self, p: &str) -> Chunk {
Chunk::Custom(format!("floating_reference_guard!({});", p).to_owned())
}
Expand Down Expand Up @@ -288,7 +283,6 @@ impl Builder {

let iface_name = format!("{}_iface", self.object_name.to_lowercase()).to_owned();

body.push(self.callback_guard());
body.push(Chunk::Let {
name: iface_name.clone(),
is_mut: false,
Expand Down

0 comments on commit 573f58b

Please sign in to comment.