/// <summary> /// Make sure that any NativeDefinedType referenced is in the bag. That way if we /// have structures which point to other NativeDefinedType instances, they are automagically /// put into the bag /// </summary> /// <param name="bag"></param> /// <remarks></remarks> private void ChaseReferencedDefinedTypes(NativeSymbolBag bag) { bag.TryResolveSymbolsAndValues(); foreach (NativeSymbol sym in bag.FindAllReachableNativeSymbols()) { if (NativeSymbolCategory.Defined == sym.Category) { NativeDefinedType defined = null; if (!bag.TryGetGlobalSymbol(sym.Name, out defined)) { bag.AddDefinedType((NativeDefinedType)sym); } } } }
private void VerifyReachable(NativeSymbolBag bag, params string[] names) { Assert.NotNull(bag); Dictionary <string, NativeType> map = new Dictionary <string, NativeType>(); foreach (NativeSymbol curSym in bag.FindAllReachableNativeSymbols()) { NativeType cur = curSym as NativeType; if (cur != null) { NativeType nt = cur as NativeType; if (nt != null) { map.Add(cur.DisplayName, nt); } } } Assert.Equal(names.Length, map.Count); foreach (string name in names) { Assert.True(map.ContainsKey(name), "NativeType with name " + name + " not reachable"); } }