本文整理汇总了C#中Jurassic.Compiler.ILGenerator.StoreField方法的典型用法代码示例。如果您正苦于以下问题:C# ILGenerator.StoreField方法的具体用法?C# ILGenerator.StoreField怎么用?C# ILGenerator.StoreField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jurassic.Compiler.ILGenerator
的用法示例。
在下文中一共展示了ILGenerator.StoreField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateStub
/// <summary>
/// Generates a method that does type conversion and calls the bound method.
/// </summary>
/// <param name="generator"> The ILGenerator used to output the body of the method. </param>
/// <param name="argumentCount"> The number of arguments that will be passed to the delegate. </param>
/// <returns> A delegate that does type conversion and calls the method represented by this
/// object. </returns>
protected override void GenerateStub(ILGenerator generator, int argumentCount)
{
// Check for the correct number of arguments.
if (argumentCount != 1)
{
EmitHelpers.EmitThrow(generator, "TypeError", "Wrong number of arguments");
EmitHelpers.EmitDefaultValue(generator, PrimitiveType.Any);
generator.Complete();
return;
}
if (this.field.IsStatic == false)
{
generator.LoadArgument(1);
ClrBinder.EmitConversionToType(generator, this.field.DeclaringType, convertToAddress: true);
}
generator.LoadArgument(2);
generator.LoadInt32(0);
generator.LoadArrayElement(typeof(object));
ClrBinder.EmitConversionToType(generator, this.field.FieldType, convertToAddress: false);
generator.StoreField(this.field);
EmitHelpers.EmitUndefined(generator);
generator.Complete();
}