226 IR::Type_Header *flattenedHeader =
nullptr;
227 std::vector<cstring> nameSegments{};
228 std::vector<const IR::Annotations *> allAnnotations{};
229 std::vector<Util::SourceInfo> srcInfos{};
230 cstring makeName(std::string_view sep)
const;
231 void flattenType(
const IR::Type *type);
232 const IR::Annotations *mergeAnnotations()
const;
234 const IR::Member *flattenedMember;
235 std::vector<cstring> memberSegments{};
236 std::map<cstring, cstring> fieldNameMap;
237 std::map<cstring, std::tuple<const IR::Expression *, cstring>> replacementMap;
238 cstring makeMember(std::string_view sep)
const;
239 void flattenMember(
const IR::Member *member);
240 const IR::Member *doFlattenMember(
const IR::Member *member);
242 std::vector<cstring> pathSegments{};
243 cstring makePath(std::string_view sep)
const;
244 void flattenStructInitializer(
const IR::StructExpression *e,
246 IR::StructExpression *doFlattenStructInitializer(
const IR::StructExpression *e);
247 IR::ListExpression *flatten_list(
const IR::ListExpression *args);
249 int memberDepth(
const IR::Member *m);
250 const IR::Member *getTailMembers(
const IR::Member *m,
int depth);
251 const IR::PathExpression *replaceSrcInfo(
const IR::PathExpression *tgt,
252 const IR::PathExpression *src);
253 const IR::Member *replaceSrcInfo(
const IR::Member *tgt,
const IR::Member *src);
254 const IR::Expression *balancedReplaceSrcInfo(
const IR::Expression *tgt,
const IR::Member *src);
256 std::function<bool(
const Context *,
const IR::Type_StructLike *)> policy;
261 std::function<
bool(
const Context *,
const IR::Type_StructLike *)> policy =
262 [](
const Context *,
const IR::Type_StructLike *) ->
bool {
return false; })
263 : typeMap(typeMap), policy(policy) {}
264 bool preorder(IR::Type_Header *header)
override;
265 bool preorder(IR::Member *member)
override;
266 void postorder(IR::Member *member)
override;
267 bool preorder(IR::MethodCallExpression *mc)
override;
278 std::function<bool(
const Context *,
const IR::Type_StructLike *)> policy;
282 std::function<
bool(
const Context *,
const IR::Type_StructLike *)> policy)
283 : refMap(refMap), typeMap(typeMap), policy(policy) {
284 setName(
"EliminateHeaders");
286 std::map<cstring, IR::IndexedVector<IR::NamedExpression>> rewriteTupleType;
287 std::map<const IR::MethodCallExpression *, const IR::Type *> rewriteOtherType;
288 const IR::Node *preorder(IR::Argument *arg)
override;