Skip to content

Latest commit

 

History

History

outOfScopeMethodCall

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

This example shows how to create a macro that calls this.bar when the type of this is not known but otherwise the name and parameters of the target method are known. The tricky part is to obtain the reference of this. We can do it by inspecting the place where the macro is expanded. We can obtain the symbol of the method where it is expanded via Symbol.spliceOwner. We can then access the symbol of the place where that method is defined (a class or another method in case of method nesting) via Symbol.owner.