public TypeCode ResolveExpression(NRefactory.CSharp.Expression expression) { var annotation = expression.Annotations.OfType <TypeInformation>().FirstOrDefault(); if (annotation == null || annotation.InferredType == null) { return(TypeCode.Object); } var definition = annotation.InferredType.Resolve(); if (definition == null) { return(TypeCode.Object); } switch (definition.FullName) { case "System.String": return(TypeCode.String); default: break; } return(TypeCode.Object); }
public bool IsMethodGroup(NRefactory.CSharp.Expression expression) { var methodInfo = expression.Annotation <MethodReference>()?.Resolve(); if (methodInfo != null) { return(!methodInfo.IsGetter && !methodInfo.IsSetter); } return(false); }
public Nullable <bool> IsReferenceType(NRefactory.CSharp.Expression expression) { if (expression is NRefactory.CSharp.NullReferenceExpression) { return(true); } var annotation = expression.Annotations.OfType <TypeInformation>().FirstOrDefault(); if (annotation == null || annotation.InferredType == null) { return(null); } var definition = annotation.InferredType.Resolve(); if (definition == null) { return(null); } return(!definition.IsValueType); }