Fix support for Nullable (language version 8) (#25)
* Only emit #nullable when nullable is supported (>= 8.0) * x * is not
This commit is contained in:
@@ -11,8 +11,8 @@ namespace ProxyInterfaceSourceGenerator.FileGenerators
|
||||
{
|
||||
internal class PartialInterfacesGenerator : BaseGenerator, IFilesGenerator
|
||||
{
|
||||
public PartialInterfacesGenerator(Context context) :
|
||||
base(context)
|
||||
public PartialInterfacesGenerator(Context context, bool supportsNullable) :
|
||||
base(context, supportsNullable)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ProxyInterfaceSourceGenerator.FileGenerators
|
||||
var interfaceName = targetClassSymbol.ResolveInterfaceNameWithOptionalTypeConstraints(pd.InterfaceName);
|
||||
|
||||
var file = new FileData(
|
||||
$"{pd.FileName}.g.cs",
|
||||
$"{targetClassSymbol.GetFileName()}.g.cs",
|
||||
CreatePartialInterfaceCode(pd.Namespace, targetClassSymbol, interfaceName, pd.ProxyAll)
|
||||
);
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace ProxyInterfaceSourceGenerator.FileGenerators
|
||||
// </auto-generated>
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#nullable enable
|
||||
{(_supportsNullable ? "#nullable enable" : string.Empty)}
|
||||
using System;
|
||||
|
||||
namespace {ns}
|
||||
@@ -62,7 +62,7 @@ namespace {ns}
|
||||
{GenerateEvents(targetClassSymbol)}
|
||||
}}
|
||||
}}
|
||||
#nullable disable";
|
||||
{(_supportsNullable ? "#nullable disable" : string.Empty)}";
|
||||
|
||||
private string GenerateProperties(INamedTypeSymbol targetClassSymbol, bool proxyAll)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user