本文整理汇总了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;
}
}
示例2: ReturnTypeEnsuresAvailability
public ReturnTypeEnsuresAvailability(ICSharpContextActionDataProvider provider)
{
Contract.Requires(provider != null);
_provider = provider;
IsAvailable = ComputeIsAvailable(out _currentFunction);
}
示例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;
}
示例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);
}
示例5: IsAvailableForSelectedType
public static AddContractClassAvailability IsAvailableForSelectedType(ICSharpContextActionDataProvider provider)
{
Contract.Requires(provider != null);
Contract.Ensures(Contract.Result<AddContractClassAvailability>() != null);
return new AddContractClassAvailability(provider, false, null);
}
示例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;
}
}
示例7: EnsuresAvailability
protected EnsuresAvailability(ICSharpContextActionDataProvider provider,
ReturnTypeEnsuresAvailability returnTypeEnsuresAvailability)
{
Contract.Requires(provider != null);
Contract.Requires(returnTypeEnsuresAvailability != null);
_provider = provider;
_returnTypeEnsuresAvailability = returnTypeEnsuresAvailability;
IsAvailable = ComputeIsAvailable(out _selectedFunction);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例13: ComboEnsuresAvailability
public ComboEnsuresAvailability(ICSharpContextActionDataProvider provider)
{
Contract.Requires(provider != null);
_provider = provider;
if (IsAbstractClassOrInterface()
&& IsEnsuresAvailableFor(out _selectedFunctionDeclaration)
&& CanAddContractForSelectedMethod(out _addContractAvailability,
_selectedFunctionDeclaration))
{
IsAvailable = true;
}
}
示例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;
}
示例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;
}