2 using TypeSystem.Operations;
4 namespace CodeGeneration.Operations {
8 internal class CGStoreArrayElementOperation<T> :
TypeSystemOperation where T : ILCodeGenerator {
13 private T codeGenerator;
20 public CGStoreArrayElementOperation(T codeGenerator,
int indent) {
21 this.codeGenerator = codeGenerator;
24 public override object Exec(
ClassType ct,
object arg) {
25 this.codeGenerator.stelemRef(this.indent);
28 public override object Exec(
StringType s,
object arg) {
29 this.codeGenerator.stelemRef(this.indent);
32 public override object Exec(
ArrayType a,
object arg) {
33 this.codeGenerator.stelemRef(this.indent);
39 this.codeGenerator.stelemRef(
this.indent);
42 String tempIndex = this.codeGenerator.NewLabel +
"_temp";
43 String tempValue = this.codeGenerator.NewLabel +
"_temp";
44 this.codeGenerator.WriteAuxiliarLocalVariable(this.indent, tempValue,
"object");
45 this.codeGenerator.WriteAuxiliarLocalVariable(this.indent, tempIndex,
"int32");
46 this.codeGenerator.stloc(this.indent, tempValue);
47 this.codeGenerator.stloc(this.indent, tempIndex);
48 this.codeGenerator.ldloc(this.indent, tempValue);
49 this.codeGenerator.ldloc(this.indent, tempIndex);
50 this.codeGenerator.CallVirt(this.indent,
"instance",
"void",
"class [mscorlib]System.Array",
"SetValue",
51 new string[] {
"class [mscorlib]System.Object",
"int32"});
55 public override object Exec(
UnionType t,
object arg) {
56 this.codeGenerator.stelemRef(this.indent);
59 public override object Exec(
DoubleType d,
object arg) {
60 this.codeGenerator.stelemDouble(this.indent);
64 this.codeGenerator.stelemInt(this.indent);
Representa an array type.
This class represent the entry wnen sending a message to an operation object derived from TypeExpress...
Abstract class that represents all different types.
Represents a generic type expression
abstract bool IsValueType()
True if type expression is a ValueType. Otherwise, false.
Represents a double type.
TypeExpression Substitution
Gets the substitution; null if it does not exist