Skip to content

Commit 8a62778

Browse files
committed
C#: Extract out/ref information in this(...) constructor calls
1 parent a3b1fb6 commit 8a62778

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: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,7 @@ protected override void ExtractInitializers(TextWriter trapFile)
113113

114114
trapFile.expr_call(init, target);
115115

116-
var child = 0;
117-
foreach (var arg in initializer.ArgumentList.Arguments)
118-
{
119-
Expression.Create(Context, arg.Expression, init, child++);
120-
}
116+
init.PopulateArguments(trapFile, initializer.ArgumentList, 0);
121117
}
122118

123119
private ConstructorDeclarationSyntax? Syntax

csharp/ql/test/library-tests/csharp7.3/PrintAst.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ csharp73.cs:
102102
# 46| 1: [IntLiteral] 5
103103
# 49| 5: [InstanceConstructor] ExpressionVariables
104104
# 49| 3: [ConstructorInitializer] call to constructor ExpressionVariables
105-
# 49| 0: [LocalVariableDeclExpr] Int32 x
105+
# 49| 0: [LocalVariableAccess,LocalVariableDeclExpr] Int32 x
106106
# 50| 4: [BlockStmt] {...}
107107
# 51| 0: [ExprStmt] ...;
108108
# 51| 0: [MethodCall] call to method WriteLine

0 commit comments

Comments
 (0)