Skip to content

Commit 199e937

Browse files
committed
C#: Rename CachedEntity.symbol to Symbol
1 parent 67289a4 commit 199e937

40 files changed

+327
-334
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public static IPropertySymbol GetPropertySymbol(IMethodSymbol symbol)
2929
/// <summary>
3030
/// Gets the property symbol associated with this accessor.
3131
/// </summary>
32-
private IPropertySymbol PropertySymbol => GetPropertySymbol(symbol);
32+
private IPropertySymbol PropertySymbol => GetPropertySymbol(Symbol);
3333

34-
public new Accessor OriginalDefinition => Create(Context, symbol.OriginalDefinition);
34+
public new Accessor OriginalDefinition => Create(Context, Symbol.OriginalDefinition);
3535

3636
public override void Populate(TextWriter trapFile)
3737
{
@@ -42,42 +42,42 @@ public override void Populate(TextWriter trapFile)
4242
var prop = PropertySymbol;
4343
if (prop == null)
4444
{
45-
Context.ModelError(symbol, "Unhandled accessor associated symbol");
45+
Context.ModelError(Symbol, "Unhandled accessor associated symbol");
4646
return;
4747
}
4848

4949
var parent = Property.Create(Context, prop);
5050
int kind;
5151
Accessor unboundAccessor;
52-
if (SymbolEqualityComparer.Default.Equals(symbol, prop.GetMethod))
52+
if (SymbolEqualityComparer.Default.Equals(Symbol, prop.GetMethod))
5353
{
5454
kind = 1;
5555
unboundAccessor = Create(Context, prop.OriginalDefinition.GetMethod);
5656
}
57-
else if (SymbolEqualityComparer.Default.Equals(symbol, prop.SetMethod))
57+
else if (SymbolEqualityComparer.Default.Equals(Symbol, prop.SetMethod))
5858
{
5959
kind = 2;
6060
unboundAccessor = Create(Context, prop.OriginalDefinition.SetMethod);
6161
}
6262
else
6363
{
64-
Context.ModelError(symbol, "Unhandled accessor kind");
64+
Context.ModelError(Symbol, "Unhandled accessor kind");
6565
return;
6666
}
6767

68-
trapFile.accessors(this, kind, symbol.Name, parent, unboundAccessor);
68+
trapFile.accessors(this, kind, Symbol.Name, parent, unboundAccessor);
6969

7070
foreach (var l in Locations)
7171
trapFile.accessor_location(this, l);
7272

7373
Overrides(trapFile);
7474

75-
if (symbol.FromSource() && Block == null)
75+
if (Symbol.FromSource() && Block == null)
7676
{
7777
trapFile.compiler_generated(this);
7878
}
7979

80-
if (symbol.IsInitOnly)
80+
if (Symbol.IsInitOnly)
8181
{
8282
trapFile.init_only_accessors(this);
8383
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public override void WriteQuotedId(TextWriter trapFile)
4747

4848
public override void Populate(TextWriter trapFile)
4949
{
50-
var type = Type.Create(Context, symbol.AttributeClass);
50+
var type = Type.Create(Context, Symbol.AttributeClass);
5151
trapFile.attributes(this, type.TypeRef, entity);
5252
trapFile.attribute_location(this, Location);
5353

@@ -69,10 +69,10 @@ private void ExtractArguments(TextWriter trapFile)
6969
var ctorArguments = attributeSyntax?.ArgumentList?.Arguments.Where(a => a.NameEquals == null).ToList();
7070

7171
var childIndex = 0;
72-
for (var i = 0; i < symbol.ConstructorArguments.Length; i++)
72+
for (var i = 0; i < Symbol.ConstructorArguments.Length; i++)
7373
{
74-
var constructorArgument = symbol.ConstructorArguments[i];
75-
var paramName = symbol.AttributeConstructor?.Parameters[i].Name;
74+
var constructorArgument = Symbol.ConstructorArguments[i];
75+
var paramName = Symbol.AttributeConstructor?.Parameters[i].Name;
7676
var argSyntax = ctorArguments?.SingleOrDefault(a => a.NameColon != null && a.NameColon.Name.Identifier.Text == paramName);
7777

7878
if (argSyntax == null && // couldn't find named argument
@@ -89,7 +89,7 @@ private void ExtractArguments(TextWriter trapFile)
8989
childIndex++);
9090
}
9191

92-
foreach (var namedArgument in symbol.NamedArguments)
92+
foreach (var namedArgument in Symbol.NamedArguments)
9393
{
9494
var expr = CreateExpressionFromArgument(
9595
namedArgument.Value,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public override void Populate(TextWriter trapFile)
1313
{
1414
trapFile.commentblock(this);
1515
var child = 0;
16-
trapFile.commentblock_location(this, Context.CreateLocation(symbol.Location));
17-
foreach (var l in symbol.CommentLines)
16+
trapFile.commentblock_location(this, Context.CreateLocation(Symbol.Location));
17+
foreach (var l in Symbol.CommentLines)
1818
{
1919
trapFile.commentblock_child(this, (CommentLine)l, child++);
2020
}
@@ -24,11 +24,11 @@ public override void Populate(TextWriter trapFile)
2424

2525
public override void WriteId(TextWriter trapFile)
2626
{
27-
trapFile.WriteSubId(Context.CreateLocation(symbol.Location));
27+
trapFile.WriteSubId(Context.CreateLocation(Symbol.Location));
2828
trapFile.Write(";commentblock");
2929
}
3030

31-
public override Microsoft.CodeAnalysis.Location ReportingLocation => symbol.Location;
31+
public override Microsoft.CodeAnalysis.Location ReportingLocation => Symbol.Location;
3232

3333
public void BindTo(Label entity, CommentBinding binding)
3434
{

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ private CommentLine(Context cx, Microsoft.CodeAnalysis.Location loc, CommentLine
1313
RawText = raw;
1414
}
1515

16-
public Microsoft.CodeAnalysis.Location Location => symbol.Item1;
16+
public Microsoft.CodeAnalysis.Location Location => Symbol.Item1;
1717
public CommentLineType Type { get; private set; }
1818

19-
public string Text { get { return symbol.Item2; } }
19+
public string Text { get { return Symbol.Item2; } }
2020
public string RawText { get; private set; }
2121

2222
private Location location;
@@ -28,7 +28,7 @@ public override void Populate(TextWriter trapFile)
2828
trapFile.commentline_location(this, location);
2929
}
3030

31-
public override Microsoft.CodeAnalysis.Location ReportingLocation => location.symbol;
31+
public override Microsoft.CodeAnalysis.Location ReportingLocation => location.Symbol;
3232

3333
public override bool NeedsPopulation => true;
3434

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ public override void Populate(TextWriter trapFile)
1919
PopulateModifiers(trapFile);
2020
ContainingType.PopulateGenerics();
2121

22-
trapFile.constructors(this, symbol.ContainingType.Name, ContainingType, (Constructor)OriginalDefinition);
22+
trapFile.constructors(this, Symbol.ContainingType.Name, ContainingType, (Constructor)OriginalDefinition);
2323
trapFile.constructor_location(this, Location);
2424

25-
if (symbol.IsImplicitlyDeclared)
25+
if (Symbol.IsImplicitlyDeclared)
2626
{
2727
var lineCounts = new LineCounts() { Total = 2, Code = 1, Comment = 0 };
2828
trapFile.numlines(this, lineCounts);
@@ -48,10 +48,10 @@ protected override void ExtractInitializers(TextWriter trapFile)
4848
switch (initializer.Kind())
4949
{
5050
case SyntaxKind.BaseConstructorInitializer:
51-
initializerType = symbol.ContainingType.BaseType;
51+
initializerType = Symbol.ContainingType.BaseType;
5252
break;
5353
case SyntaxKind.ThisConstructorInitializer:
54-
initializerType = symbol.ContainingType;
54+
initializerType = Symbol.ContainingType;
5555
break;
5656
default:
5757
Context.ModelError(initializer, "Unknown initializer");
@@ -73,7 +73,7 @@ protected override void ExtractInitializers(TextWriter trapFile)
7373

7474
if (target == null)
7575
{
76-
Context.ModelError(symbol, "Unable to resolve call");
76+
Context.ModelError(Symbol, "Unable to resolve call");
7777
return;
7878
}
7979

@@ -90,7 +90,7 @@ private ConstructorDeclarationSyntax Syntax
9090
{
9191
get
9292
{
93-
return symbol.DeclaringSyntaxReferences
93+
return Symbol.DeclaringSyntaxReferences
9494
.Select(r => r.GetSyntax())
9595
.OfType<ConstructorDeclarationSyntax>()
9696
.FirstOrDefault();
@@ -114,15 +114,15 @@ private ConstructorDeclarationSyntax Syntax
114114

115115
public override void WriteId(TextWriter trapFile)
116116
{
117-
if (symbol.IsStatic)
117+
if (Symbol.IsStatic)
118118
trapFile.Write("static");
119119
trapFile.WriteSubId(ContainingType);
120-
AddParametersToId(Context, trapFile, symbol);
120+
AddParametersToId(Context, trapFile, Symbol);
121121
trapFile.Write(";constructor");
122122
}
123123

124124
private ConstructorDeclarationSyntax GetSyntax() =>
125-
symbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<ConstructorDeclarationSyntax>().FirstOrDefault();
125+
Symbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<ConstructorDeclarationSyntax>().FirstOrDefault();
126126

127127
public override Microsoft.CodeAnalysis.Location FullLocation => ReportingLocation;
128128

@@ -136,12 +136,12 @@ public override Microsoft.CodeAnalysis.Location ReportingLocation
136136
return syn.Identifier.GetLocation();
137137
}
138138

139-
if (symbol.IsImplicitlyDeclared)
139+
if (Symbol.IsImplicitlyDeclared)
140140
{
141141
return ContainingType.ReportingLocation;
142142
}
143143

144-
return symbol.ContainingType.Locations.FirstOrDefault();
144+
return Symbol.ContainingType.Locations.FirstOrDefault();
145145
}
146146
}
147147

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ public override Microsoft.CodeAnalysis.Location ReportingLocation
1717
{
1818
get
1919
{
20-
return symbol.DeclaringSyntaxReferences
20+
return Symbol.DeclaringSyntaxReferences
2121
.Select(r => r.GetSyntax())
2222
.OfType<ConversionOperatorDeclarationSyntax>()
2323
.Select(s => s.FixedLocation())
24-
.Concat(symbol.Locations)
24+
.Concat(Symbol.Locations)
2525
.FirstOrDefault();
2626
}
2727
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public override void Populate(TextWriter trapFile)
1414
PopulateModifiers(trapFile);
1515
ContainingType.PopulateGenerics();
1616

17-
trapFile.destructors(this, string.Format("~{0}", symbol.ContainingType.Name), ContainingType, OriginalDefinition(Context, this, symbol));
17+
trapFile.destructors(this, string.Format("~{0}", Symbol.ContainingType.Name), ContainingType, OriginalDefinition(Context, this, Symbol));
1818
trapFile.destructor_location(this, Location);
1919
}
2020

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ public override void WriteId(TextWriter trapFile)
1414
{
1515
trapFile.WriteSubId(ContainingType);
1616
trapFile.Write('.');
17-
Method.AddExplicitInterfaceQualifierToId(Context, trapFile, symbol.ExplicitInterfaceImplementations);
18-
trapFile.Write(symbol.Name);
17+
Method.AddExplicitInterfaceQualifierToId(Context, trapFile, Symbol.ExplicitInterfaceImplementations);
18+
trapFile.Write(Symbol.Name);
1919
trapFile.Write(";event");
2020
}
2121

2222
public override void Populate(TextWriter trapFile)
2323
{
24-
PopulateNullability(trapFile, symbol.GetAnnotatedType());
24+
PopulateNullability(trapFile, Symbol.GetAnnotatedType());
2525

26-
var type = Type.Create(Context, symbol.Type);
27-
trapFile.events(this, symbol.GetName(), ContainingType, type.TypeRef, Create(Context, symbol.OriginalDefinition));
26+
var type = Type.Create(Context, Symbol.Type);
27+
trapFile.events(this, Symbol.GetName(), ContainingType, type.TypeRef, Create(Context, Symbol.OriginalDefinition));
2828

29-
var adder = symbol.AddMethod;
30-
var remover = symbol.RemoveMethod;
29+
var adder = Symbol.AddMethod;
30+
var remover = Symbol.RemoveMethod;
3131

3232
if (!(adder is null))
3333
Method.Create(Context, adder);
@@ -39,10 +39,10 @@ public override void Populate(TextWriter trapFile)
3939
BindComments();
4040

4141
var declSyntaxReferences = IsSourceDeclaration
42-
? symbol.DeclaringSyntaxReferences.Select(d => d.GetSyntax()).ToArray()
42+
? Symbol.DeclaringSyntaxReferences.Select(d => d.GetSyntax()).ToArray()
4343
: Enumerable.Empty<SyntaxNode>();
4444

45-
foreach (var explicitInterface in symbol.ExplicitInterfaceImplementations.Select(impl => Type.Create(Context, impl.ContainingType)))
45+
foreach (var explicitInterface in Symbol.ExplicitInterfaceImplementations.Select(impl => Type.Create(Context, impl.ContainingType)))
4646
{
4747
trapFile.explicitly_implements(this, explicitInterface.TypeRef);
4848

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ private EventAccessor(Context cx, IMethodSymbol init)
1111
/// <summary>
1212
/// Gets the event symbol associated with this accessor.
1313
/// </summary>
14-
private IEventSymbol EventSymbol => symbol.AssociatedSymbol as IEventSymbol;
14+
private IEventSymbol EventSymbol => Symbol.AssociatedSymbol as IEventSymbol;
1515

1616
public override void Populate(TextWriter trapFile)
1717
{
@@ -21,30 +21,30 @@ public override void Populate(TextWriter trapFile)
2121
var @event = EventSymbol;
2222
if (@event == null)
2323
{
24-
Context.ModelError(symbol, "Unhandled event accessor associated symbol");
24+
Context.ModelError(Symbol, "Unhandled event accessor associated symbol");
2525
return;
2626
}
2727

2828
var parent = Event.Create(Context, @event);
2929
int kind;
3030
EventAccessor unboundAccessor;
31-
if (SymbolEqualityComparer.Default.Equals(symbol, @event.AddMethod))
31+
if (SymbolEqualityComparer.Default.Equals(Symbol, @event.AddMethod))
3232
{
3333
kind = 1;
3434
unboundAccessor = Create(Context, @event.OriginalDefinition.AddMethod);
3535
}
36-
else if (SymbolEqualityComparer.Default.Equals(symbol, @event.RemoveMethod))
36+
else if (SymbolEqualityComparer.Default.Equals(Symbol, @event.RemoveMethod))
3737
{
3838
kind = 2;
3939
unboundAccessor = Create(Context, @event.OriginalDefinition.RemoveMethod);
4040
}
4141
else
4242
{
43-
Context.ModelError(symbol, "Undhandled event accessor kind");
43+
Context.ModelError(Symbol, "Undhandled event accessor kind");
4444
return;
4545
}
4646

47-
trapFile.event_accessors(this, kind, symbol.Name, parent, unboundAccessor);
47+
trapFile.event_accessors(this, kind, Symbol.Name, parent, unboundAccessor);
4848

4949
foreach (var l in Locations)
5050
trapFile.event_accessor_location(this, l);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected sealed override void Populate(TextWriter trapFile)
5757
type.PopulateGenerics();
5858
}
5959

60-
public override Microsoft.CodeAnalysis.Location ReportingLocation => Location.symbol;
60+
public override Microsoft.CodeAnalysis.Location ReportingLocation => Location.Symbol;
6161

6262
bool IExpressionParentEntity.IsTopLevelParent => false;
6363

0 commit comments

Comments
 (0)