|
From cc8743ebdab8d32dfcf91c78de210133bb6d6d86 Mon Sep 17 00:00:00 2001 |
|
From: Burke Libbey <[email protected]> |
|
Date: Wed, 3 Feb 2010 10:30:40 -0600 |
|
Subject: [PATCH] FIXED failing class variable-related specs in C API. |
|
|
|
--- |
|
vm/capi/class.cpp | 14 ++++++++++---- |
|
1 files changed, 10 insertions(+), 4 deletions(-) |
|
|
|
diff --git a/vm/capi/class.cpp b/vm/capi/class.cpp |
|
index 92f6c63..4d52c19 100644 |
|
--- a/vm/capi/class.cpp |
|
+++ b/vm/capi/class.cpp |
|
@@ -56,15 +56,21 @@ extern "C" { |
|
VALUE rb_cvar_defined(VALUE module_handle, ID name) { |
|
NativeMethodEnvironment* env = NativeMethodEnvironment::get(); |
|
|
|
- return rb_funcall(module_handle, rb_intern("class_variable_defined?"), |
|
- 1, |
|
- env->get_handle(prefixed_by("@@", name))); |
|
+ if (((Symbol *)name)->is_cvar_p(env->state())->true_p()) { |
|
+ return rb_funcall(module_handle, rb_intern("class_variable_defined?"), |
|
+ 1, |
|
+ env->get_handle(prefixed_by("@@", name))); |
|
+ } else { |
|
+ return rb_funcall(module_handle, rb_intern("instance_variable_defined?"), |
|
+ 1, |
|
+ env->get_handle(prefixed_by("@", name))); |
|
+ } |
|
} |
|
|
|
VALUE rb_cvar_get(VALUE module_handle, ID name) { |
|
NativeMethodEnvironment* env = NativeMethodEnvironment::get(); |
|
|
|
- return rb_funcall(module_handle, rb_intern("class_variable_set"), |
|
+ return rb_funcall(module_handle, rb_intern("class_variable_get"), |
|
1, |
|
env->get_handle(prefixed_by("@@", name))); |
|
} |
|
-- |
|
1.6.6 |