support docs in app, platform and packages

This commit is contained in:
faldor20 2024-03-11 11:01:52 +10:00
parent d95da9dd5b
commit f6799cae92
No known key found for this signature in database
GPG key ID: F2216079B890CD57
2 changed files with 41 additions and 4 deletions

View file

@ -5400,11 +5400,48 @@ fn canonicalize_and_constrain<'a>(
// Generate documentation information
// TODO: store timing information?
let module_docs = match header_type {
HeaderType::App { .. } => None,
HeaderType::Platform { .. } | HeaderType::Package { .. } => {
// TODO: actually generate docs for platform and package modules.
HeaderType::App {
output_name: StrLiteral::PlainLine(str),
..
} => {
let mut scope = module_output.scope.clone();
scope.add_docs_imports();
let docs = crate::docs::generate_module_docs(
scope,
module_id,
module_ids,
str.into(),
&parsed_defs_for_docs,
exposed_module_ids,
module_output.exposed_symbols.clone(),
parsed.header_comments,
);
Some(docs)
}
HeaderType::App { .. } => {
//TODO:Eli This may not be needed after module params becuase app headers might have non string names
None
}
HeaderType::Platform {
config_shorthand, ..
}
| HeaderType::Package {
config_shorthand, ..
} => {
let mut scope = module_output.scope.clone();
scope.add_docs_imports();
let docs = crate::docs::generate_module_docs(
scope,
module_id,
module_ids,
config_shorthand.into(),
&parsed_defs_for_docs,
exposed_module_ids,
module_output.exposed_symbols.clone(),
parsed.header_comments,
);
Some(docs)
}
HeaderType::Interface { name, .. }
| HeaderType::Builtin { name, .. }
| HeaderType::Hosted { name, .. } => {