예제 #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);
            }
        }
예제 #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]);
                }
            }
        }
예제 #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]);
                }
            }
        }
예제 #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);
                }
            }
        }