Skip to content

Commit 27f81c1

Browse files
C#: Add missing WithMarkers to ExpressionStatement
ExpressionStatement delegates Markers to its inner expression but had no WithMarkers method, which would cause a RuntimeBinderException if SearchResult.Found or any other dynamic WithMarkers call targeted this type.
1 parent c2e3ff4 commit 27f81c1

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • rewrite-csharp/csharp/OpenRewrite/CSharp

rewrite-csharp/csharp/OpenRewrite/CSharp/Cs.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public ExpressionStatement WithExpression(Expression expression) =>
5151
// ExpressionStatement delegates prefix/markers to its expression
5252
public Space Prefix => Expression.Prefix;
5353
public Markers Markers => Expression.Markers;
54+
public ExpressionStatement WithMarkers(Markers markers) =>
55+
new(Id, (Expression)((dynamic)Expression).WithMarkers(markers));
5456

5557
Tree Tree.WithId(Guid id) => WithId(id);
5658

0 commit comments

Comments
 (0)