From 9ca9df88c017990771cb3f48db4df5da34af5a65 Mon Sep 17 00:00:00 2001 From: Thomas Refis Date: Wed, 16 Sep 2020 20:49:05 +0200 Subject: [PATCH] Untypeast: define untype_expression, untype_pattern (#9920) Convenience functions that have been defined in merlin for a while. --- typing/untypeast.ml | 6 ++++++ typing/untypeast.mli | 2 ++ 2 files changed, 8 insertions(+) diff --git a/typing/untypeast.ml b/typing/untypeast.ml index 7106da5b9..dc36aaf43 100644 --- a/typing/untypeast.ml +++ b/typing/untypeast.ml @@ -887,3 +887,9 @@ let untype_structure ?(mapper=default_mapper) structure = let untype_signature ?(mapper=default_mapper) signature = mapper.signature mapper signature + +let untype_expression ?(mapper=default_mapper) expression = + mapper.expr mapper expression + +let untype_pattern ?(mapper=default_mapper) pattern = + mapper.pat mapper pattern diff --git a/typing/untypeast.mli b/typing/untypeast.mli index d8a01519f..809df9ad0 100644 --- a/typing/untypeast.mli +++ b/typing/untypeast.mli @@ -81,5 +81,7 @@ val default_mapper : mapper val untype_structure : ?mapper:mapper -> Typedtree.structure -> structure val untype_signature : ?mapper:mapper -> Typedtree.signature -> signature +val untype_expression : ?mapper:mapper -> Typedtree.expression -> expression +val untype_pattern : ?mapper:mapper -> _ Typedtree.general_pattern -> pattern val constant : Asttypes.constant -> Parsetree.constant