diff options
| author | Daniel Kasza | 2020-11-16 14:21:01 -0500 |
|---|---|---|
| committer | GitHub | 2020-11-16 14:21:01 -0500 |
| commit | 87916d55490ff04691bc59454086c82ed09646b2 (patch) | |
| tree | a0f2a95adbff6016af74717bf240e810ae738606 /src/main/scala/chisel3 | |
| parent | e6192ea75ce0d840b4b51a376921c2feecaa3b46 (diff) | |
Improve source locators for switch statements. (#1669)
* Improve source locators for switch statements.
Diffstat (limited to 'src/main/scala/chisel3')
| -rw-r--r-- | src/main/scala/chisel3/util/Conditional.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/scala/chisel3/util/Conditional.scala b/src/main/scala/chisel3/util/Conditional.scala index ca393055..b934f27f 100644 --- a/src/main/scala/chisel3/util/Conditional.scala +++ b/src/main/scala/chisel3/util/Conditional.scala @@ -10,6 +10,7 @@ import scala.language.experimental.macros import scala.reflect.macros.blackbox._ import chisel3._ +import chisel3.internal.sourceinfo.SourceInfo @deprecated("The unless conditional is deprecated, use when(!condition){...} instead", "3.2") object unless { @@ -25,7 +26,7 @@ object unless { * @note DO NOT USE. This API is subject to change without warning. */ class SwitchContext[T <: Element](cond: T, whenContext: Option[WhenContext], lits: Set[BigInt]) { - def is(v: Iterable[T])(block: => Any): SwitchContext[T] = { + def is(v: Iterable[T])(block: => Any)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SwitchContext[T] = { if (!v.isEmpty) { val newLits = v.map { w => require(w.litOption.isDefined, "is condition must be literal") @@ -43,8 +44,8 @@ class SwitchContext[T <: Element](cond: T, whenContext: Option[WhenContext], lit this } } - def is(v: T)(block: => Any): SwitchContext[T] = is(Seq(v))(block) - def is(v: T, vr: T*)(block: => Any): SwitchContext[T] = is(v :: vr.toList)(block) + def is(v: T)(block: => Any)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SwitchContext[T] = is(Seq(v))(block) + def is(v: T, vr: T*)(block: => Any)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SwitchContext[T] = is(v :: vr.toList)(block) } /** Use to specify cases in a [[switch]] block, equivalent to a [[when$ when]] block comparing to |
