コード例 #1
0
		public TypeKind GetTypeKindForAstType(ICSharpCode.NRefactory.CSharp.AstType type) {
			var annotation = type.Annotation<ITypeDefOrRef>();
			if (annotation == null)
				return TypeKind.Unknown;

			var definition = annotation.ResolveTypeDef();
			if (definition == 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;
		}
コード例 #2
0
		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;
		}
コード例 #3
0
		public bool IsMethodGroup(ICSharpCode.NRefactory.CSharp.Expression expression)
		{
			var annotation = expression.Annotation<MethodDef>();
			if (annotation != null) {
				return true;
			}
			
			return false;
		}
コード例 #4
0
        public bool IsMethodGroup(ICSharpCode.NRefactory.CSharp.Expression expression)
        {
            var annotation = expression.Annotation<MethodDefinition>();
            if (annotation != null && annotation.SemanticsAttributes == MethodSemanticsAttributes.None)
            {
                return true;
            }

            return false;
        }
コード例 #5
0
		public ICSharpCode.NRefactory.CSharp.ParameterDeclaration[] GetParametersForProperty(ICSharpCode.NRefactory.CSharp.PropertyDeclaration property) {
			var propInfo = property.Annotation<PropertyDef>();

			if (propInfo == null)
				return new ICSharpCode.NRefactory.CSharp.ParameterDeclaration[0];

			sb.Clear();
			var getMethod = propInfo.GetMethod;
			if (getMethod != null)
				return getMethod.Parameters.Where(p => p.IsNormalMethodParameter).Select(p => new ICSharpCode.NRefactory.CSharp.ParameterDeclaration(AstBuilder.ConvertType(p.Type, sb), p.Name, GetModifiers(p))).ToArray();
			var setMethod = propInfo.SetMethod;
			if (setMethod != null) {
				var ps = setMethod.Parameters.Where(p => p.IsNormalMethodParameter).ToArray();
				if (ps.Length > 1)
					return ps.Take(ps.Length - 1).Select(p => new ICSharpCode.NRefactory.CSharp.ParameterDeclaration(AstBuilder.ConvertType(p.Type, sb), p.Name, GetModifiers(p))).ToArray();
			}

			return new ICSharpCode.NRefactory.CSharp.ParameterDeclaration[0];
		}
コード例 #6
0
		public bool IsMethodGroup(ICSharpCode.NRefactory.CSharp.Expression expression) {
			var annotation = expression.Annotation<MethodDef>();
			if (annotation == null)
				return false;
			return expression.Annotation<PropertyDef>() == null && expression.Annotation<EventDef>() == null;
		}
コード例 #7
0
		public bool HasEvent(ICSharpCode.NRefactory.VB.Ast.Expression expression) => expression.Annotation<EventDef>() != null;