On Mon, 27 Apr 2020, Jaskaran Singh wrote:
> Parameter attributes are added to the SmPL AST. Reflect these changes in
> unparse_ast0.ml.
>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654...@gmail.com>
> ---
> parsing_cocci/unparse_ast0.ml | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/parsing_cocci/unparse_ast0.ml b/parsing_cocci/unparse_ast0.ml
> index fdaf6cfa..738549fd 100644
> --- a/parsing_cocci/unparse_ast0.ml
> +++ b/parsing_cocci/unparse_ast0.ml
> @@ -546,9 +546,18 @@ and parameterTypeDef p =
> print_context p
> (function _ ->
> match Ast0.unwrap p with
> - Ast0.VoidParam(ty) -> typeC ty
> - | Ast0.Param(ty,Some id) -> print_named_type ty id
> - | Ast0.Param(ty,None) -> typeC ty
> + Ast0.VoidParam(ty,attr) ->
> + typeC ty;
> + (if (attr = []) then print_string " ");
> + print_between (fun _ -> print_string " ") (mcode print_string) attr;
> + | Ast0.Param(ty,Some id,attr) ->
> + print_named_type ty id;
> + (if (attr = []) then print_string " ");
> + print_between (fun _ -> print_string " ") (mcode print_string) attr;
> + | Ast0.Param(ty,None,attr) ->
> + typeC ty;
> + (if (attr = []) then print_string " ");
> + print_between (fun _ -> print_string " ") (mcode print_string) attr;
There is some unpleasant alignment in the code above. After the | there
should be a space not a tab, and the subsequent lines should use tabs if
possible. You didn't introduce these problems, but since you are changing
these lines, you may as well make these changes as well.
julia
> | Ast0.MetaParam(name,_,_) -> mcode print_meta name
> | Ast0.MetaParamList(name,_,_,_) -> mcode print_meta name
> | Ast0.PComma(cm) -> mcode print_string cm; print_space()
> --
> 2.21.1
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci