case "System.Windows.Forms":
case "System.Windows.Forms.Layout":
- assembly = "System.Windows.Name";
+ assembly = "System.Windows.Forms";
break;
}
public Namespace AddNamespace (MemberName name)
{
- Namespace ns_parent;
- if (name.Left != null) {
- if (parent != null)
- ns_parent = parent.AddNamespace (name.Left);
- else
- ns_parent = AddNamespace (name.Left);
- } else {
- ns_parent = this;
- }
-
+ var ns_parent = name.Left == null ? this : AddNamespace (name.Left);
return ns_parent.TryAddNamespace (name.Basename);
}
if (mode != LookupMode.Normal)
continue;
- if (ts.MemberDefinition.IsImported)
+ if (ts.MemberDefinition.IsImported) {
+ ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (best);
ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (ts);
+ }
ctx.Module.Compiler.Report.Warning (436, 2, loc,
"The type `{0}' conflicts with the imported type of same name'. Ignoring the imported type definition",
types = new Dictionary<string, IList<TypeSpec>> (64);
}
- if ((ts.IsStatic || ts.MemberDefinition.IsPartial) && ts.Arity == 0 &&
- (ts.MemberDefinition.DeclaringAssembly == null || ts.MemberDefinition.DeclaringAssembly.HasExtensionMethod)) {
- if (extension_method_types == null)
- extension_method_types = new List<TypeSpec> ();
+ if (ts.IsClass && ts.Arity == 0) {
+ var extension_method_allowed = ts.MemberDefinition.IsImported ? (ts.Modifiers & Modifiers.METHOD_EXTENSION) != 0 : (ts.IsStatic || ts.MemberDefinition.IsPartial);
+ if (extension_method_allowed) {
+ if (extension_method_types == null)
+ extension_method_types = new List<TypeSpec> ();
- extension_method_types.Add (ts);
+ extension_method_types.Add (ts);
+ }
}
var name = ts.Name;
"Identifier `{0}' differing only in case is not CLS-compliant", compiled.GetSignatureForError ());
}
}
+
+ public override string ToString ()
+ {
+ return Name;
+ }
}
public class CompilationSourceFile : NamespaceContainer
return Compiler.Settings.IsConditionalSymbolDefined (value);
}
+
+ public override void Accept (StructuralVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
MemberCore mc;
if (names_container.DefinedNames.TryGetValue (name, out mc)) {
if (tc is NamespaceContainer && mc is NamespaceContainer) {
- containers.Add (tc);
+ AddTypeContainerMember (tc);
return;
}
}
} else {
names_container.DefinedNames.Add (name, tc);
+
+ var tdef = tc.PartialContainer;
+ if (tdef != null) {
+ //
+ // Same name conflict in different namespace containers
+ //
+ var conflict = ns.GetAllTypes (name);
+ if (conflict != null) {
+ foreach (var e in conflict) {
+ if (e.Arity == mn.Arity) {
+ mc = (MemberCore) e.MemberDefinition;
+ break;
+ }
+ }
+ }
+
+ if (mc != null) {
+ Report.SymbolRelatedToPreviousError (mc);
+ Report.Error (101, tc.Location, "The namespace `{0}' already contains a definition for `{1}'",
+ GetSignatureForError (), mn.GetSignatureForError ());
+ } else {
+ ns.AddType (Module, tdef.Definition);
+ }
+ }
}
base.AddTypeContainer (tc);
-
- var tdef = tc.PartialContainer;
- if (tdef != null)
- ns.AddType (Module, tdef.Definition);
}
public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
public override void GetCompletionStartingWith (string prefix, List<string> results)
{
+ if (Usings == null)
+ return;
+
foreach (var un in Usings) {
if (un.Alias != null)
continue;
if (aliases != null && arity == 0) {
UsingAliasNamespace uan;
if (aliases.TryGetValue (name, out uan)) {
- if (fne != null) {
+ if (fne != null && mode != LookupMode.Probing) {
// TODO: Namespace has broken location
//Report.SymbolRelatedToPreviousError (fne.Location, null);
Compiler.Report.SymbolRelatedToPreviousError (uan.Location, null);
}
}
- public void EnableUsingClausesRedefinition ()
+ public void EnableRedefinition ()
{
+ is_defined = false;
namespace_using_table = null;
}
return false;
}
+
+ public override void Accept (StructuralVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
public class UsingNamespace
}
}
}
+
+ public override string ToString()
+ {
+ return resolved.ToString();
+ }
}
public class UsingExternAlias : UsingAliasNamespace