Skip to content

Commit

Permalink
fix missing variable error only showing the defined variable's name
Browse files Browse the repository at this point in the history
  • Loading branch information
Pixaurora committed Sep 13, 2023
1 parent 635088a commit fe850a2
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Stream;

import org.mariuszgromada.math.mxparser.Expression;
Expand Down Expand Up @@ -39,8 +38,7 @@ public static VariableDefinition fromString(Map<String, Function> functionTable,
Expression expression = new Expression(expressionText);

List<Variable> requiredVariables = Stream.of(expression.getMissingUserDefinedArguments())
.map(requiredName -> variableTable.get(requiredName))
.map(variable -> Objects.nonNull(variable) ? variable : new MissingVariable(name))
.map(requiredName -> variableTable.getOrDefault(requiredName, new MissingVariable(requiredName)))
.toList();

List<String> missingVariables = requiredVariables.stream()
Expand Down

0 comments on commit fe850a2

Please sign in to comment.