void ParameterizeMembers(DataType definition, DataType current, Dictionary <DataType, DataType> map, DataType result)
        {
            current.AssignAttributes();
            result.SetAttributes(current.Attributes);
            current.PopulateMembers();

            foreach (var s in current.Swizzlers)
            {
                result.Swizzlers.Add(ParameterizeType(map, s));
            }

            if (current.Initializer != null)
            {
                var m = current.Initializer;
                var c = new Constructor(m.Source, result, m.DocComment,
                                        m.Modifiers, ParameterizeParameters(map, m.Parameters), m.Body);
                m.AssignAttributes();
                c.SetAttributes(m.Attributes);
                c.SetMasterDefinition(m.MasterDefinition);
                result.Initializer = c;
            }

            if (current.Finalizer != null)
            {
                var m = current.Finalizer;
                var c = new Finalizer(m.Source, result, m.DocComment,
                                      m.Modifiers, ParameterizeParameters(map, m.Parameters), m.Body);
                m.AssignAttributes();
                c.SetAttributes(m.Attributes);
                c.SetMasterDefinition(m.MasterDefinition);
                result.Finalizer = c;
            }

            foreach (var m in current.Constructors)
            {
                var c = new Constructor(m.Source, result, m.DocComment,
                                        m.Modifiers, ParameterizeParameters(map, m.Parameters), m.Body);
                m.AssignAttributes();
                c.SetAttributes(m.Attributes);
                c.SetMasterDefinition(m.MasterDefinition);
                result.Constructors.Add(c);
            }

            foreach (var m in current.Methods)
            {
                DataType  owner = result;
                ClassType genericMethodParametersOwner = null;

                if (m.IsGenericDefinition)
                {
                    if (m.GenericType != definition)
                    {
                        genericMethodParametersOwner = new ClassType(m.Source, result, m.DocComment, Modifiers.Private | Modifiers.Static | Modifiers.Generated, m.UnoName);
                        genericMethodParametersOwner.MakeGenericDefinition(m.GenericParameters);

                        foreach (var p in m.GenericParameters)
                        {
                            map.Add(p, p);
                        }
                    }
                    else
                    {
                        owner = (DataType)result.Parent;
                        genericMethodParametersOwner = (ClassType)result;
                    }
                }

                var c = new Method(m.Source, owner, m.DocComment,
                                   m.Modifiers, m.UnoName, genericMethodParametersOwner, ParameterizeType(map, m.ReturnType), ParameterizeParameters(map, m.Parameters), m.Body);

                if (genericMethodParametersOwner != null && genericMethodParametersOwner != result)
                {
                    genericMethodParametersOwner.Methods.Add(c);
                }

                if (m.OverriddenMethod != null)
                {
                    c.SetOverriddenMethod(ParameterizeMethod(map, m.OverriddenMethod));
                }
                if (m.ImplementedMethod != null)
                {
                    c.SetImplementedMethod(ParameterizeMethod(map, m.ImplementedMethod));
                }

                m.AssignAttributes();
                c.SetAttributes(m.Attributes);
                c.SetMasterDefinition(m.MasterDefinition);
                result.Methods.Add(c);
            }

            foreach (var m in current.Properties)
            {
                var c = new Property(m.Source, m.DocComment, m.Modifiers, m.UnoName, result,
                                     ParameterizeType(map, m.ReturnType), ParameterizeParameters(map, m.Parameters));

                if (m.GetMethod != null)
                {
                    c.CreateGetMethod(m.GetMethod.Source, m.GetMethod.Modifiers, m.GetMethod.Body);
                }
                if (m.SetMethod != null)
                {
                    c.CreateSetMethod(m.SetMethod.Source, m.SetMethod.Modifiers, m.SetMethod.Body);
                }
                if (m.ImplicitField != null)
                {
                    c.CreateImplicitField(m.ImplicitField.Source);
                }

                if (m.OverriddenProperty != null)
                {
                    c.SetOverriddenProperty(ParameterizeProperty(map, m.OverriddenProperty));
                }
                if (m.ImplementedProperty != null)
                {
                    c.SetImplementedProperty(ParameterizeProperty(map, m.ImplementedProperty));
                }

                m.AssignAttributes();
                c.SetAttributes(m.Attributes);
                c.SetMasterDefinition(m.MasterDefinition);
                result.Properties.Add(c);
            }

            foreach (var m in current.Events)
            {
                var c = new Event(m.Source, m.DocComment, m.Modifiers, result,
                                  ParameterizeType(map, m.ReturnType), m.UnoName);

                if (m.AddMethod != null)
                {
                    c.CreateAddMethod(m.AddMethod.Source, m.AddMethod.Modifiers, m.AddMethod.Body);
                }
                if (m.RemoveMethod != null)
                {
                    c.CreateRemoveMethod(m.RemoveMethod.Source, m.RemoveMethod.Modifiers, m.RemoveMethod.Body);
                }
                if (m.ImplicitField != null)
                {
                    c.CreateImplicitField(m.ImplicitField.Source);
                }

                if (m.OverriddenEvent != null)
                {
                    c.SetOverriddenEvent(ParameterizeEvent(map, m.OverriddenEvent));
                }
                if (m.ImplementedEvent != null)
                {
                    c.SetImplementedEvent(ParameterizeEvent(map, m.ImplementedEvent));
                }

                m.AssignAttributes();
                c.SetAttributes(m.Attributes);
                c.SetMasterDefinition(m.MasterDefinition);
                result.Events.Add(c);
            }

            foreach (var m in current.Casts)
            {
                var c = new Cast(m.Source, result, m.Type, m.DocComment, m.Modifiers,
                                 ParameterizeType(map, m.ReturnType), ParameterizeParameters(map, m.Parameters), m.Body);
                m.AssignAttributes();
                c.SetAttributes(m.Attributes);
                c.SetMasterDefinition(m.MasterDefinition);
                result.Casts.Add(c);
            }

            foreach (var m in current.Operators)
            {
                var c = new Operator(m.Source, result, m.Type, m.DocComment, m.Modifiers,
                                     ParameterizeType(map, m.ReturnType), ParameterizeParameters(map, m.Parameters), m.Body);
                m.AssignAttributes();
                c.SetAttributes(m.Attributes);
                c.SetMasterDefinition(m.MasterDefinition);
                result.Operators.Add(c);
            }

            foreach (var m in current.Fields)
            {
                var c = new Field(m.Source, result, m.UnoName, m.DocComment, m.Modifiers, m.FieldModifiers,
                                  ParameterizeType(map, m.ReturnType));
                m.AssignAttributes();
                c.SetAttributes(m.Attributes);
                c.SetMasterDefinition(m.MasterDefinition);
                result.Fields.Add(c);
            }

            foreach (var m in current.Literals)
            {
                var c = new Literal(m.Source, result, m.UnoName, m.DocComment, m.Modifiers,
                                    ParameterizeType(map, m.ReturnType), m.Value);
                m.AssignAttributes();
                c.SetAttributes(m.Attributes);
                c.SetMasterDefinition(m.MasterDefinition);
                result.Literals.Add(c);
            }

            result.AssignBaseType();

            if (!result.IsParameterizedDefinition &&
                !result.IsInterface && result.Interfaces.Length > 0)
            {
                foreach (var e in current.InterfaceMethods)
                {
                    var impl = FindParameterizedMethod(ParameterizeType(map, e.Key.DeclaringType), e.Key);
                    var decl = FindParameterizedMethod(result, e.Value);
                    result.InterfaceMethods[impl] = decl;
                }
            }
        }