Skip to content

Commit a61622e

Browse files
committed
feat(core): add source-location macro to Dynamic
1 parent d718653 commit a61622e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

core/Dynamic.carp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,7 @@ integers [`imod`](#imod).")
123123

124124
(defndynamic add-c [relpath]
125125
(Project.config "cmod" (relative-to (current-file) relpath)))
126+
127+
(doc source-location "Returns a string representing the file and line number of the given AST node. Useful for building custom logging and profiling macros.")
128+
(defmacro source-location [x]
129+
(Dynamic.String.concat [(eval (list 'file x)) ":" (str (eval (list 'line x)))]))

0 commit comments

Comments
 (0)