Skip to content

Commit

Permalink
checker: add -skip-unused support for vweb.run_at too (#18884)
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Jul 17, 2023
1 parent 63867d4 commit 8c8d21d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vlib/v/checker/fn.v
Expand Up @@ -2261,7 +2261,7 @@ fn (mut c Checker) post_process_generic_fns() ! {
for concrete_types in gtypes {
c.table.cur_concrete_types = concrete_types
c.fn_decl(mut node)
if node.name == 'vweb.run' {
if node.name in ['vweb.run', 'vweb.run_at'] {
for ct in concrete_types {
if ct !in c.vweb_gen_types {
c.vweb_gen_types << ct
Expand Down
3 changes: 3 additions & 0 deletions vlib/v/tests/skip_unused/vweb_run_at.run.out
@@ -0,0 +1,3 @@
[Vweb] Running app on http://localhost:38090/
[Vweb] We have 1 workers
done
3 changes: 3 additions & 0 deletions vlib/v/tests/skip_unused/vweb_run_at.skip_unused.run.out
@@ -0,0 +1,3 @@
[Vweb] Running app on http://localhost:38090/
[Vweb] We have 1 workers
done
21 changes: 21 additions & 0 deletions vlib/v/tests/skip_unused/vweb_run_at.vv
@@ -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')
}

0 comments on commit 8c8d21d

Please sign in to comment.