fix(codegen): Fixes bulk order deed hue and codegens (#647)
- [X] Codegens some Bulk Order stuff - [X] Fixes deserializing with a class that requires the parent as a constructor argument Closes #641 Closes #623
This commit is contained in:
parent
eb4e3ac070
commit
510d2e006b
32 changed files with 185 additions and 378 deletions
|
|
@ -13,6 +13,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
|
@ -66,7 +67,12 @@ namespace SerializationGenerator
|
|||
symbol is INamedTypeSymbol namedSymbol &&
|
||||
symbols.Contains(namedSymbol, SymbolEqualityComparer.Default);
|
||||
|
||||
public static bool HasGenericReaderCtor(this INamedTypeSymbol symbol, Compilation compilation, out bool requiresParent)
|
||||
public static bool HasGenericReaderCtor(
|
||||
this INamedTypeSymbol symbol,
|
||||
Compilation compilation,
|
||||
ISymbol? parentSymbol,
|
||||
out bool requiresParent
|
||||
)
|
||||
{
|
||||
var genericReaderInterface = compilation.GetTypeByMetadataName(GENERIC_READER_INTERFACE);
|
||||
var genericCtor = symbol.Constructors.FirstOrDefault(
|
||||
|
|
@ -76,7 +82,7 @@ namespace SerializationGenerator
|
|||
SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, genericReaderInterface)
|
||||
);
|
||||
|
||||
requiresParent = genericCtor?.Parameters.Length == 2 && SymbolEqualityComparer.Default.Equals(genericCtor.Parameters[1].Type, symbol);
|
||||
requiresParent = genericCtor?.Parameters.Length == 2 && SymbolEqualityComparer.Default.Equals(genericCtor.Parameters[1].Type, parentSymbol);
|
||||
return genericCtor != null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue