예제 #1
0
        private void generateAssignInto(LValueProvider lValue)
        {
            if (_storage != null)
            {
                //value is already created, reassign it
                lValue.Assign(_storage, _newOperator);
                return;
            }

            var storageProvider = lValue as IStorageReadProvider;

            if (storageProvider == null)
            {
                var temporary = new TemporaryVariableValue(_objectType, Context);
                _storage = temporary.Storage;
                temporary.AssignNewObject(_objectType, _newOperator);
                lValue.Assign(_storage, _newOperator);
            }
            else
            {
                _storage = storageProvider.Storage;
                lValue.AssignNewObject(_objectType, _newOperator);
            }

            _ctorCall.Generate();

            if (_initializerArguments.Length > 0)
            {
                generateInitializer();
            }
        }
예제 #2
0
        /// <summary>
        /// Generate computation or assigning that are needed
        /// </summary>
        /// <param name="target">Target where value will be assigned to</param>
        private void generateAssignToStorage(LValueProvider target)
        {
            if (_generated && _storage == target)
            {
                //storage is already assigned to requested
                // varialbe. Also computation is generated.
                return;
            }

            if (_storage != null)
            {
                //reasign value

                throw new NotImplementedException();
            }

            //remember, target can be null
            _storage = target;

            if (_generated)
            {
                return;
            }

            _generated = true;

            _computation(E, _storage);
            //  throw new NotImplementedException();
        }
예제 #3
0
        /// <summary>
        /// Try to get call hierarchy (chained calls, properties, indexes, namespaces and statit classes).
        /// </summary>
        /// <param name="call">Result representation of call hierarchy.</param>
        /// <param name="calledObject">Object on which call hierarchy starts if any.</param>
        /// <returns><c>true</c> if call hierarchy is recognized, <c>false</c> otherwise.</returns>
        internal bool TryGetSetter(out LValueProvider call, RValueProvider calledObject)
        {
            var currNode = initializeCallSearch(calledObject, _entryNode.Child == null);

            while (currNode != null)
            {
                if (currNode.Child == null)
                {
                    //setter could be only the last child in hierarchy
                    call = processLNode(currNode);
                    return(call != null);
                }

                if (!processRNode(currNode))
                {
                    break;
                }

                currNode = currNode.Child;

                //there is indexer on last child - get it as rvalue
                if (currNode.Child == null && currNode.Indexer != null && !processRNode(currNode))
                {
                    //indexer setters are handled in
                    //different way than getters
                    break;
                }
            }

            //setter hasnt been found
            call = null;
            return(false);
        }
예제 #4
0
 /// <inheritdoc />
 public override void GenerateAssignInto(LValueProvider lValue)
 {
     lValue.Assign(Storage, null);
 }
예제 #5
0
 public override void GenerateAssignInto(LValueProvider target)
 {
     _castedValue.GenerateAssignInto(target);
 }
예제 #6
0
 /// <inheritdoc />
 public override void GenerateAssignInto(LValueProvider lValue)
 {
     generateAssignToStorage(lValue);
 }
예제 #7
0
 /// <summary>
 /// Generate instructions that ensure presence of represented
 /// rvalue in given target
 /// </summary>
 /// <param name="target">Target where represented value will be available</param>
 public abstract void GenerateAssignInto(LValueProvider target);
예제 #8
0
 /// <inheritdoc />
 public override void GenerateAssignInto(LValueProvider lValue)
 {
     generateCall();
     lValue.AssignReturnValue(MethodInfo.ReturnType, _activation.CallNode);
 }
예제 #9
0
 /// <inheritdoc />
 public override void GenerateAssignInto(LValueProvider lValue)
 {
     throw new NotImplementedException();
 }
예제 #10
0
 /// <inheritdoc />
 public override void GenerateAssignInto(LValueProvider lValue)
 {
     lValue.Assign(_variable.Name, _variableNode);
 }
예제 #11
0
 /// <inheritdoc />
 public override void GenerateAssignInto(LValueProvider lValue)
 {
     lValue.AssignLiteral(_literal, _literalNode);
 }