private void WriteMethodDefinitionSignature(IMethodDefinition method, string name) { bool isOperator = method.IsConversionOperator(); if (!isOperator && !method.IsConstructor) { WriteAttributes(method.ReturnValueAttributes, true); // We are ignoring custom modifiers right now, we might need to add them later. WriteTypeName(method.Type, isDynamic: IsDynamic(method.ReturnValueAttributes)); } WriteIdentifier(name); if (isOperator) { WriteSpace(); WriteTypeName(method.Type); } Contract.Assert(!(method is IGenericMethodInstance), "Currently don't support generic method instances"); if (method.IsGeneric) { WriteGenericParameters(method.GenericParameters); } WriteParameters(method.Parameters, extensionMethod: method.IsExtensionMethod(), acceptsExtraArguments: method.AcceptsExtraArguments); if (method.IsGeneric && !method.IsOverride() && !method.IsExplicitInterfaceMethod()) { WriteGenericContraints(method.GenericParameters); } }
public static bool IsOverride(this ITypeDefinitionMember member) { IMethodDefinition method = member as IMethodDefinition; if (method != null) { return(method.IsOverride()); } IPropertyDefinition property = member as IPropertyDefinition; if (property != null) { return(property.Accessors.Any(m => m.ResolvedMethod.IsOverride())); } IEventDefinition evnt = member as IEventDefinition; if (evnt != null) { return(evnt.Accessors.Any(m => m.ResolvedMethod.IsOverride())); } return(false); }
private void WriteMethodDefinitionSignature(IMethodDefinition method, string name) { bool isOperator = method.IsConversionOperator(); if (!isOperator && !method.IsConstructor) { WriteAttributes(method.ReturnValueAttributes, true); // We are ignoring custom modifiers right now, we might need to add them later. WriteTypeName(method.Type, isDynamic: IsDynamic(method.ReturnValueAttributes)); } WriteIdentifier(name); if (isOperator) { WriteSpace(); WriteTypeName(method.Type); } Contract.Assert(!(method is IGenericMethodInstance), "Currently don't support generic method instances"); if (method.IsGeneric) WriteGenericParameters(method.GenericParameters); WriteParameters(method.Parameters, extensionMethod: method.IsExtensionMethod(), acceptsExtraArguments: method.AcceptsExtraArguments); if (method.IsGeneric && !method.IsOverride() && !method.IsExplicitInterfaceMethod()) WriteGenericContraints(method.GenericParameters); }
private void WriteMethodDefinitionSignature(IMethodDefinition method, string name) { bool isOperator = method.IsConversionOperator(); if (!isOperator && !method.IsConstructor) { WriteAttributes(method.ReturnValueAttributes, true); if (method.Attributes.HasIsReadOnlyAttribute() && (LangVersion >= LangVersion8_0)) { WriteKeyword("readonly"); } if (method.ReturnValueIsByRef) { WriteKeyword("ref"); if (method.ReturnValueAttributes.HasIsReadOnlyAttribute()) { WriteKeyword("readonly"); } } // We are ignoring custom modifiers right now, we might need to add them later. WriteTypeName(method.Type, method.ContainingType, method.ReturnValueAttributes); } if (method.IsExplicitInterfaceMethod() && _forCompilationIncludeGlobalprefix) { Write("global::"); } WriteIdentifier(name); if (isOperator) { WriteSpace(); WriteTypeName(method.Type, method.ContainingType); } Contract.Assert(!(method is IGenericMethodInstance), "Currently don't support generic method instances"); if (method.IsGeneric) { WriteGenericParameters(method.GenericParameters); } WriteParameters(method.Parameters, method.ContainingType, extensionMethod: method.IsExtensionMethod(), acceptsExtraArguments: method.AcceptsExtraArguments); if (method.IsGeneric && !method.IsOverride() && !method.IsExplicitInterfaceMethod()) { WriteGenericContraints(method.GenericParameters); } }