Skip to content

Commit 42ae4ed

Browse files
committed
Avoid duplicate ClassicRegexp + org.joni.Regex creation for static Regexp literals
1 parent 5f2e980 commit 42ae4ed

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,7 @@ public String[] getNames() {
10051005
// From ParserSupport#newRegexpNode
10061006
public static TStringWithEncoding findEncodingForRegexpLiteral(TStringWithEncoding regexp, RegexpOptions options,
10071007
RubyEncoding lexerEncoding, Node currentNode) throws DeferredRaiseException {
1008-
TStringWithEncoding meat = regexpFragmentCheck(regexp, options, lexerEncoding, currentNode);
1009-
checkRegexpSyntax(meat, options.withoutOnce());
1010-
return meat;
1008+
return regexpFragmentCheck(regexp, options, lexerEncoding, currentNode);
10111009
}
10121010

10131011
// MRI: reg_fragment_check
@@ -1053,11 +1051,6 @@ private static TStringWithEncoding setRegexpEncoding(TStringWithEncoding value,
10531051
return value;
10541052
}
10551053

1056-
private static ClassicRegexp checkRegexpSyntax(TStringWithEncoding value, RegexpOptions options)
1057-
throws DeferredRaiseException {
1058-
return new ClassicRegexp(value, options);
1059-
}
1060-
10611054
private static char optionsEncodingChar(Encoding optionEncoding) {
10621055
if (optionEncoding == USASCIIEncoding.INSTANCE) {
10631056
return 'n';

0 commit comments

Comments
 (0)