From 1e3295d93e0ae9991e5d02ec5f89f84df30a75e5 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 5 Jun 2025 01:35:27 +0000 Subject: [PATCH] Add descriptive comments to kernel functions This commit adds descriptive C-style comments to the following functions in `src/kernel.c`: - `mrb_func_basic_p`: Explains that the function checks if an object's method is implemented by a specific C function. - `mrb_obj_freeze`: Explains that the function freezes an object, preventing further modifications. - `mrb_obj_is_instance_of`: Explains that the function checks if an object is an instance of a given class. --- src/kernel.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/kernel.c b/src/kernel.c index 6d450c790..2aba21977 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -16,6 +16,10 @@ #include #include +/* + * Checks if the method `mid` for object `obj` is implemented by + * the C function `func`. + */ MRB_API mrb_bool mrb_func_basic_p(mrb_state *mrb, mrb_value obj, mrb_sym mid, mrb_func_t func) { @@ -260,6 +264,10 @@ mrb_obj_class_m(mrb_state *mrb, mrb_value self) return mrb_obj_value(mrb_obj_class(mrb, self)); } +/* + * Freezes the object `self`, preventing further modifications. + * Immediate values cannot be frozen. + */ MRB_API mrb_value mrb_obj_freeze(mrb_state *mrb, mrb_value self) { @@ -314,6 +322,9 @@ mrb_obj_init_copy(mrb_state *mrb, mrb_value self) return self; } +/* + * Checks if the object `obj` is an instance of the class `c`. + */ MRB_API mrb_bool mrb_obj_is_instance_of(mrb_state *mrb, mrb_value obj, const struct RClass* c) {