Ejemplo n.º 1
0
        static IEnumerable <IMember> GetOverridableMembers(IClass c)
        {
            if (c == null)
            {
                throw new ArgumentException("c");
            }

            return(MemberLookupHelper.GetAccessibleMembers(c.BaseType, c, c.ProjectContent.Language, true)
                   .Where(m => m.IsOverridable && !m.IsConst));
        }
Ejemplo n.º 2
0
        public static void ImplementAbstractClass(IRefactoringDocument doc, IClass target, IReturnType abstractClass)
        {
            CodeGenerator generator = target.ProjectContent.Language.CodeGenerator;
            var           pos       = doc.OffsetToPosition(doc.PositionToOffset(target.BodyRegion.EndLine, target.BodyRegion.EndColumn) - 1);
            ClassFinder   context   = new ClassFinder(target, pos.Line, pos.Column);

            foreach (IMember member in MemberLookupHelper.GetAccessibleMembers(abstractClass, target, LanguageProperties.CSharp, true)
                     .Where(m => m.IsAbstract && !target.HasMember(m)))
            {
                generator.InsertCodeAtEnd(target.BodyRegion, doc, generator.GetOverridingMethod(member, context));
            }
        }