Exemplo n.º 1
0
                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);
                        }
                    }
                }
Exemplo n.º 2
0
                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]);
                        }
                    }
                }