Skip to content

Commit

Permalink
Apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
buyaa-n committed Aug 1, 2022
1 parent 18f5a44 commit 46aa74c
Show file tree
Hide file tree
Showing 16 changed files with 207 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ static string AppendMessage(Versions attribute, string message)
{
if (attribute.UnsupportedMessage is not null)
{
message += $"{CommaSeparator}{attribute.UnsupportedMessage}";
message += string.Format(CultureInfo.InvariantCulture, ParenthesisWithPlaceHolder, attribute.UnsupportedMessage);
}

return message;
Expand All @@ -942,12 +942,16 @@ static string AppendMessageAndUrl(Versions attribute, string message)
{
if (attribute.ObsoletedMessage is not null)
{
message += $"{CommaSeparator}{attribute.ObsoletedMessage}";
string customMessge = attribute.ObsoletedMessage;
if (attribute.ObsoletedUrl is not null)
{
customMessge = $"{customMessge} {attribute.ObsoletedUrl}";
}
message += string.Format(CultureInfo.InvariantCulture, ParenthesisWithPlaceHolder, customMessge);
}

if (attribute.ObsoletedUrl is not null)
else if (attribute.ObsoletedUrl is not null)
{
message += $" {attribute.ObsoletedUrl}";
message += string.Format(CultureInfo.InvariantCulture, ParenthesisWithPlaceHolder, attribute.ObsoletedUrl);
}

return message;
Expand Down Expand Up @@ -1001,9 +1005,11 @@ static bool GetPlatformNames(SmallDictionary<string, Versions> attributes, Small
platformsBuilder.Add(AppendMessage(pAttribute,
GetFormattedString(PlatformCompatibilityFromVersionToVersion, pName, unsupportedVersion, supportedVersion)));
}
continue;
}
platformsBuilder.Add(AppendMessage(pAttribute, GetFormattedString(PlatformCompatibilityVersionAndLater, pName, supportedVersion)));
else
{
platformsBuilder.Add(AppendMessage(pAttribute, GetFormattedString(PlatformCompatibilityVersionAndLater, pName, supportedVersion)));
}
}
else
{
Expand All @@ -1018,9 +1024,11 @@ static bool GetPlatformNames(SmallDictionary<string, Versions> attributes, Small
if (csAttributes != null && HasSameVersionedPlatformSupport(csAttributes, pName, checkSupport: true))
{
platformsBuilder.Add(AppendMessage(pAttribute, GetFormattedString(PlatformCompatibilityAllVersions, pName)));
continue;
}
platformsBuilder.Add(AppendMessage(pAttribute, EncloseWithQuotes(pName)));
else
{
platformsBuilder.Add(AppendMessage(pAttribute, EncloseWithQuotes(pName)));
}
}
else
{
Expand Down Expand Up @@ -1578,7 +1586,7 @@ private static bool IsNotSuppressedByCallSite(SmallDictionary<string, Versions>
}
}

// Check if obsoleted attribute suppressed
// Check if obsoleted attribute guarded by callsite attributes
if (attribute.ObsoletedIn != null)
{
if (callSiteAttributes.TryGetValue(platformName, out var callSiteAttribute))
Expand Down Expand Up @@ -1811,6 +1819,17 @@ static void MergePlatformAttributes(ImmutableArray<AttributeData> immediateAttri
existing.SupportedFirst = childAttribute.SupportedFirst;
}
}

if (childAttribute.ObsoletedIn != null &&
(childAttribute.ObsoletedIn < existing.UnsupportedFirst ||
existing.SupportedFirst != null &&
(existing.UnsupportedSecond == null || existing.UnsupportedSecond > childAttribute.ObsoletedIn)) &&
(existing.ObsoletedIn == null || childAttribute.ObsoletedIn < existing.ObsoletedIn))
{
existing.ObsoletedIn = childAttribute.ObsoletedIn;
existing.ObsoletedMessage = childAttribute.ObsoletedMessage;
existing.ObsoletedUrl = childAttribute.ObsoletedMessage;
}
}
else
{
Expand Down Expand Up @@ -1862,12 +1881,15 @@ static void MergePlatformAttributes(ImmutableArray<AttributeData> immediateAttri
notFoundPlatforms.Add(platform);
}
}

// Check for Obsoleted attributes, only lower version could overwrite
if (attributes.ObsoletedIn != null &&
childAttributes.TryGetValue(platform, out var childAttr) &&
childAttr.ObsoletedIn != null && childAttr.ObsoletedIn < attributes.ObsoletedIn)
if (childAttributes.TryGetValue(platform, out var childAttr) &&
childAttr.ObsoletedIn != null &&
(attributes.ObsoletedIn == null || childAttr.ObsoletedIn < attributes.ObsoletedIn))
{
attributes.ObsoletedIn = childAttr.ObsoletedIn;
attributes.ObsoletedMessage = childAttr.ObsoletedMessage;
attributes.ObsoletedUrl = childAttr.ObsoletedUrl;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1956,4 +1956,7 @@
<value>This call site is reachable on: {2}. '{0}' is obsoleted on: {1}.</value>
<comment>This call site is reachable on 'macos', 'linux'. 'OboletedOnMacOS()' is obsoleted on: 'macos'.</comment>
</data>
<data name="ParenthesisWithPlaceHolder" xml:space="preserve">
<value> ({0})</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">Metody P/Invoke nemají být viditelné</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">a všechny ostatní platformy</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">P/Invokes dürfen nicht sichtbar sein</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">und alle anderen Plattformen</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">Los elementos P/Invoke no deben estar visibles</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">y el resto de plataformas</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">Les P/Invoke ne doivent pas être visibles</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">et toutes les autres plateformes</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">I metodi P/Invoke non devono essere visibili</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">e tutte le altre piattaforme</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">P/Invokes は参照可能にすることはできません</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">およびその他すべてのプラットフォーム</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">P/Invokes를 표시하지 않아야 합니다.</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">및 다른 모든 플랫폼</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">Elementy P/Invoke nie powinny być widoczne</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">i wszystkie inne platformy</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">P/Invokes não deve ser visível</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">e todas as outras plataformas</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">Методы P/Invoke не должны быть видимыми</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">и на всех остальных платформах</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">P/Invokes görünür olmamalıdır</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">ve diğer tüm platformlar</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">P/Invokes 应该是不可见的</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">和其他所有平台</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
<target state="translated">不應看得見 P/Invoke</target>
<note />
</trans-unit>
<trans-unit id="ParenthesisWithPlaceHolder">
<source> ({0})</source>
<target state="new"> ({0})</target>
<note />
</trans-unit>
<trans-unit id="PlatformCompatibilityAllPlatforms">
<source>and all other platforms</source>
<target state="translated">及所有其他平台</target>
Expand Down
Loading

0 comments on commit 46aa74c

Please sign in to comment.