예제 #1
0
파일: eval.cs 프로젝트: xamarin/NRefactory
        public void AddTypeContainer(TypeContainer current_container, TypeDefinition tc)
        {
            if (current_container == tc)
            {
                Console.Error.WriteLine("Internal error: inserting container into itself");
                return;
            }

            if (undo_actions == null)
            {
                undo_actions = new List <Action> ();
            }

            if (current_container.Containers != null)
            {
                var existing = current_container.Containers.FirstOrDefault(l => l.MemberName.Basename == tc.MemberName.Basename);
                if (existing != null)
                {
                    current_container.RemoveContainer(existing);
                    undo_actions.Add(() => current_container.AddTypeContainer(existing));
                }
            }

            undo_actions.Add(() => current_container.RemoveContainer(tc));
        }