public Lexicon.Type GetOrCreateDataTypeByName(ICSharpClosure closure, string name, Func <string, Lexicon.Type> create = null) { var dt = closure?.GetByName(name); if (dt != null) { return(dt); } dt = Objects.SingleOrDefault(ddt => ddt.FullName.Equals(name) && (ddt.Closure?.Equals(closure) ?? closure == ddt.Closure)); if (dt == null) { dt = Lookups.FirstOrDefault(ddt => ddt.FullName.Equals(name) && (ddt.FromClosure?.Equals(closure) ?? closure == ddt.FromClosure)); if (dt == null) { if (create == null) { LookupObjectType lt = new LookupObjectType(closure, name); dt = lt; Lookups.Add(lt); } else { Objects.Add(dt = create(name)); } } } return(dt); }
public Lexicon.Type GetOrCreateArrayDataTypeByName(ICSharpClosure closure, Lexicon.Type type) { string name = type.FullName + "[]"; var dt = closure?.GetByName(name); if (dt != null) { return(dt); } dt = Objects.SingleOrDefault(ddt => ddt.FullName.Equals(name) && (ddt.Closure?.Equals(closure) ?? closure == ddt.Closure)); if (dt == null) { dt = Lookups.FirstOrDefault(ddt => ddt.FullName.Equals(name) && (ddt.FromClosure?.Equals(closure) ?? closure == ddt.FromClosure)); if (dt == null) { LookupObjectType lt = new LookupObjectType(closure, name); dt = lt; Lookups.Add(lt); } } return(dt); }