
com.avsystem.commons.misc.SourceInfo.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-core_2.12 Show documentation
Show all versions of commons-core_2.12 Show documentation
AVSystem commons library for Scala
The newest version!
package com.avsystem.commons
package misc
/**
* Macro-materialized implicit value that provides information about callsite source file position.
* It can be used in runtime for logging and debugging purposes.
* Similar to Scalactic's `Position`, but contains more information.
*/
case class SourceInfo(
filePath: String,
fileName: String,
offset: Int,
line: Int,
column: Int,
lineContent: String,
enclosingSymbols: List[String]
) {
override def equals(obj: Any): Boolean = obj match {
case otherInfo: SourceInfo => filePath ==
otherInfo.filePath && offset == otherInfo.offset
case _ => false
}
override def hashCode: Int =
(filePath, offset).hashCode
}
object SourceInfo {
def apply()(implicit si: SourceInfo): SourceInfo = si
implicit def here: SourceInfo = macro macros.misc.MiscMacros.sourceInfo
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy