void EmitArg(CodeGen g, int index, Operand arg) { if (_appliedSignature[index].IsByRef) { arg.EmitAddressOf(g); return; } g.EmitGetHelper(arg, _appliedSignature[index], _conversions[index], @from: _paramsSignature[index]); }
internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { if (IsReference) { g.EmitLdargHelper(_index); g.EmitStindHelper(GetReturnType(g.TypeMapper), value, allowExplicitConversion); } else { g.EmitGetHelper(value, GetReturnType(g.TypeMapper), allowExplicitConversion); g.EmitStargHelper(_index); } }
internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { if (IsReference) { g.EmitLdargHelper(index); g.EmitStindHelper(Type, value, allowExplicitConversion); } else { g.EmitGetHelper(value, Type, allowExplicitConversion); g.EmitStargHelper(index); } }
protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { OperandExtensions.SetLeakedState(this, false); if (IsReference) { g.EmitLdargHelper(_index); g.EmitStindHelper(GetReturnType(g.TypeMapper), value, allowExplicitConversion); } else { g.EmitGetHelper(value, GetReturnType(g.TypeMapper), allowExplicitConversion); g.EmitStargHelper(_index); } }
protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { OperandExtensions.SetLeakedState(this, false); CheckScope(g); if (_t == null) { _t = value.GetReturnType(g.TypeMapper); } if (_var == null) { _var = g.IL.DeclareLocal(_t); } Type nullableUnderlyingType = Helpers.GetNullableUnderlyingType(_t); if (ReferenceEquals(value, null)) { if (nullableUnderlyingType != null) { g.InitObj(this); return; } } else if (nullableUnderlyingType == value.GetReturnType(g.TypeMapper)) { EmitAddressOf(g); g.EmitGetHelper(value, nullableUnderlyingType, false); ConstructorInfo ctor = _t.GetConstructor(new [] { nullableUnderlyingType }); g.IL.Emit(OpCodes.Call, ctor); return; } g.EmitGetHelper(value, _t, allowExplicitConversion); EmitSetFromStack(g); }
public override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { if (!IsStatic) { if (g.Context.IsStatic || g.Context.OwnerType != owner.TypeBuilder) { throw new InvalidOperationException("The field is accessed from an invalid context"); } g.IL.Emit(OpCodes.Ldarg_0); } g.EmitGetHelper(value, type, allowExplicitConversion); g.IL.Emit(IsStatic ? OpCodes.Stsfld : OpCodes.Stfld, fb); }
internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { if (!IsStatic) { if (g.Context.IsStatic || g.Context.OwnerType != owner.TypeBuilder) { throw new InvalidOperationException(Properties.Messages.ErrInvalidFieldContext); } g.IL.Emit(OpCodes.Ldarg_0); } g.EmitGetHelper(value, type, allowExplicitConversion); g.IL.Emit(IsStatic ? OpCodes.Stsfld : OpCodes.Stfld, fb); }
internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { CheckScope(g); if (t == null) { t = value.Type; } if (var == null) { var = g.il.DeclareLocal(t); } g.EmitGetHelper(value, t, allowExplicitConversion); g.il.Emit(OpCodes.Stloc, var); }
internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { CheckScope(g); if (_t == null) { _t = value.GetReturnType(g.TypeMapper); } if (_var == null) { _var = g.IL.DeclareLocal(_t); } g.EmitGetHelper(value, _t, allowExplicitConversion); g.IL.Emit(OpCodes.Stloc, _var); }
public override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { if (setter == null) { base.EmitSet(g, value, allowExplicitConversion); } if (indexParameters.Count != 0) { throw new InvalidOperationException("Cannot access indexed property without indexes"); } if (!IsStatic && (g.Context.IsStatic || g.Context.OwnerType != owner.TypeBuilder)) { throw new InvalidOperationException("The property is accessed from an invalid context"); } g.IL.Emit(OpCodes.Ldarg_0); g.EmitGetHelper(value, Type, allowExplicitConversion); g.EmitCallHelper(setter.GetMethodBuilder(), null); }
internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { if (setter == null) { base.EmitSet(g, value, allowExplicitConversion); } if (indexParameters.Count != 0) { throw new InvalidOperationException(Properties.Messages.ErrMissingPropertyIndex); } if (!IsStatic && (g.Context.IsStatic || g.Context.OwnerType != owner.TypeBuilder)) { throw new InvalidOperationException(Properties.Messages.ErrInvalidPropertyContext); } g.IL.Emit(OpCodes.Ldarg_0); g.EmitGetHelper(value, Type, allowExplicitConversion); g.EmitCallHelper(setter.GetMethodBuilder(), null); }
protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { OperandExtensions.SetLeakedState(this, false); if (_setter == null) { base.EmitSet(g, value, allowExplicitConversion); } if (_indexParameters.Count != 0) { throw new InvalidOperationException(Properties.Messages.ErrMissingPropertyIndex); } if (!IsStatic && (g.Context.IsStatic || g.Context.OwnerType != _owner.TypeBuilder)) { throw new InvalidOperationException(Properties.Messages.ErrInvalidPropertyContext); } g.IL.Emit(OpCodes.Ldarg_0); g.EmitGetHelper(value, GetReturnType(TypeMapper), allowExplicitConversion); g.EmitCallHelper(_setter.GetMethodBuilder(), null); }
internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { if (setter == null) base.EmitSet(g, value, allowExplicitConversion); if (indexParameters.Count != 0) throw new InvalidOperationException(Properties.Messages.ErrMissingPropertyIndex); if (!IsStatic && (g.Context.IsStatic || g.Context.OwnerType != owner.TypeBuilder)) throw new InvalidOperationException(Properties.Messages.ErrInvalidPropertyContext); g.IL.Emit(OpCodes.Ldarg_0); g.EmitGetHelper(value, Type, allowExplicitConversion); g.EmitCallHelper(setter.GetMethodBuilder(), null); }
protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { OperandExtensions.SetLeakedState(this, false); if (!IsStatic) { if (g.Context.IsStatic || g.Context.OwnerType != _owner.TypeBuilder) throw new InvalidOperationException(Properties.Messages.ErrInvalidFieldContext); g.IL.Emit(OpCodes.Ldarg_0); } g.EmitGetHelper(value, _type, allowExplicitConversion); g.IL.Emit(IsStatic ? OpCodes.Stsfld : OpCodes.Stfld, _fb); }
protected void EmitGetHelper(CodeGen g, Operand op, Type desiredType, bool allowExplicitConversion) { g.EmitGetHelper(op, desiredType,allowExplicitConversion); }
protected void EmitGetHelper(CodeGen g, Operand op, Type desiredType, bool allowExplicitConversion) { g.EmitGetHelper(op, desiredType, allowExplicitConversion); }
protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { OperandExtensions.SetLeakedState(this, false); CheckScope(g); if (_t == null) _t = value.GetReturnType(g.TypeMapper); if (_var == null) _var = g.IL.DeclareLocal(_t); Type nullableUnderlyingType = Helpers.GetNullableUnderlyingType(_t); if (ReferenceEquals(value, null)) { if (nullableUnderlyingType != null) { g.InitObj(this); return; } } else if (nullableUnderlyingType == value.GetReturnType(g.TypeMapper)) { EmitAddressOf(g); g.EmitGetHelper(value, nullableUnderlyingType, false); ConstructorInfo ctor = _t.GetConstructor(new [] { nullableUnderlyingType}); g.IL.Emit(OpCodes.Call, ctor); return; } g.EmitGetHelper(value, _t, allowExplicitConversion); EmitSetFromStack(g); }
internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { CheckScope(g); if (t == null) t = value.Type; if (var == null) var = g.il.DeclareLocal(t); g.EmitGetHelper(value, t, allowExplicitConversion); g.il.Emit(OpCodes.Stloc, var); }
protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion) { OperandExtensions.SetLeakedState(this, false); if (_setter == null) base.EmitSet(g, value, allowExplicitConversion); if (_indexParameters.Count != 0) throw new InvalidOperationException(Properties.Messages.ErrMissingPropertyIndex); if (!IsStatic && (g.Context.IsStatic || g.Context.OwnerType != _owner.TypeBuilder)) throw new InvalidOperationException(Properties.Messages.ErrInvalidPropertyContext); g.IL.Emit(OpCodes.Ldarg_0); g.EmitGetHelper(value, GetReturnType(TypeMapper), allowExplicitConversion); g.EmitCallHelper(_setter.GetMethodBuilder(), null); }