internal override void TranslateToIL(ILGenerator il, Type rtype){
if (rtype == Typeob.Array){
this.TranslateToILArray(il, Typeob.Object);
return;
}
if (rtype.IsArray && rtype.GetArrayRank() == 1){
this.TranslateToILArray(il, rtype.GetElementType());
return;
}
int n = this.elements.count;
MethodInfo constructorMethod = null;
if (this.Engine.Globals.globalObject is LenientGlobalObject){
this.EmitILToLoadEngine(il);
il.Emit(OpCodes.Call, CompilerGlobals.getOriginalArrayConstructorMethod);
constructorMethod = CompilerGlobals.constructArrayMethod;
}else
constructorMethod = CompilerGlobals.fastConstructArrayLiteralMethod;
ConstantWrapper.TranslateToILInt(il, n);
il.Emit(OpCodes.Newarr, Typeob.Object);
for (int i = 0; i < n; i++){
il.Emit(OpCodes.Dup);
ConstantWrapper.TranslateToILInt(il, i);
this.elements[i].TranslateToIL(il, Typeob.Object);
il.Emit(OpCodes.Stelem_Ref);
}
il.Emit(OpCodes.Call, constructorMethod);
Convert.Emit(this, il, Typeob.ArrayObject, rtype);
}