Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation in case this is an abstract class #1051

Merged
merged 1 commit into from
Feb 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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