+ (* try to be more efficient for the case where the body is just
+ ... Perhaps this is too much of a special case, but useful
+ for dropping a parameter and checking that it is never used. *)
+ (match d with
+ Ast.MINUS(_,_,_,_) -> None
+ | _ ->
+ Some (
+ make_seq
+ [start_brace;
+ match whencode with
+ [] -> CTL.True
+ | _ ->
+ let leftarg =
+ ctl_and
+ (ctl_not
+ (List.fold_left
+ (function prev ->
+ function
+ Ast.WhenAlways(s) -> prev
+ | Ast.WhenNot(sl) ->
+ let x =
+ statement_list sl Tail
+ new_quantified3
+ new_mquantified3
+ label llabel slabel
+ true true in
+ ctl_or prev x
+ | Ast.WhenNotTrue(_)
+ | Ast.WhenNotFalse(_) ->
+ failwith "unexpected"
+ | Ast.WhenModifier
+ (Ast.WhenAny) -> CTL.False
+ | Ast.WhenModifier(_) -> prev)
+ CTL.False whencode))
+ (List.fold_left
+ (function prev ->
+ function
+ Ast.WhenAlways(s) ->
+ let x =
+ statement s Tail
+ new_quantified3
+ new_mquantified3
+ label llabel slabel true in
+ ctl_and prev x
+ | Ast.WhenNot(sl) -> prev
+ | Ast.WhenNotTrue(_)
+ | Ast.WhenNotFalse(_) ->
+ failwith "unexpected"
+ | Ast.WhenModifier(Ast.WhenAny) ->
+ CTL.True
+ | Ast.WhenModifier(_) -> prev)
+ CTL.True whencode) in
+ ctl_au leftarg (make_match stripped_rbrace)]))
+ | _ -> None)
+ | _ -> None in
+ let optim2 =
+ (* function body is all minus, no whencode *)
+ match Ast.undots body with
+ [body] ->
+ (match Ast.unwrap body with
+ Ast.Dots
+ ((_,i,(Ast.MINUS(_,_,_,[]) as d),_),[],_,_) ->
+ (match (Ast.unwrap lbrace,Ast.unwrap rbrace) with
+ (Ast.SeqStart((_,_,Ast.MINUS(_,_,_,[]),_)),
+ Ast.SeqEnd((_,_,Ast.MINUS(_,_,_,[]),_)))
+ when not (contains_pos rbrace) ->
+ Some
+ (* andany drops everything to the end, including close
+ braces - not just function body, could check
+ label to keep braces *)
+ (ctl_and start_brace
+ (ctl_ax
+ (CTL.AndAny
+ (CTL.FORWARD,guard_to_strict guard,CTL.True,
+ make_match
+ (make_meta_rule_elem d ([],[],[]))))))
+ | _ -> None)