public List <NativeSymbolRelationship> FindAllReachableNativeSymbolRelationships() { // Build up the list of types List <NativeSymbol> list = new List <NativeSymbol>(); foreach (var definedNt in NativeDefinedTypes) { list.Add(definedNt); } foreach (NativeTypeDef typedefNt in NativeTypeDefs) { list.Add(typedefNt); } foreach (NativeProcedure proc in NativeProcedures) { list.Add(proc); } foreach (NativeConstant c in NativeConstants) { list.Add(c); } NativeSymbolIterator iter = new NativeSymbolIterator(); return(iter.FindAllNativeSymbolRelationships(list)); }
private bool IsResolved(NativeSymbol ns, Dictionary <NativeSymbol, bool?> map) { ThrowIfNull(ns); ThrowIfNull(map); // See if this has already been calculated bool?ret = false; if (map.TryGetValue(ns, out ret)) { if (ret.HasValue) { return(ret.Value); } else { // We're in a recursive call to the same type. Return true here because if another type is // not resolved then this will fall out return(true); } } // If there are no immediate children then the type is most definately resolved NativeSymbolIterator it = new NativeSymbolIterator(); List <NativeSymbol> children = new List <NativeSymbol>(ns.GetChildren()); if (children.Count == 0) { return(true); } // Add an entry into the map to indicate that we are exploring this type map.Add(ns, null); ret = true; foreach (NativeSymbol child in children) { if (!child.IsImmediateResolved || !IsResolved(child, map)) { ret = false; break; } } // Save the success map[ns] = ret; return(ret.Value); }