Skip to content

Commit d78c021

Browse files
committed
resharper_possibly_impure_method_call_on_readonly_variable_highlighting=error
1 parent 84dfc4f commit d78c021

File tree

6 files changed

+9
-12
lines changed

6 files changed

+9
-12
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ csharp_preserve_single_line_blocks = true
2424
resharper_csharp_wrap_lines = false
2525
resharper_csharp_space_before_trailing_comment = true
2626
resharper_csharp_space_after_operator_keyword = true
27+
28+
resharper_possibly_impure_method_call_on_readonly_variable_highlighting=error

src/Box2D.NET.Samples/Samples/Collisions/RayCast.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public override void Step()
281281
B2Vec2 translation = b2InvRotateVector(transform.q, b2Sub(m_rayEnd, m_rayStart));
282282
B2RayCastInput input = new B2RayCastInput(start, translation, maxFraction);
283283

284-
B2CastOutput localOutput = b2RayCastPolygon(m_box, input);
284+
B2CastOutput localOutput = b2RayCastPolygon(ref m_box, input);
285285
if (localOutput.hit)
286286
{
287287
output = localOutput;
@@ -302,7 +302,7 @@ public override void Step()
302302
B2Vec2 translation = b2InvRotateVector(transform.q, b2Sub(m_rayEnd, m_rayStart));
303303
B2RayCastInput input = new B2RayCastInput(start, translation, maxFraction);
304304

305-
B2CastOutput localOutput = b2RayCastPolygon(m_triangle, input);
305+
B2CastOutput localOutput = b2RayCastPolygon(ref m_triangle, input);
306306
if (localOutput.hit)
307307
{
308308
output = localOutput;

src/Box2D.NET/B2DynamicTrees.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,14 +1065,9 @@ internal static void b2DynamicTree_ValidateNoEnlarged(B2DynamicTree tree)
10651065
B2TreeNode[] nodes = tree.nodes;
10661066
for (int i = 0; i < capacity; ++i)
10671067
{
1068-
ref B2TreeNode node = ref nodes[i];
1068+
ref readonly B2TreeNode node = ref nodes[i];
10691069
if (0 != (node.flags & (ushort)B2TreeNodeFlags.b2_allocatedNode))
10701070
{
1071-
if ((node.flags & (ushort)B2TreeNodeFlags.b2_enlargedNode) != 0)
1072-
{
1073-
int a = 3;
1074-
}
1075-
10761071
B2_ASSERT((node.flags & (ushort)B2TreeNodeFlags.b2_enlargedNode) == 0);
10771072
}
10781073
}

src/Box2D.NET/B2Geometries.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ public static B2CastOutput b2RayCastSegment(in B2Segment shape, in B2RayCastInpu
840840
}
841841

842842
/// Ray cast versus polygon shape in local space.
843-
public static B2CastOutput b2RayCastPolygon(in B2Polygon shape, in B2RayCastInput input)
843+
public static B2CastOutput b2RayCastPolygon(ref B2Polygon shape, in B2RayCastInput input)
844844
{
845845
B2_ASSERT(b2IsValidRay(input));
846846

src/Box2D.NET/B2Shapes.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ internal static B2CastOutput b2RayCastShape(in B2RayCastInput input, B2Shape sha
852852
output = b2RayCastCircle(shape.us.circle, localInput);
853853
break;
854854
case B2ShapeType.b2_polygonShape:
855-
output = b2RayCastPolygon(shape.us.polygon, localInput);
855+
output = b2RayCastPolygon(ref shape.us.polygon, localInput);
856856
break;
857857
case B2ShapeType.b2_segmentShape:
858858
output = b2RayCastSegment(shape.us.segment, localInput, false);
@@ -1107,7 +1107,7 @@ internal static B2CastOutput b2Shape_RayCast(in B2ShapeId shapeId, in B2RayCastI
11071107
break;
11081108

11091109
case B2ShapeType.b2_polygonShape:
1110-
output = b2RayCastPolygon(shape.us.polygon, localInput);
1110+
output = b2RayCastPolygon(ref shape.us.polygon, localInput);
11111111
break;
11121112

11131113
case B2ShapeType.b2_chainSegmentShape:

test/Box2D.NET.Test/B2ShapeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void RayCastShapeTest()
142142
}
143143

144144
{
145-
B2CastOutput output = b2RayCastPolygon(box, input);
145+
B2CastOutput output = b2RayCastPolygon(ref box, input);
146146
Assert.That(output.hit);
147147
Assert.That(output.normal.X + 1.0f, Is.LessThan(FLT_EPSILON));
148148
Assert.That(output.normal.Y, Is.LessThan(FLT_EPSILON));

0 commit comments

Comments
 (0)