Пример #1
0
		public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
		{
			if (identifierExpression.TypeArguments != null && identifierExpression.TypeArguments.Count > 0) {
				if (resolver.CallingType != null) {
					foreach (var type in resolver.Dom.GetInheritanceTree (resolver.CallingType)) {
						IMethod possibleMethod = type.Methods.Where (m => m.Name == identifierExpression.Identifier && m.TypeParameters.Count == identifierExpression.TypeArguments.Count && m.IsAccessibleFrom (resolver.Dom, resolver.CallingType, resolver.CallingMember, true)).FirstOrDefault ();
						if (possibleMethod != null) {
							MethodResolveResult methodResolveResult = new MethodResolveResult (possibleMethod);
							methodResolveResult.CallingType   = resolver.CallingType;
							methodResolveResult.CallingMember = resolver.CallingMember;
							
							identifierExpression.TypeArguments.ForEach (arg => methodResolveResult.AddGenericArgument (resolver.ResolveType (arg.ConvertToReturnType ())));
							methodResolveResult.ResolveExtensionMethods ();
							return methodResolveResult;
						}
					}
				}
				TypeReference reference = new TypeReference (identifierExpression.Identifier);
				reference.GenericTypes.AddRange (identifierExpression.TypeArguments);
				ResolveResult result = CreateResult (reference);
				result.StaticResolve = true;
				return result;
			}
//			Console.WriteLine ("visit id: " + identifierExpression.Identifier);
			var res = resolver.ResolveIdentifier (this, identifierExpression.Identifier.TrimEnd ('.'));
//			Console.WriteLine ("result: " + res);
			return res;
		}