make externally available the expression used for initializating a record field

This commit is contained in:
Vern Paxson 2024-04-08 17:54:58 -04:00 committed by Tim Wojtulewicz
parent 88ef6cb5b6
commit 9fe7d8581f
2 changed files with 10 additions and 1 deletions

View file

@ -854,6 +854,8 @@ void TypeDecl::DescribeReST(ODesc* d, bool roles_only) const {
namespace detail {
ExprPtr FieldInit::InitExpr() const { return nullptr; }
// A record field initialization that directly assigns a fixed value ...
class DirectFieldInit final : public FieldInit {
public:
@ -884,7 +886,7 @@ private:
class ExprFieldInit final : public FieldInit {
public:
// Initialization requires evaluating the given expression,
// yielding the a value of the given type (which might require
// yielding a value of the given type (which might require
// coercion for some records).
ExprFieldInit(detail::ExprPtr _init_expr, TypePtr _init_type)
: init_expr(std::move(_init_expr)), init_type(std::move(_init_type)) {
@ -910,6 +912,8 @@ public:
bool IsDeferrable() const override { return false; }
ExprPtr InitExpr() const override { return init_expr; }
private:
detail::ExprPtr init_expr;
TypePtr init_type;