@@ -35,7 +35,7 @@ namespace HIR {
35
35
// field: ...
36
36
// ]
37
37
//
38
- // When a field is a collection of other HIR object :
38
+ // When a field is a collection of other HIR objects :
39
39
// field {
40
40
// SomeHIRNode [ ... ]
41
41
// SomeOtherHIRNode [ ... ]
@@ -1214,19 +1214,13 @@ Dump::visit (ClosureExpr &e)
1214
1214
auto oa = param.get_outer_attrs ();
1215
1215
do_outer_attrs (oa);
1216
1216
visit_field (" pattern" , param.get_pattern ());
1217
- if (param.has_type_given ())
1218
- visit_field (" type" , param.get_type ());
1219
- else
1220
- put_field (" type" , " none" );
1217
+ visit_field (" type" , param.get_type ());
1221
1218
end (" ClosureParam" );
1222
1219
}
1223
1220
end_field (" params" );
1224
1221
}
1225
1222
1226
- if (e.has_return_type ())
1227
- visit_field (" return_type" , *e.get_return_type ());
1228
- else
1229
- put_field (" return_type" , " none" );
1223
+ visit_field (" return_type" , e.get_return_type ());
1230
1224
1231
1225
visit_field (" expr" , e.get_expr ());
1232
1226
end (" ClosureExpr" );
@@ -1241,10 +1235,7 @@ Dump::visit (BlockExpr &e)
1241
1235
1242
1236
visit_collection (" statements" , e.get_statements ());
1243
1237
1244
- if (e.has_expr ())
1245
- visit_field (" expr" , e.get_final_expr ());
1246
- else
1247
- put_field (" expr" , " none" );
1238
+ visit_field (" expr" , e.get_final_expr ());
1248
1239
1249
1240
end (" BlockExpr" );
1250
1241
}
@@ -1273,10 +1264,7 @@ Dump::visit (BreakExpr &e)
1273
1264
else
1274
1265
put_field (" label" , " none" );
1275
1266
1276
- if (e.has_break_expr ())
1277
- visit_field (" break_expr " , e.get_expr ());
1278
- else
1279
- put_field (" break_expr " , " none" );
1267
+ visit_field (" break_expr " , e.get_expr ());
1280
1268
1281
1269
end (" BreakExpr" );
1282
1270
}
@@ -1346,10 +1334,7 @@ Dump::visit (ReturnExpr &e)
1346
1334
begin (" ReturnExpr" );
1347
1335
do_mappings (e.get_mappings ());
1348
1336
1349
- if (e.has_return_expr ())
1350
- visit_field (" return_expr" , e.get_expr ());
1351
- else
1352
- put_field (" return_expr" , " none" );
1337
+ visit_field (" return_expr" , e.get_expr ());
1353
1338
1354
1339
end (" ReturnExpr" );
1355
1340
}
@@ -1496,10 +1481,7 @@ Dump::visit (TypeParam &e)
1496
1481
1497
1482
visit_collection (" type_param_bounds" , e.get_type_param_bounds ());
1498
1483
1499
- if (e.has_type ())
1500
- visit_field (" type" , e.get_type ());
1501
- else
1502
- put_field (" type" , " none" );
1484
+ visit_field (" type" , e.get_type ());
1503
1485
1504
1486
end (" TypeParam" );
1505
1487
}
@@ -1665,10 +1647,7 @@ Dump::visit (Function &e)
1665
1647
put_field (" function_params" , " empty" );
1666
1648
}
1667
1649
1668
- if (e.has_function_return_type ())
1669
- visit_field (" return_type" , *e.get_return_type ());
1670
- else
1671
- put_field (" return_type" , " none" );
1650
+ visit_field (" return_type" , e.get_return_type ());
1672
1651
1673
1652
if (!e.has_where_clause ())
1674
1653
put_field (" where_clause" , " none" );
@@ -1901,10 +1880,7 @@ Dump::visit (TraitItemFunc &e)
1901
1880
1902
1881
do_traitfunctiondecl (e.get_decl ());
1903
1882
1904
- if (e.has_definition ())
1905
- visit_field (" block_expr" , e.get_block_expr ());
1906
- else
1907
- put_field (" block_expr" , " none" );
1883
+ visit_field (" block_expr" , e.get_block_expr ());
1908
1884
1909
1885
end (" TraitItemFunc" );
1910
1886
}
@@ -2019,10 +1995,7 @@ Dump::visit (ExternalFunctionItem &e)
2019
1995
2020
1996
put_field (" has_variadics" , std::to_string (e.is_variadic ()));
2021
1997
2022
- if (e.has_return_type ())
2023
- visit_field (" return_type" , e.get_return_type ());
2024
- else
2025
- put_field (" return_type" , " none" );
1998
+ visit_field (" return_type" , e.get_return_type ());
2026
1999
2027
2000
end (" ExternalFunctionItem" );
2028
2001
}
0 commit comments