1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

doc: vfmt and make compile

This commit is contained in:
Alexander Medvednikov 2020-09-09 14:24:42 +02:00
parent cb43084e26
commit 78e28a72ed

View File

@ -14,7 +14,7 @@ import v.util
pub struct Doc {
pub mut:
input_path string = ''
input_path string
prefs &pref.Preferences = &pref.Preferences{}
table &table.Table = &table.Table{}
pub_only bool = true
@ -34,10 +34,10 @@ pub:
pub struct DocNode {
pub mut:
name string
content string = ''
content string
comment string
pos DocPos = DocPos{-1, -1}
file_path string = ''
file_path string
attrs map[string]string
}
@ -156,7 +156,9 @@ pub fn (d Doc) get_name(stmt ast.Stmt) string {
pub fn new_vdoc_preferences() &pref.Preferences {
// vdoc should be able to parse as much user code as possible
// so its preferences should be permissive:
return &pref.Preferences{ enable_globals: true }
return &pref.Preferences{
enable_globals: true
}
}
pub fn new(input_path string) Doc {
@ -424,13 +426,8 @@ fn (mut d Doc) generate() ?Doc {
ast.InterfaceDecl { node.attrs['category'] = 'Interfaces' }
ast.StructDecl { node.attrs['category'] = 'Structs' }
ast.TypeDecl { node.attrs['category'] = 'Typedefs' }
ast.FnDecl {
node.attrs['category'] = if node.attrs['parent'] in ['void', ''] || !node.attrs.exists('parent') {
'Functions'
} else {
'Methods'
}
}
ast.FnDecl { node.attrs['category'] = if node.attrs['parent'] in ['void', ''] ||
!node.attrs.exists('parent') { 'Functions' } else { 'Methods' } }
else {}
}
d.contents << node