当前位置: 首页>>代码示例>>C#>>正文


C# ICSharpContextActionDataProvider类代码示例

本文整理汇总了C#中ICSharpContextActionDataProvider的典型用法代码示例。如果您正苦于以下问题:C# ICSharpContextActionDataProvider类的具体用法?C# ICSharpContextActionDataProvider怎么用?C# ICSharpContextActionDataProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ICSharpContextActionDataProvider类属于命名空间,在下文中一共展示了ICSharpContextActionDataProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddContracts

        public override void AddContracts(
            ICSharpContextActionDataProvider provider,
            Func<IExpression, IExpression> getContractExpression,
            out ICollection<ICSharpStatement> firstNonContractStatements)
        {
            var contractInvariantMethodDeclaration = classLikeDeclaration.EnsureContractInvariantMethod(provider.PsiModule);

            if (contractInvariantMethodDeclaration.Body != null)
            {
                var factory = CSharpElementFactory.GetInstance(provider.PsiModule);

                var expression = factory.CreateExpression("$0", declaration.DeclaredElement);

                ICSharpStatement firstNonContractStatement;

                AddContract(
                    ContractKind.Invariant,
                    contractInvariantMethodDeclaration.Body,
                    provider.PsiModule,
                    () => getContractExpression(expression),
                    out firstNonContractStatement);
                firstNonContractStatements = firstNonContractStatement != null ? new[] { firstNonContractStatement } : null;
            }
            else
            {
                firstNonContractStatements = null;
            }
        }
开发者ID:prodot,项目名称:ReCommended-Extension,代码行数:28,代码来源:FieldContractInfo.cs

示例2: ReturnTypeEnsuresAvailability

        public ReturnTypeEnsuresAvailability(ICSharpContextActionDataProvider provider)
        {
            Contract.Requires(provider != null);
            _provider = provider;

            IsAvailable = ComputeIsAvailable(out _currentFunction);
        }
开发者ID:remyblok,项目名称:ReSharperContractExtensions,代码行数:7,代码来源:ReturnTypeEnsuresAvailability.cs

示例3: AddRequiresExecutor

 public AddRequiresExecutor(ICSharpContextActionDataProvider provider, bool shouldBeGeneric,
     ICSharpFunctionDeclaration functionDeclaration, string parameterName, IClrTypeName propertyType)
     : this(provider, shouldBeGeneric, new []{functionDeclaration}, parameterName, propertyType)
 {
     Contract.Requires(provider != null);
     _provider = provider;
 }
开发者ID:remyblok,项目名称:ReSharperContractExtensions,代码行数:7,代码来源:AddRequiresExecutor.cs

示例4: IsAvailableForSelectedMethod

        public static AddContractClassAvailability IsAvailableForSelectedMethod(ICSharpContextActionDataProvider provider, ICSharpFunctionDeclaration selectedFunction = null)
        {
            Contract.Requires(provider != null);
            Contract.Ensures(Contract.Result<AddContractClassAvailability>() != null);

            return new AddContractClassAvailability(provider, true, selectedFunction);
        }
开发者ID:breki,项目名称:ReSharperContractExtensions,代码行数:7,代码来源:AddContractClassAvailability.cs

示例5: IsAvailableForSelectedType

        public static AddContractClassAvailability IsAvailableForSelectedType(ICSharpContextActionDataProvider provider)
        {
            Contract.Requires(provider != null);
            Contract.Ensures(Contract.Result<AddContractClassAvailability>() != null);

            return new AddContractClassAvailability(provider, false, null);
        }
开发者ID:breki,项目名称:ReSharperContractExtensions,代码行数:7,代码来源:AddContractClassAvailability.cs

示例6: AddContracts

        public override void AddContracts(
            ICSharpContextActionDataProvider provider,
            Func<IExpression, IExpression> getContractExpression,
            out ICollection<ICSharpStatement> firstNonContractStatements)
        {
            if (declaration.Body != null)
            {
                var factory = CSharpElementFactory.GetInstance(provider.PsiModule);

                var contractType = new DeclaredTypeFromCLRName(ClrTypeNames.Contract, provider.PsiModule).GetTypeElement();

                Debug.Assert(declaration.DeclaredElement != null);

                var expression = factory.CreateExpression(
                    string.Format("$0.{0}<$1>()", nameof(Contract.Result)),
                    contractType,
                    declaration.DeclaredElement.ReturnType);

                ICSharpStatement firstNonContractStatement;
                AddContract(
                    ContractKind.Ensures,
                    declaration.Body,
                    provider.PsiModule,
                    () => getContractExpression(expression),
                    out firstNonContractStatement);
                firstNonContractStatements = firstNonContractStatement != null ? new[] { firstNonContractStatement } : null;
            }
            else
            {
                firstNonContractStatements = null;
            }
        }
开发者ID:prodot,项目名称:ReCommended-Extension,代码行数:32,代码来源:OperatorContractInfo.cs

示例7: EnsuresAvailability

        protected EnsuresAvailability(ICSharpContextActionDataProvider provider, 
            ReturnTypeEnsuresAvailability returnTypeEnsuresAvailability)
        {
            Contract.Requires(provider != null);
            Contract.Requires(returnTypeEnsuresAvailability != null);

            _provider = provider;
            _returnTypeEnsuresAvailability = returnTypeEnsuresAvailability;
            IsAvailable = ComputeIsAvailable(out _selectedFunction);
        }
开发者ID:remyblok,项目名称:ReSharperContractExtensions,代码行数:10,代码来源:EnsuresAvailability.cs

示例8: CreateArgumentCheckStatement

        private static ICSharpStatement CreateArgumentCheckStatement(ICSharpContextActionDataProvider provider, string pattern, IRegularParameterDeclaration parameterDeclaration)
        {
            Argument.IsNotNull(() => provider);
            Argument.IsNotNullOrWhitespace(() => pattern);
            Argument.IsNotNull(() => parameterDeclaration);

            var catelArgumentType = TypeHelper.CreateTypeByCLRName(CatelCore.Argument, provider.PsiModule, provider.SelectedElement.GetResolveContext());

            return provider.ElementFactory.CreateStatement(pattern, catelArgumentType.GetTypeElement(), parameterDeclaration.DeclaredName);
        }
开发者ID:Catel,项目名称:Catel.ReSharper,代码行数:10,代码来源:ArgumentCheckStatementHelper.cs

示例9: EnsuresExecutor

        private EnsuresExecutor(ICSharpContextActionDataProvider provider, ICSharpFunctionDeclaration selectedFunction,
            EnsuresType ensuresType)
            : base(provider)
        {
            Contract.Requires(provider != null);
            Contract.Requires(selectedFunction != null);
            Contract.Requires(Enum.IsDefined(typeof (EnsuresType), ensuresType));

            _selectedFunction = selectedFunction;
            _ensuresFactoryMethod = CreateEnsuresFactoryMethod(ensuresType);
        }
开发者ID:remyblok,项目名称:ReSharperContractExtensions,代码行数:11,代码来源:EnsuresExecutor.cs

示例10: TryCreateFieldOrProperty

        private static FieldOrPropertyDeclaration? TryCreateFieldOrProperty(ICSharpContextActionDataProvider provider)
        {
            var fieldDeclaration = provider.GetSelectedElement<IFieldDeclaration>(true, true);
            if (fieldDeclaration != null && IsFieldDeclarationValid(fieldDeclaration))
                return FieldOrPropertyDeclaration.FromFieldDeclaration(fieldDeclaration);

            var propertyDeclaration = provider.GetSelectedElement<IPropertyDeclaration>(true, true);
            if (propertyDeclaration != null && IsPropertyDeclarationValid(propertyDeclaration))
                return FieldOrPropertyDeclaration.FromPropertyDeclaration(propertyDeclaration);

            return null;
        }
开发者ID:breki,项目名称:ReSharperContractExtensions,代码行数:12,代码来源:InvariantAvailability.cs

示例11: Create

        public static InvariantAvailability Create(ICSharpContextActionDataProvider provider)
        {
            Contract.Requires(provider != null);
            Contract.Ensures(Contract.Result<InvariantAvailability>() != null);

            var fieldOrPropertyDeclaration = TryCreateFieldOrProperty(provider);

            if (fieldOrPropertyDeclaration == null)
                return InvariantUnavailable;

            return new InvariantAvailability(provider, fieldOrPropertyDeclaration.Value);
        }
开发者ID:breki,项目名称:ReSharperContractExtensions,代码行数:12,代码来源:InvariantAvailability.cs

示例12: InvariantAvailability

        private InvariantAvailability(ICSharpContextActionDataProvider provider,
            FieldOrPropertyDeclaration selectedElement)
        {
            Contract.Requires(provider != null);
            
            _classDeclaration = provider.GetSelectedElement<IClassLikeDeclaration>(true, true);
            _selectedElement = selectedElement;

            IsAvailable = AnalyzeAvailability();
            if (IsAvailable)
                SelectedMemberName = _selectedElement.Name;
        }
开发者ID:breki,项目名称:ReSharperContractExtensions,代码行数:12,代码来源:InvariantAvailability.cs

示例13: ComboEnsuresAvailability

        public ComboEnsuresAvailability(ICSharpContextActionDataProvider provider)
        {
            Contract.Requires(provider != null);

            _provider = provider;

            if (IsAbstractClassOrInterface()
                && IsEnsuresAvailableFor(out _selectedFunctionDeclaration)
                && CanAddContractForSelectedMethod(out _addContractAvailability,
                        _selectedFunctionDeclaration))
            {
                IsAvailable = true;
            }
        }
开发者ID:breki,项目名称:ReSharperContractExtensions,代码行数:14,代码来源:ComboEnsuresAvailability.cs

示例14: ContextActionExecutorBase

        protected ContextActionExecutorBase(ICSharpContextActionDataProvider provider)
        {
            Contract.Requires(provider != null);


            _factory = provider.ElementFactory;

            Contract.Assert(provider.SelectedElement != null,
                "Can't create executor if SelectedElement is null");

            _currentFile = (ICSharpFile)provider.SelectedElement.GetContainingFile();
            _psiServices = provider.PsiServices;
            _psiModule = provider.PsiModule;
        }
开发者ID:remyblok,项目名称:ReSharperContractExtensions,代码行数:14,代码来源:ContextActionExecutorBase.cs

示例15: ComboEnsuresExecutor

        public ComboEnsuresExecutor(ICSharpContextActionDataProvider provider, 
            AddContractClassAvailability addContractAvailability,
            ICSharpFunctionDeclaration selectedFunctionDeclaration)
            : base(provider)
        {
            Contract.Requires(provider != null);
            Contract.Requires(addContractAvailability != null);
            Contract.Requires(addContractAvailability.IsAvailable);

            Contract.Requires(selectedFunctionDeclaration != null);

            _provider = provider;
            _addContractAvailability = addContractAvailability;
            _selectedFunctionDeclaration = selectedFunctionDeclaration;
        }
开发者ID:remyblok,项目名称:ReSharperContractExtensions,代码行数:15,代码来源:ComboEnsuresExecutor.cs


注:本文中的ICSharpContextActionDataProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。