本文整理汇总了C#中ITypeElement类的典型用法代码示例。如果您正苦于以下问题:C# ITypeElement类的具体用法?C# ITypeElement怎么用?C# ITypeElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITypeElement类属于命名空间,在下文中一共展示了ITypeElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetConstructorsState
private void SetConstructorsState(ITypeElement typeElement, UsageState state)
{
foreach (IConstructor constructor in typeElement.Constructors)
{
collectUsagesStageProcess.SetElementState(constructor, state);
}
}
示例2: CreateContext
public ContextElement CreateContext(ITypeElement type)
{
if (_cache.Classes.ContainsKey(type))
{
return _cache.Classes[type];
}
var context = GetOrCreateContextElement(_provider,
#if RESHARPER_61
_manager,
_psiModuleManager,
_cacheManager,
#endif
_project,
_projectEnvoy,
type.GetClrName().FullName,
_assemblyPath,
type.GetSubjectString(),
type.GetTags(),
type.IsIgnored());
foreach (var child in context.Children)
{
child.State = UnitTestElementState.Pending;
}
_cache.Classes.Add(type, context);
return context;
}
示例3: BasedOnRegistration
public BasedOnRegistration(ITreeNode registrationRootElement, ITypeElement basedOnElement, IEnumerable<WithServiceRegistration> withServices)
: base(registrationRootElement, withServices)
{
this.basedOnElement = basedOnElement;
name = basedOnElement.GetClrName().FullName;
}
示例4: IsValidReferenceAndQualifier
private bool IsValidReferenceAndQualifier(LanguageElement activeRerence, out ITypeElement callerType, out Expression qualifier)
{
qualifier = null;
callerType = null;
if (!(activeRerence is IHasQualifier))
return false;
// should be undeclared....
IElement declaration = activeRerence.GetDeclaration(false);
if (declaration != null)
return false;
qualifier = (activeRerence as IHasQualifier).Qualifier;
if (qualifier is MethodReferenceExpression)
qualifier = (qualifier as MethodReferenceExpression).Qualifier;
if (qualifier == null)
return false;
callerType = qualifier.Resolve(ParserServices.SourceTreeResolver) as ITypeElement;
if (callerType == null)
return false;
return true;
}
示例5: SearchGenericImplementationsRequest
public SearchGenericImplementationsRequest(DeclaredElementTypeUsageInfo declaredElement,
ITypeElement originType,
ISearchDomain searchDomain,
IEnumerable<IDeclaredType> originTypeParams)
: base(declaredElement, originType, searchDomain) {
_originTypeParams = originTypeParams;
}
示例6: IsSatisfiedBy
public override bool IsSatisfiedBy(ITypeElement typeElement)
{
if (!types.Contains(typeElement))
return false;
return basedOn.IsSatisfiedBy(typeElement);
}
示例7: ExtendsTheCallerType
private bool ExtendsTheCallerType(IMethodElement method, ITypeElement callerType, Expression qualifier)
{
if (method == null || callerType == null)
return false;
if (method.Parameters.Count == 0)
return false;
ISourceTreeResolver resolver = ParserServices.SourceTreeResolver;
ExpressionCollection arguments = new ExpressionCollection();
arguments.Add(qualifier);
method = GenericElementActivator.ActivateMemberIfNeeded(resolver, method, arguments, null, ArgumentsHelper.ResolveArgumentTypes(resolver, arguments)) as IMethodElement;
if (method == null)
return false;
IParameterElement extensionParam = method.Parameters[0] as IParameterElement;
if (extensionParam == null)
return false;
ITypeReferenceExpression typeRef = extensionParam.Type;
if (typeRef == null)
return false;
ITypeElement type = typeRef.GetDeclaration() as ITypeElement;
if (type == null)
return false;
IArrayTypeElement arrayType = callerType as IArrayTypeElement;
//if (arrayType != null)
//{
// return true;
//}
//else
return ArgumentsHelper.HasParamConversion(resolver, extensionParam, callerType, qualifier, TypeConversionMode.ImplicitConversion);
}
示例8: ControlFlowInspector
public ControlFlowInspector([NotNull] ICSharpFunctionDeclaration functionDeclaration,
[NotNull] CSharpControlFlowGraf graf, int maxLevel, [NotNull] ITypeElement disposableInterface)
: base(functionDeclaration, graf)
{
_disposableInterface = disposableInterface;
_maxLevel = maxLevel;
}
示例9: BasedOnRegistration
public BasedOnRegistration(ITreeNode registrationRootElement, ITypeElement basedOnElement)
: base(registrationRootElement)
{
this.basedOnElement = basedOnElement;
name = basedOnElement.GetClrName().FullName;
}
示例10: IsElementOfType
/// <summary>
/// Is element of type
/// </summary>
public bool IsElementOfType(ITypeElement DeclaredTypeElement, string type)
{
if (DeclaredTypeElement == null)
return false;
if (DeclaredTypeElement.FullName.Replace("`1", "") == type || DeclaredTypeElement.DescendsFrom(type))
return true;
return false;
} // IsElementOfType(DeclaredTypeElement, type)
示例11: IsSatisfiedBy
public override bool IsSatisfiedBy(ITypeElement typeElement)
{
if (!typeElement.IsDescendantOf(basedOnElement))
{
return false;
}
return base.IsSatisfiedBy(typeElement);;
}
示例12: IsSatisfiedBy
public override bool IsSatisfiedBy(ITypeElement typeElement)
{
if (defaultFilter(typeElement))
{
return true;
}
return false;
}
示例13: ComponentRegistration
public ComponentRegistration(ITreeNode registrationElement, ITypeElement serviceType)
: base(registrationElement)
{
this.serviceType = serviceType;
// for some reason, in tests this throws an exception
// copying the name to display later in ToString()
name = GetDisplayName(serviceType);
}
示例14: IsSatisfiedBy
public override bool IsSatisfiedBy(ITypeElement typeElement)
{
if (!defaultFilter(typeElement))
{
return false;
}
return withServices.All(registration => registration.IsSatisfiedBy(typeElement));
}
示例15: IsSatisfiedBy
public override bool IsSatisfiedBy(ITypeElement typeElement)
{
var attributesOwner = typeElement as IAttributesOwner;
if (attributesOwner == null)
{
return false;
}
return attributesOwner.HasAttributeInstance(attributeType.GetClrName(), true);
}