Skip to content

Commit

Permalink
fix: docs of docs.ExternFunctionDocs has always been empty
Browse files Browse the repository at this point in the history
  • Loading branch information
vknabel committed Feb 17, 2022
1 parent b0797ce commit 2a98e0c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ast/decl-extern-func.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type DeclExternFunc struct {
Name Identifier
Parameters []DeclParameter

Docs *Docs
MetaInfo *MetaDecl
}

Expand All @@ -28,3 +29,7 @@ func MakeDeclExternFunc(name Identifier, params []DeclParameter, source *Source)
MetaInfo: &MetaDecl{source},
}
}

func (decl DeclExternFunc) ProvidedDocs() *Docs {
return decl.Docs
}
1 change: 1 addition & 0 deletions parser/parse-decl-extern.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func (fp *FileParser) ParseExternDeclaration() (*ast.Decl, []SyntaxError) {
return nil, errs
}
funcDecl := ast.MakeDeclExternFunc(name, params, fp.AstSource())
funcDecl.Docs = fp.ConsumeDocs()
decl = *funcDecl
return &decl, nil
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/external-docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func docsInspectValue(value RuntimeValue, env *Environment) (RuntimeValue, *Runt
}
return env.MakeDataRuntimeValue("ExternFunctionDocs", map[string]Evaluatable{
"name": NewConstantRuntimeValue(PreludeString(value.Decl.Name)),
"docs": NewConstantRuntimeValue(PreludeString("")),
"docs": NewConstantRuntimeValue(PreludeString(value.Decl.Docs.Content)),
"params": NewConstantRuntimeValue(paramsList),
})
case RxVariableType:
Expand Down

0 comments on commit 2a98e0c

Please sign in to comment.