Beispiel #1
0
void bug_with_is_major_block()
{
    Block block;
    Term* f = block.compile("def f() {}");

    test_assert(is_major_block(nested_contents(f)));
    
    // There was a bug where, if the function was patched with a native handler, it
    // would no longer be considered a major block.

    install_function(f, my_native_patch);

    test_assert(is_major_block(nested_contents(f)));
}
Beispiel #2
0
Block* get_parent_block_major(Block* block)
{
    if (block->owningTerm == NULL)
        return NULL;

    if (is_major_block(block))
        return NULL;

    return block->owningTerm->owningBlock;
}
Beispiel #3
0
Block* find_enclosing_major_block(Block* block)
{
    while (true) {
        if (block == NULL)
            return NULL;

        if (is_major_block(block))
            return block;

        block = get_parent_block(block);
    }
    return NULL;
}