8000 fix incomplete module support. · mrubyc/mrubyc@393d963 · GitHub
[go: up one dir, main page]

Skip to content

Commit 393d963

Browse files
fix incomplete module support.
1 parent 0661e30 commit 393d963

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/class.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,11 @@ mrbc_class * mrbc_get_class_by_name( const char *name )
492492

493493
mrbc_value *obj = mrbc_get_const(sym_id);
494494
if( obj == NULL ) return NULL;
495-
if( mrbc_type(*obj) != MRBC_TT_CLASS ) return NULL;
496495

497-
return obj->cls;
496+
if( obj->tt == MRBC_TT_CLASS ||
497+
obj->tt == MRBC_TT_MODULE ) return obj->cls;
498+
499+
return NULL;
498500
}
499501

500502

src/value.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ int mrbc_compare(const mrbc_value *v1, const mrbc_value *v2)
120120
#endif
121121

122122
case MRBC_TT_CLASS:
123+
case MRBC_TT_MODULE:
123124
case MRBC_TT_OBJECT:
124125
case MRBC_TT_PROC:
125126
return (v1->cls > v2->cls) * 2 - (v1->cls != v2->cls);

0 commit comments

Comments
 (0)
0