@@ -78,11 +78,7 @@ public final class ClassicRegexp implements ReOptions {
78
78
79
79
private final Regex pattern ;
80
80
private final TStringWithEncoding str ;
81
- private RegexpOptions options ;
82
-
83
- public void setLiteral () {
84
- options = options .setLiteral (true );
85
- }
81
+ private final RegexpOptions options ;
86
82
87
83
public Encoding getEncoding () {
88
84
return pattern .getEncoding ();
@@ -121,8 +117,6 @@ private static Regex getRegexpFromCache(TStringBuilder bytes, RubyEncoding encod
121
117
122
118
public ClassicRegexp (TStringWithEncoding strEnc , RegexpOptions originalOptions )
123
119
throws DeferredRaiseException {
124
- this .options = originalOptions ;
125
-
126
120
if (strEnc .encoding .isDummy ) {
127
121
throw new UnsupportedOperationException ("can't make regexp with dummy encoding" );
128
122
}
@@ -131,12 +125,13 @@ public ClassicRegexp(TStringWithEncoding strEnc, RegexpOptions originalOptions)
131
125
RubyEncoding [] fixedEnc = new RubyEncoding []{ null };
132
126
TStringBuilder unescaped = preprocess (strEnc , strEnc .encoding , fixedEnc , RegexpSupport .ErrorMode .RAISE );
133
127
final RubyEncoding computedEnc = computeRegexpEncoding (optionsArray , strEnc .encoding , fixedEnc );
128
+ final RegexpOptions options = optionsArray [0 ];
134
129
this .pattern = getRegexpFromCache (
135
130
unescaped ,
136
131
computedEnc ,
137
132
options ,
138
133
strEnc .forceEncoding (computedEnc ).tstring );
139
- this .options = optionsArray [ 0 ] ;
134
+ this .options = options ;
140
135
this .str = strEnc ;
141
136
}
142
137
0 commit comments