private void AppendUnion(Node n) { Contract.Requires(n != null); if (crntTypeTerm == null) { crntTypeTerm = n; } else if (crntTypeTerm.NodeKind == NodeKind.Union) { ((Union)crntTypeTerm).AddComponent(n); } else { var unn = new Union(crntTypeTerm.Span); unn.AddComponent(crntTypeTerm); unn.AddComponent(n); crntTypeTerm = unn; } }
private void EndEnum() { Contract.Requires(currentEnum != null); Contract.Ensures(currentEnum == null); if (crntTypeTerm == null) { crntTypeTerm = currentEnum; } else if (crntTypeTerm.NodeKind == NodeKind.Union) { ((Union)crntTypeTerm).AddComponent(currentEnum); } else { var unn = new Union(crntTypeTerm.Span); unn.AddComponent(crntTypeTerm); unn.AddComponent(currentEnum); crntTypeTerm = unn; } currentEnum = null; }