vm.c (check_target_class): raise error if target_class is NULL
It fixes a bug that instance_eval for immediate objects defines methods
in Object, instead of raising error.
```ruby
1.instance_eval do
def foo
p :foo
end
end
```
@@ -1290,7 +1290,7 @@ check_target_class(mrb_state *mrb)
{
struct RClass *target = CI_TARGET_CLASS(mrb->c->ci);
if (!target) {
- return mrb->object_class;
+ mrb_raise(mrb, E_TYPE_ERROR, "no class/module to add method");
}
return target;
}
