private void ResolveNonVirtualMethodImplementation(ClassDefinition node, IMethod resolvedMethod, InheritsImplementationStyle style) { if (style == InheritsImplementationStyle.IsLocal) { var method = ((InternalMethod)resolvedMethod).Method; method.Modifiers |= TypeMemberModifiers.Virtual | TypeMemberModifiers.Final; } else { var coverMethod = CodeBuilder.CreateMethodFromPrototype(resolvedMethod, TypeMemberModifiers.Public | TypeMemberModifiers.Virtual | TypeMemberModifiers.Final | TypeMemberModifiers.New); var superCall = CodeBuilder.CreateSuperMethodInvocation(resolvedMethod); foreach (var param in resolvedMethod.GetParameters()) { superCall.Arguments.Add(CodeBuilder.CreateReference(param)); } if (resolvedMethod.ReturnType == TypeSystemServices.VoidType) { coverMethod.Body.Add(superCall); } else { coverMethod.Body.Add(new ReturnStatement(superCall)); } node.Members.Add(coverMethod); } }
private void ResolveNonVirtualMethodImplementation(ClassDefinition node, TypeReference rootBaseType, IMethod baseAbstractMethod, InheritsImplementationStyle style) { if (!((IType)rootBaseType.Entity).IsInterface) { return; } var impl = (IMethod)GetBaseImplememtation(node, baseAbstractMethod); ResolveNonVirtualMethodImplementation(node, impl, style); }
private void ResolveNonVirtualPropertyImplementation(ClassDefinition node, TypeReference rootBaseType, IProperty baseAbstractProperty, InheritsImplementationStyle style) { if (!((IType)rootBaseType.Entity).IsInterface) { return; } var impl = (IProperty)GetBaseImplememtation(node, baseAbstractProperty); var abstractAccessor = baseAbstractProperty.GetGetMethod(); if (abstractAccessor != null) { var getter = impl.GetGetMethod(); if (!getter.IsVirtual) { ResolveNonVirtualMethodImplementation(node, getter, style); } } abstractAccessor = baseAbstractProperty.GetSetMethod(); if (abstractAccessor != null) { var setter = impl.GetGetMethod(); if (!setter.IsVirtual) { ResolveNonVirtualMethodImplementation(node, setter, style); } } }