Skip to content

Commit

Permalink
Merge pull request #2947 from Goober5000/short_circuiting_update
Browse files Browse the repository at this point in the history
don't flush the tree when evaluating the *-argument conditionals
  • Loading branch information
Goober5000 committed Dec 2, 2020
2 parents bd3b0fc + 958237f commit 8252d39
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions code/parse/sexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9542,9 +9542,6 @@ int test_argument_nodes_for_condition(int n, int condition_node, int *num_true,
// only eval this argument if it's valid
if (Sexp_nodes[n].flags & SNF_ARGUMENT_VALID)
{
// flush conditional to avoid short-circuiting
flush_sexp_tree(condition_node);

// evaluate conditional for current argument
Sexp_replacement_arguments.emplace_back(Sexp_nodes[n].text, n);
val = eval_sexp(condition_node);
Expand Down Expand Up @@ -9626,9 +9623,6 @@ int test_argument_vector_for_condition(const SCP_vector<std::pair<char*, int>> &
{
// since we can't see or modify the validity, assume all are valid
{
// flush conditional to avoid short-circuiting
flush_sexp_tree(condition_node);

// evaluate conditional for current argument
Sexp_replacement_arguments.push_back(argument);
val = eval_sexp(condition_node);
Expand Down Expand Up @@ -9838,9 +9832,8 @@ int eval_random_of(int arg_handler_node, int condition_node, bool multiple)
val = SEXP_FALSE;
if (Sexp_nodes[n].flags & SNF_ARGUMENT_VALID)
{
// flush stuff
// ensure special argument list is empty
Sexp_applicable_argument_list.clear_nesting_level();
flush_sexp_tree(condition_node);

// evaluate conditional for current argument
Sexp_replacement_arguments.emplace_back(Sexp_nodes[n].text, n);
Expand Down Expand Up @@ -9891,9 +9884,8 @@ int eval_in_sequence(int arg_handler_node, int condition_node)
// Only execute if the argument is valid (if all nodes were invalid we would still reach this point)
if (Sexp_nodes[n].flags & SNF_ARGUMENT_VALID)
{
// flush stuff
// ensure special argument list is empty
Sexp_applicable_argument_list.clear_nesting_level();
flush_sexp_tree(condition_node);

// evaluate conditional for current argument
Sexp_replacement_arguments.emplace_back(Sexp_nodes[n].text, n);
Expand Down

0 comments on commit 8252d39

Please sign in to comment.