public ReferenceReplacer(
                AbstractReplacePropertyWithMethodsService <TIdentifierNameSyntax, TExpressionSyntax, TCrefSyntax, TStatementSyntax, TPropertySyntax> service,
                SemanticModel semanticModel,
                ISyntaxFactsService syntaxFacts,
                ISemanticFactsService semanticFacts,
                SyntaxEditor editor,
                TIdentifierNameSyntax identifierName,
                IPropertySymbol property, IFieldSymbol propertyBackingField,
                string desiredGetMethodName,
                string desiredSetMethodName,
                CancellationToken cancellationToken)
            {
                _service              = service;
                _semanticModel        = semanticModel;
                _syntaxFacts          = syntaxFacts;
                _semanticFacts        = semanticFacts;
                _editor               = editor;
                _identifierName       = identifierName;
                _property             = property;
                _propertyBackingField = propertyBackingField;
                _desiredGetMethodName = desiredGetMethodName;
                _desiredSetMethodName = desiredSetMethodName;
                _cancellationToken    = cancellationToken;

                _expression = _identifierName;
                _cref       = _service.TryGetCrefSyntax(_identifierName);
                if (_syntaxFacts.IsNameOfMemberAccessExpression(_expression))
                {
                    _expression = (TExpressionSyntax)_expression.Parent !;
                }
            }
Esempio n. 2
0
            public ReferenceReplacer(
                AbstractReplacePropertyWithMethodsService <TIdentifierNameSyntax, TExpressionSyntax, TStatementSyntax> service,
                SemanticModel semanticModel,
                ISyntaxFactsService syntaxFacts,
                ISemanticFactsService semanticFacts,
                SyntaxEditor editor, SyntaxToken nameToken,
                IPropertySymbol property, IFieldSymbol propertyBackingField,
                string desiredGetMethodName,
                string desiredSetMethodName,
                CancellationToken cancellationToken)
            {
                _service              = service;
                _semanticModel        = semanticModel;
                _syntaxFacts          = syntaxFacts;
                _semanticFacts        = semanticFacts;
                _editor               = editor;
                _nameToken            = nameToken;
                _property             = property;
                _propertyBackingField = propertyBackingField;
                _desiredGetMethodName = desiredGetMethodName;
                _desiredSetMethodName = desiredSetMethodName;
                _cancellationToken    = cancellationToken;

                _identifierName = (TIdentifierNameSyntax)nameToken.Parent;
                _expression     = _identifierName;
                if (_syntaxFacts.IsMemberAccessExpressionName(_expression))
                {
                    _expression = _expression.Parent as TExpressionSyntax;
                }
            }