@@ -745,11 +745,11 @@ TypeInference::assignment(const IR::Node* errorPosition, const IR::Type* destTyp
745
745
}
746
746
if (initType->is <IR::Type_UnknownStruct>()) {
747
747
if (auto ts = destType->to <IR::Type_StructLike>()) {
748
- auto si = sourceExpression->to <IR::StructInitializerExpression >();
748
+ auto si = sourceExpression->to <IR::StructExpression >();
749
749
CHECK_NULL (si);
750
750
bool cst = isCompileTimeConstant (sourceExpression);
751
751
auto type = new IR::Type_Name (ts->name );
752
- sourceExpression = new IR::StructInitializerExpression (
752
+ sourceExpression = new IR::StructExpression (
753
753
type, type, si->components );
754
754
setType (sourceExpression, destType);
755
755
if (cst)
@@ -1589,23 +1589,23 @@ const IR::Node* TypeInference::postorder(IR::Operation_Relation* expression) {
1589
1589
}
1590
1590
1591
1591
if (ls != nullptr ) {
1592
- auto l = expression->left ->to <IR::StructInitializerExpression >();
1592
+ auto l = expression->left ->to <IR::StructExpression >();
1593
1593
CHECK_NULL (l); // struct initializers are the only expressions that can
1594
1594
// have StructUnknown types
1595
1595
BUG_CHECK (rtype->is <IR::Type_StructLike>(), " %1%: expected a struct" , rtype);
1596
1596
auto type = new IR::Type_Name (rtype->to <IR::Type_StructLike>()->name );
1597
- expression->left = new IR::StructInitializerExpression (
1597
+ expression->left = new IR::StructExpression (
1598
1598
expression->left ->srcInfo , type, type, l->components );
1599
1599
setType (expression->left , rtype);
1600
1600
if (lcst)
1601
1601
setCompileTimeConstant (expression->left );
1602
1602
} else {
1603
- auto r = expression->right ->to <IR::StructInitializerExpression >();
1603
+ auto r = expression->right ->to <IR::StructExpression >();
1604
1604
CHECK_NULL (r); // struct initializers are the only expressions that can
1605
1605
// have StructUnknown types
1606
1606
BUG_CHECK (ltype->is <IR::Type_StructLike>(), " %1%: expected a struct" , ltype);
1607
1607
auto type = new IR::Type_Name (ltype->to <IR::Type_StructLike>()->name );
1608
- expression->right = new IR::StructInitializerExpression (
1608
+ expression->right = new IR::StructExpression (
1609
1609
expression->right ->srcInfo , type, type, r->components );
1610
1610
setType (expression->right , rtype);
1611
1611
if (rcst)
@@ -1845,7 +1845,7 @@ const IR::Node* TypeInference::postorder(IR::ListExpression* expression) {
1845
1845
return expression;
1846
1846
}
1847
1847
1848
- const IR::Node* TypeInference::postorder (IR::StructInitializerExpression * expression) {
1848
+ const IR::Node* TypeInference::postorder (IR::StructExpression * expression) {
1849
1849
if (done ()) return expression;
1850
1850
bool constant = true ;
1851
1851
auto components = new IR::IndexedVector<IR::StructField>();
@@ -2316,14 +2316,14 @@ const IR::Node* TypeInference::postorder(IR::Cast* expression) {
2316
2316
return expression;
2317
2317
2318
2318
if (auto st = castType->to <IR::Type_StructLike>()) {
2319
- if (auto se = expression->expr ->to <IR::StructInitializerExpression >()) {
2319
+ if (auto se = expression->expr ->to <IR::StructExpression >()) {
2320
2320
// Interpret (S) { kvpairs } as a struct initializer expression
2321
2321
// instead of a cast to a struct.
2322
2322
if (se->type == nullptr || se->type ->is <IR::Type_Unknown>() ||
2323
2323
se->type ->is <IR::Type_UnknownStruct>()) {
2324
2324
auto type = new IR::Type_Name (st->name );
2325
2325
setType (type, new IR::Type_Type (st));
2326
- auto sie = new IR::StructInitializerExpression (
2326
+ auto sie = new IR::StructExpression (
2327
2327
se->srcInfo , type, se->components );
2328
2328
auto result = postorder (sie); // may insert casts
2329
2329
setType (result, st);
0 commit comments