Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Created June 12, 2019 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseoliv/89bf8b18cbb5d04c92d790e4771dedaa to your computer and use it in GitHub Desktop.
Save joseoliv/89bf8b18cbb5d04c92d790e4771dedaa to your computer and use it in GitHub Desktop.
compilationInfo
package metaobjectTest
@doc{*
Annotation 'compilationInfo' takes a parameter and returns an information
on the current source code. The parameter and the return type are as
follows:
"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");
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment