Beispiel #1
0
        /// <summary>
        /// Adds a diagnostic indicating that a property trigger condition is missing its comparison operator
        /// to the specified collection of diagnostics.
        /// </summary>
        /// <param name="collection">The collection to which to add the diagnostic.</param>
        /// <param name="node">The syntax node which is associated with the diagnostic.</param>
        internal static void ReportPropertyTriggerMissingComparisonOperator(ref ICollection <DiagnosticInfo> collection,
                                                                            SyntaxToken node)
        {
            Contract.Require(node, nameof(node));

            var span       = new TextSpan(0, node.Width);
            var diagnostic = new DiagnosticInfo(node, DiagnosticID.MissingToken, DiagnosticSeverity.Error, span,
                                                $"Comparison operator expected");

            var nodeDiagnosticsArray = node.GetDiagnosticsArray();
            var nodeDiagnostics      = (ICollection <DiagnosticInfo>)nodeDiagnosticsArray?.ToList();

            Report(ref nodeDiagnostics, diagnostic);

            node.SetDiagnostics(nodeDiagnostics);
        }
Beispiel #2
0
        /// <summary>
        /// Adds a diagnostic indicating that a property trigger condition is missing its comparison operator
        /// to the specified collection of diagnostics.
        /// </summary>
        /// <param name="collection">The collection to which to add the diagnostic.</param>
        /// <param name="node">The syntax node which is associated with the diagnostic.</param>
        internal static void ReportPropertyTriggerMissingComparisonOperator(ref ICollection<DiagnosticInfo> collection,
            SyntaxToken node)
        {
            Contract.Require(node, nameof(node));

            var span = new TextSpan(0, node.Width);
            var diagnostic = new DiagnosticInfo(node, DiagnosticID.MissingToken, DiagnosticSeverity.Error, span,
                $"Comparison operator expected");

            var nodeDiagnosticsArray = node.GetDiagnosticsArray();
            var nodeDiagnostics = (ICollection<DiagnosticInfo>)nodeDiagnosticsArray?.ToList();

            Report(ref nodeDiagnostics, diagnostic);

            node.SetDiagnostics(nodeDiagnostics);
        }