Skip to content

Commit 7442af2

Browse files
author
Oron Port
committed
fix missing global context for top-level design arguments when trying to get their data for DFApp
1 parent 7e9544e commit 7442af2

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

core/src/main/scala/dfhdl/core/DFRef.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import dfhdl.compiler.analysis.DclPort
44

55
import scala.annotation.targetName
66
extension [M <: ir.DFMember](member: M)
7-
private def injectGlobalCtx()(using DFC): Unit =
7+
private[dfhdl] def injectGlobalCtx()(using DFC): Unit =
88
import dfc.getSet
99
member match
1010
case dfVal: ir.DFVal.CanBeGlobal if dfVal.isGlobal =>

lib/src/main/scala/dfhdl/app/DesignArgs.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package dfhdl.app
22
import dfhdl.*
33
import dfhdl.compiler.ir
4-
import core.{DFValAny, asValAny}
4+
import core.{DFValAny, asValAny, injectGlobalCtx}
55
import scala.collection.immutable.ListMap
66

77
case class DesignArg(name: String, value: Any, desc: String)(using DFC):
88
val typeName =
99
value match
10-
case _: String => "String"
11-
case _: Int => "Int"
12-
case _: Double => "Double"
13-
case _: Boolean => "Boolean"
14-
case _: BigInt => "Int"
10+
case _: String => "String"
11+
case _: Int => "Int"
12+
case _: Double => "Double"
13+
case _: Boolean => "Boolean"
14+
case _: BigInt => "Int"
1515
case dfConst: DFValAny =>
1616
dfConst.asIR.dfType match
1717
case ir.DFBit | ir.DFBool => "Boolean"
@@ -22,6 +22,7 @@ case class DesignArg(name: String, value: Any, desc: String)(using DFC):
2222
val data = value match
2323
case dfConst: DFValAny =>
2424
import dfc.getSet
25+
dfConst.asIR.injectGlobalCtx()
2526
dfConst.asIR.getConstData.asInstanceOf[Option[Option[Any]]].get.get
2627
case _ => value
2728
data match

0 commit comments

Comments
 (0)