diff options
author | Nicolás Ojeda Bär <n.oje.bar@gmail.com> | 2020-05-12 11:20:34 +0200 |
---|---|---|
committer | Nicolás Ojeda Bär <n.oje.bar@gmail.com> | 2020-05-13 20:57:21 +0200 |
commit | 4a44bf17678ee6fba23484f63fc2f48101d9354a (patch) | |
tree | cda0553c33a2163e2864943d673fbe656c921155 /stdlib | |
parent | 6e3f710d78e7ed6799df4e82351acb26850d5a15 (diff) | |
download | ocaml-4a44bf17678ee6fba23484f63fc2f48101d9354a.tar.gz |
Expose %loc_FUNCTION as __FUNCTION__
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/stdlib.ml | 1 | ||||
-rw-r--r-- | stdlib/stdlib.mli | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/stdlib/stdlib.ml b/stdlib/stdlib.ml index 5cef512c84..c58613a731 100644 --- a/stdlib/stdlib.ml +++ b/stdlib/stdlib.ml @@ -55,6 +55,7 @@ external __FILE__ : string = "%loc_FILE" external __LINE__ : int = "%loc_LINE" external __MODULE__ : string = "%loc_MODULE" external __POS__ : string * int * int * int = "%loc_POS" +external __FUNCTION__ : string = "%loc_FUNCTION" external __LOC_OF__ : 'a -> string * 'a = "%loc_LOC" external __LINE_OF__ : 'a -> int * 'a = "%loc_LINE" diff --git a/stdlib/stdlib.mli b/stdlib/stdlib.mli index 94d2b4ca3c..3330a5b24b 100644 --- a/stdlib/stdlib.mli +++ b/stdlib/stdlib.mli @@ -273,6 +273,12 @@ external __POS__ : string * int * int * int = "%loc_POS" @since 4.02.0 *) +external __FUNCTION__ : string = "%loc_FUNCTION" +(** [__FUNCTION__] returns the name of the current function or method, including + any enclosing modules or classes. + + @since 4.12.0 *) + external __LOC_OF__ : 'a -> string * 'a = "%loc_LOC" (** [__LOC_OF__ expr] returns a pair [(loc, expr)] where [loc] is the location of [expr] in the file currently being parsed by the |