+ lock (evaluator_lock){
+ if (!inited)
+ Init ();
+
+ bool partial_input;
+ CSharpParser parser = ParseString (ParseMode.GetCompletions, input, out partial_input);
+ if (parser == null){
+ if (CSharpParser.yacc_verbose_flag != 0)
+ Console.WriteLine ("DEBUG: No completions available");
+ return null;
+ }
+
+ Class parser_result = parser.InteractiveResult as Class;
+
+ if (parser_result == null){
+ if (CSharpParser.yacc_verbose_flag != 0)
+ Console.WriteLine ("Do not know how to cope with !Class yet");
+ return null;
+ }
+
+ try {
+ RootContext.ResolveTree ();
+ if (ctx.Report.Errors != 0)
+ return null;
+
+ RootContext.PopulateTypes ();
+ if (ctx.Report.Errors != 0)
+ return null;
+
+ MethodOrOperator method = null;
+ foreach (MemberCore member in parser_result.Methods){
+ if (member.Name != "Host")
+ continue;
+
+ method = (MethodOrOperator) member;
+ break;
+ }
+ if (method == null)
+ throw new InternalErrorException ("did not find the the Host method");
+
+ BlockContext bc = new BlockContext (method, method.Block, method.ReturnType);
+
+ try {
+ method.Block.Resolve (null, bc, method.ParameterInfo, method);
+ } catch (CompletionResult cr){
+ prefix = cr.BaseText;
+ return cr.Result;
+ }
+ } finally {
+ parser.undo.ExecuteUndo ();
+ }
+
+ }
+ return null;
+ }
+