//$TODO: change the signature to disallow nulls. public DataType?Unify(DataType?a, DataType?b) { if (++recDepth > 100) { --recDepth; DebugEx.Error(trace, "Unifier: exceeded stack depth, giving up"); if (a == null && b == null) { return(null); } if (a == null) { return(b); } if (b == null) { return(a); } return(factory.CreateUnionType(null, null, new[] { a, b })); } var u = UnifyInternal(a, b); --recDepth; return(u); }
public DataType Unify(DataType a, DataType b) { if (++recDepth > 100) { //$BUG: should emit warning in the error log. --recDepth; Debug.Print("Exceeded stack depth, giving up"); return(factory.CreateUnionType(null, null, new[] { a, b })); } var u = UnifyInternal(a, b); --recDepth; return(u); }
public override DataType BuildDataType(Reko.Core.Types.TypeFactory factory) { UnionType u = factory.CreateUnionType(Name, null); foreach (var alt in Alternatives) { u.Alternatives.Add(new UnionAlternative(alt.Name, alt.Type.BuildDataType(factory))); } return(u); }