Пример #1
0
        private BoundStatement UpdateStatement(BoundSpillSequenceBuilder builder, BoundStatement statement, bool substituteTemps)
        {
            if (builder == null)
            {
                // statement doesn't contain any await
                Debug.Assert(!substituteTemps || tempSubstitution.Count == 0);
                Debug.Assert(statement != null);
                return(statement);
            }

            Debug.Assert(builder.Value == null);
            if (statement != null)
            {
                builder.AddStatement(statement);
            }

            var substituterOpt = (substituteTemps && tempSubstitution.Count > 0) ? new LocalSubstituter(tempSubstitution) : null;
            var result         = F.Block(builder.GetLocals(), builder.GetStatements(substituterOpt));

            if (substituteTemps)
            {
                tempSubstitution.Clear();
            }

            builder.Free();
            return(result);
        }
Пример #2
0
        private void ParseGlobal_Expr_List(UDMFParsedMapData dataClass, ParserInfo info)
        {
            unknownGlobalAssignmentsPooled.Clear();
            unknownBlocksPooled.Clear();

            UDMFToken tok = scanner.LookAhead();

            while (tok.Type == UDMFTokenType.IDENTIFIER)
            {
                ParseGlobal_Expr(dataClass, info);

                tok = scanner.LookAhead();
            }

            if (unknownGlobalAssignmentsPooled.Count > 0)
            {
                dataClass.UnknownGlobalAssignments = new Dictionary <string, UDMFUnknownAssignment> (
                    unknownGlobalAssignmentsPooled,
                    StringComparer.InvariantCultureIgnoreCase
                    );

                unknownGlobalAssignmentsPooled.Clear();
            }

            if (unknownBlocksPooled.Count > 0)
            {
                dataClass.UnknownBlocks = new Dictionary <string, List <UDMFUnknownBlock> > (unknownBlocksPooled.Count);
                foreach (var kvp in unknownBlocksPooled)
                {
                    var pooledList = kvp.Value;
                    var newList    = new List <UDMFUnknownBlock> (pooledList.Count);

                    foreach (var block in pooledList)
                    {
                        newList.Add(block);
                    }

                    dataClass.UnknownBlocks.Add(kvp.Key, newList);

                    pooledList.Clear();
                    pooledList.Capacity = 0;
                }

                unknownBlocksPooled.Clear();
            }
        }
Пример #3
0
        public void TestClear()
        {
            using var dict = new PooledDictionary <string, string>();
            dict["one"]    = "One";

            dict.Clear();

            Assert.False(dict.ContainsKey("one"));
        }
            protected (ImmutableArray <BoundStatement> loweredDag, ImmutableDictionary <SyntaxNode, ImmutableArray <BoundStatement> > switchSections) LowerDecisionDag(BoundDecisionDag decisionDag)
            {
                Debug.Assert(this._loweredDecisionDag.IsEmpty());
                ComputeLabelSet(decisionDag);
                LowerDecisionDagCore(decisionDag);
                ImmutableArray <BoundStatement> loweredDag = _loweredDecisionDag.ToImmutableAndFree();
                var switchSections = _switchArms.ToImmutableDictionary(kv => kv.Key, kv => kv.Value.ToImmutableAndFree());

                _switchArms.Clear();
                return(loweredDag, switchSections);
            }
Пример #5
0
        public UDMFParsedMapData Parse(string udmfSource, Type dataType)
        {
            scanner.Init(udmfSource);

            GetParserInfo(dataType);

            var data = (UDMFParsedMapData)Activator.CreateInstance(dataType);
            var info = GetParserInfo(dataType);

            info.InitializeDataClass(data);

            ParseGlobal_Expr_List(data, info);
            if (Errors.Count < 1)
            {
                data.PostProcessing();
            }

            scanner.Reset();
            unknownGlobalAssignmentsPooled.Clear();
            unknownAssignmentsPooled.Clear();

            return(data);
        }
Пример #6
0
        /// <summary>
        /// Dispose and clear component data
        /// </summary>
        public void Dispose()
        {
            Array.Clear(ComponentTypes, 0, ComponentTypes.Length);
            entities.Clear();
            foreach (var component in Components.Values)
            {
                component.Dispose();
            }

            Components.Clear();

            entityToIndex.Dispose();
            entities.Dispose();
            Components.Dispose();
        }
Пример #7
0
 private void EnterStatement(BoundNode boundStatement)
 {
     _tempSubstitution.Clear();
 }
 public void Clear()
 {
     Debug.Assert(!IsDisposed);
     _coreAnalysisData.Clear();
 }
 private static void Free(PooledDictionary dictionary)
 {
     dictionary.Clear();
     pool.Free(dictionary);
 }