Skip to content

Commit 9799eea

Browse files
Copilotstephentoub
andcommitted
Apply ILiteralOperation handling symmetrically to both pattern and options arguments
Co-authored-by: stephentoub <[email protected]>
1 parent 970bc3e commit 9799eea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libraries/System.Text.RegularExpressions/gen/UpgradeToGeneratedRegexCodeFixer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,13 @@ static RegexOptions GetRegexOptionsFromArgument(ImmutableArray<IArgumentOperatio
303303
// For patterns, let the normal logic below handle the formatting
304304
}
305305

306-
// Handle literal operations for pattern
307-
if (parameterName == UpgradeToGeneratedRegexAnalyzer.PatternArgumentName && argument.Value is ILiteralOperation literalOperation)
306+
// Handle literal operations for both pattern and options
307+
if (argument.Value is ILiteralOperation literalOperation)
308308
{
309309
return literalOperation.Syntax;
310310
}
311311

312-
// Handle options
312+
// Handle options that are not literal operations
313313
if (parameterName == UpgradeToGeneratedRegexAnalyzer.OptionsArgumentName)
314314
{
315315
// For RegexOptions that are not constant field references, expand the value

0 commit comments

Comments
 (0)