mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix vweb app route methods filtering (#16186)
This commit is contained in:
parent
26c737b6db
commit
4aa4af4afb
@ -477,7 +477,8 @@ fn (mut g Gen) comptime_for(node ast.ComptimeFor) {
|
|||||||
rec_sym := g.table.sym(method.receiver_type)
|
rec_sym := g.table.sym(method.receiver_type)
|
||||||
if rec_sym.kind == .struct_ {
|
if rec_sym.kind == .struct_ {
|
||||||
if _ := g.table.find_field_with_embeds(rec_sym, 'Context') {
|
if _ := g.table.find_field_with_embeds(rec_sym, 'Context') {
|
||||||
if method.generic_names.len > 0 {
|
if method.generic_names.len > 0
|
||||||
|
|| (method.params.len > 1 && method.attrs.len == 0) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,3 +92,17 @@ fn (mut app App) some_helper<T>(result T) ApiSuccessResponse<T> {
|
|||||||
fn (mut app App) ok() vweb.Result {
|
fn (mut app App) ok() vweb.Result {
|
||||||
return app.json(app.some_helper(123))
|
return app.json(app.some_helper(123))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct ExampleStruct {
|
||||||
|
example int
|
||||||
|
}
|
||||||
|
|
||||||
|
fn (mut app App) request_raw_2() vweb.Result {
|
||||||
|
stuff := []ExampleStruct{}
|
||||||
|
return app.request_raw(stuff)
|
||||||
|
}
|
||||||
|
|
||||||
|
// should compile, this is a helper method, not exposed as a route
|
||||||
|
fn (mut app App) request_raw(foo []ExampleStruct) vweb.Result {
|
||||||
|
return app.text('Hello world')
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user