41 for (
size_t i = 0; i < len; i++)
52 static tree_t *get_import(
tree_t *sema,
const char *name)
76 if (ctx->
tree == sema)
89 msg_note(evt,
"consider using import aliases; eg. `import %s as my_%s`",
105 for (
size_t i = 0; i < len; i++)
108 import_module(runtime, unit->
tree, it);
CT_PUREFN CT_TREE_API const node_t * tree_get_node(const tree_t *tree)
ctu_forward_t ctu_forward_decl(tree_t *sema, ctu_t *decl)
void ctu_rt_mod(language_runtime_t *runtime, tree_t *root)
void ctu_add_decl(tree_t *sema, ctu_tag_t tag, const char *name, tree_t *decl)
void ctu_forward_decls(language_runtime_t *runtime, compile_unit_t *unit)
void ctu_process_imports(language_runtime_t *runtime, compile_unit_t *unit)
void ctu_init(language_runtime_t *runtime, tree_t *root)
CT_BROKER_API void * unit_get_ast(compile_unit_t *unit)
CT_BROKER_API void unit_update(compile_unit_t *unit, void *ast, tree_t *tree)
CT_BROKER_API compile_unit_t * lang_get_unit(language_runtime_t *runtime, unit_id_t id)
CT_BROKER_API text_view_t build_unit_id(const vector_t *parts, arena_t *arena)
CT_EVENTS_API event_builder_t evt_symbol_shadowed(logger_t *logger, const char *name, const node_t *prev, const node_t *next)
signal that a declaration would shadow a previous declaration
CT_NODISCARD CT_PUREFN CT_STD_API void * map_get(const map_t *map, const void *key)
get a value from a map
#define CT_UNUSED(x)
mark a variable as unused
CT_NOTIFY_API event_builder_t msg_notify(INOUT_NOTNULL logger_t *logs, const diagnostic_t *diagnostic, const node_t *node, STA_FORMAT_STRING const char *fmt,...)
notify the logger of a new message
CT_NOTIFY_API void msg_note(event_builder_t builder, STA_FORMAT_STRING const char *fmt,...)
add a note to an existing message
#define CTASSERT(expr)
assert a condition, prints the condition as a message
CT_NODISCARD CT_STD_API char * str_join(const char *sep, const vector_t *parts, arena_t *arena)
join strings
CT_TREE_API map_t * tree_module_tag(const tree_t *self, size_t tag)
CT_NODISCARD CT_PUREFN CT_STD_API void * vector_get(const vector_t *vector, size_t index)
get a value from a vector
CT_NODISCARD CT_PUREFN CT_STD_API size_t vector_len(const vector_t *vector)
get the length of a vector
tree_t * tree
the tree for this unit is NULL if the unit has not been forward declared yet
const vector_t * import_path
an event builder handles adding additional information to an event
arena_t * arena
default memory arena
a non-owning view of text
a generic vector of pointers