# 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
    return ctype_replaced(ft, tmap)

def prop_lhs_attr(lhs, s, f):
    t = prop_expr(s)
    # TEMP: resolve the field name now that we have type info
    lhs.attr = resolve_field_by_name(t, f)
    return resolve_field_type(t, lhs.attr.type)

def prop_lhs(lhs):
    t = match(lhs,
        ("LhsVar(v)", prop_local_var),
        ("lhs==LhsAttr(s, f)", prop_lhs_attr))
    add_extrinsic(PendingType, lhs, t)
    return t

def prop_DT(form):
    dtT = vanilla_tdata(form)
    for c in form.ctors:
        set_type(c, ctor_type(c, dtT))

def prop_func_defn(var, f):
    t = extrinsic(TypeOf, var)
    ft = prop_func_expr(var, f, f.params, f.body)
    unify(ft, ctype(t))

def prop_defn(pat, e):
    m = match((pat, e))
    if m("(PatVar(v), FuncExpr(f))"):
        var = m.v
        if has_extrinsic(TypeOf, var):

# 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

    return ctype_replaced(ft, tmap)

def prop_lhs_attr(lhs, s, f):
    t = prop_expr(s)
    # TEMP: resolve the field name now that we have type info
    lhs.attr = resolve_field_by_name(t, f)
    return resolve_field_type(t, lhs.attr.type)

def prop_lhs(lhs):
    t = match(lhs,
        ("LhsVar(v)", prop_local_var),
        ("lhs==LhsAttr(s, f)", prop_lhs_attr))
    add_extrinsic(PendingType, lhs, t)
    return t

def prop_DT(form):
    dtT = vanilla_tdata(form)
    for c in form.ctors:
        set_type(c, ctor_type(c, dtT))

def prop_func_defn(var, f):
    t = extrinsic(TypeOf, var)
    ft = prop_func_expr(var, f, f.params, f.body)
    unify(ft, ctype(t))

def prop_defn(pat, e):
    m = match((pat, e))
    if m("(PatVar(v), FuncExpr(f))"):
        var = m.v
        if has_extrinsic(TypeOf, var):

            cft = ctype(extrinsic(TypeOf, var))