Skip to content

Commit

Permalink
don't flush the tree when evaluating the *-argument conditionals
Browse files Browse the repository at this point in the history
This is a follow-up to PR scp-fs2open#2942.  Given that the short-circuiting is now explicitly skipped for node trees containing the special argument, it should no longer be necessary to flush the conditional branch of the sexp tree.  (The .cache field is already skipped for special-arg nodes.)

The sexp tree is still explicitly flushed for `every-time` and `every-time-argument`.
  • Loading branch information
Goober5000 authored and JohnAFernandez committed Dec 17, 2020
1 parent 67c26e4 commit e9e2e38
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions code/parse/sexp.cpp
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 e9e2e38

Please sign in to comment.