internal static void PostprocessConditionsForEmbedObjectsWriteSansIds <TDoc, TCursor>(
            MegaloScriptModel model, IO.TagElementStream <TDoc, TCursor, string> s,
            IEnumerable <MegaloScriptModelObjectHandle> elements)
            where TDoc : class
            where TCursor : class
        {
            Util.MarkUnusedVariable(ref s);

            MegaloScriptUnionGroup prev_union_group = null;

            foreach (var obj in elements)
            {
                if (obj.Type != MegaloScriptModelObjectType.Condition)
                {
                    continue;
                }
                var cond = model.Conditions[obj.Id];

                if (cond.UnionGroup >= 0)                                  // id is already valid
                {
                    prev_union_group = model.UnionGroups[cond.UnionGroup]; // mark it as prev in case it was inserted into existing code
                    continue;
                }
                else if (cond.UnionGroup == MegaloScriptCondition.kUseNewUnionGroupId)
                {
                    prev_union_group = model.CreateUnionGroup();
                    prev_union_group.Add(cond);
                }
                else if (cond.UnionGroup == MegaloScriptCondition.kUsePrevUnionGroupId)
                {
                    Contract.Assert(prev_union_group != null);
                    prev_union_group.Add(cond);
                }
                else
                {
                    throw new KSoft.Debug.UnreachableException(cond.UnionGroup.ToString(Util.InvariantCultureInfo));
                }
            }
        }