diff options
| author | Andrew Waterman | 2016-10-05 15:18:25 -0700 |
|---|---|---|
| committer | Andrew Waterman | 2016-10-05 15:49:59 -0700 |
| commit | b2373ebda5e63fa850de21585307013f8419320a (patch) | |
| tree | 9d155b3f7bbc02421b1b50d52cbbf8c23f7eafab /chiselFrontend/src/main/scala/chisel3/core/Data.scala | |
| parent | c7ce06493300cf7ffa89ef472cd6a7086443c16f (diff) | |
Make asInput/asOutput/flip deprecation warnings dynamic
Code that imports Chisel._ shouldn't see them.
Not sure if requireIOWrap is the right condition... or if cyan is a
good choice of color for deprecation warnings.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Data.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Data.scala | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Data.scala b/chiselFrontend/src/main/scala/chisel3/core/Data.scala index 3f21a34c..922b33a9 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Data.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Data.scala @@ -104,12 +104,21 @@ object Data { } implicit class AddDirectionToData[T<:Data](val target: T) extends AnyVal { - @deprecated("Input(Data) should be used over Data.asInput", "gchisel") - def asInput: T = Input(target) - @deprecated("Output(Data) should be used over Data.asOutput", "gchisel") - def asOutput: T = Output(target) - @deprecated("Flipped(Data) should be used over Data.flip", "gchisel") - def flip(): T = Flipped(target) + def asInput(implicit opts: CompileOptions): T = { + if (opts.deprecateOldDirectionMethods) + Builder.deprecated("Input(Data) should be used over Data.asInput") + Input(target) + } + def asOutput(implicit opts: CompileOptions): T = { + if (opts.deprecateOldDirectionMethods) + Builder.deprecated("Output(Data) should be used over Data.asOutput") + Output(target) + } + def flip()(implicit opts: CompileOptions): T = { + if (opts.deprecateOldDirectionMethods) + Builder.deprecated("Flipped(Data) should be used over Data.flip") + Flipped(target) + } } } |
