diff options
author | Son Ho | 2021-11-29 18:20:12 +0100 |
---|---|---|
committer | Son Ho | 2021-11-29 18:20:12 +0100 |
commit | 39dc9fb942bd965f5b68d0159ee1dfe15a2deb6d (patch) | |
tree | bd27d1042ae3944f378b2843b13cad45b40dc567 | |
parent | 1991b6b9d1d1a5e00ac8b54a66458aa696e7baab (diff) |
Implement eval_ctx_to_ast_formatter
Diffstat (limited to '')
-rw-r--r-- | src/Print.ml | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Print.ml b/src/Print.ml index 441e76e6..6d340835 100644 --- a/src/Print.ml +++ b/src/Print.ml @@ -525,6 +525,29 @@ module CfimAst = struct PT.type_def_id_to_string = fmt.type_def_id_to_string; } + let eval_ctx_to_ast_formatter (ctx : C.eval_ctx) : ast_formatter = + let ctx_fmt = PC.eval_ctx_to_ctx_formatter ctx in + let adt_field_to_string def_id opt_variant_id field_id = + let def = T.TypeDefId.nth ctx.type_context def_id in + let fields = T.type_def_get_fields def opt_variant_id in + let field = T.FieldId.nth fields field_id in + field.T.field_name + in + let fun_def_id_to_string def_id = + let def = A.FunDefId.nth ctx.fun_context def_id in + PT.name_to_string def.name + in + { + r_to_string = ctx_fmt.PV.r_to_string; + type_var_id_to_string = ctx_fmt.PV.type_var_id_to_string; + type_def_id_to_string = ctx_fmt.PV.type_def_id_to_string; + adt_variant_to_string = ctx_fmt.PV.adt_variant_to_string; + var_id_to_string = ctx_fmt.PV.var_id_to_string; + adt_field_names = ctx_fmt.PV.adt_field_names; + adt_field_to_string; + fun_def_id_to_string; + } + let rec projection_to_string (fmt : ast_formatter) (inside : string) (p : E.projection) : string = match p with |