Пример #1
0
 public static void ReportAmbiguousUnaryOperator(this ICollection<Diagnostic> diagnostics, SyntaxToken operatorToken, TypeSymbol type)
 {
     var operatorName = operatorToken.Text;
     var typeName = type.ToDisplayName();
     diagnostics.Report(operatorToken.Span, DiagnosticId.AmbiguousUnaryOperator, operatorName, typeName);
 }
Пример #2
0
 public static void ReportAmbiguousBinaryOperator(this ICollection<Diagnostic> diagnostics, SyntaxToken operatorToken, TypeSymbol leftType, TypeSymbol rightType)
 {
     var operatorName = operatorToken.Text;
     var leftTypeName = leftType.ToDisplayName();
     var rightTypeName = rightType.ToDisplayName();
     diagnostics.Report(operatorToken.Span, DiagnosticId.AmbiguousBinaryOperator, operatorName, leftTypeName, rightTypeName);
 }
Пример #3
0
 public static void ReportCannotConvert(this ICollection<Diagnostic> diagnostics, TextSpan span, TypeSymbol sourceType, TypeSymbol targetType)
 {
     var sourceTypeName = sourceType.ToDisplayName();
     var targetTypeName = targetType.ToDisplayName();
     diagnostics.Report(span, DiagnosticId.CannotConvert, sourceTypeName, targetTypeName);
 }
Пример #4
0
 public static void ReportUndeclaredField(this ICollection<Diagnostic> diagnostics, FieldAccessExpressionSyntax node, TypeSymbol type)
 {
     var typeName = type.ToDisplayName();
     var propertyName = node.Name.ValueText;
     diagnostics.Report(node.GetTextSpanSafe(), DiagnosticId.UndeclaredField, typeName, propertyName);
 }
Пример #5
0
 public static void ReportUndeclaredIndexer(this ICollection<Diagnostic> diagnostics, ElementAccessExpressionSyntax node, TypeSymbol declaringType, IEnumerable<TypeSymbol> argumentTypes)
 {
     var declaringTypeName = declaringType.ToDisplayName();
     var argumentTypeNames = string.Join(@", ", argumentTypes.Select(t => t.ToDisplayName()));
     diagnostics.Report(node.GetTextSpanRoot(), DiagnosticId.UndeclaredIndexer, declaringTypeName, argumentTypeNames);
 }
Пример #6
0
 public static void ReportUndeclaredMethod(this ICollection<Diagnostic> diagnostics, MethodInvocationExpressionSyntax node, TypeSymbol declaringType, IEnumerable<TypeSymbol> argumentTypes)
 {
     var name = node.Name.ValueText;
     var declaringTypeName = declaringType.ToDisplayName();
     var argumentTypeNames = string.Join(@", ", argumentTypes.Select(t => t.ToDisplayName()));
     diagnostics.Report(node.GetTextSpanRoot(), DiagnosticId.UndeclaredMethod, declaringTypeName, name, argumentTypeNames);
 }