mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
variable.c: skip prepended module for constant lookup.
```ruby
module M
FOO = 'm'
end
class A
FOO = 'a'
prepend M
end
class B < A
def foo
p FOO
end
end
B.new.foo # should print `m` not `a`
```
This commit is contained in:
+1
-1
@@ -775,7 +775,7 @@ const_get(mrb_state *mrb, struct RClass *base, mrb_sym sym)
|
||||
|
||||
L_RETRY:
|
||||
while (c) {
|
||||
if (c->iv) {
|
||||
if (!MRB_FLAG_TEST(c, MRB_FL_CLASS_IS_PREPENDED) && c->iv) {
|
||||
if (iv_get(mrb, c->iv, sym, &v))
|
||||
return v;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user