Skip to content

Commit

Permalink
ProductValueTypeExpression::members(): unwrap SubobjectValueExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyG committed Oct 12, 2023
1 parent 4b877ab commit de08e1e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions lib/reflifc/include/reflifc/Expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ namespace reflifc
ProductValueTypeExpression as_product_value_type() const;

ifc::ExprSort sort() const { return index_.sort(); }
ifc::ExprIndex index() const { return index_; }

auto operator<=>(Expression const& other) const = default;

Expand Down
19 changes: 14 additions & 5 deletions lib/reflifc/include/reflifc/expr/ProductValueType.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#pragma once

#include "reflifc/Expression.h"
#include "reflifc/HashCombine.h"
#include "reflifc/TupleView.h"
#include "reflifc/ViewOf.h"

#include <ifc/FileFwd.h>
#include <ifc/ExpressionFwd.h>
#include <ifc/Expression.h>
#include <ifc/File.h>

namespace reflifc
{
struct Type;
struct TupleExpressionView;

struct ProductValueTypeExpression
{
Expand All @@ -18,8 +20,15 @@ namespace reflifc
{
}

Type structure() const;
TupleExpressionView members() const;
Type structure() const;

ViewOf<Expression> auto members() const
{
return TupleExpressionView(ifc_, expr_->members) | std::views::transform([this] (Expression e)
{
return Expression(ifc_, ifc_->suboject_value_expressions()[e.index()].value);
});
}

auto operator<=>(ProductValueTypeExpression const& other) const = default;

Expand Down
8 changes: 0 additions & 8 deletions lib/reflifc/src/expr/ProductValueType.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
#include "reflifc/expr/ProductValueType.h"

#include "reflifc/TupleView.h"
#include "reflifc/Type.h"

#include <ifc/Expression.h>

namespace reflifc
{
Type ProductValueTypeExpression::structure() const
{
return { ifc_, expr_->structure };
}

TupleExpressionView ProductValueTypeExpression::members() const
{
return { ifc_, expr_->members };
}
}

0 comments on commit de08e1e

Please sign in to comment.