/// <summary> /// Emit <see cref="String.Format(IFormatProvider,String,Object[])"/> invocation with <see cref="CultureInfo.InvariantCulture"/>. /// </summary> /// <param name="temporaryLocalArrayIndex"> /// Index of temporary local variable index to store param array for <see cref="String.Format(IFormatProvider,String,Object[])"/>. /// Note that the type of local variable must be Object[]. /// </param> /// <param name="formatLiteral">Forat string literal.</param> /// <param name="argumentLoadingEmitters"> /// List of delegates to emittion of loading formatting parameter loading instruction. /// Index of this array corresponds to index of formatting parameter. /// 1st argument is this instance. /// Post condition is that exactly one storing element will be added on the top of evaluation stack. /// </param> public void EmitStringFormatInvariant(int temporaryLocalArrayIndex, string formatLiteral, params Action <TracingILGenerator>[] argumentLoadingEmitters) { Contract.Assert(formatLiteral != null); Contract.Assert(0 < formatLiteral.Length); Contract.Assert(argumentLoadingEmitters != null); Contract.Assert(Contract.ForAll(argumentLoadingEmitters, item => item != null)); this.EmitInvariantCulture(); this.EmitLdstr(formatLiteral); this.EmitStringFormatArgumentAndCall(temporaryLocalArrayIndex, argumentLoadingEmitters); }
/// <summary> /// Emit <see cref="String.Format(IFormatProvider,String,Object[])"/> invocation with <see cref="CultureInfo.InvariantCulture"/>. /// </summary> /// <param name="temporaryLocalArrayIndex"> /// Index of temporary local variable index to store param array for <see cref="String.Format(IFormatProvider,String,Object[])"/>. /// Note that the type of local variable must be Object[]. /// </param> /// <param name="resource"> /// Type of resource accessor. /// </param> /// <param name="resourceKey"> /// Key of rethis. Note that this method assumes that key equals to accessor property name. /// </param> /// <param name="argumentLoadingEmitters"> /// List of delegates to emittion of loading formatting parameter loading instruction. /// Index of this array corresponds to index of formatting parameter. /// 1st argument is this instance. /// Post condition is that exactly one storing element will be added on the top of evaluation stack. /// </param> public void EmitStringFormatInvariant(int temporaryLocalArrayIndex, Type resource, string resourceKey, params Action <TracingILGenerator>[] argumentLoadingEmitters) { Contract.Assert(resource != null); Contract.Assert(resourceKey != null); #if !NET35 Contract.Assert(!String.IsNullOrWhiteSpace(resourceKey)); #else Contract.Assert(!String.IsNullOrEmpty(resourceKey)); #endif Contract.Assert(argumentLoadingEmitters != null); Contract.Assert(Contract.ForAll(argumentLoadingEmitters, item => item != null)); this.EmitInvariantCulture(); this.EmitGetProperty(resource.GetRuntimeProperty(resourceKey)); this.EmitStringFormatArgumentAndCall(temporaryLocalArrayIndex, argumentLoadingEmitters); }
/// <summary> /// Emit array initialization code with initializer. /// Post condition is evaluation stack will no be modified as previous state. /// Note that initialized array is not placed on the top of evaluation stack. /// </summary> /// <param name="arrayLocalIndex"> /// Index of local variable which stores the array. /// </param> /// <param name="elementType"><see cref="Type"/> of array element. This can be generaic parameter.</param> /// <param name="elementLoadingEmitters"> /// List of delegates to emittion of storing element loading instruction. /// Index of this array corresponds to index of initializing array. /// 1st argument is this instance. /// Post condition is that exactly one storing element will be added on the top of stack and its type is <paramref name="elementType"/> compatible. /// </param> public void EmitNewarr(int arrayLocalIndex, Type elementType, params Action <TracingILGenerator>[] elementLoadingEmitters) { Contract.Assert(0 <= arrayLocalIndex); Contract.Assert(elementType != null); Contract.Assert(elementLoadingEmitters != null); Contract.Assert(Contract.ForAll(elementLoadingEmitters, item => item != null)); // TODO: NLiblet this.EmitNewarrCore(elementType, elementLoadingEmitters.Length); this.EmitAnyStloc(arrayLocalIndex); // TODO: NLiblet for (long i = 0; i < elementLoadingEmitters.Length; i++) { this.EmitAnyStelem(elementType, il => il.EmitAnyLdloc(arrayLocalIndex), i, elementLoadingEmitters[i]); } }
/// <summary> /// Emit array initialization code with initializer. /// Post condition is evaluation stack will no be modified as previous state. /// Note that initialized array is not placed on the top of evaluation stack. /// </summary> /// <param name="arrayLoadingEmitter"> /// Delegate to emittion of array loading instruction. /// 1st argument is this instance. /// Post condition is that exactly one target array will be added on the top of stack and element type is <paramref name="elementType"/>. /// </param> /// <param name="arrayStoringEmitter"> /// Delegate to emittion of array storing instruction. /// 1st argument is this instance. /// Pre condition is that the top of evaluation stack is array type and its element type is <paramref name="elementType"/>. /// Post condition is that exactly one target array will be removed from the top of stack. /// </param> /// <param name="elementType"><see cref="Type"/> of array element. This can be generaic parameter.</param> /// <param name="elementLoadingEmitters"> /// List of delegates to emittion of storing element loading instruction. /// Index of this array corresponds to index of initializing array. /// 1st argument is this instance. /// Post condition is that exactly one storing element will be added on the top of stack and its type is <paramref name="elementType"/> compatible. /// </param> public void EmitNewarr(Action <TracingILGenerator> arrayLoadingEmitter, Action <TracingILGenerator> arrayStoringEmitter, Type elementType, params Action <TracingILGenerator>[] elementLoadingEmitters) { Contract.Assert(arrayLoadingEmitter != null); Contract.Assert(arrayStoringEmitter != null); Contract.Assert(elementType != null); Contract.Assert(elementLoadingEmitters != null); Contract.Assert(Contract.ForAll(elementLoadingEmitters, item => item != null)); // TODO: NLiblet this.EmitNewarrCore(elementType, elementLoadingEmitters.Length); arrayStoringEmitter(this); // TODO: NLiblet for (long i = 0; i < elementLoadingEmitters.Length; i++) { arrayLoadingEmitter(this); this.EmitAnyStelem(elementType, null, i, elementLoadingEmitters[i]); } }