public Dictionary <string, List <SymbolDecl> > GetSymbolContent(SymbolDecl symbol, bool forChildSymbol) { if (symbol is NamespaceDecl) { return(this.NamespaceContents[symbol.NameKey]); } else { Dictionary <string, List <SymbolDecl> > content = null; if (!this.SymbolContents.TryGetValue(symbol, out content)) { var template = symbol as TemplateDecl; var typedef = (template == null ? symbol : template.Element) as TypedefDecl; if (typedef != null && forChildSymbol) { typedef.Type.Resolve(typedef.Parent, this); var refType = FindRefType(typedef.Type); if (refType.ReferencingNameKey == null) { content = null; } else { var symbols = this.ResolvedTypes[refType]; content = symbols .Select(x => GetSymbolContent(x, forChildSymbol)) .Where(x => x != null) .SelectMany(x => x) .GroupBy(x => x.Key) .ToDictionary(x => x.Key, x => x.SelectMany(y => y.Value).Distinct().ToList()) ; } } else { var visitor = new ResolveSymbolDeclContentVisitor { Environment = this, }; symbol.Accept(visitor); content = visitor.Content; } this.SymbolContents.Add(symbol, content); } return(content); } }
public Dictionary<string, List<SymbolDecl>> GetSymbolContent(SymbolDecl symbol) { if (symbol is NamespaceDecl) { return this.NamespaceContents[symbol.NameKey]; } else { Dictionary<string, List<SymbolDecl>> content = null; if (!this.SymbolContents.TryGetValue(symbol, out content)) { var template = symbol as TemplateDecl; var typedef = (template == null ? symbol : template.Element) as TypedefDecl; if (typedef != null) { typedef.Type.Resolve(typedef.Parent, this); var refType = FindRefType(typedef.Type); if (refType.ReferencingNameKey == null) { content = null; } else { var symbols = this.ResolvedTypes[refType]; content = symbols .Select(x => GetSymbolContent(x)) .Where(x => x != null) .SelectMany(x => x) .GroupBy(x => x.Key) .ToDictionary(x => x.Key, x => x.SelectMany(y => y.Value).Distinct().ToList()) ; } } else { var visitor = new ResolveSymbolDeclContentVisitor { Environment = this, }; symbol.Accept(visitor); content = visitor.Content; } this.SymbolContents.Add(symbol, content); } return content; } }