11using Microsoft . CodeAnalysis ;
2- using System ;
3- using System . Data . Common ;
4- using System . Diagnostics . CodeAnalysis ;
5- using System . Reflection ;
6- using System . Reflection . Metadata ;
72using System . Text ;
83
94namespace ConsoleAppFramework ;
@@ -28,12 +23,12 @@ public record class Command
2823 public bool IsRootCommand => Name == "" ;
2924 public required string Name { get ; init ; }
3025
31- public required CommandParameter [ ] Parameters { get ; init ; }
26+ public required EquatableArray < CommandParameter > Parameters { get ; init ; }
3227 public required string Description { get ; init ; }
3328 public required MethodKind MethodKind { get ; init ; }
3429 public required DelegateBuildType DelegateBuildType { get ; init ; }
3530 public CommandMethodInfo ? CommandMethodInfo { get ; set ; } // can set...!
36- public required FilterInfo [ ] Filters { get ; init ; }
31+ public required EquatableArray < FilterInfo > Filters { get ; init ; }
3732 public bool HasFilter => Filters . Length != 0 ;
3833
3934 public string ? BuildDelegateSignature ( out string ? delegateType )
@@ -148,7 +143,7 @@ public string BuildDelegateType(string delegateName)
148143
149144public record class CommandParameter
150145{
151- public required ITypeSymbol Type { get ; init ; }
146+ public required EquatableTypeSymbol Type { get ; init ; }
152147 public required Location Location { get ; init ; }
153148 public required WellKnownTypes WellKnownTypes { get ; init ; }
154149 public required bool IsNullableReference { get ; init ; }
@@ -157,7 +152,7 @@ public record class CommandParameter
157152 public required string OriginalParameterName { get ; init ; }
158153 public required bool HasDefaultValue { get ; init ; }
159154 public object ? DefaultValue { get ; init ; }
160- public required ITypeSymbol ? CustomParserType { get ; init ; }
155+ public required EquatableTypeSymbol ? CustomParserType { get ; init ; }
161156 public required bool IsFromServices { get ; init ; }
162157 public required bool IsConsoleAppContext { get ; init ; }
163158 public required bool IsCancellationToken { get ; init ; }
@@ -166,15 +161,15 @@ public record class CommandParameter
166161 public required bool HasValidation { get ; init ; }
167162 public required int ArgumentIndex { get ; init ; } // -1 is not Argument, other than marked as [Argument]
168163 public bool IsArgument => ArgumentIndex != - 1 ;
169- public required string [ ] Aliases { get ; init ; }
164+ public required EquatableArray < string > Aliases { get ; init ; }
170165 public required string Description { get ; init ; }
171166 public bool RequireCheckArgumentParsed => ! ( HasDefaultValue || IsParams || IsFlag ) ;
172167
173168 // increment = false when passed from [Argument]
174169 public string BuildParseMethod ( int argCount , string argumentName , bool increment )
175170 {
176171 var incrementIndex = increment ? "!TryIncrementIndex(ref i, args.Length) || " : "" ;
177- return Core ( Type , false ) ;
172+ return Core ( Type . TypeSymbol , false ) ;
178173
179174 string Core ( ITypeSymbol type , bool nullable )
180175 {
@@ -360,7 +355,7 @@ public record class CommandMethodInfo
360355{
361356 public required string TypeFullName { get ; init ; }
362357 public required string MethodName { get ; init ; }
363- public required ITypeSymbol [ ] ConstructorParameterTypes { get ; init ; }
358+ public required EquatableArray < EquatableTypeSymbol > ConstructorParameterTypes { get ; init ; }
364359 public required bool IsIDisposable { get ; init ; }
365360 public required bool IsIAsyncDisposable { get ; init ; }
366361
@@ -379,7 +374,7 @@ public string BuildNew()
379374public record class FilterInfo
380375{
381376 public required string TypeFullName { get ; init ; }
382- public required ITypeSymbol [ ] ConstructorParameterTypes { get ; init ; }
377+ public required EquatableArray < EquatableTypeSymbol > ConstructorParameterTypes { get ; init ; }
383378
384379 FilterInfo ( )
385380 {
@@ -401,7 +396,7 @@ public record class FilterInfo
401396 var filter = new FilterInfo
402397 {
403398 TypeFullName = type . ToFullyQualifiedFormatDisplayString ( ) ,
404- ConstructorParameterTypes = publicConstructors [ 0 ] . Parameters . Select ( x => x . Type ) . ToArray ( )
399+ ConstructorParameterTypes = publicConstructors [ 0 ] . Parameters . Select ( x => new EquatableTypeSymbol ( x . Type ) ) . ToArray ( )
405400 } ;
406401
407402 return filter ;
0 commit comments