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(); } }
/// <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(); }
/// <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); }
/// <inheritdoc /> public override void GenerateAssignInto(LValueProvider lValue) { lValue.Assign(Storage, null); }
public override void GenerateAssignInto(LValueProvider target) { _castedValue.GenerateAssignInto(target); }
/// <inheritdoc /> public override void GenerateAssignInto(LValueProvider lValue) { generateAssignToStorage(lValue); }
/// <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);
/// <inheritdoc /> public override void GenerateAssignInto(LValueProvider lValue) { generateCall(); lValue.AssignReturnValue(MethodInfo.ReturnType, _activation.CallNode); }
/// <inheritdoc /> public override void GenerateAssignInto(LValueProvider lValue) { throw new NotImplementedException(); }
/// <inheritdoc /> public override void GenerateAssignInto(LValueProvider lValue) { lValue.Assign(_variable.Name, _variableNode); }
/// <inheritdoc /> public override void GenerateAssignInto(LValueProvider lValue) { lValue.AssignLiteral(_literal, _literalNode); }