/* * Add a type for which corresponding layout structure(s) must * be emitted. */ internal static void AddTypeLayout(XType xt) { /* * All arrays share the same structure. If an array value * is to be generated, it is up to the caller to call * AddTypeLayout() with the type of embedded elements. */ if (xt.IsArray) { return; } /* * No layout structure for restricted types and for * std::int. */ if (xt.IsRestricted || xt == XType.INT) { return; } /* * std::type has special treatment. */ if (xt == XType.XTYPE) { return; } /* * We now have a normal structure type. We must add * layouts for all embedded elements, and do it * _before_ adding this type. */ if (layouts.Contains(xt)) { return; } foreach (XType xt2 in xt.GetEmbeddedTypes()) { AddTypeLayout(xt2); } layouts.Add(xt); orderedLayouts.Add(xt); }