Skip to content

Commit 7ae8a39

Browse files
authored
Replace 'is null' with more compatible clause and fix MSBuild bug. (#465)
- Replace is null usages in generated code with downlevel equivalent to support older versions of C# in client applications - Fix MSBuild task to send bool args correctly. The LottieGen cmdline only allows flags to be set without an associated value arg.
1 parent b242a33 commit 7ae8a39

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

LottieGen/MSBuildTask/LottieGen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ void AddOptionalBool(string parameterName, bool value)
246246
{
247247
if (value)
248248
{
249-
AddArg(parameterName, "true");
249+
args.Add($"-{parameterName}");
250250
}
251251
}
252252

source/UIDataCodeGen/CodeGen/CSharp/CSharpInstantiatorGenerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void WriteThemeProperties(CodeBuilder builder)
211211
builder.WriteLine("set");
212212
builder.OpenScope();
213213
builder.WriteLine($"_theme{prop.BindingName} = value;");
214-
builder.WriteLine($"if ({SourceInfo.ThemePropertiesFieldName} is not null)");
214+
builder.WriteLine($"if ({SourceInfo.ThemePropertiesFieldName} != null)");
215215
builder.OpenScope();
216216
WriteThemePropertyInitialization(builder, SourceInfo.ThemePropertiesFieldName, prop);
217217
builder.CloseScope();
@@ -408,7 +408,7 @@ void WriteThemeMethodsAndFields(CodeBuilder builder)
408408
// EnsureThemeProperties(...) method implementation.
409409
builder.WriteLine("CompositionPropertySet EnsureThemeProperties(Compositor compositor)");
410410
builder.OpenScope();
411-
builder.WriteLine($"if ({SourceInfo.ThemePropertiesFieldName} is null)");
411+
builder.WriteLine($"if ({SourceInfo.ThemePropertiesFieldName} == null)");
412412
builder.OpenScope();
413413
builder.WriteLine($"{SourceInfo.ThemePropertiesFieldName} = compositor.CreatePropertySet();");
414414

@@ -714,7 +714,7 @@ void WriteSetPropertyImpl(
714714
builder.WriteLine();
715715

716716
// Update the CompositionPropertySet if it has been created.
717-
builder.WriteLine($"if ({SourceInfo.ThemePropertiesFieldName} is not null)");
717+
builder.WriteLine($"if ({SourceInfo.ThemePropertiesFieldName} != null)");
718718
builder.OpenScope();
719719

720720
builder.WriteLine($"{SourceInfo.ThemePropertiesFieldName}.Insert{propertySetTypeName}(propertyName, {valueInitializer});");

0 commit comments

Comments
 (0)