mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-17 17:25:01 +00:00
Basic support for multi-ability docs
This commit is contained in:
parent
1053c11907
commit
fc6f7d2613
1 changed files with 6 additions and 4 deletions
|
@ -86,7 +86,7 @@ pub enum RecordField {
|
||||||
pub struct AbilityMember {
|
pub struct AbilityMember {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub type_annotation: TypeAnnotation,
|
pub type_annotation: TypeAnnotation,
|
||||||
pub able_variables: Vec<(String, TypeAnnotation)>,
|
pub able_variables: Vec<(String, Vec<TypeAnnotation>)>,
|
||||||
pub docs: Option<String>,
|
pub docs: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ fn type_to_docs(in_func_type_ann: bool, type_annotation: ast::TypeAnnotation) ->
|
||||||
|
|
||||||
fn ability_member_type_to_docs(
|
fn ability_member_type_to_docs(
|
||||||
type_annotation: ast::TypeAnnotation,
|
type_annotation: ast::TypeAnnotation,
|
||||||
) -> (TypeAnnotation, Vec<(String, TypeAnnotation)>) {
|
) -> (TypeAnnotation, Vec<(String, Vec<TypeAnnotation>)>) {
|
||||||
match type_annotation {
|
match type_annotation {
|
||||||
ast::TypeAnnotation::Where(ta, has_clauses) => {
|
ast::TypeAnnotation::Where(ta, has_clauses) => {
|
||||||
let ta = type_to_docs(false, ta.value);
|
let ta = type_to_docs(false, ta.value);
|
||||||
|
@ -397,8 +397,10 @@ fn ability_member_type_to_docs(
|
||||||
let ast::HasClause { var, abilities } = hc.value;
|
let ast::HasClause { var, abilities } = hc.value;
|
||||||
(
|
(
|
||||||
var.value.extract_spaces().item.to_string(),
|
var.value.extract_spaces().item.to_string(),
|
||||||
// TODO(abilities)
|
abilities
|
||||||
type_to_docs(false, abilities[0].value),
|
.iter()
|
||||||
|
.map(|ability| type_to_docs(false, ability.value))
|
||||||
|
.collect(),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue