// another time. -brendanfh 2020/10/09
// :RelativeFiles This should lookup for the file relative to "relative_to"
char* lookup_included_file(char* filename, char* relative_to, b32 add_onyx_suffix, b32 search_included_folders);
+
+extern AstNode node_that_signals_a_yield;
\ No newline at end of file
if (call->callee->kind == Ast_Kind_Polymorphic_Proc) {
AstTyped* new_callee = (AstTyped *) polymorphic_proc_lookup((AstPolyProc *) call->callee, PPLM_By_Arguments, &call->args, call->token);
+ if (new_callee == (AstTyped *) &node_that_signals_a_yield) return Check_Yield_Macro;
if (new_callee == NULL) return Check_Error;
arguments_remove_baked(&call->args);
//
// Polymorphic Procedures
//
+
+AstNode node_that_signals_a_yield = {};
+
static void ensure_polyproc_cache_is_created(AstPolyProc* pp) {
if (pp->concrete_funcs == NULL) {
bh_table_init(global_heap_allocator, pp->concrete_funcs, 16);
*resolved = solve_poly_type(param->poly_sym, param->type_expr, actual_type);
}
+// HACK HACK HACK nocheckin
+static b32 flag_to_yield = 0;
+
// NOTE: The job of this function is to look through the arguments provided and find a matching
// value that is to be baked into the polymorphic procedures poly-scope. It expected that param
// will be of kind PPK_Baked_Value.
}
Type* resolved_type = type_build_from_ast(context.ast_alloc, (AstType *) value);
+ if (resolved_type == NULL) flag_to_yield = 1;
+
*resolved = ((PolySolveResult) { PSK_Type, .actual = resolved_type });
} else {
default: if (err_msg) *err_msg = "Invalid polymorphic parameter kind. This is a compiler bug.";
}
+
+ if (flag_to_yield) {
+ bh_arr_free(slns);
+ return NULL;
+ }
switch (resolved.kind) {
case PSK_Undefined:
char *err_msg = NULL;
bh_arr(AstPolySolution) slns = find_polymorphic_slns(pp, pp_lookup, actual, &err_msg);
if (slns == NULL) {
+ if (flag_to_yield) {
+ flag_to_yield = 0;
+ return (AstFunction *) &node_that_signals_a_yield;
+ }
+
if (err_msg != NULL) onyx_report_error(tkn->pos, err_msg);
else onyx_report_error(tkn->pos, "Some kind of error occured when generating a polymorphic procedure. You hopefully will not see this");