Exemple #1
0
        /// <summary>
        /// Generates CIL for a compound assignment expression.
        /// </summary>
        /// <param name="generator"> The generator to output the CIL to. </param>
        /// <param name="optimizationInfo"> Information about any optimizations that should be performed. </param>
        /// <param name="target"> The target to modify. </param>
        private void GenerateCompoundAssignment(ILGenerator generator, OptimizationInfo optimizationInfo, IReferenceExpression target)
        {
            // Load the value to assign.
            var compoundOperator = new BinaryExpression(GetCompoundBaseOperator(this.OperatorType), this.GetOperand(0), this.GetOperand(1));

            compoundOperator.GenerateCode(generator, optimizationInfo);

            // Duplicate the value so it remains on the stack afterwards.
            //if (optimizationInfo.SuppressReturnValue == false)
            generator.Duplicate();

            // Store the value.
            target.GenerateSet(generator, optimizationInfo, compoundOperator.ResultType, optimizationInfo.StrictMode);
        }