aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/options/OptionsView.scala
diff options
context:
space:
mode:
authorSchuyler Eldridge2018-11-15 21:50:29 -0500
committerSchuyler Eldridge2018-11-21 23:22:11 -0500
commit696bc256a90cc80bcb094aaeada8eea51a643ae0 (patch)
tree8435ab570e88b60ca6af127e607794c64565bb9c /src/main/scala/firrtl/options/OptionsView.scala
parent4a2211c1602b37a65b4e44c3b7ebe82e8bfeedc0 (diff)
Change firrtl.options API, add Phase
This breaks firrtl.options.Stage into a small type hierarchy: * Phase: something that transforms an AnnotationSeq * Stage extends Phase: a Phase with a Command Line Interface Some of the old "common options" (input annotation file and target directory) are moved into firrtl.options and provided as part of the Stage class. Stage will automatically preprocess an input annotation sequence to resolve all input annotation files and add a default target directory. Minor changes: * Adds ViewException * Stops mixing in the DoNotTerminateOnExit trait into the default Shell parser * Add StageOptionsView Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/main/scala/firrtl/options/OptionsView.scala')
-rw-r--r--src/main/scala/firrtl/options/OptionsView.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/scala/firrtl/options/OptionsView.scala b/src/main/scala/firrtl/options/OptionsView.scala
index dade5c56..aacd997e 100644
--- a/src/main/scala/firrtl/options/OptionsView.scala
+++ b/src/main/scala/firrtl/options/OptionsView.scala
@@ -12,7 +12,8 @@ trait OptionsView[T] {
/** Convert an [[AnnotationSeq]] to some other type
* @param options some annotations
*/
- def view(options: AnnotationSeq): Option[T]
+ def view(options: AnnotationSeq): T
+
}
/** A shim to manage multiple "views" of an [[AnnotationSeq]] */
@@ -23,5 +24,6 @@ object Viewer {
* @param optionsView a converter of options to the requested type
* @tparam T the type to which the input [[AnnotationSeq]] should be viewed as
*/
- def view[T](options: AnnotationSeq)(implicit optionsView: OptionsView[T]): Option[T] = optionsView.view(options)
+ def view[T](options: AnnotationSeq)(implicit optionsView: OptionsView[T]): T = optionsView.view(options)
+
}