void EmitLiftedLogical(EmitContext ec) { var ig = ec.ig; var and = NodeType == ExpressionType.And; var left = ec.EmitStored(this.left); var right = ec.EmitStored(this.right); var ret_from_left = ig.DefineLabel(); var ret_from_right = ig.DefineLabel(); var done = ig.DefineLabel(); ec.EmitNullableGetValueOrDefault(left); ig.Emit(OpCodes.Brtrue, ret_from_left); ec.EmitNullableGetValueOrDefault(right); ig.Emit(OpCodes.Brtrue, ret_from_right); ec.EmitNullableHasValue(left); ig.Emit(OpCodes.Brfalse, ret_from_left); ig.MarkLabel(ret_from_right); ec.EmitLoad(and ? left : right); ig.Emit(OpCodes.Br, done); ig.MarkLabel(ret_from_left); ec.EmitLoad(and ? right : left); ig.MarkLabel(done); }
void EmitConvertedCoalesce(EmitContext ec) { var ig = ec.ig; var done = ig.DefineLabel(); var load_right = ig.DefineLabel(); var left = ec.EmitStored(this.left); if (left.LocalType.IsNullable()) { ec.EmitNullableHasValue(left); } else { ec.EmitLoad(left); } ig.Emit(OpCodes.Brfalse, load_right); ec.Emit(conversion); ec.EmitLoad(left); ig.Emit(OpCodes.Callvirt, conversion.Type.GetInvokeMethod()); ig.Emit(OpCodes.Br, done); ig.MarkLabel(load_right); ec.Emit(this.right); ig.MarkLabel(done); }
private void EmitCoalesce(EmitContext ec) { ILGenerator ig = ec.ig; Label label = ig.DefineLabel(); Label label2 = ig.DefineLabel(); LocalBuilder localBuilder = ec.EmitStored(left); bool flag = localBuilder.LocalType.IsNullable(); if (flag) { ec.EmitNullableHasValue(localBuilder); } else { ec.EmitLoad(localBuilder); } ig.Emit(OpCodes.Brfalse, label2); if (flag && !base.Type.IsNullable()) { ec.EmitNullableGetValue(localBuilder); } else { ec.EmitLoad(localBuilder); } ig.Emit(OpCodes.Br, label); ig.MarkLabel(label2); ec.Emit(right); ig.MarkLabel(label); }
internal override void Emit(EmitContext ec) { var local = ec.EmitStored(new_expression); ec.EmitCollection(initializers, local); ec.EmitLoad(local); }
internal override void Emit(EmitContext ec) { LocalBuilder local = ec.EmitStored(this.new_expression); ec.EmitCollection(this.bindings, local); ec.EmitLoad(local); }
private void EmitUserDefinedLiftedLogicalShortCircuit(EmitContext ec) { ILGenerator ig = ec.ig; bool flag = base.NodeType == ExpressionType.AndAlso; Label label = ig.DefineLabel(); Label label2 = ig.DefineLabel(); Label label3 = ig.DefineLabel(); Label label4 = ig.DefineLabel(); LocalBuilder local = ec.EmitStored(left); ec.EmitNullableHasValue(local); ig.Emit(OpCodes.Brfalse, (!flag) ? label : label3); ec.EmitNullableGetValueOrDefault(local); ec.EmitCall((!flag) ? GetTrueOperator() : GetFalseOperator()); ig.Emit(OpCodes.Brtrue, label2); ig.MarkLabel(label); LocalBuilder local2 = ec.EmitStored(right); ec.EmitNullableHasValue(local2); ig.Emit(OpCodes.Brfalse, label3); ec.EmitNullableGetValueOrDefault(local); ec.EmitNullableGetValueOrDefault(local2); ec.EmitCall(method); ec.EmitNullableNew(base.Type); ig.Emit(OpCodes.Br, label4); ig.MarkLabel(label2); ec.EmitLoad(local); ig.Emit(OpCodes.Br, label4); ig.MarkLabel(label3); LocalBuilder local3 = ig.DeclareLocal(base.Type); ec.EmitNullableInitialize(local3); ig.MarkLabel(label4); }
private void EmitLiftedLogical(EmitContext ec) { ILGenerator ig = ec.ig; bool flag = base.NodeType == ExpressionType.And; LocalBuilder localBuilder = ec.EmitStored(left); LocalBuilder localBuilder2 = ec.EmitStored(right); Label label = ig.DefineLabel(); Label label2 = ig.DefineLabel(); Label label3 = ig.DefineLabel(); ec.EmitNullableGetValueOrDefault(localBuilder); ig.Emit(OpCodes.Brtrue, label); ec.EmitNullableGetValueOrDefault(localBuilder2); ig.Emit(OpCodes.Brtrue, label2); ec.EmitNullableHasValue(localBuilder); ig.Emit(OpCodes.Brfalse, label); ig.MarkLabel(label2); ec.EmitLoad((!flag) ? localBuilder2 : localBuilder); ig.Emit(OpCodes.Br, label3); ig.MarkLabel(label); ec.EmitLoad((!flag) ? localBuilder : localBuilder2); ig.MarkLabel(label3); }
void EmitCoalesce(EmitContext ec) { var ig = ec.ig; var done = ig.DefineLabel(); var load_right = ig.DefineLabel(); var left = ec.EmitStored(this.left); var left_is_nullable = left.LocalType.IsNullable(); if (left_is_nullable) { ec.EmitNullableHasValue(left); } else { ec.EmitLoad(left); } ig.Emit(OpCodes.Brfalse, load_right); if (left_is_nullable && !Type.IsNullable()) { ec.EmitNullableGetValue(left); } else { ec.EmitLoad(left); } ig.Emit(OpCodes.Br, done); ig.MarkLabel(load_right); ec.Emit(this.right); ig.MarkLabel(done); }
private void EmitConvertedCoalesce(EmitContext ec) { ILGenerator ig = ec.ig; Label label = ig.DefineLabel(); Label label2 = ig.DefineLabel(); LocalBuilder localBuilder = ec.EmitStored(left); if (localBuilder.LocalType.IsNullable()) { ec.EmitNullableHasValue(localBuilder); } else { ec.EmitLoad(localBuilder); } ig.Emit(OpCodes.Brfalse, label2); ec.Emit(conversion); ec.EmitLoad(localBuilder); ig.Emit(OpCodes.Callvirt, conversion.Type.GetInvokeMethod()); ig.Emit(OpCodes.Br, label); ig.MarkLabel(label2); ec.Emit(right); ig.MarkLabel(label); }
private void EmitUserDefinedLogicalShortCircuit(EmitContext ec) { ILGenerator ig = ec.ig; bool flag = base.NodeType == ExpressionType.AndAlso; Label label = ig.DefineLabel(); LocalBuilder local = ec.EmitStored(left); ec.EmitLoad(local); ig.Emit(OpCodes.Dup); ec.EmitCall((!flag) ? GetTrueOperator() : GetFalseOperator()); ig.Emit(OpCodes.Brtrue, label); ec.Emit(right); ec.EmitCall(method); ig.MarkLabel(label); }
void EmitUserDefinedLiftedLogicalShortCircuit(EmitContext ec) { var ig = ec.ig; var and = NodeType == ExpressionType.AndAlso; var left_is_null = ig.DefineLabel(); var ret_left = ig.DefineLabel(); var ret_null = ig.DefineLabel(); var done = ig.DefineLabel(); var left = ec.EmitStored(this.left); ec.EmitNullableHasValue(left); ig.Emit(OpCodes.Brfalse, and ? ret_null : left_is_null); ec.EmitNullableGetValueOrDefault(left); ec.EmitCall(and ? GetFalseOperator() : GetTrueOperator()); ig.Emit(OpCodes.Brtrue, ret_left); ig.MarkLabel(left_is_null); var right = ec.EmitStored(this.right); ec.EmitNullableHasValue(right); ig.Emit(OpCodes.Brfalse, ret_null); ec.EmitNullableGetValueOrDefault(left); ec.EmitNullableGetValueOrDefault(right); ec.EmitCall(method); ec.EmitNullableNew(Type); ig.Emit(OpCodes.Br, done); ig.MarkLabel(ret_left); ec.EmitLoad(left); ig.Emit(OpCodes.Br, done); ig.MarkLabel(ret_null); var ret = ig.DeclareLocal(Type); ec.EmitNullableInitialize(ret); ig.MarkLabel(done); }
void EmitUserDefinedLogicalShortCircuit(EmitContext ec) { var ig = ec.ig; var and = NodeType == ExpressionType.AndAlso; var done = ig.DefineLabel(); var left = ec.EmitStored(this.left); ec.EmitLoad(left); ig.Emit(OpCodes.Dup); ec.EmitCall(and ? GetFalseOperator() : GetTrueOperator()); ig.Emit(OpCodes.Brtrue, done); ec.Emit(this.right); ec.EmitCall(method); ig.MarkLabel(done); }