@@ -54,6 +54,7 @@ internal static class Program
5454 private static readonly string [ ] s_withManualImportOptionAliases = [ "--with-manual-import" , "-wmi" ] ;
5555 private static readonly string [ ] s_withNamespaceOptionAliases = [ "--with-namespace" , "-wn" ] ;
5656 private static readonly string [ ] s_withPackingOptionAliases = [ "--with-packing" , "-wp" ] ;
57+ private static readonly string [ ] s_withReadonlyOptionAliases = [ "--with-readonly" , "-wro" ] ;
5758 private static readonly string [ ] s_withSetLastErrorOptionAliases = [ "--with-setlasterror" , "-wsle" ] ;
5859 private static readonly string [ ] s_withSuppressGCTransitionOptionAliases = [ "--with-suppressgctransition" , "-wsgct" ] ;
5960 private static readonly string [ ] s_withTransparentStructOptionAliases = [ "--with-transparent-struct" , "-wts" ] ;
@@ -92,6 +93,7 @@ internal static class Program
9293 private static readonly Option < string [ ] > s_withManualImports = GetWithManualImportOption ( ) ;
9394 private static readonly Option < string [ ] > s_withNamespaceNameValuePairs = GetWithNamespaceOption ( ) ;
9495 private static readonly Option < string [ ] > s_withPackingNameValuePairs = GetWithPackingOption ( ) ;
96+ private static readonly Option < string [ ] > s_withReadonlys = GetWithReadonlyOption ( ) ;
9597 private static readonly Option < string [ ] > s_withSetLastErrors = GetWithSetLastErrorOption ( ) ;
9698 private static readonly Option < string [ ] > s_withSuppressGCTransitions = GetWithSuppressGCTransitionOption ( ) ;
9799 private static readonly Option < string [ ] > s_withTransparentStructNameValuePairs = GetWithTransparentStructOption ( ) ;
@@ -255,6 +257,7 @@ public static void Run(InvocationContext context)
255257 var withLibraryPathNameValuePairs = context . ParseResult . GetValueForOption ( s_withLibraryPathNameValuePairs ) ?? [ ] ;
256258 var withManualImports = context . ParseResult . GetValueForOption ( s_withManualImports ) ?? [ ] ;
257259 var withNamespaceNameValuePairs = context . ParseResult . GetValueForOption ( s_withNamespaceNameValuePairs ) ?? [ ] ;
260+ var withReadonlys = context . ParseResult . GetValueForOption ( s_withReadonlys ) ?? [ ] ;
258261 var withSetLastErrors = context . ParseResult . GetValueForOption ( s_withSetLastErrors ) ?? [ ] ;
259262 var withSuppressGCTransitions = context . ParseResult . GetValueForOption ( s_withSuppressGCTransitions ) ?? [ ] ;
260263 var withTransparentStructNameValuePairs = context . ParseResult . GetValueForOption ( s_withTransparentStructNameValuePairs ) ?? [ ] ;
@@ -729,6 +732,7 @@ public static void Run(InvocationContext context)
729732 WithLibraryPaths = withLibraryPaths ,
730733 WithManualImports = withManualImports ,
731734 WithNamespaces = withNamespaces ,
735+ WithReadonlys = withReadonlys ,
732736 WithSetLastErrors = withSetLastErrors ,
733737 WithSuppressGCTransitions = withSuppressGCTransitions ,
734738 WithTransparentStructs = withTransparentStructs ,
@@ -1202,6 +1206,7 @@ private static RootCommand GetRootCommand()
12021206 s_withManualImports ,
12031207 s_withNamespaceNameValuePairs ,
12041208 s_withPackingNameValuePairs ,
1209+ s_withReadonlys ,
12051210 s_withSetLastErrors ,
12061211 s_withSuppressGCTransitions ,
12071212 s_withTransparentStructNameValuePairs ,
@@ -1350,6 +1355,17 @@ private static Option<string[]> GetWithNamespaceOption()
13501355 } ;
13511356 }
13521357
1358+ private static Option < string [ ] > GetWithReadonlyOption ( )
1359+ {
1360+ return new Option < string [ ] > (
1361+ aliases : s_withReadonlyOptionAliases ,
1362+ description : "Add the readonly modifier to a given instance method. Supports wildcards." ,
1363+ getDefaultValue : Array . Empty < string >
1364+ ) {
1365+ AllowMultipleArgumentsPerToken = true
1366+ } ;
1367+ }
1368+
13531369 private static Option < string [ ] > GetWithSetLastErrorOption ( )
13541370 {
13551371 return new Option < string [ ] > (
0 commit comments