[asp.net] FormsAuthenticationTicket.FromByteArray stops early if it is passed a null...
[mono.git] / mcs / mcs / complete.cs
index 675704110515198db6302164c6cd4eb9ef2e0ea5..43cc8fad7f8e9b0449712914eafcb99133b9f305 100644 (file)
 // statements even when the expression is incomplete (for example
 // completing inside a lambda
 //
-using System;
 using System.Collections.Generic;
-using System.Reflection;
-using System.Reflection.Emit;
-using System.Text;
-using Mono.CSharp.Linq;
 using System.Linq;
 
 namespace Mono.CSharp {
@@ -32,10 +27,10 @@ namespace Mono.CSharp {
                public static void AppendResults (List<string> results, string prefix, IEnumerable<string> names)
                {
                        foreach (string name in names) {
-                               if (name == null || prefix == null)
+                               if (name == null)
                                        continue;
 
-                               if (!name.StartsWith (prefix))
+                               if (prefix != null && !name.StartsWith (prefix))
                                        continue;
 
                                if (results.Contains (name))
@@ -119,7 +114,7 @@ namespace Mono.CSharp {
                                return null;
 
                        TypeSpec expr_type = expr_resolved.Type;
-                       if (expr_type.IsPointer || expr_type == TypeManager.void_type || expr_type == TypeManager.null_type || expr_type == InternalType.AnonymousMethod) {
+                       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;
                        }
@@ -155,7 +150,7 @@ namespace Mono.CSharp {
                                AppendResults (results, partial_name, r);
                        }
 
-                       throw new CompletionResult (partial_name == null ? "" : partial_name, results.ToArray ());
+                       throw new CompletionResult (partial_name == null ? "" : partial_name, results.Distinct ().ToArray ());
                }
 
                protected override void CloneTo (CloneContext clonectx, Expression t)
@@ -193,7 +188,7 @@ namespace Mono.CSharp {
                                results = temp;
                        }
 
-                       throw new CompletionResult (partial_name == null ? "" : partial_name, results.ToArray ());
+                       throw new CompletionResult (partial_name == null ? "" : partial_name, results.Distinct ().ToArray ());
                }
 
                protected override void CloneTo (CloneContext clonectx, Expression t)