Skip to content

Commit 0592b81

Browse files
committed
Correct some stuff and return needed at compile time not only for resharper
1 parent 0f2a444 commit 0592b81

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs

+13-11
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ protected enum TryBlockEvaluatedState
288288
if ( left is BubbleExceptionContainer leftExceptionContainer)
289289
{
290290
ExceptionDispatchInfo.Capture(leftExceptionContainer.Exception).Throw();
291-
// Will not go here but Resharper detect some errors because he does not know ExceptionDispatchInfo stuff.
292-
throw leftExceptionContainer.Exception;
291+
// Will not go here but need to return something to avoid compilation errors.
292+
return null;
293293
}
294294
else if (!left)
295295
{
@@ -298,8 +298,8 @@ protected enum TryBlockEvaluatedState
298298
else if (right is BubbleExceptionContainer rightExceptionContainer)
299299
{
300300
ExceptionDispatchInfo.Capture(rightExceptionContainer.Exception).Throw();
301-
// Will not go here but Resharper detect some errors because he does not know ExceptionDispatchInfo stuff.
302-
throw rightExceptionContainer.Exception;
301+
// Will not go here but need to return something to avoid compilation errors.
302+
return null;
303303
}
304304
else
305305
{
@@ -313,8 +313,8 @@ protected enum TryBlockEvaluatedState
313313
if ( left is BubbleExceptionContainer leftExceptionContainer)
314314
{
315315
ExceptionDispatchInfo.Capture(leftExceptionContainer.Exception).Throw();
316-
// Will not go here but Resharper detect some errors because he does not know ExceptionDispatchInfo stuff.
317-
throw leftExceptionContainer.Exception;
316+
// Will not go here but need to return something to avoid compilation errors.
317+
return null;
318318
}
319319
else if (left)
320320
{
@@ -323,8 +323,8 @@ protected enum TryBlockEvaluatedState
323323
else if (right is BubbleExceptionContainer rightExceptionContainer)
324324
{
325325
ExceptionDispatchInfo.Capture(rightExceptionContainer.Exception).Throw();
326-
// Will not go here but Resharper detect some errors because he does not know ExceptionDispatchInfo stuff.
327-
throw rightExceptionContainer.Exception;
326+
// Will not go here but need to return something to avoid compilation errors.
327+
return null;
328328
}
329329
else
330330
{
@@ -1658,6 +1658,8 @@ public object Evaluate(string expression)
16581658
catch (TargetInvocationException exception) when (exception.InnerException != null)
16591659
{
16601660
ExceptionDispatchInfo.Capture(exception.InnerException).Throw();
1661+
// Will not go here but need to return something to avoid compilation errors.
1662+
return null;
16611663
}
16621664
finally
16631665
{
@@ -3376,7 +3378,7 @@ protected virtual object ManageKindOfAssignation(string expression, ref int inde
33763378

33773379
if (rightExpression.Trim().Equals(string.Empty))
33783380
throw new ExpressionEvaluatorSyntaxErrorException("Right part is missing in assignation");
3379-
3381+
33803382
if (match.Groups["assignmentPrefix"].Success)
33813383
{
33823384
ExpressionOperator prefixOp = operatorsDictionary[match.Groups["assignmentPrefix"].Value];
@@ -4147,8 +4149,8 @@ protected virtual Type GetTypeByFriendlyName(string typeName, string genericType
41474149
catch (ExpressionEvaluatorSyntaxErrorException exception)
41484150
{
41494151
ExceptionDispatchInfo.Capture(exception).Throw();
4150-
// Will not go here but Resharper detect some errors because he does not know ExceptionDispatchInfo stuff.
4151-
throw;
4152+
// Will not go here but need to return something to avoid compilation errors.
4153+
return null;
41524154
}
41534155
catch { }
41544156

0 commit comments

Comments
 (0)