# 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

def check_cond(cases):
    for case in cases:
        check_expr_as(TBool(), case.test)
        check_body(case.body)

def check_while(test, body):
    check_expr_as(TBool(), test)
    check_body(body)

def check_assert(tst, msg):
    check_expr_as(TBool(), tst)
    check_expr_as(TStr(), msg)

def check_return(e):
    check_expr_as(env(CHECKSCOPE).result.type, e)

def check_returnnothing():
    assert not matches(env(CHECKSCOPE).result, "Ret(_)")

def check_writeextrinsic(t, node, val):
    check_expr_as_boxed(node)
    check_expr_as(t, val)

def check_voidexpr(e):
    match(e,
        ("call==VoidCall(f, args)", check_void_call),
        ("VoidInEnv(environ, init, e)", check_void_inenv))

def check_voidstmt(s, e):

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


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


def check_cond(cases):
    for case in cases:
        check_expr_as(TBool(), case.test)
        check_body(case.body)

def check_while(test, body):
    check_expr_as(TBool(), test)
    check_body(body)

def check_assert(tst, msg):
    check_expr_as(TBool(), tst)
    check_expr_as(TStr(), msg)

def check_return(e):
    check_expr_as(env(CHECKSCOPE).result.type, e)

def check_returnnothing():
    assert not matches(env(CHECKSCOPE).result, "Ret(_)")

def check_writeextrinsic(t, node, val):
    check_expr_as_boxed(node)
    check_expr_as(t, val)

def check_voidexpr(e):
    match(e,
        ("call==VoidCall(f, args)", check_void_call),
        ("VoidInEnv(environ, init, e)", check_void_inenv))

def check_voidstmt(s, e):

    result = extrinsic(ResultOf, s)