예제 #1
0
        /// <summary>
        /// Get a walker with all mutations for <paramref name="property"/>.
        /// </summary>
        /// <param name="property">The <see cref="IPropertySymbol"/>.</param>
        /// <param name="semanticModel">The <see cref="SemanticModel"/>.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
        /// <returns>A walker with all mutations for <paramref name="property"/>.</returns>
        public static MutationWalker For(IPropertySymbol property, SemanticModel semanticModel, CancellationToken cancellationToken)
        {
            if (FieldOrProperty.TryCreate(property, out var fieldOrProperty))
            {
                return(For(fieldOrProperty, semanticModel, cancellationToken));
            }

            return(Borrow(() => new MutationWalker()));
        }
예제 #2
0
        /// <summary>
        /// Get a walker with all mutations for <paramref name="symbol"/>.
        /// </summary>
        /// <param name="symbol">The <see cref="ISymbol"/>.</param>
        /// <param name="semanticModel">The <see cref="SemanticModel"/>.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
        /// <returns>A walker with all mutations for <paramref name="symbol"/>.</returns>
        public static MutationWalker For(ISymbol symbol, SemanticModel semanticModel, CancellationToken cancellationToken)
        {
            if (LocalOrParameter.TryCreate(symbol, out var localOrParameter))
            {
                return(For(localOrParameter, semanticModel, cancellationToken));
            }

            if (FieldOrProperty.TryCreate(symbol, out var fieldOrProperty))
            {
                return(For(fieldOrProperty, semanticModel, cancellationToken));
            }

            return(Borrow(() => new MutationWalker()));
        }