All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mdoc.internal.sourcecode.Compat.scala Maven / Gradle / Ivy

The newest version!
package mdoc.internal.sourcecode

object Compat {
  type Context = scala.reflect.macros.blackbox.Context
  def enclosingOwner(c: Context) = c.internal.enclosingOwner

  def enclosingParamList(c: Context): List[List[c.Symbol]] = {
    def nearestEnclosingMethod(owner: c.Symbol): c.Symbol =
      if (owner.isMethod) owner
      else if (owner.isClass) owner.asClass.primaryConstructor
      else nearestEnclosingMethod(owner.owner)

    nearestEnclosingMethod(enclosingOwner(c)).asMethod.paramLists
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy