public TypeKind GetTypeKindForAstType(ICSharpCode.NRefactory.CSharp.AstType type) { var annotation = type.Annotation <ITypeDefOrRef>(); if (annotation is null) { return(TypeKind.Unknown); } var definition = annotation.ResolveTypeDef(); if (definition is null) { return(TypeKind.Unknown); } if (definition.IsClass) { return(TypeKind.Class); } if (definition.IsInterface) { return(TypeKind.Interface); } if (definition.IsEnum) { return(TypeKind.Enum); } if (definition.IsValueType) { return(TypeKind.Struct); } return(TypeKind.Unknown); }
public TypeKind GetTypeKindForAstType(ICSharpCode.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); }