-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Namespace management using control frame #13454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
/* | ||
static bool | ||
namespace_ignore_builtin_primitive_methods_p(const rb_namespace_t *ns, rb_method_definition_t *def) | ||
{ | ||
if (!NAMESPACE_BUILTIN_P(ns)) { | ||
return false; | ||
} | ||
/* Primitive methods (just to call C methods) covers/hides the effective | ||
/ Primitive methods (just to call C methods) covers/hides the effective | ||
namespaces, so ignore the methods' namespaces to expose user code's | ||
namespace to the implementation. | ||
*/ | ||
/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can disable code contains comments by #if 0
..#endif
.
9cb95e9
to
b0193f3
Compare
fd04acf
to
88e1fad
Compare
❌ Tests Failed✖️19 tests failed ✔️61988 tests passed(1 flake) 22/154 test sessions failed❌ Test session #4512207 failed ❌ Test session #4512211 failed ❌ Test session #4512218 failed ❌ Test session #4512219 failed ❌ Test session #4512222 failed ❌ Test session #4512223 failed ❌ Test session #4512229 failed ❌ Test session #4512230 failed ❌ Test session #4512235 failed ❌ Test session #4512237 failed ❌ Test session #4512238 failed ❌ Test session #4512243 failed ❌ Test session #4512244 failed ❌ Test session #4512249 failed ❌ Test session #4512250 failed ❌ Test session #4512257 failed ❌ Test session #4512258 failed ❌ Test session #4512259 failed ❌ Test session #4512262 failed ❌ Test session #4512275 failed ❌ Test session #4512278 failed ❌ Test session #4512303 failed |
139ed12
to
a5bbd18
Compare
a5bbd18
to
0ac3835
Compare
…al contexts to fix inconsistent and wrong current namespace detections. This includes: * Moving load_path and related things from rb_vm_t to rb_namespace_t to simplify accessing those values via namespace (instead of accessing either vm or ns) * Initializing root_namespace earlier and consolidate builtin_namespace into root_namespace * Adding VM_FRAME_FLAG_NS_REQUIRE for checkpoints to detect a namespace to load/require files * Removing implicit refinements in the root namespace which was used to determine the namespace to be loaded (replaced by VM_FRAME_FLAG_NS_REQUIRE) * Removing namespaces from rb_proc_t because its namespace can be identified by lexical context * Starting to use ep[VM_ENV_DATA_INDEX_SPECVAL] to store the current namespace when the frame type is MAGIC_TOP or MAGIC_CLASS (block handlers don't exist in this case)
Calling rb_current_namespace() in rb_namespace_current() means to show the definition namespace of Namespace.current itself (it's the root always) but the users' expectation is to show the namespace of the place where the Namespace.current is called.
* checking all control frames (instead of filtering by VM_FRAME_RUBYFRAME_P) because VM_FRAME_FLAG_NS_REQUIRE is set on non-rubyframe * skip frames of CFUNC in the root namespace for Kernel#require (etc) to avoid detecting the root namespace of those frames wrongly
0ac3835
to
1e43ad1
Compare
TODO: write later