Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 397be7e

Browse files
committed
C#: Change constructor visibility to protected in abstract classes
1 parent 71faa51 commit 397be7e

10 files changed

Lines changed: 11 additions & 11 deletions

File tree

csharp/autobuilder/Semmle.Autobuild.Shared/Autobuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void FindFiles(string dir, int depth, int maxDepth, IList<(string, int)> results
146146
/// solution file and tools.
147147
/// </summary>
148148
/// <param name="options">The command line options.</param>
149-
public Autobuilder(IBuildActions actions, AutobuildOptions options)
149+
protected Autobuilder(IBuildActions actions, AutobuildOptions options)
150150
{
151151
Actions = actions;
152152
Options = options;

csharp/extractor/Semmle.Extraction.CIL.Driver/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void Main(string[] args)
3939

4040
var options = new ExtractorOptions(args);
4141
var layout = new Layout();
42-
var logger = new ConsoleLogger(options.Verbosity);
42+
using var logger = new ConsoleLogger(options.Verbosity);
4343

4444
var actions = options.
4545
AssembliesToExtract.Select(asm => asm.filename).

csharp/extractor/Semmle.Extraction.CIL/Context.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public abstract class GenericContext
125125
{
126126
public Context cx;
127127

128-
public GenericContext(Context cx)
128+
protected GenericContext(Context cx)
129129
{
130130
this.cx = cx;
131131
}

csharp/extractor/Semmle.Extraction.CIL/Entities/Type.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ abstract class TypeParameter : Type, ITypeParameter
963963
{
964964
protected readonly GenericContext gc;
965965

966-
public TypeParameter(GenericContext gc) : base(gc.cx)
966+
protected TypeParameter(GenericContext gc) : base(gc.cx)
967967
{
968968
this.gc = gc;
969969
}

csharp/extractor/Semmle.Extraction.CSharp/Entities/Method.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Semmle.Extraction.CSharp.Entities
99
{
1010
public abstract class Method : CachedSymbol<IMethodSymbol>, IExpressionParentEntity, IStatementParentEntity
1111
{
12-
public Method(Context cx, IMethodSymbol init)
12+
protected Method(Context cx, IMethodSymbol init)
1313
: base(cx, init) { }
1414

1515
protected void PopulateParameters()

csharp/extractor/Semmle.Extraction.CSharp/Entities/Symbol.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Semmle.Extraction.CSharp.Entities
1111
{
1212
public abstract class CachedSymbol<T> : CachedEntity<T> where T : ISymbol
1313
{
14-
public CachedSymbol(Context cx, T init)
14+
protected CachedSymbol(Context cx, T init)
1515
: base(cx, init) { }
1616

1717
public virtual Type ContainingType => symbol.ContainingType != null ? Type.Create(Context, symbol.ContainingType) : null;

csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/Type.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public AnnotatedType(Type t, NullableAnnotation n)
3333

3434
public abstract class Type : CachedSymbol<ITypeSymbol>
3535
{
36-
public Type(Context cx, ITypeSymbol init)
36+
protected Type(Context cx, ITypeSymbol init)
3737
: base(cx, init) { }
3838

3939
public virtual AnnotatedType ElementType => default(AnnotatedType);
@@ -336,7 +336,7 @@ public override bool Equals(object obj)
336336

337337
abstract class Type<T> : Type where T : ITypeSymbol
338338
{
339-
public Type(Context cx, T init)
339+
protected Type(Context cx, T init)
340340
: base(cx, init) { }
341341

342342
public new T symbol => (T)base.symbol;

csharp/extractor/Semmle.Extraction/Entities/Location.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace Semmle.Extraction.Entities
33
{
44
public abstract class Location : CachedEntity<Microsoft.CodeAnalysis.Location?>
55
{
6-
public Location(Context cx, Microsoft.CodeAnalysis.Location? init)
6+
protected Location(Context cx, Microsoft.CodeAnalysis.Location? init)
77
: base(cx, init) { }
88

99
public static Location Create(Context cx, Microsoft.CodeAnalysis.Location? loc) =>

csharp/extractor/Semmle.Extraction/FreshEntity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public abstract class FreshEntity : IEntity
99
{
1010
protected readonly Context cx;
1111

12-
public FreshEntity(Context cx)
12+
protected FreshEntity(Context cx)
1313
{
1414
this.cx = cx;
1515
cx.AddFreshLabel(this);

csharp/extractor/Semmle.Extraction/Symbol.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Semmle.Extraction
99
/// <typeparam name="Initializer">The type of the symbol.</typeparam>
1010
public abstract class CachedEntity<Initializer> : ICachedEntity
1111
{
12-
public CachedEntity(Context context, Initializer init)
12+
protected CachedEntity(Context context, Initializer init)
1313
{
1414
Context = context;
1515
symbol = init;

0 commit comments

Comments
 (0)