mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools: add support for a |``v shared| markdown code tag, for illustrating code examples starting with
module not_main`
This commit is contained in:
@ -517,6 +517,24 @@ fn (mut f MDFile) check_examples() CheckResult {
|
|||||||
}
|
}
|
||||||
oks++
|
oks++
|
||||||
}
|
}
|
||||||
|
'shared' {
|
||||||
|
res := cmdexecute('${os.quoted_path(vexe)} -w -Wfatal-errors -shared -o ${os.quoted_path(cfile)} ${os.quoted_path(vfile)}')
|
||||||
|
if res != 0 || fmt_res != 0 {
|
||||||
|
if res != 0 {
|
||||||
|
eprintln(eline(f.path, e.sline, 0, 'module example failed to compile with -shared'))
|
||||||
|
}
|
||||||
|
f.report_not_formatted_example_if_needed(e, fmt_res, vfile) or {
|
||||||
|
unsafe {
|
||||||
|
goto recheck_all_examples
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eprintln(vcontent)
|
||||||
|
should_cleanup_vfile = false
|
||||||
|
errors++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
oks++
|
||||||
|
}
|
||||||
'failcompile' {
|
'failcompile' {
|
||||||
res := silent_cmdexecute('${os.quoted_path(vexe)} -w -Wfatal-errors -o ${os.quoted_path(cfile)} ${os.quoted_path(vfile)}')
|
res := silent_cmdexecute('${os.quoted_path(vexe)} -w -Wfatal-errors -o ${os.quoted_path(cfile)} ${os.quoted_path(vfile)}')
|
||||||
if res == 0 || fmt_res != 0 {
|
if res == 0 || fmt_res != 0 {
|
||||||
@ -580,7 +598,7 @@ fn (mut f MDFile) check_examples() CheckResult {
|
|||||||
}
|
}
|
||||||
'nofmt' {}
|
'nofmt' {}
|
||||||
else {
|
else {
|
||||||
eprintln(eline(f.path, e.sline, 0, 'unrecognized command: "$command", use one of: wip/ignore/compile/cgen/failcompile/okfmt/oksyntax/badsyntax/nofmt'))
|
eprintln(eline(f.path, e.sline, 0, 'unrecognized command: "$command", use one of: wip/ignore/compile/failcompile/okfmt/nofmt/oksyntax/badsyntax/cgen/globals/live/shared'))
|
||||||
should_cleanup_vfile = false
|
should_cleanup_vfile = false
|
||||||
errors++
|
errors++
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user