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

all: replace generic <> with [] - part 2 (#16536)

This commit is contained in:
yuyi
2022-11-27 00:23:26 +08:00
committed by GitHub
parent b19b97e7b1
commit ef5be22f81
297 changed files with 1959 additions and 1943 deletions

View File

@@ -125,7 +125,7 @@ fn main() {
}
// webhook server mode
if flag_options.serve {
vweb.run<WebhookServer>(&WebhookServer{}, flag_options.port)
vweb.run[WebhookServer](&WebhookServer{}, flag_options.port)
} else {
// cmd mode
mut gen_vc := new_gen_vc(flag_options)

View File

@@ -336,7 +336,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
tls_bench.no_cstep = true
tls_bench.njobs = ts.benchmark.njobs
mut relative_file := os.real_path(p.get_item<string>(idx))
mut relative_file := os.real_path(p.get_item[string](idx))
mut cmd_options := [ts.vargs]
mut run_js := false

View File

@@ -109,23 +109,23 @@ fn defer_fn() {
}
// generic function
fn g_fn<T>(p T) T {
fn g_fn[T](p T) T {
return p
}
// generic struct
struct GenericStruct<T> {
struct GenericStruct[T] {
point Point
mut:
model T
}
// generic interface
interface Gettable<T> {
interface Gettable[T] {
get() T
}
// generic sumtype
struct None {}
type MyOption<T> = Error | None | T
type MyOption[T] = Error | None | T

View File

@@ -228,7 +228,7 @@ fn (t Tree) token_node(tok_kind token.Kind) &Node {
}
// enum type node
fn (t Tree) enum_node<T>(value T) &Node {
fn (t Tree) enum_node[T](value T) &Node {
return t.string_node('enum:${int(value)}(${value})')
}

View File

@@ -201,7 +201,7 @@ fn (vd VDoc) work_processor(mut work sync.Channel, mut wg sync.WaitGroup) {
fn (vd VDoc) render_parallel(out Output) {
vjobs := runtime.nr_jobs()
mut work := sync.new_channel<ParallelDoc>(u32(vd.docs.len))
mut work := sync.new_channel[ParallelDoc](u32(vd.docs.len))
mut wg := sync.new_waitgroup()
for i in 0 .. vd.docs.len {
p_doc := ParallelDoc{vd.docs[i], out}