public NRefactory.CSharp.ParameterDeclaration[] GetParametersForProperty(NRefactory.CSharp.PropertyDeclaration property) { var propInfo = property.Annotation<PropertyReference>(); if (propInfo == null) return new NRefactory.CSharp.ParameterDeclaration[0]; return propInfo.Parameters.Select(p => new NRefactory.CSharp.ParameterDeclaration(AstBuilder.ConvertType(p.ParameterType), p.Name, GetModifiers(p))).ToArray(); }
public IType ResolveType(NRefactory.VB.Ast.AstType type, NRefactory.VB.Ast.TypeDeclaration entity = null) { var annotation = type.Annotation<TypeReference>(); if (annotation == null ) return null; IEntity current = null; if (entity != null) { var typeInfo = entity.Annotation<TypeReference>(); current = loader.ReadTypeReference(typeInfo).Resolve(context).GetDefinition(); } return loader.ReadTypeReference(annotation, entity: current).Resolve(context); }
public TypeKind GetTypeKindForAstType(NRefactory.CSharp.AstType type) { var annotation = type.Annotation<TypeReference>(); if (annotation == null) return TypeKind.Unknown; var definition = annotation.ResolveOrThrow(); if (definition.IsClass) return TypeKind.Class; if (definition.IsInterface) return TypeKind.Interface; if (definition.IsEnum) return TypeKind.Enum; if (definition.IsFunctionPointer) return TypeKind.Delegate; if (definition.IsValueType) return TypeKind.Struct; return TypeKind.Unknown; }
public bool HasEvent(NRefactory.VB.Ast.Expression expression) { return expression.Annotation<EventDef>() != null; }
public bool IsMethodGroup(NRefactory.CSharp.Expression expression) { var methodInfo = expression.Annotation<MethodReference>()?.Resolve(); if (methodInfo != null) { return !methodInfo.IsGetter && !methodInfo.IsSetter && !methodInfo.IsAddOn && !methodInfo.IsRemoveOn; } return false; }