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

cgen: fix push on closed channel (#15468)

This commit is contained in:
yuyi
2022-08-20 00:27:42 +08:00
committed by GitHub
parent 6ed69289a8
commit fa447443ca
3 changed files with 10 additions and 2 deletions

View File

@ -390,8 +390,6 @@ pub fn gen(files []&ast.File, table &ast.Table, pref &pref.Preferences) string {
}
global_g.gen_jsons()
global_g.write_optionals()
global_g.write_results()
global_g.dump_expr_definitions() // this uses global_g.get_str_fn, so it has to go before the below for loop
for i := 0; i < global_g.str_types.len; i++ {
global_g.final_gen_str(global_g.str_types[i])
@ -406,6 +404,8 @@ pub fn gen(files []&ast.File, table &ast.Table, pref &pref.Preferences) string {
global_g.gen_array_index_methods()
global_g.gen_equality_fns()
global_g.gen_free_methods()
global_g.write_results()
global_g.write_optionals()
global_g.sort_globals_consts()
global_g.timers.show('cgen unification')

View File

@ -0,0 +1 @@
Channel closed.

View File

@ -0,0 +1,7 @@
module main
fn main() {
ch := chan int{cap: 100}
ch.close()
ch <- 1 or { println('Channel closed.') }
}