Skip to content

Commit b6da0d5

Browse files
committed
Make ClassicRegexp#options final and remove unused method
1 parent 3c22d4a commit b6da0d5

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/main/java/org/truffleruby/core/regexp/ClassicRegexp.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ public final class ClassicRegexp implements ReOptions {
7878

7979
private final Regex pattern;
8080
private final TStringWithEncoding str;
81-
private RegexpOptions options;
82-
83-
public void setLiteral() {
84-
options = options.setLiteral(true);
85-
}
81+
private final RegexpOptions options;
8682

8783
public Encoding getEncoding() {
8884
return pattern.getEncoding();
@@ -121,8 +117,6 @@ private static Regex getRegexpFromCache(TStringBuilder bytes, RubyEncoding encod
121117

122118
public ClassicRegexp(TStringWithEncoding strEnc, RegexpOptions originalOptions)
123119
throws DeferredRaiseException {
124-
this.options = originalOptions;
125-
126120
if (strEnc.encoding.isDummy) {
127121
throw new UnsupportedOperationException("can't make regexp with dummy encoding");
128122
}
@@ -131,12 +125,13 @@ public ClassicRegexp(TStringWithEncoding strEnc, RegexpOptions originalOptions)
131125
RubyEncoding[] fixedEnc = new RubyEncoding[]{ null };
132126
TStringBuilder unescaped = preprocess(strEnc, strEnc.encoding, fixedEnc, RegexpSupport.ErrorMode.RAISE);
133127
final RubyEncoding computedEnc = computeRegexpEncoding(optionsArray, strEnc.encoding, fixedEnc);
128+
final RegexpOptions options = optionsArray[0];
134129
this.pattern = getRegexpFromCache(
135130
unescaped,
136131
computedEnc,
137132
options,
138133
strEnc.forceEncoding(computedEnc).tstring);
139-
this.options = optionsArray[0];
134+
this.options = options;
140135
this.str = strEnc;
141136
}
142137

0 commit comments

Comments
 (0)