// We should probably lock other places too // but this one is especially risky because multiple IVariableStores may have // a handle to us and trigger flushing simultaneously. This must happen sequentially private void FlushUnflushedStores() { lock (UnflushedStores) { foreach (var mapping in UnflushedStores) { DirectWrite(mapping.Key.Indices, mapping.Value); } UnflushedStores.Clear(); Debug.Assert(UnflushedStores.Count == 0); } }
private static ImmutableDictionary <SyntaxTree, ImmutableDictionary <DiagnosticAnalyzer, ImmutableArray <Diagnostic> > > GetImmutable( ImmutableHashSet <DiagnosticAnalyzer> analyzers, Dictionary <SyntaxTree, Dictionary <DiagnosticAnalyzer, ImmutableArray <Diagnostic> .Builder> > localDiagnosticsOpt) { if (localDiagnosticsOpt == null) { return(ImmutableDictionary <SyntaxTree, ImmutableDictionary <DiagnosticAnalyzer, ImmutableArray <Diagnostic> > > .Empty); } ImmutableDictionary <SyntaxTree, ImmutableDictionary <DiagnosticAnalyzer, ImmutableArray <Diagnostic> > > .Builder builder = ImmutableDictionary.CreateBuilder <SyntaxTree, ImmutableDictionary <DiagnosticAnalyzer, ImmutableArray <Diagnostic> > >(); ImmutableDictionary <DiagnosticAnalyzer, ImmutableArray <Diagnostic> > .Builder perTreeBuilder = ImmutableDictionary.CreateBuilder <DiagnosticAnalyzer, ImmutableArray <Diagnostic> >(); foreach (KeyValuePair <SyntaxTree, Dictionary <DiagnosticAnalyzer, ImmutableArray <Diagnostic> .Builder> > diagnosticsByTree in localDiagnosticsOpt) { SyntaxTree tree = diagnosticsByTree.Key; foreach (KeyValuePair <DiagnosticAnalyzer, ImmutableArray <Diagnostic> .Builder> diagnosticsByAnalyzer in diagnosticsByTree.Value) { if (analyzers.Contains(diagnosticsByAnalyzer.Key)) { perTreeBuilder.Add(diagnosticsByAnalyzer.Key, diagnosticsByAnalyzer.Value.ToImmutable()); } } builder.Add(tree, perTreeBuilder.ToImmutable()); perTreeBuilder.Clear(); } return(builder.ToImmutable()); }
public void Reset() { lock (_sync) { _touchedDataLoaders = _touchedDataLoaders.Clear(); } }
public void ImmutableDictAdd() { immutableDictionary.Clear(); for (int i = 0; i < N; i++) { immutableDictionary.Add($"{i},{i}", i); } }
public void SetAddressSharedEntities(ImmutableDictionary <AnalysisEntity, CopyAbstractValue> addressSharedEntitiesOpt) { _addressSharedEntitiesBuilder.Clear(); if (addressSharedEntitiesOpt != null) { _addressSharedEntitiesBuilder.AddRange(addressSharedEntitiesOpt); } }
/// <summary> /// Clears all parts from this collection /// </summary> public void Clear() { lock (m_mutationLock) { m_partsByUuid = m_partsByUuid.Clear(); m_partsByLocalId = m_partsByLocalId.Clear(); } }
public ImmutableDictionary <T, T> ImmutableDictionary() { ImmutableDictionary <T, T> immutableDictionary = ImmutableDictionary <T, T> .Empty; foreach (T value in _uniqueValues) { immutableDictionary = immutableDictionary.Add(value, value); } return(immutableDictionary.Clear()); }
/// <summary> /// Builds a factory and clear the dictionary builder. /// </summary> /// <param name="builder">the func that build the factory</param> /// <returns>A <see cref="TFact"/> instance</returns> /// <exception cref="ArgumentOutOfRangeException"></exception> protected TFact CreateFactory(Func <ImmutableDictionary <TKey, TVal>, TFact> builder) { if (Builder.Count < 1) { throw new ArgumentOutOfRangeException(nameof(Builder.Count)); } var immutable = Builder.ToImmutable(); Builder.Clear(); return(builder(immutable)); }
public void ImmutableDictionary_ClearTest() { Dictionary<int, string> dictionary = new Dictionary<int, string> { {1,"asaas"}, {2,"sasas"}, {3,"tak"} }; ImmutableDictionary<int, string> test = new ImmutableDictionary<int, string>(dictionary); test.Clear(); }
public void ImmutableDictionary_ClearTest() { Dictionary <int, string> dictionary = new Dictionary <int, string> { { 1, "asaas" }, { 2, "sasas" }, { 3, "tak" } }; ImmutableDictionary <int, string> test = new ImmutableDictionary <int, string>(dictionary); test.Clear(); }
/// <inheritdoc /> public void Dispose() { if (disposed) { return; } nextId = 0L; itemMap.Clear(); queue.Clear(); disposed = true; }
public void Dispose() { AssertMainThread(); foreach (object ob in properties.Values) { IDisposable disp = ob as IDisposable; if (disp != null) { disp.Dispose(); } } properties = properties.Clear(); }
public void Clear_HasComparer_ReturnsEmptyWithOriginalComparer() { ImmutableDictionary<string, int> dictionary = new Dictionary<string, int> { { "a", 1 } }.ToImmutableDictionary(StringComparer.OrdinalIgnoreCase); ImmutableDictionary<string, int> clearedDictionary = dictionary.Clear(); Assert.NotSame(ImmutableDictionary<string, int>.Empty, clearedDictionary.Clear()); Assert.NotEmpty(dictionary); clearedDictionary = clearedDictionary.Add("a", 1); Assert.True(clearedDictionary.ContainsKey("A")); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> /// <param name="disposing">if true, call from <see cref="Dispose()"/></param> protected virtual void Dispose(bool disposing) { if (Interlocked.Exchange(ref disposed, 1) != 0) { return; } foreach (var lockObject in lockMap.Values) { lockObject.Dispose(); } if (disposing) { lockMap.Clear(); AvailableKeys = Array.Empty <string>(); } }
public async Task Subscribe(IMessageChannel messageChannel, ulong botId) { if (channel != null && channel != messageChannel) { await ClearChannelAsync(channel, botId); } channel = messageChannel; await ClearChannelAsync(messageChannel, botId); messages = messages.Clear( ); foreach (var embedInfo in EmbedService.Embeds.Values) { await UpdateChannelAsync(embedInfo); } }
public void ToImmutableDictionary() { ImmutableDictionary <int, int> .Builder builder = ImmutableDictionary.CreateBuilder <int, int>(); builder.Add(0, 0); builder.Add(1, 1); builder.Add(2, 2); var dictionary = builder.ToImmutableDictionary(); Assert.Equal(0, dictionary[0]); Assert.Equal(1, dictionary[1]); Assert.Equal(2, dictionary[2]); builder[1] = 5; Assert.Equal(5, builder[1]); Assert.Equal(1, dictionary[1]); builder.Clear(); Assert.True(builder.ToImmutableDictionary().IsEmpty); Assert.False(dictionary.IsEmpty); ImmutableDictionary <int, int> .Builder nullBuilder = null; AssertExtensions.Throws <ArgumentNullException>("builder", () => nullBuilder.ToImmutableDictionary()); }
public void Clear() { map = map.Clear(); }
/// <summary> /// Clears the instance metadata. /// </summary> public void ClearInstanceMetadata() { instanceMetadata = instanceMetadata.Clear(); }
public virtual void Clear() { specs = specs.Clear(); }
public IImmutableDictionary <string, object> Clear() => _values.Clear();
/// <summary> /// Empties the collection /// </summary> public void Clear() { _backing = _backing.Clear(); }
private void DropSymbolicNonAliasingStores() { StoresAtSymbolicNonAliasingIndices.Clear(); Debug.Assert(StoresAtSymbolicNonAliasingIndices.Count == 0); SymVariable = null; }
public void Clear() { _hostiles.Clear(); _isDirty = true; }
protected override ImmutableDictionary <TKey, TValue> Clear(ImmutableDictionary <TKey, TValue> values, ISerializationContext context) => values.Clear();
public IImmutableDictionary <T, V> Clear() { _items = _items.Clear(); RaiseNotifyCollectionChanged(); return(this); }
public void Clear() { unreachable = false; thisPath = new PathNode(typeSystem.NonNullNode, emptyMembers); locals.Clear(); }
private void DropConcreteStores() { StoresAtConcreteIndices.Clear(); Debug.Assert(StoresAtConcreteIndices.Count == 0); }
/// <summary> /// Clears the instance metadata. /// </summary> public void ClearInstanceData() { instanceData = instanceData.Clear(); }
public TGraph Clear() { return(CreateInstance(_vertices.Clear(), _edges.Clear(), _graph.Clear())); }
public void Clear() { specs = specs.Clear(); }
/// <summary> /// Removes all key-value pairs from this dictionary. /// </summary> public void Clear() { innerDictionary.Clear(); orderedKeyList.Clear(); }