summaryrefslogtreecommitdiff
path: root/macros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala
diff options
context:
space:
mode:
authorJack Koenig2022-01-10 10:39:52 -0800
committerJack Koenig2022-01-10 15:53:55 -0800
commit3131c0daad41dea78bede4517669e376c41a325a (patch)
tree55baed78a6a01f80ff3952a08233ca553a19964f /macros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala
parentdd36f97a82746cec0b25b94651581fe799e24579 (diff)
Apply scalafmt
Command: sbt scalafmtAll
Diffstat (limited to 'macros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala')
-rw-r--r--macros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala11
1 files changed, 7 insertions, 4 deletions
diff --git a/macros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala b/macros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala
index ac3e236c..01e0acd6 100644
--- a/macros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala
+++ b/macros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala
@@ -9,7 +9,6 @@ import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
import scala.reflect.macros.whitebox
-
/** Transforms a function call so that it can both provide implicit-style source information and
* have a chained apply call. Without macros, only one is possible, since having a implicit
* argument in the definition will cause the compiler to interpret a chained apply as an
@@ -65,7 +64,6 @@ class DefinitionWrapTransform(val c: Context) extends SourceInfoTransformMacro {
}
}
-
// Workaround for https://github.com/sbt/sbt/issues/3966
object InstanceTransform
// Module instantiation transform
@@ -138,7 +136,7 @@ class VecTransform(val c: Context) extends SourceInfoTransformMacro {
def reduceTree(redOp: c.Tree, layerOp: c.Tree): c.Tree = {
q"$thisObj.do_reduceTree($redOp,$layerOp)($implicitSourceInfo, $implicitCompileOptions)"
}
- def reduceTreeDefault(redOp: c.Tree ): c.Tree = {
+ def reduceTreeDefault(redOp: c.Tree): c.Tree = {
q"$thisObj.do_reduceTree($redOp)($implicitSourceInfo, $implicitCompileOptions)"
}
}
@@ -148,13 +146,17 @@ class VecTransform(val c: Context) extends SourceInfoTransformMacro {
*/
abstract class AutoSourceTransform extends SourceInfoTransformMacro {
import c.universe._
+
/** Returns the TermName of the transformed function, which is the applied function name with do_
* prepended.
*/
def doFuncTerm: TermName = {
val funcName = c.macroApplication match {
case q"$_.$funcName[..$_](...$_)" => funcName
- case _ => throw new Exception(s"Chisel Internal Error: Could not resolve function name from macro application: ${showCode(c.macroApplication)}")
+ case _ =>
+ throw new Exception(
+ s"Chisel Internal Error: Could not resolve function name from macro application: ${showCode(c.macroApplication)}"
+ )
}
TermName("do_" + funcName)
}
@@ -223,6 +225,7 @@ class CompileOptionsTransform(val c: Context) extends AutoSourceTransform {
// Workaround for https://github.com/sbt/sbt/issues/3966
object SourceInfoWhiteboxTransform
+
/** Special whitebox version of the blackbox SourceInfoTransform, used when fun things need to
* happen to satisfy the type system while preventing the use of macro overrides.
*/