public Stmt GetImpl(Ctx ctx)
            {
                var obj             = ctx.MethodParameter(0, "obj");
                var toType          = ctx.MethodParameter(1);
                var callCanAssignTo = new ExprCall(ctx, (Func <object, Type, bool>)CanAssignTo, null, obj.Expr, toType).Named("callCanAssignTo");
                var mCtorEx         = ctx.Module.Import(typeof(InvalidCastException).GetConstructor(new[] { typeof(string) }));
                var mGetType        = ctx.Module.Import(typeof(object).GetMethod("GetType"));
                var getTypeCall     = new ExprCall(ctx, mGetType, obj.Expr);
                var msgParts        = new Expr[] {
                    new ExprLiteral(ctx, "Unable to cast object of type '", ctx.String),
                    new ExprCall(ctx, typeof(Type).GetProperty("FullName").GetMethod, getTypeCall),
                    new ExprLiteral(ctx, "' to type '", ctx.String),
                    new ExprCall(ctx, typeof(Type).GetProperty("FullName").GetMethod, toType),
                    new ExprLiteral(ctx, "'.", ctx.String)
                };
                var msg    = msgParts.Aggregate((a, b) => new ExprBinary(ctx, BinaryOp.Add, ctx.String, a, b));
                var ctorEx = new ExprNewObj(ctx, mCtorEx, msg).Named("callCtorEx");
                var js     = @"
if (callCanAssignTo) return obj;
throw callCtorEx
";
                var stmt   = new StmtJsExplicit(ctx, js, callCanAssignTo, obj, ctorEx);

                return(stmt);
            }