public override IEnumerable <Symbol> getSymbolsByName(string name, Filter sf, LookupKind lookupKind = LookupKind.RECURSIVE) { IEnumerable <Symbol> primaryResult = primary.getSymbolsByName(name, sf, lookupKind); return(lookupKind == LookupKind.RECURSIVE ? primaryResult.Concat(secondary.getSymbolsByName(name, sf, lookupKind)) : primaryResult); }
public override IEnumerable <Symbol> getSymbolsByName(String name, Filter sf, LookupKind lookupKind = LookupKind.RECURSIVE) { IEnumerable <Symbol> localResult = dict.TryGetValue(name, out var s) ? s.Where(sf) : CollectionUtils.emptyList <Symbol>(); return(lookupKind is LookupKind.RECURSIVE && outer != null ? localResult.Concat(outer.getSymbolsByName(name, sf)) : localResult); }
public Symbol Lookup(string name, LookupKind lookupKind) { Symbol symbol; switch (lookupKind) { case LookupKind.Any: if (map.TryGetValue(name, out symbol)) { return symbol; } if (parent != null) { return parent.Lookup(name, LookupKind.Any); } break; case LookupKind.Normal: if (kind != ScopeKind.Class && map.TryGetValue(name, out symbol)) { return symbol; } if (parent != null) { return parent.Lookup(name, LookupKind.Normal); } break; case LookupKind.InstanceMember: case LookupKind.StaticMember: if (kind == ScopeKind.Class && map.TryGetValue(name, out symbol) && symbol.isStatic == (lookupKind == LookupKind.StaticMember)) { return symbol; } break; } return null; }
/// Returns Symbols with the given name that match the given filter. /// Symbols from outward Scopes are included iff lookupKind == RECURSIVE. public abstract IEnumerable <Symbol> getSymbolsByName(String name, Filter sf, LookupKind lookupKind = LookupKind.RECURSIVE);
/// Returns Symbols with the given name. Symbols from outward Scopes are included /// iff lookupKind == RECURSIVE. public IEnumerable <Symbol> getSymbolsByName(String name, LookupKind lookupKind = LookupKind.RECURSIVE) { return(getSymbolsByName(name, NO_FILTER, lookupKind)); }