Follow the code style about else
This commit is contained in:
parent
90e5ce6132
commit
294b52fb9b
@ -55,7 +55,8 @@ load_with_builtin_functions(const char *feature_name, const struct rb_builtin_fu
|
||||
// exec
|
||||
if (rb_namespace_available() && rb_mNamespaceRefiner) {
|
||||
rb_iseq_eval_with_refinement(rb_iseq_check(iseq), rb_mNamespaceRefiner);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rb_iseq_eval(rb_iseq_check(iseq));
|
||||
}
|
||||
|
||||
|
93
class.c
93
class.c
@ -274,7 +274,8 @@ class_duplicate_iclass_classext(VALUE iclass, rb_classext_t *mod_ext, const rb_n
|
||||
// See also: rb_include_class_new()
|
||||
if (RCLASSEXT_ICLASS_IS_ORIGIN(src) && !RCLASSEXT_ICLASS_ORIGIN_SHARED_MTBL(src)) {
|
||||
RCLASSEXT_M_TBL(ext) = duplicate_classext_m_tbl(RCLASSEXT_M_TBL(src), iclass, true);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
RCLASSEXT_M_TBL(ext) = RCLASSEXT_M_TBL(mod_ext);
|
||||
}
|
||||
RCLASSEXT_FIELDS(ext) = (VALUE *)st_init_numtable();
|
||||
@ -318,14 +319,16 @@ rb_class_duplicate_classext(rb_classext_t *orig, VALUE klass, const rb_namespace
|
||||
if (RCLASSEXT_FIELDS(orig)) {
|
||||
RCLASSEXT_FIELDS(ext) = (VALUE *)st_copy((st_table *)RCLASSEXT_FIELDS(orig));
|
||||
rb_autoload_copy_table_for_namespace((st_table *)RCLASSEXT_FIELDS(ext), ns);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
RCLASSEXT_FIELDS(ext) = (VALUE *)st_init_numtable();
|
||||
}
|
||||
|
||||
if (RCLASSEXT_SHARED_CONST_TBL(orig)) {
|
||||
RCLASSEXT_CONST_TBL(ext) = RCLASSEXT_CONST_TBL(orig);
|
||||
RCLASSEXT_SHARED_CONST_TBL(ext) = true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
RCLASSEXT_CONST_TBL(ext) = duplicate_classext_const_tbl(RCLASSEXT_CONST_TBL(orig), klass);
|
||||
RCLASSEXT_SHARED_CONST_TBL(ext) = false;
|
||||
}
|
||||
@ -544,16 +547,19 @@ debug_dump_super_chain(rb_classext_t *ext, const rb_namespace_t *ns)
|
||||
rb_str_cat_cstr(result, " -> ");
|
||||
if (ns) {
|
||||
s = RCLASSEXT_SUPER(RCLASS_EXT_READABLE_IN_NS(s, ns));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
s = RCLASSEXT_SUPER(RCLASS_EXT_PRIME(s));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
chaining = false;
|
||||
}
|
||||
}
|
||||
if (count >= 100) {
|
||||
rb_str_cat_cstr(result, " -> ... (chain size >= 100)\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rb_str_cat_cstr(result, "\n");
|
||||
}
|
||||
return result;
|
||||
@ -571,9 +577,11 @@ debug_dump_ivars_foreach_i(st_data_t k, st_data_t v, st_data_t arg)
|
||||
// to suppress the very long Gem ivar values
|
||||
if (key == rb_intern("@loaded_specs")) {
|
||||
rb_str_cat_cstr(result, "[ ... ]");
|
||||
} else if (key == rb_intern("@path_to_default_spec_map")) {
|
||||
}
|
||||
else if (key == rb_intern("@path_to_default_spec_map")) {
|
||||
rb_str_cat_cstr(result, "{ ... }");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rb_str_concat(result, debug_dump_inspect_or_return_type(value));
|
||||
}
|
||||
rb_str_cat_cstr(result, "\n");
|
||||
@ -607,7 +615,8 @@ debug_dump_sorted_methods_i(ID key, VALUE value, void *data)
|
||||
// snprintf(buf, 2048, "%s[%p](*)", rb_id2name(key), me);
|
||||
snprintf(buf, 2048, "%s(*)", rb_id2name(key));
|
||||
rb_ary_push(ary, rb_str_new_cstr(buf));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// snprintf(buf, 2048, "%s[%p]", rb_id2name(key), me);
|
||||
snprintf(buf, 2048, "%s", rb_id2name(key));
|
||||
rb_ary_push(ary, rb_str_new_cstr(buf));
|
||||
@ -666,10 +675,12 @@ debug_dump_classext(rb_classext_t *ext, VALUE klass, const rb_namespace_t *ns)
|
||||
} else {
|
||||
if (!RCLASSEXT_FIELDS(ext)) {
|
||||
rb_str_cat_cstr(result, "Ivars: NONE\n");
|
||||
} else if (st_table_size((st_table *)RCLASSEXT_FIELDS(ext)) == 0) {
|
||||
}
|
||||
else if (st_table_size((st_table *)RCLASSEXT_FIELDS(ext)) == 0) {
|
||||
snprintf(buf, 2048, "IVars: NONE (%p)\n", (void *)RCLASSEXT_FIELDS(ext));
|
||||
rb_str_cat_cstr(result, buf);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
snprintf(buf, 2048, "IVars: %zu (%p)\n", st_table_size((st_table *)RCLASSEXT_FIELDS(ext)), (void *)RCLASSEXT_FIELDS(ext));
|
||||
rb_str_cat_cstr(result, buf);
|
||||
st_foreach((st_table *)RCLASSEXT_FIELDS(ext), debug_dump_ivars_foreach_i, (st_data_t)result);
|
||||
@ -677,7 +688,8 @@ debug_dump_classext(rb_classext_t *ext, VALUE klass, const rb_namespace_t *ns)
|
||||
}
|
||||
if (!RCLASSEXT_CONST_TBL(ext) || rb_id_table_size(RCLASSEXT_CONST_TBL(ext)) == 0) {
|
||||
rb_str_cat_cstr(result, "Constants: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
snprintf(buf, 2048, "Constants: %zu\n ", rb_id_table_size(RCLASSEXT_CONST_TBL(ext)));
|
||||
rb_str_cat_cstr(result, buf);
|
||||
rb_str_concat(result, debug_dump_sorted_constants(RCLASSEXT_CONST_TBL(ext)));
|
||||
@ -685,7 +697,8 @@ debug_dump_classext(rb_classext_t *ext, VALUE klass, const rb_namespace_t *ns)
|
||||
}
|
||||
if (!RCLASSEXT_M_TBL(ext) || rb_id_table_size(RCLASSEXT_M_TBL(ext)) == 0) {
|
||||
rb_str_cat_cstr(result, "Methods: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
snprintf(buf, 2048, "Methods: %zu\n ", rb_id_table_size(RCLASSEXT_M_TBL(ext)));
|
||||
rb_str_cat_cstr(result, buf);
|
||||
rb_str_concat(result, debug_dump_sorted_methods(RCLASSEXT_M_TBL(ext)));
|
||||
@ -693,7 +706,8 @@ debug_dump_classext(rb_classext_t *ext, VALUE klass, const rb_namespace_t *ns)
|
||||
}
|
||||
if (!RCLASSEXT_CALLABLE_M_TBL(ext) || rb_id_table_size(RCLASSEXT_CALLABLE_M_TBL(ext)) == 0) {
|
||||
rb_str_cat_cstr(result, "Callable Methods: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
snprintf(buf, 2048, "Callable Methods: %zu\n ", rb_id_table_size(RCLASSEXT_CALLABLE_M_TBL(ext)));
|
||||
rb_str_cat_cstr(result, buf);
|
||||
rb_str_concat(result, debug_dump_sorted_list_of_id_table_keys(RCLASSEXT_CALLABLE_M_TBL(ext)));
|
||||
@ -701,7 +715,8 @@ debug_dump_classext(rb_classext_t *ext, VALUE klass, const rb_namespace_t *ns)
|
||||
}
|
||||
if (!RCLASSEXT_CC_TBL(ext) || rb_id_table_size(RCLASSEXT_CC_TBL(ext)) == 0) {
|
||||
rb_str_cat_cstr(result, "Call Caches: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
snprintf(buf, 2048, "Call Caches: %zu\n ", rb_id_table_size(RCLASSEXT_CC_TBL(ext)));
|
||||
rb_str_cat_cstr(result, buf);
|
||||
rb_str_concat(result, debug_dump_sorted_list_of_id_table_keys(RCLASSEXT_CC_TBL(ext)));
|
||||
@ -709,7 +724,8 @@ debug_dump_classext(rb_classext_t *ext, VALUE klass, const rb_namespace_t *ns)
|
||||
}
|
||||
if (!RCLASSEXT_CVC_TBL(ext) || rb_id_table_size(RCLASSEXT_CVC_TBL(ext)) == 0) {
|
||||
rb_str_cat_cstr(result, "CVar Caches: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
snprintf(buf, 2048, "CVar Caches: %zu\n ", rb_id_table_size(RCLASSEXT_CVC_TBL(ext)));
|
||||
rb_str_cat_cstr(result, buf);
|
||||
rb_str_concat(result, debug_dump_sorted_list_of_id_table_keys(RCLASSEXT_CVC_TBL(ext)));
|
||||
@ -717,7 +733,8 @@ debug_dump_classext(rb_classext_t *ext, VALUE klass, const rb_namespace_t *ns)
|
||||
}
|
||||
if (RCLASSEXT_SUPERCLASS_DEPTH(ext) == 0) {
|
||||
rb_str_cat_cstr(result, "Superclasses: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rb_str_cat_cstr(result, "Superclasses: ");
|
||||
len = (int)RCLASSEXT_SUPERCLASS_DEPTH(ext);
|
||||
for (i=0; i<len; i++) {
|
||||
@ -732,7 +749,8 @@ debug_dump_classext(rb_classext_t *ext, VALUE klass, const rb_namespace_t *ns)
|
||||
rb_str_cat_cstr(result, buf);
|
||||
if (!RCLASSEXT_SUBCLASSES(ext)) {
|
||||
rb_str_cat_cstr(result, "Subclasses: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rb_str_cat_cstr(result, "Subclasses: ");
|
||||
subclass = RCLASSEXT_SUBCLASSES(ext)->head;
|
||||
while (subclass->next) {
|
||||
@ -746,26 +764,30 @@ debug_dump_classext(rb_classext_t *ext, VALUE klass, const rb_namespace_t *ns)
|
||||
}
|
||||
if (!RCLASSEXT_NS_SUPER_SUBCLASSES(ext)) {
|
||||
rb_str_cat_cstr(result, "Namespace Super Subclass Table: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
snprintf(buf, 2048, "Namespace Super Subclass Table: %p\n", (void *)RCLASSEXT_NS_SUPER_SUBCLASSES(ext));
|
||||
rb_str_cat_cstr(result, buf);
|
||||
}
|
||||
if (!RCLASSEXT_NS_MODULE_SUBCLASSES(ext)) {
|
||||
rb_str_cat_cstr(result, "Namespace Module Subclass Table: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
snprintf(buf, 2048, "Namespace Module Subclass Table: %p\n", (void *)RCLASSEXT_NS_MODULE_SUBCLASSES(ext));
|
||||
rb_str_cat_cstr(result, buf);
|
||||
}
|
||||
if (!RCLASSEXT_ORIGIN(ext)) {
|
||||
rb_str_cat_cstr(result, "Origin: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rb_str_cat_cstr(result, "Origin: ");
|
||||
rb_str_concat(result, debug_dump_inspect_or_return_type(RCLASSEXT_ORIGIN(ext)));
|
||||
rb_str_cat_cstr(result, "\n");
|
||||
}
|
||||
if (!RCLASSEXT_INCLUDER(ext)) {
|
||||
rb_str_cat_cstr(result, "Includer: NONE\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rb_str_cat_cstr(result, "Includer: ");
|
||||
rb_str_concat(result, debug_dump_inspect_or_return_type(RCLASSEXT_INCLUDER(ext)));
|
||||
rb_str_cat_cstr(result, "\n");
|
||||
@ -818,13 +840,15 @@ rb_class_debug_dump_all_classext(VALUE klass)
|
||||
rb_str_cat_cstr(r, "klass: ");
|
||||
if (METACLASS_OF(klass)) {
|
||||
rb_str_concat(r, debug_dump_inspect_or_return_type(METACLASS_OF(klass)));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rb_str_cat_cstr(r, "NONE\n");
|
||||
}
|
||||
rb_str_cat_cstr(r, "\n");
|
||||
if (RCLASS_SINGLETON_P(klass)) {
|
||||
rb_str_cat_cstr(r, "singleton class: true\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rb_str_cat_cstr(r, "singleton class: false\n");
|
||||
}
|
||||
snprintf(buf, 2048,
|
||||
@ -866,7 +890,8 @@ rb_class_debug_print_classext(const char *label, const char *opt, VALUE klass)
|
||||
VALUE d = rb_class_debug_dump_all_classext(klass);
|
||||
if (opt) {
|
||||
fprintf(stderr, "***** %s (%s)\n%s", label, opt, StringValueCStr(d));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "***** %s\n%s", label, StringValueCStr(d));
|
||||
}
|
||||
}
|
||||
@ -930,7 +955,8 @@ push_subclass_entry_to_list(VALUE super, VALUE klass, bool is_module)
|
||||
|
||||
if (is_module) {
|
||||
RCLASS_WRITE_NS_MODULE_SUBCLASSES(klass, anchor->ns_subclasses);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
RCLASS_WRITE_NS_SUPER_SUBCLASSES(klass, anchor->ns_subclasses);
|
||||
}
|
||||
}
|
||||
@ -989,13 +1015,15 @@ remove_class_from_subclasses(struct st_table *tbl, VALUE ns_id, VALUE klass)
|
||||
if (first_entry) {
|
||||
if (next) {
|
||||
st_insert(tbl, ns_id, (st_data_t)next);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// no subclass entries in this ns
|
||||
st_delete(tbl, &ns_id, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else if (first_entry) {
|
||||
}
|
||||
else if (first_entry) {
|
||||
first_entry = false;
|
||||
}
|
||||
entry = entry->next;
|
||||
@ -1174,7 +1202,8 @@ class_associate_super(VALUE klass, VALUE super, bool init)
|
||||
}
|
||||
if (init) {
|
||||
RCLASS_SET_SUPER(klass, super);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
RCLASS_WRITE_SUPER(klass, super);
|
||||
}
|
||||
rb_class_update_superclasses(klass);
|
||||
@ -1274,7 +1303,8 @@ rb_class_update_superclasses(VALUE klass)
|
||||
super_depth = RCLASS_SUPERCLASS_DEPTH(super);
|
||||
if (RCLASS_SUPERCLASSES_WITH_SELF_P(super)) {
|
||||
superclasses = RCLASS_SUPERCLASSES(super);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
superclasses = class_superclasses_including_self(super);
|
||||
RCLASS_WRITE_SUPERCLASSES(super, super_depth, superclasses, true, true);
|
||||
}
|
||||
@ -2117,7 +2147,8 @@ rb_include_class_new(VALUE module, VALUE super)
|
||||
RUBY_ASSERT(!RB_TYPE_P(module, T_ICLASS));
|
||||
if (RCLASS_WRITABLE_CONST_TBL(module)) {
|
||||
RCLASS_SET_CONST_TBL(klass, RCLASS_WRITABLE_CONST_TBL(module), true);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
RCLASS_WRITE_CONST_TBL(module, rb_id_table_create(0), false);
|
||||
RCLASS_SET_CONST_TBL(klass, RCLASS_WRITABLE_CONST_TBL(module), true);
|
||||
}
|
||||
|
6
gc.c
6
gc.c
@ -2243,7 +2243,8 @@ rb_obj_memsize_of(VALUE obj)
|
||||
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
rb_class_classext_foreach(obj, classext_fields_hash_memsize, (void *)&size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// class IV sizes are allocated as powers of two
|
||||
size += SIZEOF_VALUE << bit_length(RCLASS_FIELDS_COUNT(obj));
|
||||
}
|
||||
@ -3746,7 +3747,8 @@ update_classext(rb_classext_t *ext, bool is_prime, VALUE namespace, void *arg)
|
||||
|
||||
if (args->obj_too_complex) {
|
||||
gc_ref_update_table_values_only((st_table *)RCLASSEXT_FIELDS(ext));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Classext is not copied in this case
|
||||
for (attr_index_t i = 0; i < RCLASS_FIELDS_COUNT(klass); i++) {
|
||||
UPDATE_IF_MOVED(objspace, RCLASSEXT_FIELDS(RCLASS_EXT_PRIME(klass))[i]);
|
||||
|
12
load.c
12
load.c
@ -798,7 +798,8 @@ iseq_eval_in_namespace(VALUE arg)
|
||||
struct iseq_eval_in_namespace_data *data = (struct iseq_eval_in_namespace_data *)arg;
|
||||
if (rb_namespace_available() && data->in_builtin) {
|
||||
return rb_iseq_eval_with_refinement(data->iseq, rb_mNamespaceRefiner);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return rb_iseq_eval(data->iseq);
|
||||
}
|
||||
}
|
||||
@ -865,7 +866,8 @@ load_iseq_eval(rb_execution_context_t *ec, VALUE fname)
|
||||
.in_builtin = NAMESPACE_BUILTIN_P(loading_ns),
|
||||
};
|
||||
rb_namespace_exec(loading_ns, iseq_eval_in_namespace, (VALUE)&arg);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rb_iseq_eval(iseq);
|
||||
}
|
||||
}
|
||||
@ -891,7 +893,8 @@ load_wrapping(rb_execution_context_t *ec, VALUE fname, VALUE load_wrapper)
|
||||
ns->top_self = rb_obj_clone(rb_vm_top_self());
|
||||
}
|
||||
th->top_self = ns->top_self;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
th->top_self = rb_obj_clone(rb_vm_top_self());
|
||||
}
|
||||
th->top_wrapper = load_wrapper;
|
||||
@ -1441,7 +1444,8 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception, bool wa
|
||||
// check with NAMESPACE_OPTIONAL_P (not NAMESPACE_USER_P) for NS1::xxx naming
|
||||
// it is not expected for the main namespace
|
||||
load_wrapping(saved.ec, path, vm_ns->ns->ns_object);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
load_iseq_eval(saved.ec, path);
|
||||
}
|
||||
break;
|
||||
|
@ -111,7 +111,8 @@ rb_load_with_builtin_functions(const char *feature_name, const struct rb_builtin
|
||||
const rb_iseq_t *iseq;
|
||||
if (rb_namespace_available() && rb_mNamespaceRefiner) {
|
||||
load_with_builtin_functions(feature_name, table);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
iseq = builtin_iseq_load(feature_name, table);
|
||||
rb_iseq_eval(iseq);
|
||||
}
|
||||
|
36
namespace.c
36
namespace.c
@ -149,11 +149,13 @@ namespace_ignore_builtin_primitive_methods_p(const rb_namespace_t *ns, rb_method
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
} else if (strcmp(path, "<internal:warning>") == 0) {
|
||||
}
|
||||
else if (strcmp(path, "<internal:warning>") == 0) {
|
||||
if (mid == rb_intern("warn")) {
|
||||
return true;
|
||||
}
|
||||
} else if (strcmp(path, "<internal:marshal>") == 0) {
|
||||
}
|
||||
else if (strcmp(path, "<internal:marshal>") == 0) {
|
||||
if (mid == rb_intern("load"))
|
||||
return true;
|
||||
}
|
||||
@ -220,7 +222,8 @@ current_namespace(bool permit_calling_builtin)
|
||||
}
|
||||
}
|
||||
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
calling = 0;
|
||||
}
|
||||
}
|
||||
@ -349,21 +352,24 @@ rb_current_namespace_details(VALUE opt)
|
||||
rb_str_cat_cstr(str, buf);
|
||||
calling = 0;
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
snprintf(buf, 2048, " cfp cme->def id:%s, ns:%s, exprim:f, path:%s\n",
|
||||
rb_id2name(cme->def->original_id),
|
||||
RSTRING_PTR(part),
|
||||
path);
|
||||
rb_str_cat_cstr(str, buf);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
snprintf(buf, 2048, " cfp cme->def id:%s, ns:null, path:%s\n",
|
||||
rb_id2name(cme->def->original_id),
|
||||
path);
|
||||
rb_str_cat_cstr(str, buf);
|
||||
}
|
||||
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
calling = 0;
|
||||
}
|
||||
}
|
||||
@ -750,11 +756,13 @@ copy_ext_file(char *src_path, char *dst_path)
|
||||
if (ferror(dst)) {
|
||||
retvalue = 4;
|
||||
break;
|
||||
} else { // partial write
|
||||
}
|
||||
else { // partial write
|
||||
clean_read = 0;
|
||||
written += wrote;
|
||||
}
|
||||
} else { // Wrote the entire buffer to dst, next read is clean one
|
||||
}
|
||||
else { // Wrote the entire buffer to dst, next read is clean one
|
||||
clean_read = 1;
|
||||
}
|
||||
}
|
||||
@ -762,7 +770,8 @@ copy_ext_file(char *src_path, char *dst_path)
|
||||
if (clean_read && feof(src)) {
|
||||
// If it's not clean, buffer should have bytes not written yet.
|
||||
eof = 1;
|
||||
} else if (ferror(src)) {
|
||||
}
|
||||
else if (ferror(src)) {
|
||||
retvalue = 3;
|
||||
// Writes could be partial/dirty, but this load is failure anyway
|
||||
break;
|
||||
@ -852,7 +861,8 @@ namespace_push(rb_thread_t *th, VALUE namespace)
|
||||
{
|
||||
if (RTEST(th->namespaces)) {
|
||||
rb_ary_push(th->namespaces, namespace);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
th->namespaces = rb_ary_new_from_args(1, namespace);
|
||||
}
|
||||
th->ns = rb_get_namespace_t(namespace);
|
||||
@ -873,7 +883,8 @@ namespace_pop(VALUE th_value)
|
||||
if (stack_len == 0) {
|
||||
th->namespaces = 0;
|
||||
th->ns = main_namespace;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
upper_ns = RARRAY_AREF(namespaces, stack_len-1);
|
||||
th->ns = rb_get_namespace_t(upper_ns);
|
||||
}
|
||||
@ -990,7 +1001,8 @@ rb_namespace_inspect(VALUE obj)
|
||||
}
|
||||
if (NAMESPACE_MAIN_P(ns)) {
|
||||
rb_str_cat_cstr(r, ",main");
|
||||
} else if (NAMESPACE_OPTIONAL_P(ns)) {
|
||||
}
|
||||
else if (NAMESPACE_OPTIONAL_P(ns)) {
|
||||
rb_str_cat_cstr(r, ",optional");
|
||||
}
|
||||
rb_str_cat_cstr(r, ">");
|
||||
|
14
variable.c
14
variable.c
@ -1009,7 +1009,8 @@ rb_gvar_set(ID id, VALUE val)
|
||||
rb_hash_aset(ns->gvar_tbl, rb_id2sym(entry->id), val);
|
||||
retval = val;
|
||||
// TODO: think about trace
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
retval = rb_gvar_set_entry(entry, val);
|
||||
}
|
||||
return retval;
|
||||
@ -1034,14 +1035,16 @@ rb_gvar_get(ID id)
|
||||
key = rb_id2sym(entry->id);
|
||||
if (RTEST(rb_hash_has_key(gvars, key))) { // this gvar is already cached
|
||||
retval = rb_hash_aref(gvars, key);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
retval = (*var->getter)(entry->id, var->data);
|
||||
if (rb_obj_respond_to(retval, rb_intern("clone"), 1)) {
|
||||
retval = rb_funcall(retval, rb_intern("clone"), 0);
|
||||
}
|
||||
rb_hash_aset(gvars, key, retval);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
retval = (*var->getter)(entry->id, var->data);
|
||||
}
|
||||
return retval;
|
||||
@ -3787,11 +3790,10 @@ rb_const_remove(VALUE mod, ID id)
|
||||
val = Qnil;
|
||||
}
|
||||
|
||||
if (ce == const_lookup(RCLASS_PRIME_CONST_TBL(mod), id)) {
|
||||
// skip free'ing the ce because it still exists in the prime classext
|
||||
} else {
|
||||
if (ce != const_lookup(RCLASS_PRIME_CONST_TBL(mod), id)) {
|
||||
ruby_xfree(ce);
|
||||
}
|
||||
// else - skip free'ing the ce because it still exists in the prime classext
|
||||
|
||||
return val;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user