//By convention, the "null" scope sees all public bool VisibleInScope(VisibilityScope other) { if (other != null) { Tuple <int, bool> result; if (cached.TryGetValue(other, out result)) { if (result.Item1 == other.scopeTokens.Count) { return(result.Item2); } else { if (result.Item2) { return(true); } } } var isoverlap = overlaps(other.scopeTokens, this.scopeTokens); cached[other] = new Tuple <int, bool>(other.scopeTokens.Count, isoverlap); return(isoverlap); } return(true); }
//However augmenting with a null scope does nothing public void Augment(VisibilityScope other) { if (other != null) { scopeTokens.UnionWith(other.scopeTokens); scopeIds.UnionWith(other.scopeIds); cached.Clear(); } }