Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package metaobjectTest
Annotation 'compilationInfo' takes a parameter and returns an information
on the current source code. The parameter and the return type are as
"filename", "String"
"prototypename", "String"
"packagename", "String"
"linenumber", "Int"
"columnnumber", "Int"
"localvariablelist", "Array<String>"
"fieldlist", "Array<String>"
"signatureallmethodslist", "Array<String>"
"currentmethodname", "String"
"currentmethodfullname", "String"
"currentmethodreturntypename", "String"
There may be spaces between the letters and they can be in lower or upper case:
@compilationInfo("current Method FULL name");
object CompilationInfo
func run {
var String filename = @compilationInfo("filename");
var String prototypeName = @compilationInfo("prototypename");
var String packagename = @compilationInfo("packagename");
var Int linenumber = @compilationInfo("linenumber");
var Int columnnumber = @compilationInfo("columnnumber");
var Array<String> localvariablelist = @compilationInfo("localvariablelist");
var Array<String> fieldlist = @compilationInfo("fieldlist");
var Array<String> signatureallmethodslist = @compilationInfo("signatureallmethodslist");
var String currentmethodname = @compilationInfo("currentmethodname");
var String currentmethodfullname = @compilationInfo("currentmethodfullname");
var String currentmethodreturntypename = @compilationInfo("currentmethodreturntypename");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment