diff options
| author | ducky | 2018-05-11 16:17:44 -0700 |
|---|---|---|
| committer | Richard Lin | 2018-07-04 18:39:28 -0500 |
| commit | 83005e118c869f7cbadab32e1693e70a8e4c9840 (patch) | |
| tree | ed204b33f9f47b576ffff46052b9ab53399b0aab /chiselFrontend/src/main | |
| parent | 9a551fe1cc9c15d1ab9fca204ec3bdac2f920c48 (diff) | |
unbroken
Diffstat (limited to 'chiselFrontend/src/main')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/internal/Builder.scala | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala b/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala index d6c3c5d6..360994b1 100644 --- a/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala +++ b/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala @@ -79,6 +79,10 @@ private[chisel3] trait HasId extends InstanceId { private[chisel3] val _id: Long = Builder.idGen.next + // TODO: remove this, but its removal seems to cause a nasty Scala compiler crash. + override def hashCode: Int = super.hashCode() + override def equals(that: Any): Boolean = super.equals(that) + // Facilities for 'suggesting' a name to this. // Post-name hooks called to carry the suggestion to other candidates as needed private var suggested_name: Option[String] = None @@ -200,7 +204,10 @@ private[chisel3] object Builder { def annotations: ArrayBuffer[ChiselAnnotation] = dynamicContext.annotations def namingStack: internal.naming.NamingStack = dynamicContext.namingStack - def currentModule: Option[BaseModule] = dynamicContext.currentModule + def currentModule: Option[BaseModule] = dynamicContextVar.value match { + case Some(dyanmicContext) => dynamicContext.currentModule + case _ => None + } def currentModule_=(target: Option[BaseModule]): Unit = { dynamicContext.currentModule = target } @@ -284,9 +291,10 @@ private[chisel3] object Builder { } def errors: ErrorLog = dynamicContext.errors - def error(m: => String): Unit = errors.error(m) - def warning(m: => String): Unit = errors.warning(m) - def deprecated(m: => String, location: Option[String] = None): Unit = errors.deprecated(m, location) + def error(m: => String): Unit = if (dynamicContextVar.value.isDefined) errors.error(m) + def warning(m: => String): Unit = if (dynamicContextVar.value.isDefined) errors.warning(m) + def deprecated(m: => String, location: Option[String] = None): Unit = + if (dynamicContextVar.value.isDefined) errors.deprecated(m, location) /** Record an exception as an error, and throw it. * |
