Skip to content

Commit 2a98e0c

Browse files
committed
fix: docs of docs.ExternFunctionDocs has always been empty
1 parent b0797ce commit 2a98e0c

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

ast/decl-extern-func.go

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type DeclExternFunc struct {
66
Name Identifier
77
Parameters []DeclParameter
88

9+
Docs *Docs
910
MetaInfo *MetaDecl
1011
}
1112

@@ -28,3 +29,7 @@ func MakeDeclExternFunc(name Identifier, params []DeclParameter, source *Source)
2829
MetaInfo: &MetaDecl{source},
2930
}
3031
}
32+
33+
func (decl DeclExternFunc) ProvidedDocs() *Docs {
34+
return decl.Docs
35+
}

parser/parse-decl-extern.go

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ func (fp *FileParser) ParseExternDeclaration() (*ast.Decl, []SyntaxError) {
1515
return nil, errs
1616
}
1717
funcDecl := ast.MakeDeclExternFunc(name, params, fp.AstSource())
18+
funcDecl.Docs = fp.ConsumeDocs()
1819
decl = *funcDecl
1920
return &decl, nil
2021
}

runtime/external-docs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func docsInspectValue(value RuntimeValue, env *Environment) (RuntimeValue, *Runt
197197
}
198198
return env.MakeDataRuntimeValue("ExternFunctionDocs", map[string]Evaluatable{
199199
"name": NewConstantRuntimeValue(PreludeString(value.Decl.Name)),
200-
"docs": NewConstantRuntimeValue(PreludeString("")),
200+
"docs": NewConstantRuntimeValue(PreludeString(value.Decl.Docs.Content)),
201201
"params": NewConstantRuntimeValue(paramsList),
202202
})
203203
case RxVariableType:

0 commit comments

Comments
 (0)