|
1 | 1 | #![allow(non_upper_case_globals)] |
2 | 2 | use crate::cruby::{Qfalse, Qnil, Qtrue, VALUE, RUBY_T_ARRAY, RUBY_T_STRING, RUBY_T_HASH}; |
3 | | -use crate::cruby::{rb_cInteger, rb_cFloat, rb_cArray, rb_cHash, rb_cString, rb_cSymbol, rb_cObject, rb_cTrueClass, rb_cFalseClass, rb_cNilClass, rb_cRange, rb_cSet}; |
| 3 | +use crate::cruby::{rb_cInteger, rb_cFloat, rb_cArray, rb_cHash, rb_cString, rb_cSymbol, rb_cObject, rb_cTrueClass, rb_cFalseClass, rb_cNilClass, rb_cRange, rb_cSet, rb_cRegexp}; |
4 | 4 | use crate::cruby::ClassRelationship; |
5 | 5 | use crate::cruby::get_class_name; |
6 | 6 | use crate::cruby::ruby_sym_to_rust_string; |
@@ -197,6 +197,9 @@ impl Type { |
197 | 197 | else if is_string_exact(val) { |
198 | 198 | Type { bits: bits::StringExact, spec: Specialization::Object(val) } |
199 | 199 | } |
| 200 | + else if val.class_of() == unsafe { rb_cRegexp } { |
| 201 | + Type { bits: bits::RegexpExact, spec: Specialization::Object(val) } |
| 202 | + } |
200 | 203 | else if val.class_of() == unsafe { rb_cSet } { |
201 | 204 | Type { bits: bits::SetExact, spec: Specialization::Object(val) } |
202 | 205 | } |
@@ -292,6 +295,7 @@ impl Type { |
292 | 295 | if class == unsafe { rb_cNilClass } { return true; } |
293 | 296 | if class == unsafe { rb_cObject } { return true; } |
294 | 297 | if class == unsafe { rb_cRange } { return true; } |
| 298 | + if class == unsafe { rb_cRegexp } { return true; } |
295 | 299 | if class == unsafe { rb_cString } { return true; } |
296 | 300 | if class == unsafe { rb_cSymbol } { return true; } |
297 | 301 | if class == unsafe { rb_cTrueClass } { return true; } |
|
0 commit comments