本文整理汇总了C#中ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver.LookupSimpleNameOrTypeName方法的典型用法代码示例。如果您正苦于以下问题:C# CSharpResolver.LookupSimpleNameOrTypeName方法的具体用法?C# CSharpResolver.LookupSimpleNameOrTypeName怎么用?C# CSharpResolver.LookupSimpleNameOrTypeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver
的用法示例。
在下文中一共展示了CSharpResolver.LookupSimpleNameOrTypeName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoResolve
public ResolveResult DoResolve(ITypeResolveContext context)
{
CSharpResolver r = new CSharpResolver(context);
r.CurrentTypeDefinition = parentTypeDefinition;
r.UsingScope = parentUsingScope;
IType[] typeArgs = new IType[typeArguments.Count];
for (int i = 0; i < typeArgs.Length; i++) {
typeArgs[i] = typeArguments[i].Resolve(context);
}
return r.LookupSimpleNameOrTypeName(identifier, typeArgs, lookupMode);
}
示例2: DoResolve
public ResolveResult DoResolve(ITypeResolveContext context)
{
CacheManager cacheManager = context.CacheManager;
if (cacheManager != null) {
ResolveResult cachedResult = cacheManager.GetShared(this) as ResolveResult;
if (cachedResult != null)
return cachedResult;
}
CSharpResolver r = new CSharpResolver(context);
r.CurrentTypeDefinition = parentTypeDefinition;
r.CurrentUsingScope = parentUsingScope;
IType[] typeArgs = new IType[typeArguments.Count];
for (int i = 0; i < typeArgs.Length; i++) {
typeArgs[i] = typeArguments[i].Resolve(context);
}
ResolveResult rr = r.LookupSimpleNameOrTypeName(identifier, typeArgs, lookupMode);
if (cacheManager != null)
cacheManager.SetShared(this, rr);
return rr;
}
示例3: AddTypesAndNamespaces
//.........这里部分代码省略.........
}
if (!lookup.IsAccessible(member, isProtectedAllowed)) {
continue;
}
if (memberPred == null || memberPred(member)) {
wrapper.AddMember(member);
}
}
var declaring = def.DeclaringTypeDefinition;
while (declaring != null) {
foreach (var member in declaring.GetMembers (m => m.IsStatic)) {
if (memberPred == null || memberPred(member)) {
wrapper.AddMember(member);
}
}
declaring = declaring.DeclaringTypeDefinition;
}
}
}
if (ctx.CurrentTypeDefinition != null) {
foreach (var p in ctx.CurrentTypeDefinition.TypeParameters) {
wrapper.AddTypeParameter(p);
}
}
}
var scope = ctx.CurrentUsingScope;
for (var n = scope; n != null; n = n.Parent) {
foreach (var pair in n.UsingAliases) {
wrapper.AddAlias(pair.Key);
}
foreach (var alias in n.ExternAliases) {
wrapper.AddAlias(alias);
}
foreach (var u in n.Usings) {
foreach (var type in u.Types) {
if (!lookup.IsAccessible(type, false))
continue;
IType addType = typePred != null ? typePred(type) : type;
if (onlyAddConstructors && addType != null) {
if (!addType.GetConstructors().Any(c => lookup.IsAccessible(c, true)))
continue;
}
if (addType != null) {
var a = onlyAddConstructors ? wrapper.AddConstructors(addType, false, IsAttributeContext(node)) : wrapper.AddType(addType, false, IsAttributeContext(node));
if (a != null && callback != null) {
callback(a, type);
}
}
}
}
foreach (var type in n.Namespace.Types) {
if (!lookup.IsAccessible(type, false))
continue;
IType addType = typePred != null ? typePred(type) : type;
if (onlyAddConstructors && addType != null) {
if (!addType.GetConstructors().Any(c => lookup.IsAccessible(c, true)))
continue;
}
if (addType != null) {
var a2 = onlyAddConstructors ? wrapper.AddConstructors(addType, false, IsAttributeContext(node)) : wrapper.AddType(addType, false);
if (a2 != null && callback != null) {
callback(a2, type);
}
}
}
foreach (var curNs in n.Namespace.ChildNamespaces) {
wrapper.AddNamespace(lookup, curNs);
}
}
if (node is AstType && node.Parent is Constraint && IncludeKeywordsInCompletionList) {
wrapper.AddCustom ("new()");
}
if (AutomaticallyAddImports) {
state = GetState();
foreach (var type in Compilation.GetAllTypeDefinitions ()) {
if (!lookup.IsAccessible (type, false))
continue;
var resolveResult = state.LookupSimpleNameOrTypeName(type.Name, type.TypeArguments, NameLookupMode.Expression);
if (resolveResult.Type.GetDefinition () == type)
continue;
if (onlyAddConstructors) {
if (!type.GetConstructors().Any(c => lookup.IsAccessible(c, true)))
continue;
}
wrapper.AddTypeImport(type, !resolveResult.IsError, onlyAddConstructors);
}
}
}
示例4: Resolve
public override ResolveResult Resolve(CSharpResolver resolver)
{
var typeArgs = typeArguments.Resolve(resolver.CurrentTypeResolveContext);
return resolver.LookupSimpleNameOrTypeName(identifier, typeArgs, lookupMode);
}