summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-20 08:13:53 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-20 08:13:53 +0000
commitea01ffa56951724708858b982d7aa64504cc412c (patch)
tree8196c9203f6fe953f5bba9ccc81be26e179b5ab5 /vm_core.h
parenta1580347899f1fb6fd85d82828db3f372e5ec86d (diff)
* vm_core.h (rb_vm_defineclass_type_t),
compile.c (iseq_compile_each), insns.def (defineclass): change the meaning of the third operand of defineclass as follows: lower 3bits: the type of the defineclass 0 = class, 1 = singleton class, 2 = module 4th bit: a flag represents whether the defineclass is scoped 0 = not scoped (e.g., class Foo) 1 = scoped (e.g., class Bar::Baz) 5th bit: a flag represents whether the superclass is specified 0 = not specified (e.g., class Foo) 1 = specified (e.g., class Bar < Foo) If the superclass is specified and is not a class, a TypeError should be raised. [ruby-dev:46747] [Bug #7572] * test/ruby/test_class.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/vm_core.h b/vm_core.h
index 87076f3e08..23756f9bb4 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -612,6 +612,21 @@ typedef struct rb_thread_struct {
unsigned long running_time_us;
} rb_thread_t;
+typedef enum {
+ VM_DEFINECLASS_TYPE_CLASS = 0x00,
+ VM_DEFINECLASS_TYPE_SINGLETON_CLASS = 0x01,
+ VM_DEFINECLASS_TYPE_MODULE = 0x02,
+ /* 0x03..0x06 is reserved */
+ VM_DEFINECLASS_TYPE_MASK = 0x07,
+} rb_vm_defineclass_type_t;
+
+#define VM_DEFINECLASS_TYPE(x) ((x) & VM_DEFINECLASS_TYPE_MASK)
+#define VM_DEFINECLASS_FLAG_SCOPED 0x08
+#define VM_DEFINECLASS_FLAG_HAS_SUPERCLASS 0x10
+#define VM_DEFINECLASS_SCOPED_P(x) ((x) & VM_DEFINECLASS_FLAG_SCOPED)
+#define VM_DEFINECLASS_HAS_SUPERCLASS_P(x) \
+ ((x) & VM_DEFINECLASS_FLAG_HAS_SUPERCLASS)
+
/* iseq.c */
#if defined __GNUC__ && __GNUC__ >= 4
#pragma GCC visibility push(default)