# Path: globs.py
# WRITTEN_MODULES = {}
# RUNTIME_MODULE_OBJS = {
#     'runtime.py': 'ir/z.o',
#     'gc/interface.py': 'ir/gc_runtime.o',
# }


from atom import *
from base import *
from types_builtin import *
from globs import TypeOf, ResultOf
import vat
    consume_value_as(CBool(), test)
    prop_body(body)

def prop_assert(tst, msg):
    consume_value_as(CBool(), tst)
    consume_value_as(CStr(), msg)

def prop_return(e):
    t = prop_expr(e)
    unify_results(Ret(t), env(PROPSCOPE).result)

def prop_voidreturn():
    assert not matches(env(PROPSCOPE).result, "Ret(_)")

def prop_writeextrinsic(s, extr, node, val):
    prop_expr(node)
    consume_value_as(instantiate_type(s, extr.type), val)

def prop_void_inenv(t, init, f):
    consume_value_as(ctype(t), init)
    return prop_voidexpr(f)

def prop_voidexpr(e):
    return match(e,
        ("call==VoidCall(f, ps)", prop_call_result),
        ("VoidInEnv(Env(t), init, e)", prop_void_inenv))

def prop_voidstmt(stmt, e):
    result = prop_voidexpr(e)
    assert not matches(result, "Ret(_)"), "%s doesn't return void" % (e,)

# Path: globs.py
# WRITTEN_MODULES = {}
# RUNTIME_MODULE_OBJS = {
#     'runtime.py': 'ir/z.o',
#     'gc/interface.py': 'ir/gc_runtime.o',
# }


# Path: prop.py
from atom import *
from base import *
from types_builtin import *
from globs import TypeOf, ResultOf
import vat

    consume_value_as(CBool(), test)
    prop_body(body)

def prop_assert(tst, msg):
    consume_value_as(CBool(), tst)
    consume_value_as(CStr(), msg)

def prop_return(e):
    t = prop_expr(e)
    unify_results(Ret(t), env(PROPSCOPE).result)

def prop_voidreturn():
    assert not matches(env(PROPSCOPE).result, "Ret(_)")

def prop_writeextrinsic(s, extr, node, val):
    prop_expr(node)
    consume_value_as(instantiate_type(s, extr.type), val)

def prop_void_inenv(t, init, f):
    consume_value_as(ctype(t), init)
    return prop_voidexpr(f)

def prop_voidexpr(e):
    return match(e,
        ("call==VoidCall(f, ps)", prop_call_result),
        ("VoidInEnv(Env(t), init, e)", prop_void_inenv))

def prop_voidstmt(stmt, e):
    result = prop_voidexpr(e)
    assert not matches(result, "Ret(_)"), "%s doesn't return void" % (e,)

    add_extrinsic(ResultOf, stmt, result)