提交 743bbba7 编写于 作者: A AlekseyTs

Eliminate ‘NeedsLocalization’ calls under Compilers.

***NO_CI***
 (changeset 1392938)
上级 b5577426
......@@ -946,12 +946,12 @@ public static SyntaxTriviaList TriviaList(IEnumerable<SyntaxTrivia> trivias)
{
if (!HasSeparatedNodeTokenPattern(nodesAndTokens))
{
throw new ArgumentException("A node or token is out of sequence.".NeedsLocalization());
throw new ArgumentException(CodeAnalysisResources.NodeOrTokenOutOfSequence);
}
if (!NodesAreCorrectType<TNode>(nodesAndTokens))
{
throw new ArgumentException("A node in the list is not of the expected type.".NeedsLocalization());
throw new ArgumentException(CodeAnalysisResources.UnexpectedTypeOfNodeInList);
}
return new SeparatedSyntaxList<TNode>(nodesAndTokens);
......
......@@ -278,7 +278,7 @@ private enum ListEditKind
private static InvalidOperationException GetItemNotListElementException()
{
return new InvalidOperationException("The item specified is not the element of a list.".NeedsLocalization());
return new InvalidOperationException(CodeAnalysisResources.MissingListItem);
}
private abstract class BaseListEditor : CSharpSyntaxRewriter
......
......@@ -511,6 +511,15 @@ internal class CodeAnalysisResources {
}
}
/// <summary>
/// Looks up a localized string similar to Node to track is not a descendant of the root..
/// </summary>
internal static string InvalidNodeToTrack {
get {
return ResourceManager.GetString("InvalidNodeToTrack", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid output kind for submission. DynamicallyLinkedLibrary expected..
/// </summary>
......@@ -547,6 +556,15 @@ internal class CodeAnalysisResources {
}
}
/// <summary>
/// Looks up a localized string similar to The item specified is not the element of a list..
/// </summary>
internal static string MissingListItem {
get {
return ResourceManager.GetString("MissingListItem", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to module.
/// </summary>
......@@ -592,6 +610,42 @@ internal class CodeAnalysisResources {
}
}
/// <summary>
/// Looks up a localized string similar to Cannot deserialize type &apos;{0}&apos;, no binder supplied..
/// </summary>
internal static string NoBinderException {
get {
return ResourceManager.GetString("NoBinderException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A node or token is out of sequence..
/// </summary>
internal static string NodeOrTokenOutOfSequence {
get {
return ResourceManager.GetString("NodeOrTokenOutOfSequence", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot deserialize type &apos;{0}&apos;, it has no deserialization reader..
/// </summary>
internal static string NoReaderException {
get {
return ResourceManager.GetString("NoReaderException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The type &apos;{0}&apos; cannot be written, it does not implement IObjectWritable.
/// </summary>
internal static string NotWritableException {
get {
return ResourceManager.GetString("NotWritableException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Output kind not supported..
/// </summary>
......@@ -862,6 +916,15 @@ internal class CodeAnalysisResources {
}
}
/// <summary>
/// Looks up a localized string similar to A node in the list is not of the expected type..
/// </summary>
internal static string UnexpectedTypeOfNodeInList {
get {
return ResourceManager.GetString("UnexpectedTypeOfNodeInList", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unresolved: .
/// </summary>
......
......@@ -399,4 +399,25 @@
<data name="ArgumentElementCannotBeNull" xml:space="preserve">
<value>Argument cannot have a null element.</value>
</data>
<data name="NoBinderException" xml:space="preserve">
<value>Cannot deserialize type '{0}', no binder supplied.</value>
</data>
<data name="NoReaderException" xml:space="preserve">
<value>Cannot deserialize type '{0}', it has no deserialization reader.</value>
</data>
<data name="NotWritableException" xml:space="preserve">
<value>The type '{0}' cannot be written, it does not implement IObjectWritable</value>
</data>
<data name="InvalidNodeToTrack" xml:space="preserve">
<value>Node to track is not a descendant of the root.</value>
</data>
<data name="NodeOrTokenOutOfSequence" xml:space="preserve">
<value>A node or token is out of sequence.</value>
</data>
<data name="UnexpectedTypeOfNodeInList" xml:space="preserve">
<value>A node in the list is not of the expected type.</value>
</data>
<data name="MissingListItem" xml:space="preserve">
<value>The item specified is not the element of a list.</value>
</data>
</root>
\ No newline at end of file
......@@ -495,12 +495,20 @@ private object CreateInstance(Type type)
private Exception NoBinderException(string typeName)
{
throw new InvalidOperationException(string.Format("Cannot deserialize type '{0}', no binder supplied.".NeedsLocalization(), typeName));
#if COMPILERCORE
throw new InvalidOperationException(string.Format(Microsoft.CodeAnalysis.CodeAnalysisResources.NoBinderException, typeName));
#else
throw new InvalidOperationException(string.Format(Microsoft.CodeAnalysis.WorkspacesResources.NoBinderException, typeName));
#endif
}
private Exception NoReaderException(string typeName)
{
throw new InvalidOperationException(string.Format("Cannot deserialize type '{0}', it has no deserialization reader.".NeedsLocalization(), typeName));
#if COMPILERCORE
throw new InvalidOperationException(string.Format(Microsoft.CodeAnalysis.CodeAnalysisResources.NoReaderException, typeName));
#else
throw new InvalidOperationException(string.Format(Microsoft.CodeAnalysis.WorkspacesResources.NoReaderException, typeName));
#endif
}
}
}
\ No newline at end of file
......@@ -582,7 +582,11 @@ private void WriteWritableObject(IObjectWritable instance)
private Exception NotWritableException(string typeName)
{
throw new InvalidOperationException(string.Format("The type '{0}' cannot be written, it does not implement IObjectWritable".NeedsLocalization(), typeName));
#if COMPILERCORE
throw new InvalidOperationException(string.Format(CodeAnalysisResources.NotWritableException, typeName));
#else
throw new InvalidOperationException(string.Format(WorkspacesResources.NotWritableException, typeName));
#endif
}
}
}
\ No newline at end of file
......@@ -40,7 +40,7 @@ public static TRoot TrackNodes<TRoot>(this TRoot root, IEnumerable<SyntaxNode> n
{
if (!IsDescendant(root, node))
{
throw new ArgumentException("Node to track is not a descendant of the root.".NeedsLocalization());
throw new ArgumentException(CodeAnalysisResources.InvalidNodeToTrack);
}
nodeToIdMap.GetValue(node, n => new SyntaxAnnotation(IdAnnotationKind));
......
......@@ -954,11 +954,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' <param name="nodesAndTokens">An alternating list of nodes and tokens.</param>
Public Shared Function SeparatedList(Of TNode As SyntaxNode)(nodesAndTokens As SyntaxNodeOrTokenList) As SeparatedSyntaxList(Of TNode)
If Not HasSeparatedNodeTokenPattern(nodesAndTokens) Then
Throw New ArgumentException("A node or token is out of sequence.".NeedsLocalization())
Throw New ArgumentException(CodeAnalysisResources.NodeOrTokenOutOfSequence)
End If
If Not NodesAreCorrectType(Of TNode)(nodesAndTokens) Then
Throw New ArgumentException("A node in the list is not of the expected type.".NeedsLocalization())
Throw New ArgumentException(CodeAnalysisResources.UnexpectedTypeOfNodeInList)
End If
Return New SeparatedSyntaxList(Of TNode)(nodesAndTokens)
......
......@@ -223,7 +223,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax
End Enum
Private Shared Function GetItemNotListElementException() As InvalidOperationException
Return New InvalidOperationException("The item specified is not the element of a list.".NeedsLocalization())
Return New InvalidOperationException(CodeAnalysisResources.MissingListItem)
End Function
Private Class BaseListEditor
......
......@@ -673,6 +673,15 @@ internal class WorkspacesResources {
}
}
/// <summary>
/// Looks up a localized string similar to Cannot deserialize type &apos;{0}&apos;, no binder supplied..
/// </summary>
internal static string NoBinderException {
get {
return ResourceManager.GetString("NoBinderException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Node is of the wrong type..
/// </summary>
......@@ -682,6 +691,24 @@ internal class WorkspacesResources {
}
}
/// <summary>
/// Looks up a localized string similar to Cannot deserialize type &apos;{0}&apos;, it has no deserialization reader..
/// </summary>
internal static string NoReaderException {
get {
return ResourceManager.GetString("NoReaderException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The type &apos;{0}&apos; cannot be written, it does not implement IObjectWritable.
/// </summary>
internal static string NotWritableException {
get {
return ResourceManager.GetString("NotWritableException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Specified path must be absolute..
/// </summary>
......
......@@ -414,4 +414,13 @@
<data name="DiagnosticMustHaveMatchingSpan" xml:space="preserve">
<value>Diagnostic must have span '{0}'</value>
</data>
<data name="NoBinderException" xml:space="preserve">
<value>Cannot deserialize type '{0}', no binder supplied.</value>
</data>
<data name="NoReaderException" xml:space="preserve">
<value>Cannot deserialize type '{0}', it has no deserialization reader.</value>
</data>
<data name="NotWritableException" xml:space="preserve">
<value>The type '{0}' cannot be written, it does not implement IObjectWritable</value>
</data>
</root>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册