internal static void AddNode(GreenNode node, int hash) { if (AllChildrenInCache(node) && !node.IsMissing) { GreenStats.ItemAdded(); Debug.Assert(node.GetCacheHash() == hash); var idx = hash & CacheMask; cache[idx] = new Entry(hash, node); } }
private static bool ChildInCache(GreenNode child) { // for the purpose of this function consider that // null nodes, tokens and trivias are cached somwhere else. // TODO: should use slotCount if (child == null || child.SlotCount == 0) { return(true); } int hash = child.GetCacheHash(); int idx = hash & CacheMask; return(cache[idx].node == child); }
private static bool ChildInCache(GreenNode child) { // for the purpose of this function consider that // null nodes, tokens and trivias are cached somewhere else. // TODO: should use slotCount if (child == null || child.SlotCount == 0) return true; int hash = child.GetCacheHash(); int idx = hash & CacheMask; return s_cache[idx].node == child; }
internal static void AddNode(GreenNode node, int hash) { if (AllChildrenInCache(node) && !node.IsMissing) { GreenStats.ItemAdded(); Debug.Assert(node.GetCacheHash() == hash); var idx = hash & CacheMask; s_cache[idx] = new Entry(hash, node); } }