Skip to content

Instantly share code, notes, and snippets.

@pedrofurla
Created July 13, 2013 06:14
Show Gist options
  • Select an option

  • Save pedrofurla/5989622 to your computer and use it in GitHub Desktop.

Select an option

Save pedrofurla/5989622 to your computer and use it in GitHub Desktop.
Returns the line number where it was invoked
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