Beispiel #1
0
        public void CalculatePreAdd(RewriteDesign design)
        {
            if (_preAddCalculated)
            {
                return;
            }
            _preAddCalculated = true;

            ForBody.ForEach(statement =>
            {
                if (statement is IteratorDesign iteratorParameters)
                {
                    iteratorParameters.CalculatePreAdd(design);
                }
            });
            if (ForFrom == null)
            {
                PreFor.Insert(0, (StatementBridge)Enumerator.Assign(Collection.Access("GetEnumerator").Invoke()));
            }
            else if (IsReversed)
            {
                PreFor.Add((StatementBridge)ForIndexer.Assign(ForFrom));
                ForTo = ForTo.ReusableForConst(_design, Int, this);
            }
            else
            {
                PreFor.Add((StatementBridge)ForIndexer.Assign(ForFrom));
                ForTo = (ForTo + 1).ReusableForConst(_design, Int, this);
            }
        }