[eval] Consider base type members in tab completion
authorMarek Safar <marek.safar@gmail.com>
Thu, 2 Jan 2014 16:40:10 +0000 (17:40 +0100)
committerMarek Safar <marek.safar@gmail.com>
Thu, 2 Jan 2014 16:40:10 +0000 (17:40 +0100)
mcs/mcs/class.cs
mcs/mcs/eval.cs

index 0a46fd5b7ce8ae2ac0130b2a76e99c1ec00a5ccf..d450030d747ebc686eec4f757f2b8882983df7d1 100644 (file)
@@ -13,6 +13,7 @@
 //
 
 using System;
+using System.Linq;
 using System.Collections.Generic;
 using System.Runtime.InteropServices;
 using System.Security;
@@ -2751,6 +2752,17 @@ namespace Mono.CSharp
                        }
                }
 
+               public override void GetCompletionStartingWith (string prefix, List<string> results)
+               {
+                       base.GetCompletionStartingWith (prefix, results);
+
+                       var bt = base_type;
+                       while (bt != null) {
+                               results.AddRange (MemberCache.GetCompletitionMembers (this, bt, prefix).Where (l => l.IsStatic).Select (l => l.Name));
+                               bt = bt.BaseType;
+                       }
+               }
+
                protected override TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class)
                {
                        var ifaces = base.ResolveBaseTypes (out base_class);
index 26e4f5d8d90ca2e1d004e5b20c60b9259ccdd78d..3458f7499c937c8ecdf5a468035f02ec7ae1ced0 100644 (file)
@@ -370,8 +370,14 @@ namespace Mono.CSharp
                                if (parser == null){
                                        return null;
                                }
-                               
-                               Class parser_result = parser.InteractiveResult;
+
+                               Class host = parser.InteractiveResult;
+
+                               var base_class_imported = importer.ImportType (base_class);
+                               var baseclass_list = new List<FullNamedExpression> (1) {
+                                       new TypeExpression (base_class_imported, host.Location)
+                               };
+                               host.SetBaseTypes (baseclass_list);
 
 #if NET_4_0
                                var access = AssemblyBuilderAccess.RunAndCollect;
@@ -383,9 +389,11 @@ namespace Mono.CSharp
                                module.SetDeclaringAssembly (a);
 
                                // Need to setup MemberCache
-                               parser_result.CreateContainer ();
+                               host.CreateContainer ();
+                               // Need to setup base type
+                               host.DefineContainer ();
 
-                               var method = parser_result.Members[0] as Method;
+                               var method = host.Members[0] as Method;
                                BlockContext bc = new BlockContext (method, method.Block, ctx.BuiltinTypes.Void);
 
                                try {