Merge pull request #789 from alexcrichton/fix-mdn

Fix regression of missing documentation
This commit is contained in:
Nick Fitzgerald 2018-09-04 16:32:38 -07:00 committed by GitHub
commit b00153cbb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -534,8 +534,29 @@ impl<'src> FirstPassRecord<'src> {
import_function_kind(backend::ast::OperationKind::IndexingDeleter)
}
};
let doc = match id {
OperationId::Constructor(_) |
OperationId::Operation(None) => None,
OperationId::Operation(Some(name)) => {
Some(format!(
"The `{}()` method\n\n{}",
name,
mdn_doc(self_name, Some(name))
))
}
OperationId::IndexingGetter => {
Some(format!("The indexing getter\n\n"))
}
OperationId::IndexingSetter => {
Some(format!("The indexing setter\n\n"))
}
OperationId::IndexingDeleter => {
Some(format!("The indexing deleter\n\n"))
}
};
let attrs = data.definition_attributes;
for method in self.create_imports(attrs, kind, id, op_data) {
for mut method in self.create_imports(attrs, kind, id, op_data) {
method.doc_comment = doc.clone();
program.imports.push(wrap_import_function(method));
}
}