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

cgen: register Option_void when used for chan <- x or {...} (#9648)

This commit is contained in:
Uwe Krüger 2021-04-09 17:18:02 +02:00 committed by GitHub
parent 820fe626e7
commit 0c710ce470
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -670,6 +670,7 @@ static inline $opt_el_type __Option_${styp}_popval($styp ch) {
fn (mut g Gen) register_chan_push_optional_call(el_type string, styp string) { fn (mut g Gen) register_chan_push_optional_call(el_type string, styp string) {
if styp !in g.chan_push_optionals { if styp !in g.chan_push_optionals {
g.chan_push_optionals << styp g.chan_push_optionals << styp
g.register_optional(ast.void_type.set_flag(.optional))
g.channel_definitions.writeln(' g.channel_definitions.writeln('
static inline Option_void __Option_${styp}_pushval($styp ch, $el_type e) { static inline Option_void __Option_${styp}_pushval($styp ch, $el_type e) {
if (sync__Channel_try_push_priv(ch, &e, false)) { if (sync__Channel_try_push_priv(ch, &e, false)) {