protected override Expression DoResolve (ResolveContext ec)
{
Expression expr_resolved = expr.Resolve (ec,
ResolveFlags.VariableOrValue | ResolveFlags.Type);
if (expr_resolved == null)
return null;
TypeSpec expr_type = expr_resolved.Type;
if (expr_type.IsPointer || expr_type == TypeManager.void_type || expr_type == InternalType.Null || expr_type == InternalType.AnonymousMethod) {
Unary.Error_OperatorCannotBeApplied (ec, loc, ".", expr_type);
return null;
}
if (targs != null) {
if (!targs.Resolve (ec))
return null;
}
var results = new List<string> ();
if (expr_resolved is Namespace){
Namespace nexpr = expr_resolved as Namespace;
string namespaced_partial;
if (partial_name == null)
namespaced_partial = nexpr.Name;
else
namespaced_partial = nexpr.Name + "." + partial_name;
#if false
Console.WriteLine ("Workign with: namespaced partial {0}", namespaced_partial);
foreach (var x in ec.TypeContainer.NamespaceEntry.CompletionGetTypesStartingWith (ec.TypeContainer, namespaced_partial)){
Console.WriteLine (" {0}", x);
}
#endif
CompletionSimpleName.AppendResults (
results,
partial_name,
ec.CurrentMemberDefinition.Parent.NamespaceEntry.CompletionGetTypesStartingWith (namespaced_partial));
} else {
var r = MemberCache.GetCompletitionMembers (expr_type, partial_name).Select (l => l.Name);
AppendResults (results, partial_name, r);
}
throw new CompletionResult (partial_name == null ? "" : partial_name, results.Distinct ().ToArray ());
}