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

checker: add -skip-unused support for vweb.run_at too (#18884)

This commit is contained in:
Delyan Angelov 2023-07-17 15:51:50 +03:00 committed by GitHub
parent 63867d4ce0
commit 8c8d21d130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 1 deletions

View File

@ -2261,7 +2261,7 @@ fn (mut c Checker) post_process_generic_fns() ! {
for concrete_types in gtypes { for concrete_types in gtypes {
c.table.cur_concrete_types = concrete_types c.table.cur_concrete_types = concrete_types
c.fn_decl(mut node) c.fn_decl(mut node)
if node.name == 'vweb.run' { if node.name in ['vweb.run', 'vweb.run_at'] {
for ct in concrete_types { for ct in concrete_types {
if ct !in c.vweb_gen_types { if ct !in c.vweb_gen_types {
c.vweb_gen_types << ct c.vweb_gen_types << ct

View File

@ -0,0 +1,3 @@
[Vweb] Running app on http://localhost:38090/
[Vweb] We have 1 workers
done

View File

@ -0,0 +1,3 @@
[Vweb] Running app on http://localhost:38090/
[Vweb] We have 1 workers
done

View File

@ -0,0 +1,21 @@
import vweb
import time
struct App {
vweb.Context
}
fn main() {
spawn fn () {
time.sleep(100 * time.millisecond)
println('done')
exit(0)
}()
vweb.run_at(&App{}, port: 38090, nr_workers: 1)!
// vweb.run(&App{}, 38091)
}
['/']
pub fn (mut app App) app_main() vweb.Result {
return app.text('Hello World')
}