Avatar
関数に渡された値をログに出力したい時に使えるみたいな書き込みがありましたね。 func myMethod(_ text: String, num: Int, flag: Bool) { #debugLog("message") } // myMethod("text", num: 4, flag: true): message https://forums.swift.org/t/macros-accessing-the-parent-context-of-a-syntax-node-passed-to-a-macro/64443/3 (edited)
Here's a use case: I have a theoretically-working prototype* of a macro that prints the enclosing context for logging. For instance, if you had func myMethod(_ text: String, num: Int, flag: Bool) { #debugLog("message") } The macro would expand to printing myMethod("text", num: 4, flag: true): message to the console, or whatever the actua...