This commit is contained in:
Carl de Billy 2018-02-16 10:33:19 -05:00
Родитель a05d267eaf
Коммит dbd72b2b36
2 изменённых файлов: 18 добавлений и 14 удалений

Просмотреть файл

@ -460,7 +460,7 @@ namespace Uno
// We just show that if the collection is "sorted", because "unsorted" will always work and we don't want
// to do a "SequenceEquals" on an non-ordered structure.
builder.AppendLineInvariant($"// **{member.Name}** To use an _unsorted_ comparer, add the following attribute to your member:");
builder.AppendLineInvariant("// [EqualityCollection(CollectionComparerMode.Unsorted)]");
builder.AppendLineInvariant($"// [{nameof(EqualityComparerOptionsAttribute)}({nameof(CollectionComparerMode)}.{nameof(CollectionComparerMode.Unsorted)})]");
}
using (builder.BlockInvariant($"if(!global::Uno.Equality.{comparer}<{type}, {elementType}>.Default.Equals({member.Name}, other.{member.Name}))"))
@ -509,7 +509,7 @@ namespace Uno
{
if (equalityMode == KeyEqualityUseEquality)
{
using (builder.BlockInvariant($"if(!System.Collections.Generic.EqualityComparer<{type}>.Default.Equals({member.Name}, other.{member.Name}))"))
using (builder.BlockInvariant($"if(!global::System.Collections.Generic.EqualityComparer<{type}>.Default.Equals({member.Name}, other.{member.Name}))"))
{
builder.AppendLineInvariant($"return false; // {member.Name} not equal");
}
@ -558,7 +558,9 @@ namespace Uno
{
if (baseCall == null && hashMembers.Length == 0)
{
builder.AppendLineInvariant("#warning There is no members marked with [Uno.EqualityHash] or [Uno.EqualityKey]. You should add at least one. Documentation: https://github.com/nventive/Uno.CodeGen/blob/master/doc/Equality%20Generation.md");
builder.AppendLineInvariant(
"#warning There is no members marked with [Uno.EqualityHash] or [Uno.EqualityKey]. " +
"You should add at least one. Documentation: https://github.com/nventive/Uno.CodeGen/blob/master/doc/Equality%20Generation.md");
builder.AppendLineInvariant("return 0; // no members to compute hash");
}
else

Просмотреть файл

@ -241,7 +241,7 @@ namespace Uno
else
{
builderTypeNameAndBaseClass = baseTypeInfo.isBaseType
? $"Builder : {baseTypeInfo.builderBaseType}, Uno.IImmutableBuilder<{symbolNameWithGenerics}>"
? $"Builder : {baseTypeInfo.builderBaseType}, global::Uno.IImmutableBuilder<{symbolNameWithGenerics}>"
: $"Builder : global::Uno.IImmutableBuilder<{symbolNameWithGenerics}>";
}
@ -318,7 +318,7 @@ namespace Uno
{
using (builder.BlockInvariant($"public Builder({symbolNameWithGenerics} original)"))
{
builder.AppendLineInvariant($"_original = original ?? throw new ArgumentNullException(nameof(original));");
builder.AppendLineInvariant($"_original = original ?? throw new global::System.ArgumentNullException(nameof(original));");
}
}
else
@ -394,9 +394,7 @@ private bool _is{prop.Name}Set = false;
set
{{
var originalValue = (({symbolNameWithGenerics})_original).{prop.Name};
var isSameAsOriginal = global::System.Collections.Generic.EqualityComparer<{
prop.Type
}>.Default.Equals(originalValue, value);
var isSameAsOriginal = global::System.Collections.Generic.EqualityComparer<{prop.Type}>.Default.Equals(originalValue, value);
if(isSameAsOriginal)
{{
// Property {prop.Name} has been set back to original value
@ -576,8 +574,7 @@ public static implicit operator global::Uno.Option<{symbolNameWithGenerics}>(Bui
builder.AppendLineInvariant($"/// Construct a new immutable instance of {symbolNameForXml} from a builder.");
builder.AppendLineInvariant($"/// </summary>");
builder.AppendLineInvariant("/// <remarks>");
builder.AppendLineInvariant(
"/// Application code should prefer the usage of implicit casting which is calling this constructor.");
builder.AppendLineInvariant("/// Application code should prefer the usage of implicit casting which is calling this constructor.");
builder.AppendLineInvariant("/// </remarks>");
builder.AppendLineInvariant($"/// <param name=\"builder\">The builder for {symbolNameForXml}.</param>");
@ -587,7 +584,7 @@ public static implicit operator global::Uno.Option<{symbolNameWithGenerics}>(Bui
using (builder.BlockInvariant($"public {symbolName}(Builder builder){baseConstructorChaining}"))
{
builder.AppendLineInvariant("if(builder == null) throw new ArgumentNullException(nameof(builder));");
builder.AppendLineInvariant("if(builder == null) throw new global::System.ArgumentNullException(nameof(builder));");
foreach (var (prop, _) in properties)
{
@ -805,7 +802,10 @@ $@"public sealed class {symbolName}BuilderJsonConverterTo{symbolName}{genericArg
if (type is IArrayTypeSymbol)
{
builder.AppendLineInvariant(
$"#error {nameof(ImmutableGenerator)}: {typeSource} type {type} is an array, which is not immutable. You can treat arrays as immutable by setting a global attribute [assembly: Uno.ImmutableGenerationOptions(TreatArrayAsImmutable = true)].");
$"#error {nameof(ImmutableGenerator)}: {typeSource} type {type} is an array, which is not immutable. "
+ "You can treat arrays as immutable by setting a global attribute "
+ "[assembly: Uno.ImmutableGenerationOptions(TreatArrayAsImmutable = true)].");
}
else
{
@ -832,7 +832,8 @@ $@"public sealed class {symbolName}BuilderJsonConverterTo{symbolName}{genericArg
if (!prop.IsReadOnly)
{
builder.AppendLineInvariant(
$"#error {nameof(ImmutableGenerator)}: Non-static property {symbolNames.SymbolNameWithGenerics}.{prop.Name} cannot have a setter, even a private one. You must remove it for immutable generation.");
$"#error {nameof(ImmutableGenerator)}: Non-static property {symbolNames.SymbolNameWithGenerics}.{prop.Name} "
+ "cannot have a setter, even a private one. You must remove it for immutable generation.");
}
if (!typeSymbol.IsAbstract)
@ -860,7 +861,8 @@ $@"public sealed class {symbolName}BuilderJsonConverterTo{symbolName}{genericArg
if (!field.IsStatic)
{
builder.AppendLineInvariant(
$"#error {nameof(ImmutableGenerator)}: Immutable type {symbolNames.SymbolNameWithGenerics} cannot have a non-static field {field.Name}. You must remove it for immutable generation.");
$"#error {nameof(ImmutableGenerator)}: Immutable type {symbolNames.SymbolNameWithGenerics} cannot "
+ "have a non-static field {field.Name}. You must remove it for immutable generation.");
}
}
}