Skip to content

Commit

Permalink
Add documentation in case this is an abstract class
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 6, 2021
1 parent cbdc2e4 commit dffc453
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/codegen/doc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ fn create_object_doc(w: &mut dyn Write, env: &Env, info: &analysis::object::Info
let functions: &[Function];
let signals: &[Signal];
let properties: &[Property];
let is_abstract;

let obj = env
.config
Expand All @@ -181,13 +182,15 @@ fn create_object_doc(w: &mut dyn Write, env: &Env, info: &analysis::object::Info
functions = &cl.functions;
signals = &cl.signals;
properties = &cl.properties;
is_abstract = env.library.type_(info.type_id).is_abstract();
}
Type::Interface(ref iface) => {
doc = iface.doc.as_ref();
doc_deprecated = iface.doc_deprecated.as_ref();
functions = &iface.functions;
signals = &iface.signals;
properties = &iface.properties;
is_abstract = false;
}
_ => unreachable!(),
}
Expand All @@ -208,6 +211,12 @@ fn create_object_doc(w: &mut dyn Write, env: &Env, info: &analysis::object::Info
} else {
writeln!(w)?;
}
if is_abstract {
writeln!(
w,
"\nThis is an Abstract Base Class, you cannot instantiate it."
)?;
}
if let Some(version) = info.version {
writeln!(w, "\nFeature: `{}`", version.to_feature())?;
}
Expand Down

0 comments on commit dffc453

Please sign in to comment.