コード例 #1
0
        public void SetData(DefaultParamDelegateData data, CancellationToken cancellationToken = default)
        {
            SemanticModel       = data.SemanticModel;
            OriginalDeclaration = data.Declaration;
            _newModifierIndexes = data.NewModifierIndexes;
            _numNonDefaultParam = data.TypeParameters.NumNonDefaultParam;

            DelegateDeclarationSyntax del = data.Declaration;

            if (del.TypeParameterList is null || !del.TypeParameterList.Parameters.Any())
            {
                _numOriginalTypeParameters = 0;
                CurrentDeclaration         = data.Declaration;
                return;
            }

            del = (DelegateDeclarationSyntax)DefaultParamUtilities.InitializeDeclaration(
                del,
                data.SemanticModel,
                data.ParentCompilation,
                del.TypeParameterList,
                cancellationToken,
                out TypeParameterListSyntax updatedParameters
                );

            _numOriginalConstraints    = del.ConstraintClauses.Count;
            _numOriginalTypeParameters = updatedParameters.Parameters.Count;

            CurrentDeclaration = del.WithTypeParameterList(updatedParameters);
        }