diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expression.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expression.cs
index 58b01891addc..321cdf3ff83d 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expression.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expression.cs
@@ -100,8 +100,14 @@ public static string ValueAsString(object? value)
/// The child index.
/// A type hint.
/// The new expression.
- public static Expression Create(Context cx, ExpressionSyntax node, IExpressionParentEntity parent, int child) =>
- CreateFromNode(new ExpressionNodeInfo(cx, node, parent, child));
+ public static Expression Create(Context cx, ExpressionSyntax node, IExpressionParentEntity parent, int child, Boolean isCompilerGenerated = false)
+ {
+ var info = new ExpressionNodeInfo(cx, node, parent, child)
+ {
+ IsCompilerGenerated = isCompilerGenerated
+ };
+ return CreateFromNode(info);
+ }
public static Expression CreateFromNode(ExpressionNodeInfo info) => Expressions.ImplicitCast.Create(info);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ArrayCreation.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ArrayCreation.cs
index 5c8aa8a35d39..302bcaded39a 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ArrayCreation.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ArrayCreation.cs
@@ -97,7 +97,7 @@ public static Expression CreateGenerated(Context cx, IExpressionParentEntity par
ExprKind.ARRAY_CREATION,
parent,
childIndex,
- true,
+ isCompilerGenerated: true,
null);
var arrayCreation = new Expression(info);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Assignment.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Assignment.cs
index 2494003471b7..4de5e460e6d9 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Assignment.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Assignment.cs
@@ -26,10 +26,10 @@ protected override void PopulateExpression(TextWriter trapFile)
if (operatorKind.HasValue)
{
// Convert assignment such as `a += b` into `a = a + b`.
- var simpleAssignExpr = new Expression(new ExpressionInfo(Context, Type, Location, ExprKind.SIMPLE_ASSIGN, this, 2, false, null));
+ var simpleAssignExpr = new Expression(new ExpressionInfo(Context, Type, Location, ExprKind.SIMPLE_ASSIGN, this, 2, isCompilerGenerated: true, null));
Create(Context, Syntax.Left, simpleAssignExpr, 1);
- var opexpr = new Expression(new ExpressionInfo(Context, Type, Location, operatorKind.Value, simpleAssignExpr, 0, false, null));
- Create(Context, Syntax.Left, opexpr, 0);
+ var opexpr = new Expression(new ExpressionInfo(Context, Type, Location, operatorKind.Value, simpleAssignExpr, 0, isCompilerGenerated: true, null));
+ Create(Context, Syntax.Left, opexpr, 0, isCompilerGenerated: true);
Create(Context, Syntax.Right, opexpr, 1);
opexpr.OperatorCall(trapFile, Syntax);
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Cast.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Cast.cs
index fee739af532a..62e23e3b66dc 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Cast.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Cast.cs
@@ -41,7 +41,7 @@ public static Expression CreateGenerated(Context cx, IExpressionParentEntity par
ExprKind.CAST,
parent,
childIndex,
- true,
+ isCompilerGenerated: true,
ValueAsString(value));
var ret = new Expression(info);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Collections/Spread.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Collections/Spread.cs
index c9fa8d3512a6..a27982f7aad4 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Collections/Spread.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Collections/Spread.cs
@@ -6,7 +6,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
internal class Spread : Expression
{
public Spread(Context cx, SpreadElementSyntax syntax, IExpressionParentEntity parent, int child) :
- base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), ExprKind.SPREAD_ELEMENT, parent, child, false, null))
+ base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), ExprKind.SPREAD_ELEMENT, parent, child, isCompilerGenerated: false, null))
{
Create(cx, syntax.Expression, this, 0);
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Default.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Default.cs
index fc3b03aaf981..968f2e8f43b7 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Default.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Default.cs
@@ -24,7 +24,7 @@ public static Expression CreateGenerated(Context cx, IExpressionParentEntity par
ExprKind.DEFAULT,
parent,
childIndex,
- true,
+ isCompilerGenerated: true,
value);
return new Expression(info);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Discard.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Discard.cs
index fc53cda191b9..33d9eb64b043 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Discard.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Discard.cs
@@ -11,7 +11,7 @@ public Discard(ExpressionNodeInfo info) : base(info.SetKind(ExprKind.DISCARD))
}
private Discard(Context cx, CSharpSyntaxNode syntax, IExpressionParentEntity parent, int child) :
- base(new ExpressionInfo(cx, cx.GetType(syntax), cx.CreateLocation(syntax.GetLocation()), ExprKind.DISCARD, parent, child, false, null))
+ base(new ExpressionInfo(cx, cx.GetType(syntax), cx.CreateLocation(syntax.GetLocation()), ExprKind.DISCARD, parent, child, isCompilerGenerated: false, null))
{
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ElementAccess.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ElementAccess.cs
index 8129743e04ad..34ad6bf2533a 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ElementAccess.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ElementAccess.cs
@@ -22,7 +22,7 @@ protected override void PopulateExpression(TextWriter trapFile)
if (Kind == ExprKind.POINTER_INDIRECTION)
{
var qualifierInfo = new ExpressionNodeInfo(Context, qualifier, this, 0);
- var add = new Expression(new ExpressionInfo(Context, qualifierInfo.Type, Location, ExprKind.ADD, this, 0, false, null));
+ var add = new Expression(new ExpressionInfo(Context, qualifierInfo.Type, Location, ExprKind.ADD, this, 0, isCompilerGenerated: false, null));
qualifierInfo.SetParent(add, 0);
CreateFromNode(qualifierInfo);
PopulateArguments(trapFile, argumentList, 1);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ImplicitCast.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ImplicitCast.cs
index 57a37d863605..3e886a9c3ac9 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ImplicitCast.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ImplicitCast.cs
@@ -14,13 +14,13 @@ public Expression Expr
}
private ImplicitCast(ExpressionNodeInfo info)
- : base(new ExpressionInfo(info.Context, info.ConvertedType, info.Location, ExprKind.CAST, info.Parent, info.Child, true, info.ExprValue))
+ : base(new ExpressionInfo(info.Context, info.ConvertedType, info.Location, ExprKind.CAST, info.Parent, info.Child, isCompilerGenerated: true, info.ExprValue))
{
Expr = Factory.Create(new ExpressionNodeInfo(Context, info.Node, this, 0));
}
private ImplicitCast(ExpressionNodeInfo info, IMethodSymbol method)
- : base(new ExpressionInfo(info.Context, info.ConvertedType, info.Location, ExprKind.OPERATOR_INVOCATION, info.Parent, info.Child, true, info.ExprValue))
+ : base(new ExpressionInfo(info.Context, info.ConvertedType, info.Location, ExprKind.OPERATOR_INVOCATION, info.Parent, info.Child, isCompilerGenerated: true, info.ExprValue))
{
Expr = Factory.Create(info.SetParent(this, 0));
@@ -65,7 +65,7 @@ ExpressionInfo create(ExprKind kind, string? v) =>
kind,
parent,
childIndex,
- true,
+ isCompilerGenerated: true,
v);
var method = GetImplicitConversionMethod(type, value);
@@ -93,7 +93,7 @@ public static Expression CreateGenerated(Context cx, IExpressionParentEntity par
ExprKind.CAST,
parent,
childIndex,
- true,
+ isCompilerGenerated: true,
ValueAsString(value));
return new Expression(info);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Initializer.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Initializer.cs
index d8289e59a281..cdc2e87798ec 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Initializer.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Initializer.cs
@@ -45,7 +45,7 @@ public static Expression CreateGenerated(Context cx, IExpressionParentEntity par
ExprKind.ARRAY_INIT,
parent,
index,
- true,
+ isCompilerGenerated: true,
null);
return new Expression(info);
@@ -132,7 +132,7 @@ protected override void PopulateExpression(TextWriter trapFile)
var addMethod = Method.Create(Context, collectionInfo.Symbol as IMethodSymbol);
var voidType = AnnotatedTypeSymbol.CreateNotAnnotated(Context.Compilation.GetSpecialType(SpecialType.System_Void));
- var invocation = new Expression(new ExpressionInfo(Context, voidType, Context.CreateLocation(i.GetLocation()), ExprKind.METHOD_INVOCATION, this, child++, false, null));
+ var invocation = new Expression(new ExpressionInfo(Context, voidType, Context.CreateLocation(i.GetLocation()), ExprKind.METHOD_INVOCATION, this, child++, isCompilerGenerated: true, null));
if (addMethod is not null)
trapFile.expr_call(invocation, addMethod);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/InterpolatedString.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/InterpolatedString.cs
index 1a98f9673120..2dfe4976391d 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/InterpolatedString.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/InterpolatedString.cs
@@ -25,7 +25,7 @@ protected override void PopulateExpression(TextWriter trapFile)
case SyntaxKind.InterpolatedStringText:
// Create a string literal
var interpolatedText = (InterpolatedStringTextSyntax)c;
- new Expression(new ExpressionInfo(Context, Type, Context.CreateLocation(c.GetLocation()), ExprKind.UTF16_STRING_LITERAL, this, child++, false, interpolatedText.TextToken.ValueText));
+ new Expression(new ExpressionInfo(Context, Type, Context.CreateLocation(c.GetLocation()), ExprKind.UTF16_STRING_LITERAL, this, child++, isCompilerGenerated: false, interpolatedText.TextToken.ValueText));
break;
default:
throw new InternalError(c, $"Unhandled interpolation kind {c.Kind()}");
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Literal.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Literal.cs
index 3a0158ba1aea..72d54abf6c1a 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Literal.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Literal.cs
@@ -97,7 +97,7 @@ public static Expression CreateGenerated(Context cx, IExpressionParentEntity par
kind,
parent,
childIndex,
- true,
+ isCompilerGenerated: true,
ValueAsString(value));
return new Expression(info);
@@ -112,7 +112,7 @@ public static Expression CreateGeneratedNullLiteral(Context cx, IExpressionParen
ExprKind.NULL_LITERAL,
parent,
childIndex,
- true,
+ isCompilerGenerated: true,
ValueAsString(null));
return new Expression(info);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ObjectCreation/AnonymousObjectCreation.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ObjectCreation/AnonymousObjectCreation.cs
index f1974f1a50b7..a6f94f533387 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ObjectCreation/AnonymousObjectCreation.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ObjectCreation/AnonymousObjectCreation.cs
@@ -30,7 +30,7 @@ protected override void PopulateExpression(TextWriter trapFile)
return;
}
- var objectInitializer = new Expression(new ExpressionInfo(Context, Type, Location, ExprKind.OBJECT_INIT, this, -1, false, null));
+ var objectInitializer = new Expression(new ExpressionInfo(Context, Type, Location, ExprKind.OBJECT_INIT, this, -1, isCompilerGenerated: false, null));
foreach (var init in Syntax.Initializers)
{
@@ -40,11 +40,11 @@ protected override void PopulateExpression(TextWriter trapFile)
var type = property.GetAnnotatedType();
var loc = Context.CreateLocation(init.GetLocation());
- var assignment = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.SIMPLE_ASSIGN, objectInitializer, child++, false, null));
+ var assignment = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.SIMPLE_ASSIGN, objectInitializer, child++, isCompilerGenerated: false, null));
Create(Context, init.Expression, assignment, 0);
Property.Create(Context, property);
- var access = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.PROPERTY_ACCESS, assignment, 1, false, null));
+ var access = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.PROPERTY_ACCESS, assignment, 1, isCompilerGenerated: false, null));
trapFile.expr_access(access, propEntity);
}
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ObjectCreation/DateTimeObjectCreation.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ObjectCreation/DateTimeObjectCreation.cs
index e9f40b1bc674..012a30d81cc4 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ObjectCreation/DateTimeObjectCreation.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/ObjectCreation/DateTimeObjectCreation.cs
@@ -59,7 +59,7 @@ public static Expression CreateGenerated(Context cx, IExpressionParentEntity par
ExprKind.OBJECT_CREATION,
parent,
childIndex,
- true,
+ isCompilerGenerated: true,
null));
var longTypeSymbol = constructorSymbol.Parameters[0].Type;
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/BinaryPattern.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/BinaryPattern.cs
index ec5177c8ce6a..3eaf9cc55c3d 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/BinaryPattern.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/BinaryPattern.cs
@@ -8,7 +8,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
internal class BinaryPattern : Expression
{
public BinaryPattern(Context cx, BinaryPatternSyntax syntax, IExpressionParentEntity parent, int child) :
- base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), GetKind(syntax.OperatorToken, syntax), parent, child, false, null))
+ base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), GetKind(syntax.OperatorToken, syntax), parent, child, isCompilerGenerated: false, null))
{
Pattern.Create(cx, syntax.Left, this, 0);
Pattern.Create(cx, syntax.Right, this, 1);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/ListPattern.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/ListPattern.cs
index 87aeb84bcb48..492e2bcb1ce0 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/ListPattern.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/ListPattern.cs
@@ -7,7 +7,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
internal class ListPattern : Expression
{
internal ListPattern(Context cx, ListPatternSyntax syntax, IExpressionParentEntity parent, int child) :
- base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), ExprKind.LIST_PATTERN, parent, child, false, null))
+ base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), ExprKind.LIST_PATTERN, parent, child, isCompilerGenerated: false, null))
{
syntax.Patterns.ForEach((p, i) => Pattern.Create(cx, p, this, i));
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/PositionalPattern.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/PositionalPattern.cs
index aaf2737c1146..e6a34fd70303 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/PositionalPattern.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/PositionalPattern.cs
@@ -7,7 +7,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
internal class PositionalPattern : Expression
{
internal PositionalPattern(Context cx, PositionalPatternClauseSyntax posPc, IExpressionParentEntity parent, int child) :
- base(new ExpressionInfo(cx, null, cx.CreateLocation(posPc.GetLocation()), ExprKind.POSITIONAL_PATTERN, parent, child, false, null))
+ base(new ExpressionInfo(cx, null, cx.CreateLocation(posPc.GetLocation()), ExprKind.POSITIONAL_PATTERN, parent, child, isCompilerGenerated: false, null))
{
posPc.Subpatterns.ForEach((p, i) => Pattern.Create(cx, p.Pattern, this, i));
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/PropertyPattern.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/PropertyPattern.cs
index 30a020702e52..a195d9ffb832 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/PropertyPattern.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/PropertyPattern.cs
@@ -7,7 +7,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
internal class PropertyPattern : Expression
{
internal PropertyPattern(Context cx, PropertyPatternClauseSyntax pp, IExpressionParentEntity parent, int child) :
- base(new ExpressionInfo(cx, null, cx.CreateLocation(pp.GetLocation()), ExprKind.PROPERTY_PATTERN, parent, child, false, null))
+ base(new ExpressionInfo(cx, null, cx.CreateLocation(pp.GetLocation()), ExprKind.PROPERTY_PATTERN, parent, child, isCompilerGenerated: false, null))
{
child = 0;
foreach (var sub in pp.Subpatterns)
@@ -56,7 +56,7 @@ private static AccessStepPack GetAccessStepPack(BaseExpressionColonSyntax syntax
};
private static Expression CreateSyntheticExp(Context cx, Microsoft.CodeAnalysis.Location location, IExpressionParentEntity parent, int child) =>
- new Expression(new ExpressionInfo(cx, null, cx.CreateLocation(location), ExprKind.PROPERTY_PATTERN, parent, child, false, null));
+ new Expression(new ExpressionInfo(cx, null, cx.CreateLocation(location), ExprKind.PROPERTY_PATTERN, parent, child, isCompilerGenerated: false, null));
private static void MakeExpressions(Context cx, IExpressionParentEntity parent, SubpatternSyntax syntax, int child)
{
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/RecursivePattern.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/RecursivePattern.cs
index 010e48070ad4..514867770b6e 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/RecursivePattern.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/RecursivePattern.cs
@@ -15,7 +15,7 @@ internal class RecursivePattern : Expression
/// The parent pattern/expression.
/// The child index of this pattern.
public RecursivePattern(Context cx, RecursivePatternSyntax syntax, IExpressionParentEntity parent, int child) :
- base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), ExprKind.RECURSIVE_PATTERN, parent, child, false, null))
+ base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), ExprKind.RECURSIVE_PATTERN, parent, child, isCompilerGenerated: false, null))
{
// Extract the type access
if (syntax.Type is TypeSyntax t)
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/RelationalPattern.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/RelationalPattern.cs
index 2af3ceef60ad..4f6c2eac11ff 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/RelationalPattern.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/RelationalPattern.cs
@@ -8,7 +8,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
internal class RelationalPattern : Expression
{
public RelationalPattern(Context cx, RelationalPatternSyntax syntax, IExpressionParentEntity parent, int child) :
- base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), GetKind(syntax.OperatorToken), parent, child, false, null))
+ base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), GetKind(syntax.OperatorToken), parent, child, isCompilerGenerated: false, null))
{
Expression.Create(cx, syntax.Expression, this, 0);
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/SlicePattern.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/SlicePattern.cs
index d52af4f54f4a..69d7cc878beb 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/SlicePattern.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/SlicePattern.cs
@@ -6,7 +6,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
internal class SlicePattern : Expression
{
public SlicePattern(Context cx, SlicePatternSyntax syntax, IExpressionParentEntity parent, int child) :
- base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), ExprKind.SLICE_PATTERN, parent, child, false, null))
+ base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), ExprKind.SLICE_PATTERN, parent, child, isCompilerGenerated: false, null))
{
if (syntax.Pattern is not null)
{
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/UnaryPattern.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/UnaryPattern.cs
index 1703211fb3d9..64663c7a6e14 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/UnaryPattern.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Patterns/UnaryPattern.cs
@@ -6,7 +6,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
internal class UnaryPattern : Expression
{
public UnaryPattern(Context cx, UnaryPatternSyntax syntax, IExpressionParentEntity parent, int child) :
- base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), ExprKind.NOT_PATTERN, parent, child, false, null))
+ base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), ExprKind.NOT_PATTERN, parent, child, isCompilerGenerated: false, null))
{
Pattern.Create(cx, syntax.Pattern, this, 0);
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Query.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Query.cs
index 02936916bf4d..85a1ceda47ca 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Query.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Query.cs
@@ -23,7 +23,7 @@ private class QueryCall : Expression
public QueryCall(Context cx, IMethodSymbol? method, SyntaxNode clause, IExpressionParentEntity parent, int child)
: base(new ExpressionInfo(cx, method?.GetAnnotatedReturnType(),
cx.CreateLocation(clause.GetLocation()),
- ExprKind.METHOD_INVOCATION, parent, child, false, null))
+ ExprKind.METHOD_INVOCATION, parent, child, isCompilerGenerated: false, null))
{
if (method is not null)
cx.TrapWriter.Writer.expr_call(this, Method.Create(cx, method));
@@ -97,7 +97,7 @@ protected Expression DeclareRangeVariable(Context cx, IExpressionParentEntity pa
Expression.Create(cx, Expr, decl, 0);
var nameLoc = cx.CreateLocation(name.GetLocation());
- var access = new Expression(new ExpressionInfo(cx, type, nameLoc, ExprKind.LOCAL_VARIABLE_ACCESS, decl, 1, false, null));
+ var access = new Expression(new ExpressionInfo(cx, type, nameLoc, ExprKind.LOCAL_VARIABLE_ACCESS, decl, 1, isCompilerGenerated: false, null));
cx.TrapWriter.Writer.expr_access(access, LocalVariable.Create(cx, variableSymbol));
return decl;
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Switch.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Switch.cs
index 2e161f508aa4..26b71a6deb4a 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Switch.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Switch.cs
@@ -27,7 +27,7 @@ internal class SwitchCase : Expression
internal SwitchCase(Context cx, SwitchExpressionArmSyntax arm, Switch parent, int child) :
base(new ExpressionInfo(
cx, cx.GetType(arm.Expression), cx.CreateLocation(arm.GetLocation()),
- ExprKind.SWITCH_CASE, parent, child, false, null))
+ ExprKind.SWITCH_CASE, parent, child, isCompilerGenerated: false, null))
{
Expressions.Pattern.Create(cx, arm.Pattern, this, 0);
if (arm.WhenClause is WhenClauseSyntax when)
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/This.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/This.cs
index a13c2cb95bc4..33f2ad9fbc78 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/This.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/This.cs
@@ -8,7 +8,7 @@ internal class This : Expression
private This(IExpressionInfo info) : base(info) { }
public static This CreateImplicit(Context cx, ITypeSymbol @class, Extraction.Entities.Location loc, IExpressionParentEntity parent, int child) =>
- new This(new ExpressionInfo(cx, AnnotatedTypeSymbol.CreateNotAnnotated(@class), loc, Kinds.ExprKind.THIS_ACCESS, parent, child, true, null));
+ new This(new ExpressionInfo(cx, AnnotatedTypeSymbol.CreateNotAnnotated(@class), loc, Kinds.ExprKind.THIS_ACCESS, parent, child, isCompilerGenerated: true, null));
public static This CreateExplicit(ExpressionNodeInfo info) => new This(info.SetKind(ExprKind.THIS_ACCESS));
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/TypeAccess.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/TypeAccess.cs
index b6eaca72844f..b4e678d8ab6b 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/TypeAccess.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/TypeAccess.cs
@@ -44,7 +44,7 @@ public static Expression CreateGenerated(Context cx, IExpressionParentEntity par
ExprKind.TYPE_ACCESS,
parent,
childIndex,
- true,
+ isCompilerGenerated: true,
null);
return new Expression(typeAccessInfo);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/TypeOf.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/TypeOf.cs
index c499e405ccb4..b36c1e425a03 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/TypeOf.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/TypeOf.cs
@@ -26,7 +26,7 @@ public static Expression CreateGenerated(Context cx, IExpressionParentEntity par
ExprKind.TYPEOF,
parent,
childIndex,
- true,
+ isCompilerGenerated: true,
null);
var ret = new Expression(info);
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/VariableDeclaration.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/VariableDeclaration.cs
index e77040fd16c3..5931feb070c0 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/VariableDeclaration.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/VariableDeclaration.cs
@@ -15,7 +15,7 @@ private VariableDeclaration(IExpressionInfo info) : base(info) { }
public static VariableDeclaration Create(Context cx, ISymbol symbol, AnnotatedTypeSymbol? type, TypeSyntax? optionalSyntax, Extraction.Entities.Location exprLocation, bool isVar, IExpressionParentEntity parent, int child)
{
- var ret = new VariableDeclaration(new ExpressionInfo(cx, type, exprLocation, ExprKind.LOCAL_VAR_DECL, parent, child, false, null));
+ var ret = new VariableDeclaration(new ExpressionInfo(cx, type, exprLocation, ExprKind.LOCAL_VAR_DECL, parent, child, isCompilerGenerated: false, null));
cx.Try(null, null, () =>
{
var l = LocalVariable.Create(cx, symbol);
@@ -52,7 +52,7 @@ private static VariableDeclaration CreateSingle(Context cx, DeclarationExpressio
public static Expression CreateParenthesized(Context cx, DeclarationExpressionSyntax node, ParenthesizedVariableDesignationSyntax designation, IExpressionParentEntity parent, int child, INamedTypeSymbol? t)
{
var type = t is null ? (AnnotatedTypeSymbol?)null : new AnnotatedTypeSymbol(t, t.NullableAnnotation);
- var tuple = new Expression(new ExpressionInfo(cx, type, cx.CreateLocation(node.GetLocation()), ExprKind.TUPLE, parent, child, false, null));
+ var tuple = new Expression(new ExpressionInfo(cx, type, cx.CreateLocation(node.GetLocation()), ExprKind.TUPLE, parent, child, isCompilerGenerated: false, null));
cx.Try(null, null, () =>
{
@@ -68,7 +68,7 @@ public static Expression CreateParenthesized(Context cx, DeclarationExpressionSy
public static Expression CreateParenthesized(Context cx, VarPatternSyntax varPattern, ParenthesizedVariableDesignationSyntax designation, IExpressionParentEntity parent, int child)
{
var tuple = new Expression(
- new ExpressionInfo(cx, null, cx.CreateLocation(varPattern.GetLocation()), ExprKind.TUPLE, parent, child, false, null),
+ new ExpressionInfo(cx, null, cx.CreateLocation(varPattern.GetLocation()), ExprKind.TUPLE, parent, child, isCompilerGenerated: false, null),
shouldPopulate: false);
var elementTypes = new List();
@@ -148,7 +148,7 @@ public static Expression Create(Context cx, DeclarationExpressionSyntax node, IE
Create(cx, node, node.Designation, parent, child, cx.GetTypeInfo(node).Type.DisambiguateType() as INamedTypeSymbol);
public static VariableDeclaration Create(Context cx, CSharpSyntaxNode c, AnnotatedTypeSymbol? type, IExpressionParentEntity parent, int child) =>
- new VariableDeclaration(new ExpressionInfo(cx, type, cx.CreateLocation(c.FixedLocation()), ExprKind.LOCAL_VAR_DECL, parent, child, false, null));
+ new VariableDeclaration(new ExpressionInfo(cx, type, cx.CreateLocation(c.FixedLocation()), ExprKind.LOCAL_VAR_DECL, parent, child, isCompilerGenerated: false, null));
public static VariableDeclaration Create(Context cx, CatchDeclarationSyntax d, bool isVar, IExpressionParentEntity parent, int child)
{
@@ -179,7 +179,7 @@ public static VariableDeclaration CreateDeclarator(Context cx, VariableDeclarato
Create(cx, d.Initializer.Value, ret, 0);
// Create an access
- var access = new Expression(new ExpressionInfo(cx, type, localVar.Location, ExprKind.LOCAL_VARIABLE_ACCESS, ret, 1, false, null));
+ var access = new Expression(new ExpressionInfo(cx, type, localVar.Location, ExprKind.LOCAL_VARIABLE_ACCESS, ret, 1, isCompilerGenerated: false, null));
cx.TrapWriter.Writer.expr_access(access, localVar);
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Field.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Field.cs
index a65b30af5aaf..f423f42dd5cd 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Field.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Field.cs
@@ -110,9 +110,9 @@ private Expression AddInitializerAssignment(TextWriter trapFile, ExpressionSynta
string? constValue, ref int child)
{
var type = Symbol.GetAnnotatedType();
- var simpleAssignExpr = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.SIMPLE_ASSIGN, this, child++, false, constValue));
+ var simpleAssignExpr = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.SIMPLE_ASSIGN, this, child++, isCompilerGenerated: true, constValue));
Expression.CreateFromNode(new ExpressionNodeInfo(Context, initializer, simpleAssignExpr, 0));
- var access = new Expression(new ExpressionInfo(Context, type, Location, ExprKind.FIELD_ACCESS, simpleAssignExpr, 1, false, constValue));
+ var access = new Expression(new ExpressionInfo(Context, type, Location, ExprKind.FIELD_ACCESS, simpleAssignExpr, 1, isCompilerGenerated: true, constValue));
trapFile.expr_access(access, this);
return access;
}
diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Property.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Property.cs
index 08fa43354522..07e74e821641 100644
--- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Property.cs
+++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Property.cs
@@ -86,9 +86,9 @@ public override void Populate(TextWriter trapFile)
{
var loc = Context.CreateLocation(initializer!.GetLocation());
var annotatedType = AnnotatedTypeSymbol.CreateNotAnnotated(Symbol.Type);
- var simpleAssignExpr = new Expression(new ExpressionInfo(Context, annotatedType, loc, ExprKind.SIMPLE_ASSIGN, this, child++, false, null));
+ var simpleAssignExpr = new Expression(new ExpressionInfo(Context, annotatedType, loc, ExprKind.SIMPLE_ASSIGN, this, child++, isCompilerGenerated: true, null));
Expression.CreateFromNode(new ExpressionNodeInfo(Context, initializer.Value, simpleAssignExpr, 0));
- var access = new Expression(new ExpressionInfo(Context, annotatedType, Location, ExprKind.PROPERTY_ACCESS, simpleAssignExpr, 1, false, null));
+ var access = new Expression(new ExpressionInfo(Context, annotatedType, Location, ExprKind.PROPERTY_ACCESS, simpleAssignExpr, 1, isCompilerGenerated: true, null));
trapFile.expr_access(access, this);
if (!Symbol.IsStatic)
{
diff --git a/csharp/ql/lib/semmle/code/csharp/PrintAst.qll b/csharp/ql/lib/semmle/code/csharp/PrintAst.qll
index eb5ca6b47273..281e157975ab 100644
--- a/csharp/ql/lib/semmle/code/csharp/PrintAst.qll
+++ b/csharp/ql/lib/semmle/code/csharp/PrintAst.qll
@@ -32,7 +32,10 @@ private predicate shouldPrint(Element e, Location l) {
}
private predicate isImplicitExpression(ControlFlowElement element) {
- element.(Expr).isImplicit() and not exists(element.getAChild())
+ element.(Expr).isImplicit() and
+ not element instanceof CastExpr and
+ not element.(OperatorCall).getTarget() instanceof ImplicitConversionOperator and
+ not element instanceof ElementInitializer
}
private predicate isFilteredCompilerGenerated(Declaration d) {
@@ -291,18 +294,6 @@ class ControlFlowElementNode extends ElementNode {
controlFlowElement = element and
// Removing implicit expressions
not isImplicitExpression(element) and
- // Removing extra nodes that are generated for an `AssignOperation`
- not exists(AssignOperation ao |
- ao.hasExpandedAssignment() and
- (
- ao.getExpandedAssignment() = controlFlowElement or
- ao.getExpandedAssignment().getRValue() = controlFlowElement or
- ao.getExpandedAssignment().getRValue().(BinaryOperation).getLeftOperand() =
- controlFlowElement.getParent*() or
- ao.getExpandedAssignment().getRValue().(OperatorCall).getChild(0) =
- controlFlowElement.getParent*()
- )
- ) and
not isNotNeeded(element.getParent+()) and
// LambdaExpr is both a Callable and a ControlFlowElement,
// print it with the more specific CallableNode
@@ -429,7 +420,7 @@ final class DeclarationWithAccessorsNode extends ElementNode {
result.(ParametersNode).getParameterizable() = declaration
or
childIndex = 2 and
- result.(ElementNode).getElement() = declaration.(Property).getInitializer().getParent()
+ result.(ElementNode).getElement() = declaration.(Property).getInitializer()
or
result.(ElementNode).getElement() =
rank[childIndex - 2](Element a, string file, int line, int column, string name |
@@ -462,12 +453,7 @@ final class FieldNode extends ElementNode {
result.(AttributesNode).getAttributable() = field
or
childIndex = 1 and
- field.hasInitializer() and
- (
- if field.getDeclaringType() instanceof Enum
- then result.(ElementNode).getElement() = field.getInitializer()
- else result.(ElementNode).getElement() = field.getInitializer().getParent()
- )
+ result.(ElementNode).getElement() = field.getInitializer()
}
}
diff --git a/csharp/ql/lib/semmle/code/csharp/Variable.qll b/csharp/ql/lib/semmle/code/csharp/Variable.qll
index 4bef47056ef5..982b4e4743b6 100644
--- a/csharp/ql/lib/semmle/code/csharp/Variable.qll
+++ b/csharp/ql/lib/semmle/code/csharp/Variable.qll
@@ -408,7 +408,7 @@ class Field extends Variable, AssignableMember, Attributable, TopLevelExprParent
* }
* ```
*/
- override Expr getInitializer() { result = this.getChildExpr(0).getChildExpr(0) }
+ final override Expr getInitializer() { result = this.getChildExpr(0).getChildExpr(0) }
/**
* Holds if this field has an initial value. For example, the initial
@@ -515,6 +515,4 @@ class EnumConstant extends MemberConstant {
* ```
*/
predicate hasExplicitValue() { exists(this.getInitializer()) }
-
- override Expr getInitializer() { result = this.getChildExpr(0) }
}
diff --git a/csharp/ql/lib/semmle/code/csharp/exprs/Expr.qll b/csharp/ql/lib/semmle/code/csharp/exprs/Expr.qll
index 0cd3f36467c0..935162523a16 100644
--- a/csharp/ql/lib/semmle/code/csharp/exprs/Expr.qll
+++ b/csharp/ql/lib/semmle/code/csharp/exprs/Expr.qll
@@ -67,7 +67,11 @@ class Expr extends ControlFlowElement, @expr {
* Holds if this expression is generated by the compiler and does not appear
* explicitly in the source code.
*/
- predicate isImplicit() { compiler_generated(this) }
+ final predicate isImplicit() {
+ compiler_generated(this) or
+ this =
+ any(AssignOperation op).getExpandedAssignment().getRValue().getChildExpr(0).getAChildExpr+()
+ }
/**
* Gets an expression that is the result of stripping (recursively) all
diff --git a/csharp/ql/test/library-tests/attributes/PrintAst.expected b/csharp/ql/test/library-tests/attributes/PrintAst.expected
index 62106d43664e..209aba20ff13 100644
--- a/csharp/ql/test/library-tests/attributes/PrintAst.expected
+++ b/csharp/ql/test/library-tests/attributes/PrintAst.expected
@@ -163,9 +163,7 @@ attributes.cs:
# 67| 4: [BlockStmt] {...}
# 70| [Enum] E
# 70| 5: [Field] A
-# 70| 1: [AssignExpr] ... = ...
-# 70| 0: [MemberConstantAccess] access to constant A
-# 70| 1: [IntLiteral] 42
+# 70| 1: [IntLiteral] 42
# 72| [Class] ArgsAttribute
#-----| 3: (Base types)
# 72| 0: [TypeMention] Attribute
diff --git a/csharp/ql/test/library-tests/comments/PrintAst.expected b/csharp/ql/test/library-tests/comments/PrintAst.expected
index cbbfbc58c8d2..68c2c582e371 100644
--- a/csharp/ql/test/library-tests/comments/PrintAst.expected
+++ b/csharp/ql/test/library-tests/comments/PrintAst.expected
@@ -186,14 +186,10 @@ trivia.cs:
# 89| 4: [BlockStmt] {...}
# 92| 7: [Field] F1
# 92| -1: [TypeMention] int
-# 92| 1: [AssignExpr] ... = ...
-# 92| 0: [FieldAccess] access to field F1
-# 94| 1: [IntLiteral] 10
+# 94| 1: [IntLiteral] 10
# 98| 8: [Field] F2
# 98| -1: [TypeMention] int
-# 98| 1: [AssignExpr] ... = ...
-# 98| 0: [FieldAccess] access to field F2
-# 98| 1: [IntLiteral] 0
+# 98| 1: [IntLiteral] 0
# 100| 9: [Property] P1
# 100| -1: [TypeMention] int
# 102| 3: [Getter] get_P1
diff --git a/csharp/ql/test/library-tests/csharp11/PrintAst.expected b/csharp/ql/test/library-tests/csharp11/PrintAst.expected
index 4716334aca04..dc1927360e1b 100644
--- a/csharp/ql/test/library-tests/csharp11/PrintAst.expected
+++ b/csharp/ql/test/library-tests/csharp11/PrintAst.expected
@@ -1111,18 +1111,14 @@ StaticInterfaceMembers.cs:
#-----| 3: (Base types)
# 28| 4: [Property] Real
# 28| -1: [TypeMention] double
-# 28| 2: [AssignExpr] ... = ...
-# 28| 0: [PropertyCall] access to property Real
-# 28| 1: [DoubleLiteral] 0
+# 28| 2: [DoubleLiteral] 0
# 28| 3: [Getter] get_Real
# 28| 4: [Setter] set_Real
#-----| 2: (Parameters)
# 28| 0: [Parameter] value
# 29| 5: [Property] Imaginary
# 29| -1: [TypeMention] double
-# 29| 2: [AssignExpr] ... = ...
-# 29| 0: [PropertyCall] access to property Imaginary
-# 29| 1: [DoubleLiteral] 0
+# 29| 2: [DoubleLiteral] 0
# 29| 3: [Getter] get_Imaginary
# 29| 4: [Setter] set_Imaginary
#-----| 2: (Parameters)
diff --git a/csharp/ql/test/library-tests/csharp6/PrintAst.expected b/csharp/ql/test/library-tests/csharp6/PrintAst.expected
index 5fe46bf5afac..892ad6dd4b15 100644
--- a/csharp/ql/test/library-tests/csharp6/PrintAst.expected
+++ b/csharp/ql/test/library-tests/csharp6/PrintAst.expected
@@ -2,9 +2,7 @@ csharp6.cs:
# 10| [Class] TestCSharp6
# 12| 6: [Property] Value
# 12| -1: [TypeMention] int
-# 15| 2: [AssignExpr] ... = ...
-# 12| 0: [PropertyCall] access to property Value
-# 15| 1: [IntLiteral] 20
+# 15| 2: [IntLiteral] 20
# 14| 3: [Getter] get_Value
# 17| 7: [Method] Fn
# 17| -1: [TypeMention] Void
diff --git a/csharp/ql/test/library-tests/csharp7.2/PrintAst.expected b/csharp/ql/test/library-tests/csharp7.2/PrintAst.expected
index 39b7c407b74c..31036ced693c 100644
--- a/csharp/ql/test/library-tests/csharp7.2/PrintAst.expected
+++ b/csharp/ql/test/library-tests/csharp7.2/PrintAst.expected
@@ -35,15 +35,11 @@ csharp72.cs:
# 44| [Class] NumericLiterals
# 46| 5: [Field] binaryValue
# 46| -1: [TypeMention] int
-# 46| 1: [AssignExpr] ... = ...
-# 46| 0: [FieldAccess] access to field binaryValue
-# 46| 1: [IntLiteral] 85
+# 46| 1: [IntLiteral] 85
# 49| [Class] PrivateProtected
# 51| 5: [Field] X
# 51| -1: [TypeMention] int
-# 51| 1: [AssignExpr] ... = ...
-# 51| 0: [FieldAccess] access to field X
-# 51| 1: [IntLiteral] 1
+# 51| 1: [IntLiteral] 1
# 53| 6: [Method] F
# 53| -1: [TypeMention] Void
# 53| 4: [BlockStmt] {...}
diff --git a/csharp/ql/test/library-tests/csharp7/PrintAst.expected b/csharp/ql/test/library-tests/csharp7/PrintAst.expected
index 7f8e1d1659ab..e5d009e0df63 100644
--- a/csharp/ql/test/library-tests/csharp7/PrintAst.expected
+++ b/csharp/ql/test/library-tests/csharp7/PrintAst.expected
@@ -2,25 +2,17 @@ CSharp7.cs:
# 5| [Class] Literals
# 7| 5: [Field] x
# 7| -1: [TypeMention] int
-# 7| 1: [AssignExpr] ... = ...
-# 7| 0: [FieldAccess] access to field x
-# 7| 1: [IntLiteral] 11
+# 7| 1: [IntLiteral] 11
# 8| 6: [Field] y
# 8| -1: [TypeMention] int
-# 8| 1: [AssignExpr] ... = ...
-# 8| 0: [FieldAccess] access to field y
-# 8| 1: [IntLiteral] 123456
+# 8| 1: [IntLiteral] 123456
# 9| 7: [Field] z
# 9| -1: [TypeMention] int
-# 9| 1: [AssignExpr] ... = ...
-# 9| 0: [FieldAccess] access to field z
-# 9| 1: [IntLiteral] 128
+# 9| 1: [IntLiteral] 128
# 12| [Class] ExpressionBodiedMembers
# 14| 4: [Field] field
# 14| -1: [TypeMention] int
-# 14| 1: [AssignExpr] ... = ...
-# 14| 0: [FieldAccess] access to field field
-# 14| 1: [IntLiteral] 0
+# 14| 1: [IntLiteral] 0
# 15| 5: [Method] Foo
# 15| -1: [TypeMention] int
# 15| 4: [FieldAccess] access to field field
diff --git a/csharp/ql/test/library-tests/csharp8/PrintAst.expected b/csharp/ql/test/library-tests/csharp8/PrintAst.expected
index 10dceb400ed5..c33374e4761d 100644
--- a/csharp/ql/test/library-tests/csharp8/PrintAst.expected
+++ b/csharp/ql/test/library-tests/csharp8/PrintAst.expected
@@ -2,18 +2,14 @@ AlternateInterpolatedStrings.cs:
# 3| [Class] AlternateInterpolatedStrings
# 5| 5: [Field] s1
# 5| -1: [TypeMention] string
-# 5| 1: [AssignExpr] ... = ...
-# 5| 0: [FieldAccess] access to field s1
-# 5| 1: [InterpolatedStringExpr] $"..."
-# 5| 0: [StringLiteralUtf16] "C:"
-# 5| 1: [IntLiteral] 12
+# 5| 1: [InterpolatedStringExpr] $"..."
+# 5| 0: [StringLiteralUtf16] "C:"
+# 5| 1: [IntLiteral] 12
# 6| 6: [Field] s2
# 6| -1: [TypeMention] string
-# 6| 1: [AssignExpr] ... = ...
-# 6| 0: [FieldAccess] access to field s2
-# 6| 1: [InterpolatedStringExpr] $"..."
-# 6| 0: [StringLiteralUtf16] "C:"
-# 6| 1: [IntLiteral] 12
+# 6| 1: [InterpolatedStringExpr] $"..."
+# 6| 0: [StringLiteralUtf16] "C:"
+# 6| 1: [IntLiteral] 12
AsyncStreams.cs:
# 6| [Class] AsyncStreams
# 8| 5: [Method] Items
diff --git a/csharp/ql/test/library-tests/csharp9/PrintAst.expected b/csharp/ql/test/library-tests/csharp9/PrintAst.expected
index eacbfd8fd45a..a1ecbd0a2123 100644
--- a/csharp/ql/test/library-tests/csharp9/PrintAst.expected
+++ b/csharp/ql/test/library-tests/csharp9/PrintAst.expected
@@ -3,10 +3,8 @@ AnonymousObjectCreation.cs:
# 7| 5: [Field] l
# 7| -1: [TypeMention] List
# 7| 1: [TypeMention] AnonObj
-# 7| 1: [AssignExpr] ... = ...
-# 7| 0: [FieldAccess] access to field l
-# 7| 1: [CastExpr] (...) ...
-# 7| 1: [ObjectCreation] object creation of type List
+# 7| 1: [CastExpr] (...) ...
+# 7| 1: [ObjectCreation] object creation of type List
# 9| 6: [Property] Prop1
# 9| -1: [TypeMention] int
# 9| 3: [Getter] get_Prop1
@@ -294,10 +292,8 @@ FunctionPointer.cs:
# 5| 5: [Class] Program
# 7| 5: [Field] pointer
# 7| -1: [TypeMention] delegate* default
-# 7| 1: [AssignExpr] ... = ...
-# 7| 0: [FieldAccess] access to field pointer
-# 7| 1: [AddressOfExpr] &...
-# 7| 0: [MethodAccess] access to method M0
+# 7| 1: [AddressOfExpr] &...
+# 7| 0: [MethodAccess] access to method M0
# 9| 6: [Method] M0
# 9| -1: [TypeMention] int
# 10| 4: [BlockStmt] {...}
diff --git a/csharp/ql/test/library-tests/definitions/PrintAst.expected b/csharp/ql/test/library-tests/definitions/PrintAst.expected
index 2f15f70f4473..1ad3ad1a61d4 100644
--- a/csharp/ql/test/library-tests/definitions/PrintAst.expected
+++ b/csharp/ql/test/library-tests/definitions/PrintAst.expected
@@ -12,13 +12,9 @@ definitions.cs:
# 9| 4: [BlockStmt] {...}
# 13| 2: [Enum] Enumeration
# 15| 5: [Field] e1
-# 15| 1: [AssignExpr] ... = ...
-# 15| 0: [MemberConstantAccess] access to constant e1
-# 15| 1: [IntLiteral] 1
+# 15| 1: [IntLiteral] 1
# 15| 6: [Field] e2
-# 15| 1: [AssignExpr] ... = ...
-# 15| 0: [MemberConstantAccess] access to constant e2
-# 15| 1: [IntLiteral] 2
+# 15| 1: [IntLiteral] 2
# 15| 7: [Field] e3
# 18| 3: [Class] C1
# 20| 4: [InstanceConstructor] C1
@@ -405,14 +401,12 @@ definitions.cs:
# 166| -1: [TypeMention] Nested
# 166| 1: [TypeMention] C4
# 166| 2: [TypeMention] I4
-# 166| 1: [AssignExpr] ... = ...
-# 166| 0: [FieldAccess] access to field f
-# 166| 1: [MethodCall] call to method Create
-# 166| -1: [TypeAccess] access to type Nested
-# 166| -2: [TypeMention] Nested
-# 166| 1: [TypeMention] I4
-# 166| -1: [TypeAccess] access to type C4
-# 166| 0: [TypeMention] C4
+# 166| 1: [MethodCall] call to method Create
+# 166| -1: [TypeAccess] access to type Nested
+# 166| -2: [TypeMention] Nested
+# 166| 1: [TypeMention] I4
+# 166| -1: [TypeAccess] access to type C4
+# 166| 0: [TypeMention] C4
# 167| 6: [Field] c1
# 167| -1: [TypeMention] C1
# 169| 7: [Method] M
diff --git a/csharp/ql/test/library-tests/enums/PrintAst.expected b/csharp/ql/test/library-tests/enums/PrintAst.expected
index 6c357704ad17..bb9e5a3a9c9b 100644
--- a/csharp/ql/test/library-tests/enums/PrintAst.expected
+++ b/csharp/ql/test/library-tests/enums/PrintAst.expected
@@ -11,35 +11,25 @@ enums.cs:
# 23| 3: [Enum] E
# 25| 4: [Enum] ValueColor
# 28| 5: [Field] OneRed
-# 28| 1: [AssignExpr] ... = ...
-# 28| 0: [MemberConstantAccess] access to constant OneRed
-# 28| 1: [CastExpr] (...) ...
-# 28| 1: [IntLiteral] 1
+# 28| 1: [CastExpr] (...) ...
+# 28| 1: [IntLiteral] 1
# 29| 6: [Field] TwoGreen
-# 29| 1: [AssignExpr] ... = ...
-# 29| 0: [MemberConstantAccess] access to constant TwoGreen
-# 29| 1: [CastExpr] (...) ...
-# 29| 1: [IntLiteral] 2
+# 29| 1: [CastExpr] (...) ...
+# 29| 1: [IntLiteral] 2
# 30| 7: [Field] FourBlue
-# 30| 1: [AssignExpr] ... = ...
-# 30| 0: [MemberConstantAccess] access to constant FourBlue
-# 30| 1: [CastExpr] (...) ...
-# 30| 1: [IntLiteral] 4
+# 30| 1: [CastExpr] (...) ...
+# 30| 1: [IntLiteral] 4
# 34| 5: [Enum] SparseColor
# 37| 5: [Field] Red
# 38| 6: [Field] Green
-# 38| 1: [AssignExpr] ... = ...
-# 38| 0: [MemberConstantAccess] access to constant Green
-# 38| 1: [IntLiteral] 10
+# 38| 1: [IntLiteral] 10
# 39| 7: [Field] Blue
# 40| 8: [Field] AnotherBlue
-# 40| 1: [AssignExpr] ... = ...
-# 40| 0: [MemberConstantAccess] access to constant AnotherBlue
-# 40| 1: [AddExpr] ... + ...
-# 40| 0: [CastExpr] (...) ...
-# 40| 1: [MemberConstantAccess] access to constant Blue
-# 40| 1: [CastExpr] (...) ...
-# 40| 1: [MemberConstantAccess] access to constant Red
+# 40| 1: [AddExpr] ... + ...
+# 40| 0: [CastExpr] (...) ...
+# 40| 1: [MemberConstantAccess] access to constant Blue
+# 40| 1: [CastExpr] (...) ...
+# 40| 1: [MemberConstantAccess] access to constant Red
# 44| 6: [Class] Test
# 47| 5: [Method] Main
# 47| -1: [TypeMention] Void
diff --git a/csharp/ql/test/library-tests/events/PrintAst.expected b/csharp/ql/test/library-tests/events/PrintAst.expected
index 7f75cd7b1cbc..84825067e429 100644
--- a/csharp/ql/test/library-tests/events/PrintAst.expected
+++ b/csharp/ql/test/library-tests/events/PrintAst.expected
@@ -87,16 +87,12 @@ events.cs:
# 50| 4: [Class] Control
# 53| 6: [Field] mouseDownEventKey
# 53| -1: [TypeMention] object
-# 53| 1: [AssignExpr] ... = ...
-# 53| 0: [FieldAccess] access to field mouseDownEventKey
-# 53| 1: [ObjectCreation] object creation of type Object
-# 53| 0: [TypeMention] object
+# 53| 1: [ObjectCreation] object creation of type Object
+# 53| 0: [TypeMention] object
# 54| 7: [Field] mouseUpEventKey
# 54| -1: [TypeMention] object
-# 54| 1: [AssignExpr] ... = ...
-# 54| 0: [FieldAccess] access to field mouseUpEventKey
-# 54| 1: [ObjectCreation] object creation of type Object
-# 54| 0: [TypeMention] object
+# 54| 1: [ObjectCreation] object creation of type Object
+# 54| 0: [TypeMention] object
# 57| 8: [Method] GetEventHandler
# 57| -1: [TypeMention] Delegate
#-----| 2: (Parameters)
diff --git a/csharp/ql/test/library-tests/expressions/PrintAst.expected b/csharp/ql/test/library-tests/expressions/PrintAst.expected
index e865a36d5491..ce25c57b0d97 100644
--- a/csharp/ql/test/library-tests/expressions/PrintAst.expected
+++ b/csharp/ql/test/library-tests/expressions/PrintAst.expected
@@ -417,12 +417,10 @@ ReducedExpression.cs:
# 2| [Class] ReducedClass
# 5| 5: [Field] ReducedExpression
# 5| -1: [TypeMention] int
-# 5| 1: [AssignExpr] ... = ...
-# 5| 0: [MemberConstantAccess] access to constant ReducedExpression
-# 5| 1: [ConditionalExpr] ... ? ... : ...
-# 5| 0: [BoolLiteral] true
-# 5| 1: [IntLiteral] 10
-# 5| 2: [IntLiteral] 12
+# 5| 1: [ConditionalExpr] ... ? ... : ...
+# 5| 0: [BoolLiteral] true
+# 5| 1: [IntLiteral] 10
+# 5| 2: [IntLiteral] 12
expressions.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 7| 1: [Class] Class
@@ -550,14 +548,10 @@ expressions.cs:
# 41| 0: [LocalVariableAccess] access to local variable c
# 44| 6: [Field] constant
# 44| -1: [TypeMention] string
-# 44| 1: [AssignExpr] ... = ...
-# 44| 0: [MemberConstantAccess] access to constant constant
-# 44| 1: [StringLiteralUtf16] "constant"
+# 44| 1: [StringLiteralUtf16] "constant"
# 45| 7: [Field] f
# 45| -1: [TypeMention] int
-# 45| 1: [AssignExpr] ... = ...
-# 45| 0: [FieldAccess] access to field f
-# 45| 1: [IntLiteral] 0
+# 45| 1: [IntLiteral] 0
# 46| 8: [Field] name
# 46| -1: [TypeMention] string
# 48| 9: [StaticConstructor] Class
@@ -1492,16 +1486,12 @@ expressions.cs:
# 361| 15: [Class] Rectangle2
# 364| 5: [Field] p1
# 364| -1: [TypeMention] Point
-# 364| 1: [AssignExpr] ... = ...
-# 364| 0: [FieldAccess] access to field p1
-# 364| 1: [ObjectCreation] object creation of type Point
-# 364| 0: [TypeMention] Point
+# 364| 1: [ObjectCreation] object creation of type Point
+# 364| 0: [TypeMention] Point
# 365| 6: [Field] p2
# 365| -1: [TypeMention] Point
-# 365| 1: [AssignExpr] ... = ...
-# 365| 0: [FieldAccess] access to field p2
-# 365| 1: [ObjectCreation] object creation of type Point
-# 365| 0: [TypeMention] Point
+# 365| 1: [ObjectCreation] object creation of type Point
+# 365| 0: [TypeMention] Point
# 367| 7: [Property] P1
# 367| -1: [TypeMention] Point
# 367| 3: [Getter] get_P1
@@ -1520,11 +1510,9 @@ expressions.cs:
# 376| 6: [Field] phoneNumbers
# 376| -1: [TypeMention] List
# 376| 1: [TypeMention] string
-# 376| 1: [AssignExpr] ... = ...
-# 376| 0: [FieldAccess] access to field phoneNumbers
-# 376| 1: [ObjectCreation] object creation of type List
-# 376| 0: [TypeMention] List
-# 376| 1: [TypeMention] string
+# 376| 1: [ObjectCreation] object creation of type List
+# 376| 0: [TypeMention] List
+# 376| 1: [TypeMention] string
# 378| 7: [Property] Name
# 378| -1: [TypeMention] string
# 378| 3: [Getter] get_Name
@@ -2194,9 +2182,8 @@ expressions.cs:
# 495| 19: [Class] ExpressionDepth
# 497| 5: [Field] d
# 497| -1: [TypeMention] int
-# 497| 1: [AssignExpr] ... = ...
-# 497| 0: [MemberConstantAccess] access to constant d
-# 497| 1: [AddExpr] ... + ...
+# 497| 1: [AddExpr] ... + ...
+# 497| 0: [AddExpr] ... + ...
# 497| 0: [AddExpr] ... + ...
# 497| 0: [AddExpr] ... + ...
# 497| 0: [AddExpr] ... + ...
@@ -2274,9 +2261,7 @@ expressions.cs:
# 497| 0: [AddExpr] ... + ...
# 497| 0: [AddExpr] ... + ...
# 497| 0: [AddExpr] ... + ...
-# 497| 0: [AddExpr] ... + ...
-# 497| 0: [IntLiteral] 1
-# 497| 1: [IntLiteral] 1
+# 497| 0: [IntLiteral] 1
# 497| 1: [IntLiteral] 1
# 497| 1: [IntLiteral] 1
# 497| 1: [IntLiteral] 1
@@ -2315,7 +2300,7 @@ expressions.cs:
# 497| 1: [IntLiteral] 1
# 497| 1: [IntLiteral] 1
# 497| 1: [IntLiteral] 1
-# 498| 1: [IntLiteral] 1
+# 497| 1: [IntLiteral] 1
# 498| 1: [IntLiteral] 1
# 498| 1: [IntLiteral] 1
# 498| 1: [IntLiteral] 1
@@ -2355,6 +2340,7 @@ expressions.cs:
# 498| 1: [IntLiteral] 1
# 498| 1: [IntLiteral] 1
# 498| 1: [IntLiteral] 1
+# 498| 1: [IntLiteral] 1
# 501| 20: [Class] TupleExprs
# 503| 5: [Method] Test
# 503| -1: [TypeMention] Void
diff --git a/csharp/ql/test/library-tests/fields/PrintAst.expected b/csharp/ql/test/library-tests/fields/PrintAst.expected
index f68578327914..4f33d662a06d 100644
--- a/csharp/ql/test/library-tests/fields/PrintAst.expected
+++ b/csharp/ql/test/library-tests/fields/PrintAst.expected
@@ -3,37 +3,27 @@ fields.cs:
# 7| 1: [Class] A
# 10| 6: [Field] X
# 10| -1: [TypeMention] int
-# 10| 1: [AssignExpr] ... = ...
-# 10| 0: [FieldAccess] access to field X
-# 10| 1: [IntLiteral] 1
+# 10| 1: [IntLiteral] 1
# 10| 7: [Field] Y
# 10| -1: [TypeMention] int
# 10| 8: [Field] Z
# 10| -1: [TypeMention] int
-# 10| 1: [AssignExpr] ... = ...
-# 10| 0: [FieldAccess] access to field Z
-# 10| 1: [IntLiteral] 100
+# 10| 1: [IntLiteral] 100
# 13| 2: [Class] B
# 15| 6: [Field] X
# 15| -1: [TypeMention] int
-# 15| 1: [AssignExpr] ... = ...
-# 15| 0: [FieldAccess] access to field X
-# 15| 1: [IntLiteral] 1
+# 15| 1: [IntLiteral] 1
# 16| 7: [Field] Y
# 16| -1: [TypeMention] int
# 17| 8: [Field] Z
# 17| -1: [TypeMention] int
-# 17| 1: [AssignExpr] ... = ...
-# 17| 0: [FieldAccess] access to field Z
-# 17| 1: [IntLiteral] 100
+# 17| 1: [IntLiteral] 100
# 20| 3: [Class] C`1
#-----| 1: (Type parameters)
# 20| 0: [TypeParameter] V
# 23| 5: [Field] count
# 23| -1: [TypeMention] int
-# 23| 1: [AssignExpr] ... = ...
-# 23| 0: [FieldAccess] access to field count
-# 23| 1: [IntLiteral] 0
+# 23| 1: [IntLiteral] 0
# 25| 6: [InstanceConstructor] C
# 25| 4: [BlockStmt] {...}
# 25| 0: [ExprStmt] ...;
@@ -50,22 +40,16 @@ fields.cs:
# 34| -1: [TypeMention] bool
# 35| 7: [Field] x
# 35| -1: [TypeMention] double
-# 35| 1: [AssignExpr] ... = ...
-# 35| 0: [FieldAccess] access to field x
-# 35| 1: [MethodCall] call to method Sqrt
-# 35| -1: [TypeAccess] access to type Math
-# 35| 0: [TypeMention] Math
-# 35| 0: [DoubleLiteral] 2
+# 35| 1: [MethodCall] call to method Sqrt
+# 35| -1: [TypeAccess] access to type Math
+# 35| 0: [TypeMention] Math
+# 35| 0: [DoubleLiteral] 2
# 36| 8: [Field] i
# 36| -1: [TypeMention] int
-# 36| 1: [AssignExpr] ... = ...
-# 36| 0: [FieldAccess] access to field i
-# 36| 1: [IntLiteral] 100
+# 36| 1: [IntLiteral] 100
# 37| 9: [Field] s
# 37| -1: [TypeMention] string
-# 37| 1: [AssignExpr] ... = ...
-# 37| 0: [FieldAccess] access to field s
-# 37| 1: [StringLiteralUtf16] "Hello"
+# 37| 1: [StringLiteralUtf16] "Hello"
# 39| 10: [Method] Main
# 39| -1: [TypeMention] Void
# 40| 4: [BlockStmt] {...}
@@ -111,28 +95,24 @@ fields.cs:
# 50| 5: [Class] Color
# 53| 5: [Field] Black
# 53| -1: [TypeMention] Color
-# 53| 1: [AssignExpr] ... = ...
-# 53| 0: [FieldAccess] access to field Black
-# 53| 1: [ObjectCreation] object creation of type Color
-# 53| -1: [TypeMention] Color
-# 53| 0: [CastExpr] (...) ...
-# 53| 1: [IntLiteral] 0
-# 53| 1: [CastExpr] (...) ...
-# 53| 1: [IntLiteral] 0
-# 53| 2: [CastExpr] (...) ...
-# 53| 1: [IntLiteral] 0
+# 53| 1: [ObjectCreation] object creation of type Color
+# 53| -1: [TypeMention] Color
+# 53| 0: [CastExpr] (...) ...
+# 53| 1: [IntLiteral] 0
+# 53| 1: [CastExpr] (...) ...
+# 53| 1: [IntLiteral] 0
+# 53| 2: [CastExpr] (...) ...
+# 53| 1: [IntLiteral] 0
# 54| 6: [Field] White
# 54| -1: [TypeMention] Color
-# 54| 1: [AssignExpr] ... = ...
-# 54| 0: [FieldAccess] access to field White
-# 54| 1: [ObjectCreation] object creation of type Color
-# 54| -1: [TypeMention] Color
-# 54| 0: [CastExpr] (...) ...
-# 54| 1: [IntLiteral] 255
-# 54| 1: [CastExpr] (...) ...
-# 54| 1: [IntLiteral] 255
-# 54| 2: [CastExpr] (...) ...
-# 54| 1: [IntLiteral] 255
+# 54| 1: [ObjectCreation] object creation of type Color
+# 54| -1: [TypeMention] Color
+# 54| 0: [CastExpr] (...) ...
+# 54| 1: [IntLiteral] 255
+# 54| 1: [CastExpr] (...) ...
+# 54| 1: [IntLiteral] 255
+# 54| 2: [CastExpr] (...) ...
+# 54| 1: [IntLiteral] 255
# 56| 7: [InstanceConstructor] Color
#-----| 2: (Parameters)
# 56| 0: [Parameter] r
@@ -145,50 +125,38 @@ fields.cs:
# 60| 6: [Class] TestBindings
# 63| 6: [Field] a
# 63| -1: [TypeMention] int
-# 63| 1: [AssignExpr] ... = ...
-# 63| 0: [FieldAccess] access to field a
-# 63| 1: [AddExpr] ... + ...
-# 63| 0: [FieldAccess] access to field b
-# 63| 1: [IntLiteral] 1
+# 63| 1: [AddExpr] ... + ...
+# 63| 0: [FieldAccess] access to field b
+# 63| 1: [IntLiteral] 1
# 64| 7: [Field] b
# 64| -1: [TypeMention] int
-# 64| 1: [AssignExpr] ... = ...
-# 64| 0: [FieldAccess] access to field b
-# 64| 1: [AddExpr] ... + ...
-# 64| 0: [FieldAccess] access to field a
-# 64| 1: [IntLiteral] 1
+# 64| 1: [AddExpr] ... + ...
+# 64| 0: [FieldAccess] access to field a
+# 64| 1: [IntLiteral] 1
# 70| [NamespaceDeclaration] namespace ... { ... }
# 72| 1: [Class] A
# 74| 5: [Field] X
# 74| -1: [TypeMention] int
-# 74| 1: [AssignExpr] ... = ...
-# 74| 0: [MemberConstantAccess] access to constant X
-# 74| 1: [AddExpr] ... + ...
-# 74| 0: [MemberConstantAccess] access to constant Z
-# 74| -1: [TypeAccess] access to type B
-# 74| 0: [TypeMention] B
-# 74| 1: [IntLiteral] 1
+# 74| 1: [AddExpr] ... + ...
+# 74| 0: [MemberConstantAccess] access to constant Z
+# 74| -1: [TypeAccess] access to type B
+# 74| 0: [TypeMention] B
+# 74| 1: [IntLiteral] 1
# 75| 6: [Field] Y
# 75| -1: [TypeMention] int
-# 75| 1: [AssignExpr] ... = ...
-# 75| 0: [MemberConstantAccess] access to constant Y
-# 75| 1: [IntLiteral] 10
+# 75| 1: [IntLiteral] 10
# 78| 2: [Class] B
# 80| 5: [Field] Z
# 80| -1: [TypeMention] int
-# 80| 1: [AssignExpr] ... = ...
-# 80| 0: [MemberConstantAccess] access to constant Z
-# 80| 1: [AddExpr] ... + ...
-# 80| 0: [MemberConstantAccess] access to constant Y
-# 80| -1: [TypeAccess] access to type A
-# 80| 0: [TypeMention] A
-# 80| 1: [IntLiteral] 1
+# 80| 1: [AddExpr] ... + ...
+# 80| 0: [MemberConstantAccess] access to constant Y
+# 80| -1: [TypeAccess] access to type A
+# 80| 0: [TypeMention] A
+# 80| 1: [IntLiteral] 1
# 83| 3: [Class] C
# 85| 4: [Field] Foo
# 85| -1: [TypeMention] int
-# 85| 1: [AssignExpr] ... = ...
-# 85| 0: [MemberConstantAccess] access to constant Foo
-# 85| 1: [IntLiteral] 1
+# 85| 1: [IntLiteral] 1
# 86| 5: [Field] x
# 86| -1: [TypeMention] long?
# 86| 1: [TypeMention] long
diff --git a/csharp/ql/test/library-tests/generics/PrintAst.expected b/csharp/ql/test/library-tests/generics/PrintAst.expected
index 86a199c2ee00..3653b3b7a2d7 100644
--- a/csharp/ql/test/library-tests/generics/PrintAst.expected
+++ b/csharp/ql/test/library-tests/generics/PrintAst.expected
@@ -370,24 +370,18 @@ generics.cs:
# 60| 0: [TypeParameter] T
# 63| 5: [Field] NumRows
# 63| -1: [TypeMention] int
-# 63| 1: [AssignExpr] ... = ...
-# 63| 0: [MemberConstantAccess] access to constant NumRows
-# 63| 1: [IntLiteral] 26
+# 63| 1: [IntLiteral] 26
# 64| 6: [Field] NumCols
# 64| -1: [TypeMention] int
-# 64| 1: [AssignExpr] ... = ...
-# 64| 0: [MemberConstantAccess] access to constant NumCols
-# 64| 1: [IntLiteral] 10
+# 64| 1: [IntLiteral] 10
# 66| 7: [Field] cells
# 66| -1: [TypeMention] T[,]
# 66| 1: [TypeMention] T
-# 66| 1: [AssignExpr] ... = ...
-# 66| 0: [FieldAccess] access to field cells
-# 66| 1: [ArrayCreation] array creation of type T[,]
-# 66| -1: [TypeMention] T[,]
-# 66| 1: [TypeMention] T
-# 66| 0: [MemberConstantAccess] access to constant NumRows
-# 66| 1: [MemberConstantAccess] access to constant NumCols
+# 66| 1: [ArrayCreation] array creation of type T[,]
+# 66| -1: [TypeMention] T[,]
+# 66| 1: [TypeMention] T
+# 66| 0: [MemberConstantAccess] access to constant NumRows
+# 66| 1: [MemberConstantAccess] access to constant NumCols
# 68| 8: [Indexer] Item
# 68| -1: [TypeMention] int
#-----| 1: (Parameters)
diff --git a/csharp/ql/test/library-tests/indexers/PrintAst.expected b/csharp/ql/test/library-tests/indexers/PrintAst.expected
index 540c1d8255d2..6f9fde00e24f 100644
--- a/csharp/ql/test/library-tests/indexers/PrintAst.expected
+++ b/csharp/ql/test/library-tests/indexers/PrintAst.expected
@@ -214,24 +214,18 @@ indexers.cs:
# 81| 3: [Class] Grid
# 84| 5: [Field] NumRows
# 84| -1: [TypeMention] int
-# 84| 1: [AssignExpr] ... = ...
-# 84| 0: [MemberConstantAccess] access to constant NumRows
-# 84| 1: [IntLiteral] 26
+# 84| 1: [IntLiteral] 26
# 85| 6: [Field] NumCols
# 85| -1: [TypeMention] int
-# 85| 1: [AssignExpr] ... = ...
-# 85| 0: [MemberConstantAccess] access to constant NumCols
-# 85| 1: [IntLiteral] 10
+# 85| 1: [IntLiteral] 10
# 87| 7: [Field] cells
# 87| -1: [TypeMention] Int32[,]
# 87| 1: [TypeMention] int
-# 87| 1: [AssignExpr] ... = ...
-# 87| 0: [FieldAccess] access to field cells
-# 87| 1: [ArrayCreation] array creation of type Int32[,]
-# 87| -1: [TypeMention] Int32[,]
-# 87| 1: [TypeMention] int
-# 87| 0: [MemberConstantAccess] access to constant NumRows
-# 87| 1: [MemberConstantAccess] access to constant NumCols
+# 87| 1: [ArrayCreation] array creation of type Int32[,]
+# 87| -1: [TypeMention] Int32[,]
+# 87| 1: [TypeMention] int
+# 87| 0: [MemberConstantAccess] access to constant NumRows
+# 87| 1: [MemberConstantAccess] access to constant NumCols
# 89| 8: [Indexer] Item
# 89| -1: [TypeMention] int
#-----| 1: (Parameters)