Exemplo n.º 1
0
void finish_for_loop(Term* forTerm)
{
    Branch* contents = nested_contents(forTerm);

    // Add a 'loop_output' term that will collect each iteration's output.
    Term* loopOutput = apply(contents, FUNCS.loop_output, 
        TermList(loop_get_primary_result(contents)));

    // Add a primary output
    apply(contents, FUNCS.output, TermList(loopOutput));

    // pack_any_open_state_vars(contents);
    for_loop_fix_state_input(contents);
    check_to_add_state_output_placeholder(contents);

    add_implicit_placeholders(forTerm);
    repoint_terms_to_use_input_placeholders(contents);

    check_to_insert_implicit_inputs(forTerm);
    update_extra_outputs(forTerm);

    loop_update_exit_points(contents);

    set_branch_in_progress(contents, false);
}
Exemplo n.º 2
0
void finish_for_loop(Term* forTerm)
{
    Branch* contents = nested_contents(forTerm);

    // Need to finish here to prevent error
    branch_finish_changes(contents);

    // Add a a primary output
    Term* primaryOutput = apply(contents, FUNCS.output,
            TermList(loop_get_primary_result(contents)));
    primaryOutput->setBoolProp("accumulatingOutput", true);
    respecialize_type(primaryOutput);

    // pack_any_open_state_vars(contents);
    for_loop_fix_state_input(contents);
    check_to_add_state_output_placeholder(contents);

    add_implicit_placeholders(forTerm);
    repoint_terms_to_use_input_placeholders(contents);

    check_to_insert_implicit_inputs(forTerm);
    update_extra_outputs(forTerm);

    branch_finish_changes(contents);
}