提交 f9fe25b7 编写于 作者: R Rodrigo Kumpera 提交者: Jonathan Chambers

Raise ArgumentException for delegate on closed methods.

	* method-to-ir.c (mono_method_to_ir): Check for null
	on delegate construction so closed-on-null is not allowed
	when using the delegate .ctor.

	If the delegate been constructed is open-on-target then
	the null check must not be applied as the IL pattern is:

	ldnull
	ldftn void Bla::Foo(int)
	newobj Bar (object, native int) // delegate void Bar(Bla,int)

Conflicts:
	mono/mini/method-to-ir.c
上级 b7e9f6b2
......@@ -9698,6 +9698,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
if (cfg->verbose_level > 3)
g_print ("converting (in B%d: stack: %d) %s", bblock->block_num, (int)(sp - stack_start), mono_disasm_code_one (NULL, method, ip, NULL));
target_ins = sp [-1];
if (!(cmethod->flags & METHOD_ATTRIBUTE_STATIC)) {
if (mono_method_signature (invoke)->param_count == mono_method_signature (cmethod)->param_count) {
MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, target_ins->dreg, 0);
MONO_EMIT_NEW_COND_EXC (cfg, EQ, "ArgumentException");
}
}
sp --;
*sp = handle_delegate_ctor (cfg, ctor_method->klass, target_ins, cmethod);
CHECK_CFG_EXCEPTION;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册