Exemple #1
0
        /// <summary>
        /// Emits code for an assignement given the right-side expression of the assignement
        /// </summary>
        /// <param name="ilGen">IL generator object</param>
        /// <param name="scope">The scope of this expression</param>
        /// <param name="rightSide">Right-side expression</param>
        public override void EmitAssignement(ILGenerator ilGen, Scope scope, Expression rightSide)
        {
            // Emit code for right side expression
            rightSide.EmitCode(ilGen, scope);

            // Use symbol table to emit variable assignement
            scope.EmitVariableAssignement(name, ilGen);
        }
Exemple #2
0
        /// <summary>
        /// Emits code for assignement
        /// </summary>
        /// <param name="ilGen">IL generator object</param>
        /// <param name="scope">The scope of this expression</param>
        /// <param name="rightSide">Right-side expression</param>
        public override void EmitAssignement(ILGenerator ilGen, Scope scope, Expression rightSide)
        {
            // Emit code to index array
            EmitIndexers(ilGen, scope);

            // Emit code for right-side expression
            rightSide.EmitCode(ilGen, scope);

            // Call Set to store value at indexed position
            ilGen.Emit(OpCodes.Call, ((ArrayType)operand.returnType).ToCLRType().GetMethod("Set"));
        }