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

pull/9653/head
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
1 changed files with 1 additions and 0 deletions

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) {
if styp !in g.chan_push_optionals {
g.chan_push_optionals << styp
g.register_optional(ast.void_type.set_flag(.optional))
g.channel_definitions.writeln('
static inline Option_void __Option_${styp}_pushval($styp ch, $el_type e) {
if (sync__Channel_try_push_priv(ch, &e, false)) {