Created
July 13, 2013 06:14
-
-
Save pedrofurla/5989622 to your computer and use it in GitHub Desktop.
Returns the line number where it was invoked
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def line:Int = macro lineImpl | |
| def lineImpl(c:Context) = { | |
| import c.universe._ | |
| c.Expr[Int](Literal(Constant(c.enclosingPosition.line))) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment