Skip to content

Commit

Permalink
Explicit accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamTheCoder committed Jan 20, 2020
1 parent 4ec6602 commit 2c20279
Show file tree
Hide file tree
Showing 33 changed files with 72 additions and 71 deletions.
4 changes: 2 additions & 2 deletions CodeConverter.Web/ConverterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task<IActionResult> Post([FromBody]ConvertRequest todo)
return Ok(response);
}

string ParseLanguage(string language)
private string ParseLanguage(string language)
{
if (language == null)
throw new ArgumentNullException(nameof(language));
Expand All @@ -56,7 +56,7 @@ string ParseLanguage(string language)
throw new ArgumentException($"{language} not supported!");
}

int GetDefaultVersionForLanguage(string language)
private int GetDefaultVersionForLanguage(string language)
{
if (language == null)
throw new ArgumentNullException(nameof(language));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,18 +759,18 @@ public override async Task<SyntaxList<StatementSyntax>> VisitCallStatement(VBSyn
return SingleStatement((ExpressionSyntax) await node.Invocation.AcceptAsync(_expressionVisitor));
}

SyntaxList<StatementSyntax> SingleStatement(StatementSyntax statement)
private SyntaxList<StatementSyntax> SingleStatement(StatementSyntax statement)
{
return SyntaxFactory.SingletonList(statement);
}

SyntaxList<StatementSyntax> SingleStatement(ExpressionSyntax expression)
private SyntaxList<StatementSyntax> SingleStatement(ExpressionSyntax expression)
{
return SyntaxFactory.SingletonList<StatementSyntax>(SyntaxFactory.ExpressionStatement(expression));
}
}

static class Extensions
internal static class Extensions
{
/// <summary>
/// Returns the single statement in a block if it has no nested statements.
Expand Down
4 changes: 2 additions & 2 deletions ICSharpCode.CodeConverter/CodeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public static async Task<ConversionResult> Convert(CodeWithOptions code)
return new ConversionResult(new NotSupportedException($"Converting from {code.FromLanguage} {code.FromLanguageVersion} to {code.ToLanguage} {code.ToLanguageVersion} is not supported!"));
}

static bool IsSupportedTarget(string toLanguage, int toLanguageVersion)
private static bool IsSupportedTarget(string toLanguage, int toLanguageVersion)
{
return (toLanguage == "Visual Basic" && toLanguageVersion == 14) || (toLanguage == "C#" && toLanguageVersion == 6);
}

static bool IsSupportedSource(string fromLanguage, int fromLanguageVersion)
private static bool IsSupportedSource(string fromLanguage, int fromLanguageVersion)
{
return (fromLanguage == "C#" && fromLanguageVersion == 6) || (fromLanguage == "Visual Basic" && fromLanguageVersion == 14);
}
Expand Down
5 changes: 3 additions & 2 deletions ICSharpCode.CodeConverter/Shared/ProjectConversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,13 @@ public static async Task<IEnumerable<ConversionResult>> ConvertProject(Project p
);
}

static (string Find, string Replace, bool FirstOnly) ChangeLanguageVersionRegex(string languageVersion) {
private static (string Find, string Replace, bool FirstOnly) ChangeLanguageVersionRegex(string languageVersion) {
return (Find: new Regex(@"<\s*LangVersion>(\d|\D)*</LangVersion\s*>").ToString(), Replace: $"<LangVersion>{languageVersion}</LangVersion>", FirstOnly: true);
}
static (string Find, string Replace, bool FirstOnly) ChangeRootNamespaceRegex(string rootNamespace) {
private static (string Find, string Replace, bool FirstOnly) ChangeRootNamespaceRegex(string rootNamespace) {
return (Find: new Regex(@"<\s*RootNamespace>(\d|\D)*</RootNamespace\s*>").ToString(), Replace: $"<RootNamespace>{rootNamespace}</RootNamespace>", FirstOnly: true);
}

private static (string Find, string Replace, bool FirstOnly) AddCompiledItemsRegexFromRelativePaths(
string[] relativeFilePathsToAdd)
{
Expand Down
4 changes: 2 additions & 2 deletions ICSharpCode.CodeConverter/Util/CSharpUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace ICSharpCode.CodeConverter.Util
{
static class CSharpUtil
internal static class CSharpUtil
{
/// <summary>
/// Inverts a boolean condition. Note: The condition object can be frozen (from AST) it's cloned internally.
Expand All @@ -19,7 +19,7 @@ public static ExpressionSyntax InvertCondition(this ExpressionSyntax condition)
return InvertConditionInternal(condition);
}

static ExpressionSyntax InvertConditionInternal(ExpressionSyntax condition)
private static ExpressionSyntax InvertConditionInternal(ExpressionSyntax condition)
{
if (condition is ParenthesizedExpressionSyntax) {
return SyntaxFactory.ParenthesizedExpression(InvertCondition(((ParenthesizedExpressionSyntax)condition).Expression));
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static partial class EnumerableExtensions
internal static partial class EnumerableExtensions
{
public static IEnumerable<T> Do<T>(this IEnumerable<T> source, Action<T> action)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class ExpressionSyntaxExtensions
internal static class ExpressionSyntaxExtensions
{

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class IAssemblySymbolExtensions
internal static class IAssemblySymbolExtensions
{
private const string AttributeSuffix = "Attribute";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static partial class INamespaceOrTypeSymbolExtensions
internal static partial class INamespaceOrTypeSymbolExtensions
{
private static readonly ConditionalWeakTable<INamespaceOrTypeSymbol, List<string>> s_namespaceOrTypeToNameMap =
new ConditionalWeakTable<INamespaceOrTypeSymbol, List<string>>();
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/ISymbolExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class ISymbolExtensions
internal static class ISymbolExtensions
{
// A lot of symbols in DateAndTime do not exist in DateTime, eg. DateSerial(),
// and some have different names/arguments, eg. DateAdd(). This needs to be handled properly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class ITypeParameterSymbolExtensions
internal static class ITypeParameterSymbolExtensions
{
public static INamedTypeSymbol GetNamedTypeSymbolConstraint(this ITypeParameterSymbol typeParameter)
{
Expand Down
4 changes: 2 additions & 2 deletions ICSharpCode.CodeConverter/Util/ITypeSymbolExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class ITypeSymbolExtensions
internal static class ITypeSymbolExtensions
{
public static bool ImplementsSpecialTypeInterface(this ITypeSymbol symbol, SpecialType type)
{
Expand Down Expand Up @@ -363,7 +363,7 @@ public static bool CanSupportCollectionInitializer(this ITypeSymbol typeSymbol)
return false;
}

static bool HasAddMethod(ITypeSymbol typeSymbol)
private static bool HasAddMethod(ITypeSymbol typeSymbol)
{
return typeSymbol
.GetMembers(WellKnownMemberNames.CollectionInitializerAddMethodName)
Expand Down
4 changes: 2 additions & 2 deletions ICSharpCode.CodeConverter/Util/Matcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
abstract class Matcher<T>
internal abstract class Matcher<T>
{
// Tries to match this matcher against the provided sequence at the given index. If the
// match succeeds, 'true' is returned, and 'index' points to the location after the match
Expand Down Expand Up @@ -142,7 +142,7 @@ public override string ToString()
#if NR6
public
#endif
class Matcher
internal class Matcher
{
/// <summary>
/// Matcher equivalent to (m*)
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/NameGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace ICSharpCode.CodeConverter.Util
{
static class NameGenerator
internal static class NameGenerator
{
public static IList<string> EnsureUniqueness(
IList<string> names,
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/ObjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static partial class ObjectExtensions
internal static partial class ObjectExtensions
{

#region TypeSwitch on Action
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/SpecializedCollections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static partial class SpecializedCollections
internal static partial class SpecializedCollections
{
public static readonly byte[] EmptyBytes = EmptyArray<byte>();
public static readonly object[] EmptyObjects = EmptyArray<object>();
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class StringExtensions
internal static class StringExtensions
{
public static int? GetFirstNonWhitespaceOffset(this string line)
{
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/SymbolExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class SymbolExtensions
internal static class SymbolExtensions
{
/// <summary>
/// Returns true if the symbol wasn't tagged with
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/SyntaxExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class SyntaxExtensions
internal static class SyntaxExtensions
{
/// <summary>
/// Look inside a trivia list for a skipped token that contains the given position.
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/SyntaxNodeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static partial class SyntaxNodeExtensions
internal static partial class SyntaxNodeExtensions
{
public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxNode node)
{
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/SyntaxTokenExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class SyntaxTokenExtensions
internal static class SyntaxTokenExtensions
{
public static SyntaxNode GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
{
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/SyntaxTriviaExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class SyntaxTriviaExtensions
internal static class SyntaxTriviaExtensions
{
/// <summary>
/// Look inside a trivia list for a skipped token that contains the given position.
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ICSharpCode.CodeConverter.Util
#if NR6
public
#endif
static class TypeExtensions
internal static class TypeExtensions
{
#region GetDelegateInvokeMethod
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/Util/VBUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace ICSharpCode.CodeConverter.Util
{
static class VBUtil
internal static class VBUtil
{
/// <summary>
/// Inverts a boolean condition. Note: The condition object can be frozen (from AST) it's cloned internally.
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.CodeConverter/VB/ConversionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace ICSharpCode.CodeConverter.VB
{
static class ConversionExtensions
internal static class ConversionExtensions
{
public static bool HasUsingDirective(this CS.CSharpSyntaxTree tree, string fullName)
{
Expand Down
Loading

0 comments on commit 2c20279

Please sign in to comment.