Skip to content

Commit e8a80a4

Browse files
committed
Simplify indexing
1 parent 2bc2812 commit e8a80a4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,11 +1636,9 @@ private bool EvaluateIndexing(string expr, string s, Stack<object> stack, ref in
16361636
string beVerb = bracketCount == 1 ? "is" : "are";
16371637
throw new Exception($"{bracketCount} ']' character {beVerb} missing in expression : [{expr}]");
16381638
}
1639-
stack.Push(indexingBeginningMatch.Length == 2 ? ExpressionOperator.IndexingWithNullConditional : ExpressionOperator.Indexing);
1640-
stack.Push(Evaluate(innerExp));
16411639

1642-
dynamic right = stack.Pop();
1643-
ExpressionOperator op = (ExpressionOperator)stack.Pop();
1640+
dynamic right = Evaluate(innerExp);
1641+
ExpressionOperator op = indexingBeginningMatch.Length == 2 ? ExpressionOperator.IndexingWithNullConditional : ExpressionOperator.Indexing;
16441642
dynamic left = stack.Pop();
16451643

16461644
stack.Push(operatorsEvaluations[0][op](left, right));

0 commit comments

Comments
 (0)