public void AppendLevel(TypeGroup level, bool isNamespaceLevel) { foreach(TypeGroupName gname in level.types) { // Check if the object belongs to the included namespace level bool isNamespace = gname.IsNamespaceLevel || isNamespaceLevel; // Add not found types. TypeGroupName old = Find(gname); if(old == null) { TypeGroupName newName = new TypeGroupName(gname); newName.IsNamespaceLevel = isNamespace; types.Add(newName); continue; } // Ignore names of lower scopes. if(!isNamespace || !old.IsNamespaceLevel) continue; // Now the old name is a namespace level, and we are adding another // namespace level type, in other words, we have detected an ambiguity. Structure oldType = old.GetBuilding(); AmbiguousStructure amb; if(!oldType.IsAmbiguity()) { amb = new AmbiguousStructure(oldType.GetName(), oldType.GetFlags(), oldType.GetParentScope()); amb.AddCandidate(oldType); old.SetBuilding(oldType); } else { amb = (AmbiguousStructure)oldType; } // Add the new function into the ambiguity list. amb.AddCandidate(gname.GetBuilding()); } }
public TypeGroupName Find(TypeGroupName gname) { return types.Find(gname); }
public void Insert(Structure type) { TypeGroupName gname = new TypeGroupName(type, type.GetGenericPrototype()); types.Add (gname); }
public Structure Find(GenericPrototype prototype) { TypeGroupName gname = new TypeGroupName(null, prototype); TypeGroupName res = types.Find(gname); if(res != null) return res.GetBuilding(); return null; }