Skip to content

Commit 41e57d9

Browse files
committed
C#: Sprinkle uses of OnlyScaffold to extract less when in overlay mode.
1 parent 80cc6b7 commit 41e57d9

File tree

10 files changed

+17
-11
lines changed

10 files changed

+17
-11
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Entities/Base/CachedSymbol.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public virtual IEnumerable<Location> Locations
108108
/// </summary>
109109
protected void BindComments()
110110
{
111-
if (!Symbol.IsImplicitlyDeclared && IsSourceDeclaration && Symbol.FromSource())
111+
if (!Symbol.IsImplicitlyDeclared && IsSourceDeclaration && Symbol.FromSource() && !Context.OnlyScaffold)
112112
Context.BindComments(this, FullLocation);
113113
}
114114

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public override void Populate(TextWriter trapFile)
5252
foreach (var l in Locations)
5353
trapFile.field_location(this, l);
5454

55-
if (!IsSourceDeclaration || !Symbol.FromSource())
55+
if (!IsSourceDeclaration || !Symbol.FromSource() || Context.OnlyScaffold)
5656
return;
5757

5858
Context.BindComments(this, Location.Symbol);

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public override void Populate(TextWriter trapFile)
4040
Parameter.Create(Context, Symbol.Parameters[i], this, original);
4141
}
4242

43-
if (IsSourceDeclaration)
43+
if (IsSourceDeclaration && !Context.OnlyScaffold)
4444
{
4545
var expressionBody = ExpressionBody;
4646
if (expressionBody is not null)
@@ -53,6 +53,12 @@ public override void Populate(TextWriter trapFile)
5353

5454
PopulateAttributes();
5555
PopulateModifiers(trapFile);
56+
57+
if (Context.OnlyScaffold)
58+
{
59+
return;
60+
}
61+
5662
BindComments();
5763

5864
var declSyntaxReferences = IsSourceDeclaration

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected virtual void ExtractInitializers(TextWriter trapFile)
4848

4949
protected virtual void PopulateMethodBody(TextWriter trapFile)
5050
{
51-
if (!IsSourceDeclaration)
51+
if (!IsSourceDeclaration || Context.OnlyScaffold)
5252
return;
5353

5454
var block = Block;
@@ -94,7 +94,7 @@ public void Overrides(TextWriter trapFile)
9494
{
9595
trapFile.explicitly_implements(this, explicitInterface.TypeRef);
9696

97-
if (IsSourceDeclaration)
97+
if (IsSourceDeclaration && !Context.OnlyScaffold)
9898
{
9999
foreach (var syntax in Symbol.DeclaringSyntaxReferences.Select(d => d.GetSyntax()).OfType<MethodDeclarationSyntax>())
100100
TypeMention.Create(Context, syntax.ExplicitInterfaceSpecifier!.Name, this, explicitInterface);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public override void Populate(TextWriter trapFile)
3434
var returnType = Type.Create(Context, Symbol.ReturnType);
3535
trapFile.methods(this, Name, ContainingType, returnType.TypeRef, OriginalDefinition);
3636

37-
if (IsSourceDeclaration)
37+
if (IsSourceDeclaration && !Context.OnlyScaffold)
3838
{
3939
foreach (var declaration in Symbol.DeclaringSyntaxReferences.Select(s => s.GetSyntax()).OfType<MethodDeclarationSyntax>())
4040
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Symbol.ContainingSymbol is IMethodSymbol ms &&
137137
Context.PopulateLater(defaultValueExpressionCreation);
138138
}
139139

140-
if (!IsSourceDeclaration || !Symbol.FromSource())
140+
if (!IsSourceDeclaration || !Symbol.FromSource() || Context.OnlyScaffold)
141141
return;
142142

143143
BindComments();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public override void Populate(TextWriter trapFile)
7272
foreach (var l in Locations)
7373
trapFile.property_location(this, l);
7474

75-
if (IsSourceDeclaration && Symbol.FromSource())
75+
if (IsSourceDeclaration && Symbol.FromSource() && !Context.OnlyScaffold)
7676
{
7777
var expressionBody = ExpressionBody;
7878
if (expressionBody is not null)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ protected void PopulateType(TextWriter trapFile, bool constructUnderlyingTupleTy
222222

223223
private IEnumerable<BaseTypeSyntax> GetBaseTypeDeclarations()
224224
{
225-
if (!IsSourceDeclaration || !Symbol.FromSource())
225+
if (!IsSourceDeclaration || !Symbol.FromSource() || Context.OnlyScaffold)
226226
{
227227
return Enumerable.Empty<BaseTypeSyntax>();
228228
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public override void Populate(TextWriter trapFile)
3131
trapFile.type_location(this, Context.CreateLocation(l));
3232
}
3333

34-
if (IsSourceDeclaration)
34+
if (IsSourceDeclaration && !Context.OnlyScaffold)
3535
{
3636
var declSyntaxReferences = Symbol.DeclaringSyntaxReferences
3737
.Select(d => d.GetSyntax())

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public override void Populate(TextWriter trapFile)
2929
foreach (var l in Locations)
3030
trapFile.operator_location(this, l);
3131

32-
if (IsSourceDeclaration)
32+
if (IsSourceDeclaration && !Context.OnlyScaffold)
3333
{
3434
var declSyntaxReferences = Symbol.DeclaringSyntaxReferences.Select(s => s.GetSyntax()).ToArray();
3535
foreach (var declaration in declSyntaxReferences.OfType<OperatorDeclarationSyntax>())

0 commit comments

Comments
 (0)