internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_left); ctx.Compile(_right); ctx.MarkSequencePointFor(expressionId); ctx.Generator.Emit(OpCodes.Ceq); }
internal override void Compile(IBuildContext ctx, int expressionId) { var forceNonVirtualCall = _forceNonVirtualCall; if (_instance != null) { ctx.Compile(_instance); if (_instance.ExpressionType.IsValueType) { forceNonVirtualCall = true; } } foreach (var argument in _arguments) { ctx.Compile(argument); } ctx.MarkSequencePointFor(expressionId); if (!forceNonVirtualCall && _methodInfo.IsVirtual && !_methodInfo.IsFinal) { ctx.Generator.Emit(OpCodes.Callvirt, _methodInfo.GetBaseDefinition()); } else { ctx.Generator.Emit(OpCodes.Call, _methodInfo); } }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_left); ctx.Compile(_right); ctx.MarkSequencePointFor(expressionId); ctx.Generator.Emit(GetOpCode(CollectionHelper.Contains(_unsigned, _left.ExpressionType))); }
internal void Compile(IBuildContext ctx) { ctx.Generator.BeginCatchBlock(ExceptionType); var scope = ctx.EnterScope <CatchScope>(); ctx.Compile(_preCatchExpression); ctx.Compile(_catchExpression); ctx.LeaveScope(scope); }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_predicate); var label = ctx.DefineLabel(); label.EmitGoto(OpCodes.Brfalse); //TODO: use Brfalse_s if possible ctx.Compile(_thenExpression); label.Mark(); }
internal override void Compile(IBuildContext ctx, int expressionId) { if (_instance != null) { ctx.Compile(_instance); } ctx.Compile(_value); ctx.MarkSequencePointFor(expressionId); ctx.Generator.Emit((_instance != null) ? OpCodes.Stfld : OpCodes.Stsfld, _fieldInfo); }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_arrayInstance); ctx.Compile(_index); EmitHelper.ConvertToNativeInt(ctx, _index.ExpressionType); ctx.MarkSequencePointFor(expressionId); EmitArrayAccess(ctx); }
private void CompileTryBlock(IBuildContext ctx) { var scope = ctx.EnterScope <TryScope>(); ctx.Compile(_tryExpression); ctx.LeaveScope(scope); }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_arrayInstance); ctx.MarkSequencePointFor(expressionId); ctx.Generator.Emit(OpCodes.Ldlen);//native int ctx.Generator.Emit(OpCodes.Conv_I4); }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_count); EmitHelper.ConvertToNativeInt(ctx, _count.ExpressionType); ctx.MarkSequencePointFor(expressionId); ctx.Generator.Emit(OpCodes.Newarr, _elementType); }
internal override void Compile(IBuildContext ctx, int expressionId) { var trueLabel = ctx.DefineLabel(); var endLabel = ctx.DefineLabel(); ctx.Compile(_predicate); trueLabel.EmitGoto(OpCodes.Brtrue); //TODO: use Brtrue_s if possible ctx.Compile(_elseExpression); endLabel.EmitGoto(OpCodes.Br); //TODO: use Br_s if possible trueLabel.Mark(); ctx.Compile(_thenExpression); endLabel.Mark(); }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_expression); var local = ctx.Generator.DeclareLocal(_expression.ExpressionType); ctx.Generator.Emit(OpCodes.Stloc, local); ctx.Generator.Emit(OpCodes.Ldloca, local); }
private void CompileFinallyBlock(IBuildContext ctx) { ctx.Generator.BeginFinallyBlock(); var scope = ctx.EnterScope <FinallyScope>(); ctx.Compile(_finallyExpression); ctx.LeaveScope(scope); }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_left); ctx.Compile(_right); ctx.MarkSequencePointFor(expressionId); if (!_overflowCheck || CollectionHelper.Contains(_overflowIgnorant, _left.ExpressionType)) { ctx.Generator.Emit(OpCodes.Add); } else if (CollectionHelper.Contains(_overflowUnsigned, _left.ExpressionType) && CollectionHelper.Contains(_overflowUnsigned, _right.ExpressionType)) { ctx.Generator.Emit(OpCodes.Add_Ovf_Un); } else { ctx.Generator.Emit(OpCodes.Add_Ovf); } }
internal override void Compile(IBuildContext ctx, int expressionId) { var scope = ctx.EnterScope <VoidBlockScope>(); foreach (var expression in _expressions) { ctx.Compile(expression); } ctx.LeaveScope(scope); }
internal override void Compile(IBuildContext ctx, int expressionId) { var local = ctx.DeclareLocal(_variable); if (_initialValue != null) { ctx.Compile(_initialValue); ctx.MarkSequencePointFor(expressionId); LocalWriteExpression.EmitWriteLocal(ctx, local); } }
internal override void Compile(IBuildContext ctx, int expressionId) { ValidateReturnType(ctx); ValidateScope(ctx); if (_value != null) { ctx.Compile(_value); } ctx.MarkSequencePointFor(expressionId); ctx.Generator.Emit(OpCodes.Ret); }
internal override void Compile(IBuildContext ctx, int expressionId) { var data = new LoopData(ctx.DefineLabel(), ctx.DefineLabel()); ctx.SetLoopData(data); data.ContinueLabel.Mark(); ctx.Compile(_loop); data.ContinueLabel.EmitGoto(OpCodes.Br); data.BreakLabel.Mark(); ctx.ResetLoopData(data); }
internal override void Compile(IBuildContext ctx, int expressionId) { foreach (var argument in _arguments) { ctx.Compile(argument); } ctx.MarkSequencePointFor(expressionId); if (_constructorInfo == null) { EmitStructInit(ctx); } else { ctx.Generator.Emit(OpCodes.Newobj, _constructorInfo); } }
internal override void Compile(IBuildContext ctx, int expressionId) { if (_instance != null) { ctx.Compile(_instance); } ctx.MarkSequencePointFor(expressionId); if (_loadAddress) { ctx.Generator.Emit((_instance != null) ? OpCodes.Ldflda : OpCodes.Ldsflda, _fieldInfo); } else { ctx.Generator.Emit((_instance != null) ? OpCodes.Ldfld : OpCodes.Ldsfld, _fieldInfo); } }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_value); ctx.MarkSequencePointFor(expressionId); EmitWriteLocal(ctx, ctx.GetLocal(_variable)); }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(Expression); ctx.MarkSequencePointFor(expressionId); _conversionMethod(ctx); }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_expression); ctx.Generator.Emit(OpCodes.Pop); }
internal override void Compile(IBuildContext ctx, int expressionId) { ctx.Compile(_expression); ctx.MarkSequencePointFor(expressionId); ctx.Generator.Emit(OpCodes.Throw); }