public override void ConvertTo(CodeValue val, IlBuilder builder, CodeType to) { if (to == BaseType) { builder.PushValue(val); builder.EmitOpCode(OpCodes.Unbox_Any, Name); } else { base.ConvertTo(val, builder, to); } }
public override void Store(IlBuilder builder, CodeValue val) { builder.PushValue(val); if (Index <= 3) { builder.EmitOpCode(OpCodeUtil.GetOpcode("Stloc_" + Index)); } else { builder.EmitOpCode(OpCodeUtil.GetOpcode("Stloc"), Index); } }
public override void PushAddress(IlBuilder builder) { if (!Field.IsStatic) { builder.PushValue(_owner); builder.EmitOpCode(OpCodes.Ldflda, Type.ArgumentName, $"{ReferenceName}::{ID}"); } else { builder.EmitOpCode(OpCodes.Ldsflda, Type.ArgumentName, $"{ReferenceName}::{ID}"); } }
public override void Emit(IlBuilder builder) { base.Emit(builder); builder.PushValue(_rank); builder.EmitOpCode(OpCodes.Newarr, _typeof.TypeOf.Name); if (_entries == null) { return; } for (int i = 0; i < _entries.Length; i++) { builder.EmitOpCode(OpCodes.Dup); builder.PushValue(new CodeValue(BasicType.Int32, i)); builder.PushValue(_entries[i]); builder.EmitOpCode(OpCodeUtil.GetOpcode("Stelem_" + _typeof.TypeOf.OpName)); } }
public override void Emit(IlBuilder builder) { base.Emit(builder); foreach (var p in _parameters) { builder.PushValue(p); } builder.EmitOpCode(OpCodes.Newobj, _constructor.FullSignature); builder.ShrinkStack(_parameters.Length); builder.ExpandStack(1); }
public override void Emit(IlBuilder builder) { base.Emit(builder); bool or = _op.Type == Operator.OperatorType.Or; string label1 = Owner.LabelManager.NextLabel; string label2 = Owner.LabelManager.NextLabel; builder.PushValue(_op1); builder.EmitOpCode(or ? OpCodes.Brtrue : OpCodes.Brfalse, label1); builder.PushValue(_op2); builder.EmitOpCode(OpCodes.Br, label2); builder.Output.ReduceIndentationForLine(); builder.EmitString(label1 + ": "); builder.PushValue(new CodeValue(CodeType.Int32, or ? 1 : 0)); builder.Output.ReduceIndentationForLine(); builder.EmitString(label2 + ": "); builder.EmitOpCode(OpCodes.Nop); }
public override void Emit(IlBuilder builder) { base.Emit(builder); string label1 = Owner.LabelManager.NextLabel; string label2 = Owner.LabelManager.NextLabel; builder.PushValue(_exp); builder.EmitOpCode(OpCodes.Brfalse, label1); builder.PushValue(_op1); builder.EmitOpCode(OpCodes.Br, label2); builder.Output.ReduceIndentationForLine(); builder.EmitString(label1 + ": "); builder.PushValue(_op2); builder.Output.ReduceIndentationForLine(); builder.EmitString(label2 + ": "); builder.EmitOpCode(OpCodes.Nop); }
public override void Emit(IlBuilder builder) { base.Emit(builder); builder.PushValue(_val); }
public override void Store(IlBuilder builder, CodeValue val) { builder.PushValue(val); builder.EmitOpCode(OpCodeUtil.GetOpcode("Starg"), Index); }