@@ -348,26 +348,25 @@ plain_instr :
348348
349349select_instr :
350350 | SELECT select_instr_results
351- { let at = at () in fun c -> let b, ts = $ 2 in
352- select (if b then (Some ts) else None ) @@ at }
351+ { let at = at () in fun c -> select $ 2 @@ at }
353352
354353select_instr_results :
355- | LPAR RESULT value_type_list RPAR select_instr_results
356- { let _, ts = $ 5 in true , $ 3 @ ts }
354+ | LPAR RESULT value_type RPAR
355+ { Some $ 3 }
357356 | /* empty */
358- { false , [] }
357+ { None }
359358
360359select_instr_instr :
361360 | SELECT select_instr_results_instr
362361 { let at1 = ati 1 in
363- fun c -> let b, ts , es = $ 2 c in
364- select ( if b then ( Some ts) else None ) @@ at1, es }
362+ fun c -> let t_opt , es = $ 2 c in
363+ select t_opt @@ at1, es }
365364
366365select_instr_results_instr :
367- | LPAR RESULT value_type_list RPAR select_instr_results_instr
368- { fun c -> let _, ts, es = $ 5 c in true , $ 3 @ ts, es }
366+ | LPAR RESULT value_type RPAR instr
367+ { fun c -> Some $ 3 , $ 5 c }
369368 | instr
370- { fun c -> false , [] , $ 1 c }
369+ { fun c -> None , $ 1 c }
371370
372371
373372call_instr :
@@ -458,7 +457,7 @@ expr : /* Sugar */
458457expr1 : /* Sugar */
459458 | plain_instr expr_list { fun c -> $2 c, $1 c }
460459 | SELECT select_expr_results
461- { fun c -> let b, ts, es = $ 2 c in es, select ( if b then ( Some ts) else None ) }
460+ { fun c -> let t_opt, es = $ 2 c in es, select t_opt }
462461 | CALL_INDIRECT var call_expr_type
463462 { fun c -> let x, es = $ 3 c in es, call_indirect ($ 2 c table) x }
464463 | CALL_INDIRECT call_expr_type /* Sugar */
@@ -473,10 +472,10 @@ expr1 : /* Sugar */
473472 let ts, (es, es1, es2) = $ 3 c c' in es, if_ ts es1 es2 }
474473
475474select_expr_results :
476- | LPAR RESULT value_type_list RPAR select_expr_results
477- { fun c -> let _, ts, es = $ 5 c in true , $ 3 @ ts, es }
475+ | LPAR RESULT value_type RPAR expr_list
476+ { fun c -> Some $ 3 , $ 5 c }
478477 | expr_list
479- { fun c -> false , [] , $ 1 c }
478+ { fun c -> None , $ 1 c }
480479
481480call_expr_type :
482481 | type_use call_expr_params
0 commit comments