diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-15 11:58:30 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | 0b1b73451528d946060f4876aa38fc3278899deb (patch) | |
tree | 9fdf37446e4850112120793fe3c8f96be3faaf4e /eval.c | |
parent | a2677815f5e18116e37d7eb1d3e876798eb8e6d8 (diff) |
rb_class_modify_check: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea. Better refactor.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3247
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -456,7 +456,6 @@ void rb_class_modify_check(VALUE klass) { if (SPECIAL_CONST_P(klass)) { - noclass: Check_Type(klass, T_CLASS); } if (OBJ_FROZEN(klass)) { @@ -489,7 +488,7 @@ rb_class_modify_check(VALUE klass) desc = "class"; break; default: - goto noclass; + Check_Type(klass, T_CLASS); } } rb_frozen_error_raise(klass, "can't modify frozen %s: %"PRIsVALUE, desc, klass); |