本文整理汇总了C#中ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver.IsVariableReferenceWithSameType方法的典型用法代码示例。如果您正苦于以下问题:C# CSharpResolver.IsVariableReferenceWithSameType方法的具体用法?C# CSharpResolver.IsVariableReferenceWithSameType怎么用?C# CSharpResolver.IsVariableReferenceWithSameType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver
的用法示例。
在下文中一共展示了CSharpResolver.IsVariableReferenceWithSameType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCompletionData
IEnumerable<ICompletionData> CreateCompletionData(TextLocation location, ResolveResult resolveResult, AstNode resolvedNode, CSharpResolver state, Func<IType, IType> typePred = null)
{
if (resolveResult == null /* || resolveResult.IsError*/) {
return null;
}
var lookup = new MemberLookup(
ctx.CurrentTypeDefinition,
Compilation.MainAssembly
);
if (resolveResult is NamespaceResolveResult) {
var nr = (NamespaceResolveResult)resolveResult;
var namespaceContents = new CompletionDataWrapper(this);
foreach (var cl in nr.Namespace.Types) {
if (!lookup.IsAccessible(cl, false))
continue;
IType addType = typePred != null ? typePred(cl) : cl;
if (addType != null)
namespaceContents.AddType(addType, false);
}
foreach (var ns in nr.Namespace.ChildNamespaces) {
namespaceContents.AddNamespace(lookup, ns);
}
return namespaceContents.Result;
}
IType type = resolveResult.Type;
if (type.Namespace == "System" && type.Name == "Void")
return null;
if (resolvedNode.Parent is PointerReferenceExpression && (type is PointerType)) {
resolveResult = new OperatorResolveResult(((PointerType)type).ElementType, System.Linq.Expressions.ExpressionType.Extension, resolveResult);
}
//var typeDef = resolveResult.Type.GetDefinition();
var result = new CompletionDataWrapper(this);
bool includeStaticMembers = false;
if (resolveResult is LocalResolveResult) {
if (resolvedNode is IdentifierExpression) {
var mrr = (LocalResolveResult)resolveResult;
includeStaticMembers = mrr.Variable.Name == mrr.Type.Name;
}
}
if (resolveResult is TypeResolveResult && type.Kind == TypeKind.Enum) {
foreach (var field in type.GetFields ()) {
if (!lookup.IsAccessible(field, false))
continue;
result.AddMember(field);
}
return result.Result;
}
bool isProtectedAllowed = resolveResult is ThisResolveResult ? true : lookup.IsProtectedAccessAllowed(type);
bool skipNonStaticMembers = (resolveResult is TypeResolveResult);
if (resolveResult is MemberResolveResult && resolvedNode is IdentifierExpression) {
var mrr = (MemberResolveResult)resolveResult;
includeStaticMembers = mrr.Member.Name == mrr.Type.Name;
TypeResolveResult trr;
if (state.IsVariableReferenceWithSameType(
resolveResult,
((IdentifierExpression)resolvedNode).Identifier,
out trr
)) {
if (currentMember != null && mrr.Member.IsStatic ^ currentMember.IsStatic) {
skipNonStaticMembers = true;
if (trr.Type.Kind == TypeKind.Enum) {
foreach (var field in trr.Type.GetFields ()) {
if (lookup.IsAccessible(field, false))
result.AddMember(field);
}
return result.Result;
}
}
}
// ADD Aliases
var scope = ctx.CurrentUsingScope;
for (var n = scope; n != null; n = n.Parent) {
foreach (var pair in n.UsingAliases) {
if (pair.Key == mrr.Member.Name) {
foreach (var r in CreateCompletionData (location, pair.Value, resolvedNode, state)) {
if (r is IEntityCompletionData && ((IEntityCompletionData)r).Entity is IMember) {
result.AddMember((IMember)((IEntityCompletionData)r).Entity);
} else {
result.Add(r);
}
}
}
}
}
}
//.........这里部分代码省略.........