File tree 3 files changed +17
-3
lines changed
3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ namespace rubinius {
49
49
50
50
Object* recv = args.recv ();
51
51
52
- if (CBOOL (recv->frozen_p (state))) {
52
+ if (CBOOL (recv->frozen_p (state)) && CBOOL (recv-> frozen_mod_disallowed (state)) ) {
53
53
Exception::frozen_error (state, call_frame, recv);
54
54
return 0 ;
55
55
}
@@ -66,7 +66,7 @@ namespace rubinius {
66
66
67
67
/* The writer case. */
68
68
if (access ->write ()->true_p ()) {
69
- if (CBOOL (self->frozen_p (state))) {
69
+ if (CBOOL (self->frozen_p (state)) && CBOOL (self-> frozen_mod_disallowed (state)) ) {
70
70
Exception::frozen_error (state, call_frame, self);
71
71
return 0 ;
72
72
}
Original file line number Diff line number Diff line change @@ -183,10 +183,17 @@ namespace rubinius {
183
183
}
184
184
185
185
void Object::check_frozen (STATE) {
186
- if (CBOOL (frozen_p (state))) {
186
+ if (CBOOL (frozen_p (state)) && CBOOL ( frozen_mod_disallowed (state)) ) {
187
187
Exception::frozen_error (state, this );
188
188
}
189
189
}
190
+
191
+ Object* Object::frozen_mod_disallowed (STATE) {
192
+ if (this ->nil_p () || this ->true_p () || this ->false_p ()) {
193
+ return cFalse;
194
+ }
195
+ return cTrue;
196
+ }
190
197
191
198
Object* Object::get_field (STATE, size_t index) {
192
199
return type_info (state)->get_field (state, this , index );
Original file line number Diff line number Diff line change @@ -390,6 +390,13 @@ namespace rubinius {
390
390
* Similar to CRuby rb_check_frozen
391
391
*/
392
392
void check_frozen (STATE);
393
+
394
+ /* *
395
+ * Returns true unless one of the objects is nil, true, or
396
+ * false. Those objects are allowed to be modified when
397
+ * frozen.
398
+ */
399
+ Object* frozen_mod_disallowed (STATE);
393
400
394
401
public: /* accessors */
395
402
You can’t perform that action at this time.
0 commit comments