コード例 #1
0
ファイル: clr.cs プロジェクト: weimingtom/IronPythonMod
                private void ValidateReturn(object ret)
                {
                    // we return void...
                    if (ret == null && retType == null)
                    {
                        return;
                    }

                    DynamicType dt = Ops.GetDynamicType(ret);

                    if (dt != retType)
                    {
                        if (!dt.IsSubclassOf(retType))
                        {
                            throw Ops.AssertionError("bad return value returned (expected {0}, got {1})", retType, dt);
                        }
                    }
                }
コード例 #2
0
ファイル: clr.cs プロジェクト: weimingtom/IronPythonMod
                private void ValidateArgs(object[] args)
                {
                    int start = 0;

                    if (inst != null)
                    {
                        start = 1;
                    }


                    // no need to validate self... the method should handle it.
                    for (int i = start; i < args.Length + start; i++)
                    {
                        DynamicType dt = Ops.GetDynamicType(args[i - start]);
                        if (dt != expected[i] && !dt.IsSubclassOf(expected[i]))
                        {
                            throw Ops.AssertionError("argument {0} has bad value (got {1}, expected {2})", i, dt, expected[i]);
                        }
                    }
                }