Skip to content

Commit 1657dfb

Browse files
committed
C#: Remove expression population safeguard and guard creation of constructor initializer expressions.
1 parent 7c670cd commit 1657dfb

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected override void ExtractInitializers(TextWriter trapFile)
6060
// Do not extract initializers for constructed types.
6161
// Extract initializers for constructors with a body, primary constructors
6262
// and default constructors for classes and structs declared in source code.
63-
if (Block is null && ExpressionBody is null && !MakeSynthetic)
63+
if (Block is null && ExpressionBody is null && !MakeSynthetic || Context.OnlyScaffold)
6464
{
6565
return;
6666
}
@@ -113,6 +113,7 @@ protected override void ExtractInitializers(TextWriter trapFile)
113113
}
114114

115115
var baseConstructorTarget = Create(Context, baseConstructor);
116+
116117
var info = new ExpressionInfo(Context,
117118
AnnotatedTypeSymbol.CreateNotAnnotated(baseType),
118119
Location,

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ internal Expression(IExpressionInfo info, bool shouldPopulate = true)
3434

3535
protected sealed override void Populate(TextWriter trapFile)
3636
{
37-
if (Context.OnlyScaffold)
38-
{
39-
return;
40-
}
41-
4237
var type = Type.HasValue ? Entities.Type.Create(Context, Type.Value) : NullType.Create(Context);
4338
trapFile.expressions(this, Kind, type.TypeRef);
4439
if (info.Parent.IsTopLevelParent)

0 commit comments

Comments
 (0)