Example #1
0
// Returns whether or not we succeeded
bool get_relative_name_recursive(Block* block, Term* term, std::stringstream& output)
{
    if (name_is_reachable_from(term, block)) {
        output << term->name();
        return true;
    }

    Term* parentTerm = parent_term(term);

    if (parentTerm == NULL)
        return false;

    // Don't include the names of hidden or builtin blocks.
    if (is_hidden(parentTerm)) {
        output << term->name();
        return true;
    }
    
    if (parentTerm->nestedContents != NULL &&
        block_get_bool_prop(parentTerm->nestedContents, s_Builtins, false))
    {
        output << term->name();
        return true;
    }

    bool success = get_relative_name_recursive(block, parentTerm, output);

    if (!success)
        return false;

    output << ":" << term->name();
    return true;
}
Example #2
0
void update_for_control_flow(Block* block)
{
    if (!block_get_bool_prop(block, s_HasControlFlow, false))
        return;

    for (int i=0; i < block->length(); i++) {
        Term* term = block->get(i);
        if (term == NULL)
            continue;

        if (is_exit_point_that_handles_rebinding(term))
            update_derived_inputs_for_exit_point(term);

        Block* nestedBlock = term->nestedContents;
        if (nestedBlock != NULL && is_minor_block(nestedBlock))
            update_for_control_flow(nestedBlock);
    }
}