Constify scope reference in NetEConstParam and NetECRealParam

Parameter expressions need to remember the scope they have been declared in
so that the code generator backends can insert the right parameter
reference, rather than a constant value.

Currently the scope is stored as a non-const reference. But that is not
needed. Mark the scope reference as const so NetEConstParam and
NetECRealParam can be created when only a const scope reference is
available.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-02-19 12:08:57 +01:00
parent 892622bf64
commit ad23b08a10
3 changed files with 6 additions and 6 deletions

View File

@ -304,7 +304,7 @@ ivl_variable_type_t NetECReal::expr_type() const
return IVL_VT_REAL;
}
NetECRealParam::NetECRealParam(NetScope*s, perm_string n, const verireal&v)
NetECRealParam::NetECRealParam(const NetScope*s, perm_string n, const verireal&v)
: NetECReal(v), scope_(s), name_(n)
{
}

View File

@ -2391,7 +2391,7 @@ void NetEConst::trim()
expr_width(value_.len());
}
NetEConstParam::NetEConstParam(NetScope*s, perm_string n, const verinum&v)
NetEConstParam::NetEConstParam(const NetScope*s, perm_string n, const verinum&v)
: NetEConst(v), scope_(s), name_(n)
{
cast_signed_base_(v.has_sign());

View File

@ -2175,7 +2175,7 @@ class NetEConstEnum : public NetEConst {
class NetEConstParam : public NetEConst {
public:
explicit NetEConstParam(NetScope*scope, perm_string name,
explicit NetEConstParam(const NetScope*scope, perm_string name,
const verinum&val);
~NetEConstParam();
@ -2188,7 +2188,7 @@ class NetEConstParam : public NetEConst {
virtual NetEConstParam* dup_expr() const;
private:
NetScope*scope_;
const NetScope*scope_;
perm_string name_;
};
@ -2236,7 +2236,7 @@ class NetECString : public NetEConst {
class NetECRealParam : public NetECReal {
public:
explicit NetECRealParam(NetScope*scope, perm_string name,
explicit NetECRealParam(const NetScope*scope, perm_string name,
const verireal&val);
~NetECRealParam();
@ -2249,7 +2249,7 @@ class NetECRealParam : public NetECReal {
virtual NetECRealParam* dup_expr() const;
private:
NetScope*scope_;
const NetScope*scope_;
perm_string name_;
};