コード例 #1
0
ファイル: loops.cpp プロジェクト: levelplane/circa
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);
}
コード例 #2
0
ファイル: loops.cpp プロジェクト: mokerjoke/circa
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);
}
コード例 #3
0
ファイル: loops.cpp プロジェクト: andyfischer/circa
void finish_for_loop(Term* forTerm)
{
    Block* block = nested_contents(forTerm);

    // Need to finish here to prevent error
    block_finish_changes(block);

    Term* primaryResult = loop_get_primary_result(block);

    Term* iterator = loop_find_iterator(block);
    Term* nextCall = apply_dynamic_method(block, s_advance, TermList(iterator));
    hide_from_source(nextCall);

    // Add a a primary output
    Term* primaryOutput = apply(block, FUNCS.output, TermList(primaryResult));
    primaryOutput->setBoolProp(s_AccumulatingOutput, true); // TODO: can delete?
    respecialize_type(primaryOutput);

    insert_looped_placeholders(block);

    update_extra_outputs(forTerm, block);

    block_finish_changes(block);
}