Commit 495f66b9 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1217 from skandhas/pr-detect-cyclic-include-in-Moudle#include

detect cyclic-include in Module#include
parents ecd87aa5 96e247a4
......@@ -690,6 +690,9 @@ mrb_include_module(mrb_state *mrb, struct RClass *c, struct RClass *m)
struct RClass *p = c, *ic;
int superclass_seen = 0;
if (c->mt == m->mt) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "cyclic include detected");
}
while (p) {
if (c != p && p->tt == MRB_TT_CLASS) {
superclass_seen = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment