Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
<CompilerVisibleItemMetadata Include="AdditionalFiles" MetadataName="Inflator" />
<CompilerVisibleProperty Include="MauiXamlNoWarn" />
<CompilerVisibleItemMetadata Include="AdditionalFiles" MetadataName="NoWarn" />
<CompilerVisibleProperty Include="MauiXamlEnableDiagnostics" />
<CompilerVisibleProperty Include="EnableMauiXamlDiagnostics" />
<CompilerVisibleItemMetadata Include="AdditionalFiles" MetadataName="EnableDiagnostics" />
<CompilerVisibleProperty Include="MauiXamlLineInfo" />
<CompilerVisibleItemMetadata Include="AdditionalFiles" MetadataName="LineInfo" />
<CompilerVisibleProperty Include="MauiXamlNullable" />
<CompilerVisibleItemMetadata Include="AdditionalFiles" MetadataName="Nullable" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<_MauiXamlInflator Condition="' $(MauiXamlInflator)' != '' ">$(MauiXamlInflator)</_MauiXamlInflator>
<_MauiXamlInflator Condition=" '$(MauiXamlInflator)' == '' And '$(Configuration)' == 'Debug' ">Runtime</_MauiXamlInflator>
<_MauiXamlInflator Condition=" '$(MauiXamlInflator)' == '' And '$(Configuration)' != 'Debug' ">XamlC</_MauiXamlInflator>

<EnableMauiXamlDiagnostics Condition=" '$(EnableMauiXamlDiagnostics)' == '' ">$(EnableMauiDiagnostics)</EnableMauiXamlDiagnostics>
<EnableMauiXamlDiagnostics Condition=" '$(EnableMauiXamlDiagnostics)' == '' And '$(Configuration)' == 'Debug' ">$(EnableDiagnostics)</EnableMauiXamlDiagnostics>
<EnableMauiXamlDiagnostics Condition=" '$(EnableMauiXamlDiagnostics)' == '' And '$(Configuration)' == 'Debug' ">true</EnableMauiXamlDiagnostics>
Comment on lines +14 to +16

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These defaults make sense, as I don't think we want $(EnableDiagnostics) to default to true in the iOS/Android workloads.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

y, I like those defaults as well


<MauiXamlNoWarn Condition=" '$(MauiXamlNoWarn)' != '' ">$(MauiXamlNoWarn.Replace(';', ','))</MauiXamlNoWarn>

<!-- The WINUI check for this only runs when there is an empty string so I just convert false to an empty string to fall in line with our other properties -->
<SkipMicrosoftUIXamlCheckTargetPlatformVersion Condition="'$(SkipMicrosoftUIXamlCheckTargetPlatformVersion)'==''">true</SkipMicrosoftUIXamlCheckTargetPlatformVersion>
Expand Down Expand Up @@ -83,6 +89,7 @@
<!-- Assign the default inflator to MauiXaml that don't have any -->
<!-- there's a roslyn bug that stops parsing value at the first semicolon. replace them all https://github.com/dotnet/roslyn/issues/43970 -->
<MauiXaml Inflator="$([MSBuild]::ValueOrDefault('%(MauiXaml.Inflator)','$(_MauiXamlInflator)').Replace(';', ','))"/>
<MauiXaml NoWarn="$([MSBuild]::ValueOrDefault('%(MauiXaml.NoWarn)','').Replace(';', ','))"/>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you know, that roslyn bug...


<_MauiXaml_SG Remove="@(_MauiXaml_SG)" />
<_MauiXaml_RT Remove="@(_MauiXaml_RT)" />
Expand Down
2 changes: 0 additions & 2 deletions src/Controls/src/SourceGen/CodeBehindCodeWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ void InitComp(string methodName, bool empty = false, bool partialsignature = fal

if (empty)
{
sb.AppendLine("#if _MAUIXAML_SG_NULLABLE_ENABLE");
sb.AppendLine("#nullable enable");
sb.AppendLine("#endif");
}

sb.AppendLine();
Expand Down
2 changes: 2 additions & 0 deletions src/Controls/src/SourceGen/CodeBehindGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public void Initialize(IncrementalGeneratorInitializationContext initContext)
context.AddSource("GlobalXmlns.g.cs", SourceText.From(
$"""
{AutoGeneratedHeaderText}
#nullable enable

[assembly: global::Microsoft.Maui.Controls.XmlnsDefinition("{XamlParser.MauiGlobalUri}", "{XamlParser.MauiUri}")]
[assembly: global::Microsoft.Maui.Controls.XmlnsPrefix("{XamlParser.MauiGlobalUri}", "global")]
Expand Down Expand Up @@ -190,6 +191,7 @@ public void Initialize(IncrementalGeneratorInitializationContext initContext)

var sb = new StringBuilder();
sb.AppendLine(AutoGeneratedHeaderText);
sb.AppendLine("#nullable enable");
foreach (var xmlns in xmlnsCache.GlobalGeneratedXmlnsDefinitions)
sb.AppendLine($"[assembly: global::Microsoft.Maui.Controls.XmlnsDefinition(\"{xmlns.XmlNamespace}\", \"{xmlns.Target}\", AssemblyName = \"{EscapeIdentifier(xmlns.AssemblyName)}\")]");

Expand Down
9 changes: 1 addition & 8 deletions src/Controls/src/SourceGen/Controls.SourceGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
<NoWarn>$(NoWarn);NU5128;</NoWarn>
<IsRoslynComponent>true</IsRoslynComponent>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<!--
_SOURCEGEN_* constants:
They should be all turned on, disabling them makes it easier to read the generated code while debugging the generator.
- _SOURCEGEN_LINEINFO_ENABLE: Augment the code with #line directives.
- _SOURCEGEN_SOURCEINFO_ENABLE: write calls to RegisterSourceInfo (between conditions) for Instrumentation purposes
-->
<DefineConstants>$(DefineConstants);__SOURCEGEN__;_SOURCEGEN_LINEINFO_ENABLE;_SOURCEGEN_SOURCEINFO_ENABLE</DefineConstants>
<!-- <DefineConstants>$(DefineConstants);__SOURCEGEN__</DefineConstants> -->
<DefineConstants>$(DefineConstants);__SOURCEGEN__</DefineConstants>
</PropertyGroup>

<PropertyGroup>
Expand Down
41 changes: 27 additions & 14 deletions src/Controls/src/SourceGen/GeneratorHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ static class GeneratorHelpers
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#if _MAUIXAML_SG_NULLABLE_ENABLE
#nullable enable
#endif
";
//------------------------------------------------------------------------------";

public static string EscapeIdentifier(string identifier)
{
Expand All @@ -45,21 +41,24 @@ public static string EscapeIdentifier(string identifier)
var (additionalText, optionsProvider) = tuple;
var fileOptions = optionsProvider.GetOptions(additionalText);
if (!fileOptions.TryGetValue("build_metadata.additionalfiles.GenKind", out string? kind) || kind is null)
{
return null;
}

fileOptions.TryGetValue("build_metadata.additionalfiles.TargetPath", out var targetPath);
fileOptions.TryGetValue("build_metadata.additionalfiles.ManifestResourceName", out var manifestResourceName);
fileOptions.TryGetValue("build_metadata.additionalfiles.RelativePath", out var relativePath);
fileOptions.TryGetValue("build_property.targetframework", out var targetFramework);
fileOptions.TryGetValue("build_property.Configuration", out var configuration);

fileOptions.TryGetValue("build_metadata.additionalfiles.Inflator", out var inflator);

bool enableDiagnostics = false;
if (fileOptions.TryGetValue("build_property.EnableMauiXamlDiagnostics", out var enDiag) && string.Compare(enDiag, "true", StringComparison.OrdinalIgnoreCase) == 0)
enableDiagnostics = true;
if (fileOptions.TryGetValue("build_property.additionalfiles.EnableDiagnostics", out enDiag) && string.Compare(enDiag, "true", StringComparison.OrdinalIgnoreCase) == 0)
enableDiagnostics = true;
if (fileOptions.TryGetValue("build_property.additionalfiles.EnableDiagnostics", out enDiag) && string.Compare(enDiag, "false", StringComparison.OrdinalIgnoreCase) == 0)
enableDiagnostics = false;

var xamlinflator = 0;
if (!string.IsNullOrEmpty(inflator))
if (fileOptions.TryGetValue("build_metadata.additionalfiles.Inflator", out var inflator) && !string.IsNullOrEmpty(inflator))
{
var parts = inflator!.Split(',');
for (int i = 0; i < parts.Length; i++)
Expand All @@ -71,6 +70,20 @@ public static string EscapeIdentifier(string identifier)
}
}

var enableLineInfo = true;
if (fileOptions.TryGetValue("build_property.MauiXamlLineInfo", out var lineInfo) && string.Compare(lineInfo, "disable", StringComparison.OrdinalIgnoreCase) == 0)
enableLineInfo = false;
if (fileOptions.TryGetValue("build_metadata.additionalfiles.LineInfo", out lineInfo) && string.Compare(lineInfo, "enable", StringComparison.OrdinalIgnoreCase) == 0)
enableLineInfo = true;
if (fileOptions.TryGetValue("build_metadata.additionalfiles.LineInfo", out lineInfo) && string.Compare(lineInfo, "disable", StringComparison.OrdinalIgnoreCase) == 0)
enableLineInfo = false;

string noWarn = "";
if (fileOptions.TryGetValue("build_property.MauiXamlNoWarn", out var noWarnValue))
noWarn = noWarnValue;
if (fileOptions.TryGetValue("build_metadata.additionalfiles.NoWarn", out noWarnValue))
noWarn = noWarnValue;

return new ProjectItem
{
AdditionalText = additionalText,
Expand All @@ -79,6 +92,9 @@ public static string EscapeIdentifier(string identifier)
ManifestResourceName = manifestResourceName,
Kind = kind,
Inflator = (XamlInflator)xamlinflator,
EnableLineInfo = enableLineInfo,
EnableDiagnostics = enableDiagnostics,
NoWarn = noWarn,
TargetFramework = targetFramework,
Configuration = configuration!,
};
Expand Down Expand Up @@ -142,10 +158,7 @@ public static string EscapeIdentifier(string identifier)
continue;
}

var rootnode = new SGRootNode(new XmlType(reader.NamespaceURI, reader.Name, XamlParser.GetTypeArguments(reader)), /*typeReference, */(IXmlNamespaceResolver)reader, ((IXmlLineInfo)reader).LineNumber, ((IXmlLineInfo)reader).LinePosition)
{
DisableWarnings = warningDisableList,
};
var rootnode = new SGRootNode(new XmlType(reader.NamespaceURI, reader.Name, XamlParser.GetTypeArguments(reader)), /*typeReference, */(IXmlNamespaceResolver)reader, ((IXmlLineInfo)reader).LineNumber, ((IXmlLineInfo)reader).LinePosition);
XamlParser.ParseXaml(rootnode, reader);

return rootnode;
Expand Down
30 changes: 12 additions & 18 deletions src/Controls/src/SourceGen/InitializeComponentCodeWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ static class InitializeComponentCodeWriter
static readonly string NewLine = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "\r\n" : "\n";

public static string GeneratedCodeAttribute => $"[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{typeof(InitializeComponentCodeWriter).Assembly.FullName}\", \"{typeof(InitializeComponentCodeWriter).Assembly.GetName().Version}\")]";
const string AutoGeneratedHeaderText = @"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a .NET MAUI source generator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#if _MAUIXAML_SG_NULLABLE_ENABLE
#nullable enable
#endif
";

public static string GenerateInitializeComponent(XamlProjectItemForIC xamlItem, Compilation compilation, SourceProductionContext sourceProductionContext, AssemblyCaches xmlnsCache, IDictionary<XmlType, ITypeSymbol> typeCache)
{
Expand All @@ -37,11 +24,13 @@ public static string GenerateInitializeComponent(XamlProjectItemForIC xamlItem,
PrePost newblock() =>
PrePost.NewBlock(codeWriter);

codeWriter.WriteLine(AutoGeneratedHeaderText);
var warningDisable = xamlItem.Root!.DisableWarnings != null ? string.Join(", ", xamlItem.Root!.DisableWarnings) : null;
if (warningDisable != null && warningDisable.Length > 0)
codeWriter.WriteLine(GeneratorHelpers.AutoGeneratedHeaderText);
codeWriter.WriteLine("#nullable enable");
codeWriter.WriteLine();

if (xamlItem.ProjectItem.NoWarn != null && xamlItem.ProjectItem.NoWarn.Length > 0)
{
codeWriter.WriteLine($"#pragma warning disable {warningDisable}");
codeWriter.WriteLine($"#pragma warning disable {xamlItem.ProjectItem.NoWarn}");
codeWriter.WriteLine();
}
var root = xamlItem.Root!;
Expand Down Expand Up @@ -97,7 +86,12 @@ PrePost newblock() =>
var methodName = genSwitch ? "InitializeComponentSourceGen" : "InitializeComponent";
codeWriter.WriteLine($"private partial void {methodName}()");
xamlItem.Root!.XmlType.TryResolveTypeSymbol(null, compilation, xmlnsCache, out var baseType);
var sgcontext = new SourceGenContext(codeWriter, compilation, sourceProductionContext, xmlnsCache, typeCache, rootType!, baseType) { FilePath = xamlItem.ProjectItem.RelativePath };
var sgcontext = new SourceGenContext(codeWriter, compilation, sourceProductionContext, xmlnsCache, typeCache, rootType!, baseType)
{
FilePath = xamlItem.ProjectItem.RelativePath,
EnableLineInfo = xamlItem.ProjectItem.EnableLineInfo,
EnableDiagnostics = xamlItem.ProjectItem.EnableDiagnostics,
};
using (newblock())
{
Visit(root, sgcontext);
Expand Down
24 changes: 12 additions & 12 deletions src/Controls/src/SourceGen/NodeSGExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,28 +527,28 @@ public static bool TryProvideValue(this ElementNode node, SourceGenContext conte
return true;
}

[Conditional("_SOURCEGEN_SOURCEINFO_ENABLE")]
public static void RegisterSourceInfo(this INode node, SourceGenContext context, IndentedTextWriter writer, bool update = true)
{
if (!context.EnableDiagnostics)
return;

if (!context.Variables.TryGetValue(node, out var variable))
return;

var assembly = context.Compilation.Assembly.Name;
var filePath = context.FilePath;
var lineInfo = node as IXmlLineInfo;
using (PrePost.NewConditional(writer, "_MAUIXAML_SG_SOURCEINFO"))

if (!update)
{
if (!update)
{
writer.WriteLine($"if (global::Microsoft.Maui.VisualDiagnostics.GetSourceInfo({variable.Name}!) == null)");
writer.Indent++;
}
// on other inflators, we do not replace path separator, so keep the bug for compat
// filePath = new UriBuilder() { Path = filePath }.Path; // ensure the file use the right separator
writer.WriteLine($"global::Microsoft.Maui.VisualDiagnostics.RegisterSourceInfo({variable.Name}!, new global::System.Uri(@\"{filePath};assembly={assembly}\", global::System.UriKind.Relative), {lineInfo?.LineNumber ?? -1}, {lineInfo?.LinePosition ?? -1});");
if (!update)
writer.Indent--;
writer.WriteLine($"if (global::Microsoft.Maui.VisualDiagnostics.GetSourceInfo({variable.Name}!) == null)");
writer.Indent++;
}
// on other inflators, we do not replace path separator, so keep the bug for compat
// filePath = new UriBuilder() { Path = filePath }.Path; // ensure the file use the right separator
writer.WriteLine($"global::Microsoft.Maui.VisualDiagnostics.RegisterSourceInfo({variable.Name}!, new global::System.Uri(@\"{filePath};assembly={assembly}\", global::System.UriKind.Relative), {lineInfo?.LineNumber ?? -1}, {lineInfo?.LinePosition ?? -1});");
if (!update)
writer.Indent--;
}

static bool IsOfAnyType(XmlType xmlType, params string[] types)
Expand Down
22 changes: 13 additions & 9 deletions src/Controls/src/SourceGen/PrePost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ class PrePost : IDisposable
/// <param name="fileName"></param>
/// <returns></returns>
public static PrePost NewLineInfo(IndentedTextWriter codeWriter, IXmlLineInfo iXmlLineInfo, string? fileName)
=> new(() => LineInfo(codeWriter, iXmlLineInfo, fileName), () => LineDefault(codeWriter, iXmlLineInfo));
{
static void LineInfo(IndentedTextWriter codeWriter, IXmlLineInfo iXmlLineInfo, string? fileName)
=> codeWriter.WriteLineNoTabs($"#line {(iXmlLineInfo.LineNumber != -1 ? iXmlLineInfo.LineNumber : 1)} \"{fileName}\"");

static void LineDefault(IndentedTextWriter codeWriter, IXmlLineInfo iXmlLineInfo)
=> codeWriter.WriteLineNoTabs("#line default");

return new(() => LineInfo(codeWriter, iXmlLineInfo, fileName), () => LineDefault(codeWriter, iXmlLineInfo));
}

public static PrePost NoBlock() =>
new(() => { }, () => { });

public static PrePost NewConditional(IndentedTextWriter codeWriter, string condition, Action? orElse = null)
{
Expand All @@ -33,6 +44,7 @@ public static PrePost NewConditional(IndentedTextWriter codeWriter, string condi

public static PrePost NewDisableWarning(IndentedTextWriter codeWriter, string warning)
=> new(() => codeWriter.WriteLineNoTabs($"#pragma warning disable {warning}"), () => codeWriter.WriteLineNoTabs($"#pragma warning restore {warning}"));
Comment thread
StephaneDelcroix marked this conversation as resolved.

readonly Action post;
PrePost(Action pre, Action post)
{
Expand Down Expand Up @@ -66,12 +78,4 @@ public static PrePost NewBlock(IndentedTextWriter codeWriter, string begin = "{"
else
codeWriter.WriteLine(end);
});

[Conditional("_SOURCEGEN_LINEINFO_ENABLE")]
static void LineInfo(IndentedTextWriter codeWriter, IXmlLineInfo iXmlLineInfo, string? fileName)
=> codeWriter.WriteLineNoTabs($"#line {(iXmlLineInfo.LineNumber != -1 ? iXmlLineInfo.LineNumber : 1)} \"{fileName}\"");

[Conditional("_SOURCEGEN_LINEINFO_ENABLE")]
static void LineDefault(IndentedTextWriter codeWriter, IXmlLineInfo iXmlLineInfo)
=> codeWriter.WriteLineNoTabs("#line default");
}
3 changes: 3 additions & 0 deletions src/Controls/src/SourceGen/ProjectItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ record ProjectItem

//bypass attribute check. used for testing
public string Configuration { get; internal set; } = "Debug";
public bool EnableLineInfo { get; internal set; } = true;
public bool EnableDiagnostics { get; internal set; } = false;
public string NoWarn { get; internal set; } = "";
}
2 changes: 0 additions & 2 deletions src/Controls/src/SourceGen/SGRootNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ public SGRootNode(XmlType xmlType, /*TypeReference typeReference,*/ IXmlNamespac
// TypeReference = typeReference;
}

public IList<string>? DisableWarnings { get; internal set; }

// public TypeReference TypeReference { get; private set; }
}
3 changes: 3 additions & 0 deletions src/Controls/src/SourceGen/SourceGenContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class SourceGenContext(IndentedTextWriter writer, Compilation compilation, Sourc
public IDictionary<LocalVariable, HashSet<string>> KeysInRD { get; } = new Dictionary<LocalVariable, HashSet<string>>();
public IDictionary<(LocalVariable, IFieldSymbol?, IPropertySymbol?), LocalVariable> VariablesProperties { get; } = new Dictionary<(LocalVariable, IFieldSymbol?, IPropertySymbol?), LocalVariable>();
public IList<string> LocalMethods { get; } = new List<string>();
public bool EnableLineInfo { get; set; }
public bool EnableDiagnostics { get; internal set; }

public void AddLocalMethod(string code)
{
if (ParentContext != null)
Expand Down
14 changes: 10 additions & 4 deletions src/Controls/src/SourceGen/Visitors/SetPropertiesVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ public void Visit(ElementNode node, INode parentNode)
Writer.WriteLine($"{variable.Name}.LoadTemplate = () =>");
using (PrePost.NewBlock(Writer, begin: "{", end: "};"))
{
var templateContext = new SourceGenContext(Writer, context.Compilation, context.SourceProductionContext, context.XmlnsCache, context.TypeCache, context.RootType!, null) { FilePath = context.FilePath, ParentContext = context };
var templateContext = new SourceGenContext(Writer, context.Compilation, context.SourceProductionContext, context.XmlnsCache, context.TypeCache, context.RootType!, null)
{
FilePath = context.FilePath,
ParentContext = context,
EnableLineInfo = context.EnableLineInfo,
EnableDiagnostics = context.EnableDiagnostics,
};

//inflate the template
node.Accept(new CreateValuesVisitor(templateContext), null);
Expand Down Expand Up @@ -487,14 +493,14 @@ static void Set(IndentedTextWriter writer, LocalVariable parentVar, string local

if (node is ValueNode valueNode)
{
using (PrePost.NewLineInfo(writer, (IXmlLineInfo)node, context.FilePath))
using (context.EnableLineInfo ? PrePost.NewLineInfo(writer, (IXmlLineInfo)node, context.FilePath) : PrePost.NoBlock())
{
var valueString = valueNode.ConvertTo(property, context, parentVar);
writer.WriteLine($"{parentVar.Name}.{EscapeIdentifier(localName)} = {valueString};");
}
}
else if (node is ElementNode elementNode)
using (PrePost.NewLineInfo(writer, (IXmlLineInfo)node, context.FilePath))
using (context.EnableLineInfo ? PrePost.NewLineInfo(writer, (IXmlLineInfo)node, context.FilePath) : PrePost.NoBlock())
writer.WriteLine($"{parentVar.Name}.{EscapeIdentifier(localName)} = ({property.Type.ToFQDisplayString()}){(HasDoubleImplicitConversion(context.Variables[elementNode].Type, property.Type, context, out var conv) ? "(" + conv!.ReturnType.ToFQDisplayString() + ")" : string.Empty)}{context.Variables[elementNode].Name};");
}

Expand Down Expand Up @@ -623,7 +629,7 @@ static void Add(IndentedTextWriter writer, LocalVariable parentVar, XmlName prop
if (HasDoubleImplicitConversion(context.Variables[valueNode].Type, itemType, context, out var conv))
cast = "(" + conv!.ReturnType.ToFQDisplayString() + ")";

using (PrePost.NewLineInfo(writer, (IXmlLineInfo)valueNode, context.FilePath))
using (context.EnableLineInfo ? PrePost.NewLineInfo(writer, (IXmlLineInfo)valueNode, context.FilePath) : PrePost.NoBlock())
writer.WriteLine($"{parentObj}.Add(({itemType.ToFQDisplayString()}){cast}{context.Variables[valueNode].Name});");
}

Expand Down
Loading
Loading