Exemplo n.º 1
0
        public override void Decompose(ref Expression self, IList <CodeNode> result)
        {
            _left.Decompose(ref _left, result);

            if ((_codeContext & CodeContext.InExpression) != 0)
            {
                result.Add(new StoreValue(this, false));
                self = new ExtractStoredValue(this);
            }
        }
Exemplo n.º 2
0
        public override void Decompose(ref Expression self, IList <CodeNode> result)
        {
            var lastDecomposeIndex = -1;

            for (var i = 0; i < expressions.Length; i++)
            {
                expressions[i].Decompose(ref expressions[i], result);
                if (expressions[i].NeedDecompose)
                {
                    lastDecomposeIndex = i;
                }
            }

            for (var i = 0; i < lastDecomposeIndex; i++)
            {
                if (!(expressions[i] is ExtractStoredValue))
                {
                    result.Add(new StoreValue(expressions[i], false));
                    expressions[i] = new ExtractStoredValue(expressions[i]);
                }
            }
        }
Exemplo n.º 3
0
        public override void Decompose(ref Expression self, IList <CodeNode> result)
        {
            _left.Decompose(ref _left, result);

            var lastDecomposeIndex = -1;

            for (var i = 0; i < Arguments.Length; i++)
            {
                Arguments[i].Decompose(ref Arguments[i], result);
                if (Arguments[i].NeedDecompose)
                {
                    lastDecomposeIndex = i;
                }
            }

            for (var i = 0; i < lastDecomposeIndex; i++)
            {
                if (!(Arguments[i] is ExtractStoredValue))
                {
                    result.Add(new StoreValue(Arguments[i], false));
                    Arguments[i] = new ExtractStoredValue(Arguments[i]);
                }
            }
        }
Exemplo n.º 4
0
        public override void Decompose(ref Expression self, IList <CodeNode> result)
        {
            var lastDecomposeIndex        = -1;
            var lastComputeDecomposeIndex = -1;

            for (var i = 0; i < Values.Length; i++)
            {
                Values[i].Decompose(ref Values[i], result);
                if (Values[i].NeedDecompose)
                {
                    lastDecomposeIndex = i;
                }
            }
            for (var i = 0; i < ComputedProperties.Length; i++)
            {
                var key = ComputedProperties[i].Key;
                key.Decompose(ref key, result);

                var value = ComputedProperties[i].Value;
                value.Decompose(ref value, result);

                if ((key != ComputedProperties[i].Key) ||
                    (value != ComputedProperties[i].Value))
                {
                    ComputedProperties[i] = new KeyValuePair <Expression, Expression>(key, value);
                }

                if (ComputedProperties[i].Value.NeedDecompose ||
                    ComputedProperties[i].Key.NeedDecompose)
                {
                    lastComputeDecomposeIndex = i;
                }
            }

            if (lastComputeDecomposeIndex >= 0)
            {
                lastDecomposeIndex = Values.Length;
            }

            for (var i = 0; i < lastDecomposeIndex; i++)
            {
                if (!(Values[i] is ExtractStoredValue))
                {
                    result.Add(new StoreValue(Values[i], false));
                    Values[i] = new ExtractStoredValue(Values[i]);
                }
            }

            for (var i = 0; i < lastDecomposeIndex; i++)
            {
                Expression key   = null;
                Expression value = null;

                if (!(ComputedProperties[i].Key is ExtractStoredValue))
                {
                    result.Add(new StoreValue(ComputedProperties[i].Key, false));
                    key = new ExtractStoredValue(ComputedProperties[i].Key);
                }
                if (!(ComputedProperties[i].Value is ExtractStoredValue))
                {
                    result.Add(new StoreValue(ComputedProperties[i].Value, false));
                    value = new ExtractStoredValue(ComputedProperties[i].Value);
                }
                if ((key != null) ||
                    (value != null))
                {
                    ComputedProperties[i] = new KeyValuePair <Expression, Expression>(
                        key ?? ComputedProperties[i].Key,
                        value ?? ComputedProperties[i].Value);
                }
            }
        }