diff --git a/bootstrap/stage0.c b/bootstrap/stage0.c index 3a643b6..fca7e3e 100644 --- a/bootstrap/stage0.c +++ b/bootstrap/stage0.c @@ -68,6 +68,8 @@ void ae_assert_fail(char *dbg_msg, char *msg) { /* Constants */ +#define compiler_passes_code_generator_cls_ctx_name ("_C") +#define compiler_passes_code_generator_cls_fn_field_name ("fn") #define std_compact_map_INDEX_FREE (-1) #define std_compact_map_INDEX_DELETED (-2) /* Typedefs */ @@ -80,7 +82,7 @@ typedef struct compiler_passes_generic_pass_GenericPass compiler_passes_generic_ typedef struct compiler_passes_typechecker_TypeChecker compiler_passes_typechecker_TypeChecker; typedef struct std_buffer_Buffer std_buffer_Buffer; typedef struct compiler_passes_code_generator_CodeGenerator compiler_passes_code_generator_CodeGenerator; -typedef struct compiler_passes_reorder_structs_ReorderStructs compiler_passes_reorder_structs_ReorderStructs; +typedef struct compiler_passes_reorder_symbols_ReorderSymbols compiler_passes_reorder_symbols_ReorderSymbols; typedef struct std_span_Location std_span_Location; typedef struct std_span_Span std_span_Span; typedef struct compiler_parser_Parser compiler_parser_Parser; @@ -95,6 +97,7 @@ typedef struct compiler_ast_scopes_Template compiler_ast_scopes_Template; typedef enum compiler_ast_scopes_ReferenceType compiler_ast_scopes_ReferenceType; typedef struct compiler_ast_scopes_Reference compiler_ast_scopes_Reference; typedef struct compiler_ast_scopes_EnumField compiler_ast_scopes_EnumField; +typedef struct compiler_ast_scopes_ClosedVariable compiler_ast_scopes_ClosedVariable; typedef union compiler_ast_scopes_SymbolUnion compiler_ast_scopes_SymbolUnion; typedef enum compiler_ast_scopes_SymbolType compiler_ast_scopes_SymbolType; typedef struct compiler_ast_scopes_Symbol compiler_ast_scopes_Symbol; @@ -209,11 +212,10 @@ typedef struct std_map_Iterator__2 std_map_Iterator__2; typedef struct std_map_Iterator__3 std_map_Iterator__3; typedef struct std_map_Iterator__4 std_map_Iterator__4; typedef struct std_map_Iterator__6 std_map_Iterator__6; -typedef struct std_map_Iterator__7 std_map_Iterator__7; -typedef struct std_map_Iterator__9 std_map_Iterator__9; +typedef struct std_map_Iterator__8 std_map_Iterator__8; typedef struct std_map_ValueIterator__3 std_map_ValueIterator__3; typedef struct std_map_ValueIterator__4 std_map_ValueIterator__4; -typedef struct std_map_ValueIterator__9 std_map_ValueIterator__9; +typedef struct std_map_ValueIterator__8 std_map_ValueIterator__8; typedef struct std_vector_Vector__0 std_vector_Vector__0; typedef struct std_vector_Vector__1 std_vector_Vector__1; typedef struct std_vector_Vector__2 std_vector_Vector__2; @@ -253,7 +255,7 @@ typedef struct std_vector_Iterator__7 std_vector_Iterator__7; typedef struct std_vector_Iterator__8 std_vector_Iterator__8; typedef struct std_vector_Iterator__9 std_vector_Iterator__9; typedef struct std_vector_Iterator__10 std_vector_Iterator__10; -typedef struct std_vector_Iterator__11 std_vector_Iterator__11; +typedef struct std_vector_Iterator__12 std_vector_Iterator__12; typedef struct std_vector_Iterator__13 std_vector_Iterator__13; typedef struct std_vector_Iterator__14 std_vector_Iterator__14; typedef struct std_vector_Iterator__15 std_vector_Iterator__15; @@ -319,10 +321,9 @@ struct compiler_passes_code_generator_CodeGenerator { u32 indent; }; -struct compiler_passes_reorder_structs_ReorderStructs { +struct compiler_passes_reorder_symbols_ReorderSymbols { compiler_passes_generic_pass_GenericPass *o; - std_vector_Vector__9 *all_structs; - std_vector_Vector__10 *all_syms; + std_vector_Vector__9 *all_syms; std_set_Set__1 *done; }; @@ -339,12 +340,12 @@ struct std_span_Span { }; struct compiler_parser_Parser { - std_vector_Vector__12 *tokens; + std_vector_Vector__11 *tokens; u32 curr; compiler_ast_nodes_Function *curr_func; compiler_ast_program_Program *program; compiler_ast_program_Namespace *ns; - std_vector_Vector__13 *attrs; + std_vector_Vector__12 *attrs; std_span_Span attrs_span; compiler_tokens_Token *attrs_start_tok; std_span_Span prev_expr_error_span; @@ -361,8 +362,8 @@ struct compiler_lexer_Lexer { u32 i; std_span_Location loc; bool seen_newline; - std_vector_Vector__12 *tokens; - std_vector_Vector__14 *errors; + std_vector_Vector__11 *tokens; + std_vector_Vector__13 *errors; bool in_comment; std_buffer_Buffer comment; std_span_Location comment_start; @@ -371,7 +372,7 @@ struct compiler_lexer_Lexer { struct compiler_ast_program_Namespace { compiler_ast_program_Namespace *parent; std_vector_Vector__6 *functions; - std_vector_Vector__9 *structs; + std_vector_Vector__14 *structs; std_vector_Vector__15 *enums; std_vector_Vector__16 *constants; std_vector_Vector__16 *variables; @@ -398,20 +399,19 @@ struct compiler_ast_program_CachedSymbols { struct compiler_ast_program_Program { compiler_ast_program_Namespace *global; - std_vector_Vector__9 *ordered_structs; - std_vector_Vector__10 *ordered_symbols; + std_vector_Vector__9 *ordered_symbols; std_vector_Vector__8 *c_includes; std_vector_Vector__8 *c_flags; std_map_Map__5 *operator_overloads; std_map_Map__6 *c_embeds; std_map_Map__6 *sources; std_vector_Vector__8 *library_paths; - std_vector_Vector__14 *errors; + std_vector_Vector__13 *errors; u32 error_level; compiler_ast_program_CachedSymbols cached_symbols; bool did_cache_symbols; std_vector_Vector__17 *err_jmp_stack; - std_vector_Vector__10 *explicit_alive_symbols; + std_vector_Vector__9 *explicit_alive_symbols; std_vector_Vector__0 *closure_types; std_vector_Vector__6 *closures; bool check_doc_links; @@ -433,7 +433,7 @@ struct compiler_ast_scopes_TemplateInstance { }; struct compiler_ast_scopes_Template { - std_vector_Vector__10 *params; + std_vector_Vector__9 *params; std_vector_Vector__4 *instances; }; @@ -462,6 +462,11 @@ struct compiler_ast_scopes_EnumField { u32 idx; }; +struct compiler_ast_scopes_ClosedVariable { + compiler_ast_nodes_Variable *orig; + compiler_ast_nodes_Function *closure; +}; + union compiler_ast_scopes_SymbolUnion { compiler_ast_nodes_Function *func; compiler_ast_nodes_Structure *struc; @@ -472,6 +477,7 @@ union compiler_ast_scopes_SymbolUnion { compiler_ast_nodes_EnumVariant *enum_var; compiler_ast_scopes_EnumField enum_field; compiler_ast_nodes_Function *closure; + compiler_ast_scopes_ClosedVariable closed_var; }; enum compiler_ast_scopes_SymbolType { @@ -481,7 +487,9 @@ enum compiler_ast_scopes_SymbolType { compiler_ast_scopes_SymbolType_Namespace, compiler_ast_scopes_SymbolType_Variable, compiler_ast_scopes_SymbolType_Constant, + compiler_ast_scopes_SymbolType_ClosureType, compiler_ast_scopes_SymbolType_Closure, + compiler_ast_scopes_SymbolType_ClosedVariable, compiler_ast_scopes_SymbolType_Enum, compiler_ast_scopes_SymbolType_EnumVariant, compiler_ast_scopes_SymbolType_EnumField, @@ -495,7 +503,9 @@ char *compiler_ast_scopes_SymbolType_dbg(compiler_ast_scopes_SymbolType this) { case compiler_ast_scopes_SymbolType_Namespace: return "Namespace"; case compiler_ast_scopes_SymbolType_Variable: return "Variable"; case compiler_ast_scopes_SymbolType_Constant: return "Constant"; + case compiler_ast_scopes_SymbolType_ClosureType: return "ClosureType"; case compiler_ast_scopes_SymbolType_Closure: return "Closure"; + case compiler_ast_scopes_SymbolType_ClosedVariable: return "ClosedVariable"; case compiler_ast_scopes_SymbolType_Enum: return "Enum"; case compiler_ast_scopes_SymbolType_EnumVariant: return "EnumVariant"; case compiler_ast_scopes_SymbolType_EnumField: return "EnumField"; @@ -517,6 +527,7 @@ struct compiler_ast_scopes_Symbol { bool is_extern; char *extern_name; compiler_ast_scopes_Template *template; + bool is_dead; }; struct compiler_ast_scopes_Scope { @@ -628,7 +639,6 @@ struct compiler_ast_nodes_Variable { bool is_atomic; compiler_ast_nodes_AST *default_value; compiler_types_Type *parsed_type; - bool is_dead; }; struct compiler_ast_nodes_Structure { @@ -637,7 +647,6 @@ struct compiler_ast_nodes_Structure { compiler_types_Type *type; bool is_union; std_span_Span span; - bool is_dead; char *format_spec; char *format_args; }; @@ -648,7 +657,6 @@ struct compiler_ast_nodes_Enum { std_vector_Vector__3 *shared_fields; std_vector_Vector__20 *variants; compiler_types_Type *type; - bool is_dead; bool has_values; }; @@ -682,7 +690,7 @@ struct compiler_ast_nodes_Function { compiler_ast_nodes_AST *body; compiler_ast_scopes_Scope *scope; compiler_ast_scopes_Scope *closure_scope; - std_map_Map__7 *closed_vars; + std_map_Map__4 *closed_vars; std_span_Span span; compiler_types_Type *parsed_return_type; compiler_ast_nodes_AST *name_ast; @@ -694,7 +702,6 @@ struct compiler_ast_nodes_Function { bool exits; bool is_static; compiler_types_Type *parent_type; - bool is_dead; }; struct compiler_ast_nodes_Block { @@ -888,7 +895,7 @@ struct compiler_ast_nodes_MatchCond { }; struct compiler_ast_nodes_MatchCase { - std_vector_Vector__11 *conds; + std_vector_Vector__10 *conds; compiler_ast_nodes_AST *body; }; @@ -1380,7 +1387,7 @@ struct compiler_types_Type { compiler_types_BaseType base; std_span_Span span; compiler_types_TypeUnion u; - std_map_Map__9 *methods; + std_map_Map__8 *methods; compiler_ast_scopes_Symbol *sym; compiler_ast_scopes_TemplateInstance *template_instance; }; @@ -1501,7 +1508,7 @@ struct std_set_Set__1 { }; struct std_set_Set__2 { - std_map_Map__8 *map; + std_map_Map__7 *map; u32 size; }; @@ -1639,25 +1646,25 @@ struct std_map_Item__6 { struct std_map_Item__7 { char *key; - compiler_ast_nodes_Variable *value; + bool value; std_map_Item__7 *next; }; struct std_map_Item__8 { char *key; - bool value; + compiler_ast_nodes_Function *value; std_map_Item__8 *next; }; struct std_map_Item__9 { char *key; - compiler_ast_nodes_Function *value; + compiler_ast_nodes_Argument *value; std_map_Item__9 *next; }; struct std_map_Item__10 { char *key; - compiler_ast_nodes_Argument *value; + compiler_ast_nodes_Variable *value; std_map_Item__10 *next; }; @@ -1801,16 +1808,10 @@ struct std_map_Iterator__6 { std_map_Map__6 *map; }; -struct std_map_Iterator__7 { - i32 idx; - std_map_Item__7 *node; - std_map_Map__7 *map; -}; - -struct std_map_Iterator__9 { +struct std_map_Iterator__8 { i32 idx; - std_map_Item__9 *node; - std_map_Map__9 *map; + std_map_Item__8 *node; + std_map_Map__8 *map; }; struct std_map_ValueIterator__3 { @@ -1821,8 +1822,8 @@ struct std_map_ValueIterator__4 { std_map_Iterator__4 map_iter; }; -struct std_map_ValueIterator__9 { - std_map_Iterator__9 map_iter; +struct std_map_ValueIterator__8 { + std_map_Iterator__8 map_iter; }; struct std_vector_Vector__0 { @@ -1880,37 +1881,37 @@ struct std_vector_Vector__8 { }; struct std_vector_Vector__9 { - compiler_ast_nodes_Structure **data; + compiler_ast_scopes_Symbol **data; u32 size; u32 capacity; }; struct std_vector_Vector__10 { - compiler_ast_scopes_Symbol **data; + compiler_ast_nodes_MatchCond **data; u32 size; u32 capacity; }; struct std_vector_Vector__11 { - compiler_ast_nodes_MatchCond **data; + compiler_tokens_Token **data; u32 size; u32 capacity; }; struct std_vector_Vector__12 { - compiler_tokens_Token **data; + compiler_attributes_Attribute **data; u32 size; u32 capacity; }; struct std_vector_Vector__13 { - compiler_attributes_Attribute **data; + compiler_errors_Error **data; u32 size; u32 capacity; }; struct std_vector_Vector__14 { - compiler_errors_Error **data; + compiler_ast_nodes_Structure **data; u32 size; u32 capacity; }; @@ -2050,8 +2051,8 @@ struct std_vector_Iterator__10 { u32 index; }; -struct std_vector_Iterator__11 { - std_vector_Vector__11 *vec; +struct std_vector_Iterator__12 { + std_vector_Vector__12 *vec; u32 index; }; @@ -2250,6 +2251,8 @@ void compiler_passes_code_generator_CodeGenerator_gen_in_yield_context(compiler_ void compiler_passes_code_generator_CodeGenerator_gen_enum_constructor(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_EnumVariant *variant, std_vector_Vector__7 *args); void compiler_passes_code_generator_CodeGenerator_gen_constructor(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, compiler_ast_nodes_Structure *struc); void compiler_passes_code_generator_CodeGenerator_gen_create_new(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node); +void compiler_passes_code_generator_CodeGenerator_gen_call_args(compiler_passes_code_generator_CodeGenerator *this, std_vector_Vector__7 *args, bool is_variadic_format); +void compiler_passes_code_generator_CodeGenerator_gen_closure_call(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, compiler_ast_scopes_Symbol *sym); void compiler_passes_code_generator_CodeGenerator_gen_expression(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, bool is_top_level); void compiler_passes_code_generator_CodeGenerator_gen_var_declaration(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node); void compiler_passes_code_generator_CodeGenerator_gen_match_case_body(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, compiler_ast_nodes_AST *body); @@ -2260,7 +2263,7 @@ void compiler_passes_code_generator_CodeGenerator_gen_match(compiler_passes_code void compiler_passes_code_generator_CodeGenerator_gen_defers_upto(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_scopes_Scope *end_scope); void compiler_passes_code_generator_CodeGenerator_gen_statement(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node); void compiler_passes_code_generator_CodeGenerator_gen_block(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, bool with_braces); -char *compiler_passes_code_generator_CodeGenerator_helper_gen_function_type(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *top, compiler_types_Type *cur, char *acc, bool is_func_def); +char *compiler_passes_code_generator_CodeGenerator_helper_gen_function_type(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *top, compiler_types_Type *cur, char *acc, bool is_func_def, char *param_prefix, std_vector_Vector__3 *params); char *compiler_passes_code_generator_CodeGenerator_helper_gen_type(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *top, compiler_types_Type *cur, char *acc, bool is_func_def); char *compiler_passes_code_generator_CodeGenerator_get_type_name_string(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *type, char *name, bool is_func_def); void compiler_passes_code_generator_CodeGenerator_gen_type_and_name(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *type, char *name); @@ -2276,6 +2279,8 @@ void compiler_passes_code_generator_CodeGenerator_gen_closure_type_typedef(compi void compiler_passes_code_generator_CodeGenerator_gen_closure_type_def(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_scopes_Symbol *sym); void compiler_passes_code_generator_CodeGenerator_gen_closure_typedef(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *clos); void compiler_passes_code_generator_CodeGenerator_gen_closure_def(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *clos); +void compiler_passes_code_generator_CodeGenerator_gen_closure_func_decl(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *clos); +void compiler_passes_code_generator_CodeGenerator_gen_closure_func(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *clos); void compiler_passes_code_generator_CodeGenerator_gen_sym_typedef(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_scopes_Symbol *sym); void compiler_passes_code_generator_CodeGenerator_gen_sym_def(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_scopes_Symbol *sym); void compiler_passes_code_generator_CodeGenerator_gen_enum_typedef(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Enum *enom); @@ -2284,12 +2289,15 @@ void compiler_passes_code_generator_CodeGenerator_gen_enum_def(compiler_passes_c char *compiler_passes_code_generator_CodeGenerator_generate(compiler_passes_code_generator_CodeGenerator *this); compiler_passes_code_generator_CodeGenerator compiler_passes_code_generator_CodeGenerator_make(compiler_ast_program_Program *program); char *compiler_passes_code_generator_CodeGenerator_run(compiler_ast_program_Program *program); -compiler_passes_reorder_structs_ReorderStructs *compiler_passes_reorder_structs_ReorderStructs_new(compiler_ast_program_Program *program); -void compiler_passes_reorder_structs_ReorderStructs_free(compiler_passes_reorder_structs_ReorderStructs *this); -void compiler_passes_reorder_structs_ReorderStructs_collect_all_structs(compiler_passes_reorder_structs_ReorderStructs *this, compiler_ast_program_Namespace *ns); -void compiler_passes_reorder_structs_ReorderStructs_dfs(compiler_passes_reorder_structs_ReorderStructs *this, compiler_ast_scopes_Symbol *sym); -void compiler_passes_reorder_structs_ReorderStructs_reorder_structs(compiler_passes_reorder_structs_ReorderStructs *this); -void compiler_passes_reorder_structs_ReorderStructs_run(compiler_ast_program_Program *program); +char *compiler_passes_code_generator_cls_ctx_type(compiler_ast_nodes_Function *func); +compiler_passes_reorder_symbols_ReorderSymbols *compiler_passes_reorder_symbols_ReorderSymbols_new(compiler_ast_program_Program *program); +void compiler_passes_reorder_symbols_ReorderSymbols_free(compiler_passes_reorder_symbols_ReorderSymbols *this); +void compiler_passes_reorder_symbols_ReorderSymbols_collect_sym(compiler_passes_reorder_symbols_ReorderSymbols *this, compiler_ast_scopes_Symbol *sym); +void compiler_passes_reorder_symbols_ReorderSymbols_collect_all_symbols_ns(compiler_passes_reorder_symbols_ReorderSymbols *this, compiler_ast_program_Namespace *ns); +void compiler_passes_reorder_symbols_ReorderSymbols_collect_all_symbols(compiler_passes_reorder_symbols_ReorderSymbols *this); +void compiler_passes_reorder_symbols_ReorderSymbols_dfs(compiler_passes_reorder_symbols_ReorderSymbols *this, compiler_ast_scopes_Symbol *sym); +void compiler_passes_reorder_symbols_ReorderSymbols_reorder_structs(compiler_passes_reorder_symbols_ReorderSymbols *this); +void compiler_passes_reorder_symbols_ReorderSymbols_run(compiler_ast_program_Program *program); compiler_parser_Parser compiler_parser_Parser_make(compiler_ast_program_Program *program, compiler_ast_program_Namespace *ns); void compiler_parser_Parser_free(compiler_parser_Parser *this); compiler_tokens_Token *compiler_parser_Parser_peek(compiler_parser_Parser *this, i32 off); @@ -2314,7 +2322,7 @@ compiler_types_Type *compiler_parser_Parser_parse_type(compiler_parser_Parser *t compiler_ast_nodes_AST *compiler_parser_Parser_parse_identifier(compiler_parser_Parser *this); compiler_ast_nodes_AST *compiler_parser_Parser_parse_scoped_identifier(compiler_parser_Parser *this, bool consume_template); compiler_ast_nodes_AST *compiler_parser_Parser_parse_format_string(compiler_parser_Parser *this); -std_vector_Vector__11 *compiler_parser_Parser_parse_match_case_conds(compiler_parser_Parser *this, compiler_tokens_TokenType end_type); +std_vector_Vector__10 *compiler_parser_Parser_parse_match_case_conds(compiler_parser_Parser *this, compiler_tokens_TokenType end_type); compiler_ast_nodes_AST *compiler_parser_Parser_parse_match(compiler_parser_Parser *this); void compiler_parser_Parser_sync_toplevel(compiler_parser_Parser *this); compiler_types_Type *compiler_parser_Parser_parse_literal_suffix_type(compiler_parser_Parser *this, compiler_tokens_Token *suffix); @@ -2386,7 +2394,7 @@ compiler_tokens_Token *compiler_lexer_Lexer_lex_int_literal_different_base(compi compiler_tokens_Token *compiler_lexer_Lexer_lex_numeric_literal_helper(compiler_lexer_Lexer *this); void compiler_lexer_Lexer_lex_numeric_literal(compiler_lexer_Lexer *this); void compiler_lexer_Lexer_lex_comment(compiler_lexer_Lexer *this); -std_vector_Vector__12 *compiler_lexer_Lexer_lex(compiler_lexer_Lexer *this); +std_vector_Vector__11 *compiler_lexer_Lexer_lex(compiler_lexer_Lexer *this); compiler_ast_program_Namespace *compiler_ast_program_Namespace_new(compiler_ast_program_Namespace *parent, char *path); compiler_ast_scopes_Symbol *compiler_ast_program_Namespace_find_importable_symbol(compiler_ast_program_Namespace *this, char *name); compiler_ast_program_Namespace *compiler_ast_program_Namespace_get_project_root(compiler_ast_program_Namespace *this, std_span_Span span, compiler_ast_program_Program *program_for_errors); @@ -2409,7 +2417,7 @@ void compiler_ast_program_NSIterator_next(compiler_ast_program_NSIterator *this) compiler_ast_program_Namespace *compiler_ast_program_NSIterator_cur(compiler_ast_program_NSIterator *this); compiler_ast_scopes_TemplateInstance *compiler_ast_scopes_TemplateInstance_new(std_vector_Vector__0 *args, compiler_ast_scopes_Symbol *parent, compiler_ast_scopes_Symbol *resolved); bool compiler_ast_scopes_TemplateInstance_matches(compiler_ast_scopes_TemplateInstance *this, std_vector_Vector__0 *other); -compiler_ast_scopes_Template *compiler_ast_scopes_Template_new(std_vector_Vector__10 *params); +compiler_ast_scopes_Template *compiler_ast_scopes_Template_new(std_vector_Vector__9 *params); char *compiler_ast_scopes_Symbol_out_name(compiler_ast_scopes_Symbol *this); compiler_ast_scopes_Symbol *compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType type, compiler_ast_program_Namespace *ns, char *name, char *display, char *full_name, std_span_Span span); char *compiler_ast_scopes_Symbol_join_display(char *a, char *b); @@ -2539,7 +2547,7 @@ void compiler_errors_Error_panic(compiler_errors_Error *this) __attribute__((nor compiler_errors_Error *compiler_errors_Error_new(std_span_Span span, char *msg); compiler_errors_Error *compiler_errors_Error_new_note(std_span_Span span, char *msg, char *note); compiler_errors_Error *compiler_errors_Error_new_hint(std_span_Span span, char *msg, std_span_Span span2, char *hint); -void compiler_errors_display_error_messages(std_vector_Vector__14 *errors, u32 detail_level); +void compiler_errors_display_error_messages(std_vector_Vector__13 *errors, u32 detail_level); void std_panic(char *msg) __attribute__((noreturn)); u32 str_to_u32(char *this); bool str_eq(char *this, char *other); @@ -2581,7 +2589,7 @@ std_sv_SV std_sv_SVSplitIterator_cur(std_sv_SVSplitIterator *this); void std_sv_SVSplitIterator_next(std_sv_SVSplitIterator *this); compiler_passes_mark_dead_code_MarkDeadCode *std_mem_alloc__0(u32 count); compiler_passes_generic_pass_GenericPass *std_mem_alloc__1(u32 count); -compiler_passes_reorder_structs_ReorderStructs *std_mem_alloc__2(u32 count); +compiler_passes_reorder_symbols_ReorderSymbols *std_mem_alloc__2(u32 count); compiler_ast_program_Namespace *std_mem_alloc__3(u32 count); compiler_ast_program_Program *std_mem_alloc__4(u32 count); compiler_ast_scopes_TemplateInstance *std_mem_alloc__5(u32 count); @@ -2672,17 +2680,17 @@ compiler_ast_nodes_Argument **std_mem_alloc__89(u32 count); std_vector_Vector__8 *std_mem_alloc__90(u32 count); char **std_mem_alloc__91(u32 count); std_vector_Vector__9 *std_mem_alloc__92(u32 count); -compiler_ast_nodes_Structure **std_mem_alloc__93(u32 count); +compiler_ast_scopes_Symbol **std_mem_alloc__93(u32 count); std_vector_Vector__10 *std_mem_alloc__94(u32 count); -compiler_ast_scopes_Symbol **std_mem_alloc__95(u32 count); +compiler_ast_nodes_MatchCond **std_mem_alloc__95(u32 count); std_vector_Vector__11 *std_mem_alloc__96(u32 count); -compiler_ast_nodes_MatchCond **std_mem_alloc__97(u32 count); +compiler_tokens_Token **std_mem_alloc__97(u32 count); std_vector_Vector__12 *std_mem_alloc__98(u32 count); -compiler_tokens_Token **std_mem_alloc__99(u32 count); +compiler_attributes_Attribute **std_mem_alloc__99(u32 count); std_vector_Vector__13 *std_mem_alloc__100(u32 count); -compiler_attributes_Attribute **std_mem_alloc__101(u32 count); +compiler_errors_Error **std_mem_alloc__101(u32 count); std_vector_Vector__14 *std_mem_alloc__102(u32 count); -compiler_errors_Error **std_mem_alloc__103(u32 count); +compiler_ast_nodes_Structure **std_mem_alloc__103(u32 count); std_vector_Vector__15 *std_mem_alloc__104(u32 count); compiler_ast_nodes_Enum **std_mem_alloc__105(u32 count); std_vector_Vector__16 *std_mem_alloc__106(u32 count); @@ -2724,12 +2732,12 @@ compiler_ast_nodes_ImportPart **std_mem_realloc__6(compiler_ast_nodes_ImportPart compiler_ast_nodes_Function **std_mem_realloc__7(compiler_ast_nodes_Function **ptr, u32 old_count, u32 new_count); compiler_ast_nodes_Argument **std_mem_realloc__8(compiler_ast_nodes_Argument **ptr, u32 old_count, u32 new_count); char **std_mem_realloc__9(char **ptr, u32 old_count, u32 new_count); -compiler_ast_nodes_Structure **std_mem_realloc__10(compiler_ast_nodes_Structure **ptr, u32 old_count, u32 new_count); -compiler_ast_scopes_Symbol **std_mem_realloc__11(compiler_ast_scopes_Symbol **ptr, u32 old_count, u32 new_count); -compiler_ast_nodes_MatchCond **std_mem_realloc__12(compiler_ast_nodes_MatchCond **ptr, u32 old_count, u32 new_count); -compiler_tokens_Token **std_mem_realloc__13(compiler_tokens_Token **ptr, u32 old_count, u32 new_count); -compiler_attributes_Attribute **std_mem_realloc__14(compiler_attributes_Attribute **ptr, u32 old_count, u32 new_count); -compiler_errors_Error **std_mem_realloc__15(compiler_errors_Error **ptr, u32 old_count, u32 new_count); +compiler_ast_scopes_Symbol **std_mem_realloc__10(compiler_ast_scopes_Symbol **ptr, u32 old_count, u32 new_count); +compiler_ast_nodes_MatchCond **std_mem_realloc__11(compiler_ast_nodes_MatchCond **ptr, u32 old_count, u32 new_count); +compiler_tokens_Token **std_mem_realloc__12(compiler_tokens_Token **ptr, u32 old_count, u32 new_count); +compiler_attributes_Attribute **std_mem_realloc__13(compiler_attributes_Attribute **ptr, u32 old_count, u32 new_count); +compiler_errors_Error **std_mem_realloc__14(compiler_errors_Error **ptr, u32 old_count, u32 new_count); +compiler_ast_nodes_Structure **std_mem_realloc__15(compiler_ast_nodes_Structure **ptr, u32 old_count, u32 new_count); compiler_ast_nodes_Enum **std_mem_realloc__16(compiler_ast_nodes_Enum **ptr, u32 old_count, u32 new_count); compiler_ast_nodes_AST **std_mem_realloc__17(compiler_ast_nodes_AST **ptr, u32 old_count, u32 new_count); jmp_buf *std_mem_realloc__18(jmp_buf *ptr, u32 old_count, u32 new_count); @@ -2943,50 +2951,45 @@ u32 std_map_Map__6_hash(std_map_Map__6 *this, char *key); std_map_Map__6 *std_map_Map__6_new(u32 capacity); std_map_Item__6 *std_map_Map__6_get_item(std_map_Map__6 *this, char *key); std_map_Iterator__6 std_map_Map__6_iter(std_map_Map__6 *this); -std_map_Item__7 *std_map_Item__7_new(char *key, compiler_ast_nodes_Variable *value, std_map_Item__7 *next); +std_map_Item__7 *std_map_Item__7_new(char *key, bool value, std_map_Item__7 *next); void std_map_Item__7_free_list(std_map_Item__7 *this); void std_map_Map__7_free(std_map_Map__7 *this); -void std_map_Map__7_insert(std_map_Map__7 *this, char *key, compiler_ast_nodes_Variable *value); -std_map_Item__7 *std_map_Iterator__7_cur(std_map_Iterator__7 *this); -void std_map_Iterator__7_next(std_map_Iterator__7 *this); -bool std_map_Iterator__7_has_value(std_map_Iterator__7 *this); -std_map_Iterator__7 std_map_Iterator__7_make(std_map_Map__7 *map); +void std_map_Map__7_insert(std_map_Map__7 *this, char *key, bool value); +bool std_map_Map__7_contains(std_map_Map__7 *this, char *key); void std_map_Map__7_resize(std_map_Map__7 *this); u32 std_map_Map__7_hash(std_map_Map__7 *this, char *key); std_map_Map__7 *std_map_Map__7_new(u32 capacity); std_map_Item__7 *std_map_Map__7_get_item(std_map_Map__7 *this, char *key); -std_map_Iterator__7 std_map_Map__7_iter(std_map_Map__7 *this); -std_map_Item__8 *std_map_Item__8_new(char *key, bool value, std_map_Item__8 *next); +std_map_Item__8 *std_map_Item__8_new(char *key, compiler_ast_nodes_Function *value, std_map_Item__8 *next); void std_map_Item__8_free_list(std_map_Item__8 *this); -void std_map_Map__8_free(std_map_Map__8 *this); -void std_map_Map__8_insert(std_map_Map__8 *this, char *key, bool value); -bool std_map_Map__8_contains(std_map_Map__8 *this, char *key); +compiler_ast_nodes_Function *std_map_Map__8_at(std_map_Map__8 *this, char *key); +void std_map_Map__8_insert(std_map_Map__8 *this, char *key, compiler_ast_nodes_Function *value); +compiler_ast_nodes_Function *std_map_Map__8_get(std_map_Map__8 *this, char *key, compiler_ast_nodes_Function *defolt); +std_map_Item__8 *std_map_Iterator__8_cur(std_map_Iterator__8 *this); +void std_map_Iterator__8_next(std_map_Iterator__8 *this); +bool std_map_Iterator__8_has_value(std_map_Iterator__8 *this); +std_map_Iterator__8 std_map_Iterator__8_make(std_map_Map__8 *map); void std_map_Map__8_resize(std_map_Map__8 *this); u32 std_map_Map__8_hash(std_map_Map__8 *this, char *key); +std_map_ValueIterator__8 std_map_Map__8_iter_values(std_map_Map__8 *this); +compiler_ast_nodes_Function *std_map_ValueIterator__8_cur(std_map_ValueIterator__8 *this); +void std_map_ValueIterator__8_next(std_map_ValueIterator__8 *this); +bool std_map_ValueIterator__8_has_value(std_map_ValueIterator__8 *this); std_map_Map__8 *std_map_Map__8_new(u32 capacity); std_map_Item__8 *std_map_Map__8_get_item(std_map_Map__8 *this, char *key); -std_map_Item__9 *std_map_Item__9_new(char *key, compiler_ast_nodes_Function *value, std_map_Item__9 *next); +std_map_Iterator__8 std_map_Map__8_iter(std_map_Map__8 *this); +std_map_Item__9 *std_map_Item__9_new(char *key, compiler_ast_nodes_Argument *value, std_map_Item__9 *next); void std_map_Item__9_free_list(std_map_Item__9 *this); -compiler_ast_nodes_Function *std_map_Map__9_at(std_map_Map__9 *this, char *key); -void std_map_Map__9_insert(std_map_Map__9 *this, char *key, compiler_ast_nodes_Function *value); -compiler_ast_nodes_Function *std_map_Map__9_get(std_map_Map__9 *this, char *key, compiler_ast_nodes_Function *defolt); -std_map_Item__9 *std_map_Iterator__9_cur(std_map_Iterator__9 *this); -void std_map_Iterator__9_next(std_map_Iterator__9 *this); -bool std_map_Iterator__9_has_value(std_map_Iterator__9 *this); -std_map_Iterator__9 std_map_Iterator__9_make(std_map_Map__9 *map); +void std_map_Map__9_free(std_map_Map__9 *this); +void std_map_Map__9_insert(std_map_Map__9 *this, char *key, compiler_ast_nodes_Argument *value); void std_map_Map__9_resize(std_map_Map__9 *this); u32 std_map_Map__9_hash(std_map_Map__9 *this, char *key); -std_map_ValueIterator__9 std_map_Map__9_iter_values(std_map_Map__9 *this); -compiler_ast_nodes_Function *std_map_ValueIterator__9_cur(std_map_ValueIterator__9 *this); -void std_map_ValueIterator__9_next(std_map_ValueIterator__9 *this); -bool std_map_ValueIterator__9_has_value(std_map_ValueIterator__9 *this); std_map_Map__9 *std_map_Map__9_new(u32 capacity); std_map_Item__9 *std_map_Map__9_get_item(std_map_Map__9 *this, char *key); -std_map_Iterator__9 std_map_Map__9_iter(std_map_Map__9 *this); -std_map_Item__10 *std_map_Item__10_new(char *key, compiler_ast_nodes_Argument *value, std_map_Item__10 *next); +std_map_Item__10 *std_map_Item__10_new(char *key, compiler_ast_nodes_Variable *value, std_map_Item__10 *next); void std_map_Item__10_free_list(std_map_Item__10 *this); void std_map_Map__10_free(std_map_Map__10 *this); -void std_map_Map__10_insert(std_map_Map__10 *this, char *key, compiler_ast_nodes_Argument *value); +void std_map_Map__10_insert(std_map_Map__10 *this, char *key, compiler_ast_nodes_Variable *value); void std_map_Map__10_resize(std_map_Map__10 *this); u32 std_map_Map__10_hash(std_map_Map__10 *this, char *key); std_map_Map__10 *std_map_Map__10_new(u32 capacity); @@ -3044,7 +3047,6 @@ bool std_vector_Vector__2_is_empty(std_vector_Vector__2 *this); void std_vector_Vector__2_resize(std_vector_Vector__2 *this, u32 new_capacity); std_vector_Vector__2 *std_vector_Vector__2_new(u32 capacity); void std_vector_Vector__2_push(std_vector_Vector__2 *this, compiler_ast_program_Namespace *value); -void std_vector_Vector__3_push_front(std_vector_Vector__3 *this, compiler_ast_nodes_Variable *value); compiler_ast_nodes_Variable *std_vector_Vector__3_back(std_vector_Vector__3 *this, u32 i); std_vector_Iterator__3 std_vector_Vector__3_iter(std_vector_Vector__3 *this); compiler_ast_nodes_Variable *std_vector_Iterator__3_cur(std_vector_Iterator__3 *this); @@ -3109,62 +3111,61 @@ void std_vector_Vector__8_resize(std_vector_Vector__8 *this, u32 new_capacity); std_vector_Vector__8 *std_vector_Vector__8_new(u32 capacity); void std_vector_Vector__8_push(std_vector_Vector__8 *this, char *value); std_vector_Iterator__9 std_vector_Vector__9_iter(std_vector_Vector__9 *this); -compiler_ast_nodes_Structure *std_vector_Iterator__9_cur(std_vector_Iterator__9 *this); +compiler_ast_scopes_Symbol *std_vector_Iterator__9_cur(std_vector_Iterator__9 *this); void std_vector_Iterator__9_next(std_vector_Iterator__9 *this); bool std_vector_Iterator__9_has_value(std_vector_Iterator__9 *this); std_vector_Iterator__9 std_vector_Iterator__9_make(std_vector_Vector__9 *vec); +compiler_ast_scopes_Symbol *std_vector_Vector__9_at(std_vector_Vector__9 *this, u32 i); void std_vector_Vector__9_free(std_vector_Vector__9 *this); bool std_vector_Vector__9_is_empty(std_vector_Vector__9 *this); void std_vector_Vector__9_resize(std_vector_Vector__9 *this, u32 new_capacity); std_vector_Vector__9 *std_vector_Vector__9_new(u32 capacity); -void std_vector_Vector__9_push(std_vector_Vector__9 *this, compiler_ast_nodes_Structure *value); +void std_vector_Vector__9_push(std_vector_Vector__9 *this, compiler_ast_scopes_Symbol *value); std_vector_Iterator__10 std_vector_Vector__10_iter(std_vector_Vector__10 *this); -compiler_ast_scopes_Symbol *std_vector_Iterator__10_cur(std_vector_Iterator__10 *this); +compiler_ast_nodes_MatchCond *std_vector_Iterator__10_cur(std_vector_Iterator__10 *this); void std_vector_Iterator__10_next(std_vector_Iterator__10 *this); bool std_vector_Iterator__10_has_value(std_vector_Iterator__10 *this); std_vector_Iterator__10 std_vector_Iterator__10_make(std_vector_Vector__10 *vec); -compiler_ast_scopes_Symbol *std_vector_Vector__10_at(std_vector_Vector__10 *this, u32 i); -void std_vector_Vector__10_free(std_vector_Vector__10 *this); -bool std_vector_Vector__10_is_empty(std_vector_Vector__10 *this); +compiler_ast_nodes_MatchCond *std_vector_Vector__10_at(std_vector_Vector__10 *this, u32 i); void std_vector_Vector__10_resize(std_vector_Vector__10 *this, u32 new_capacity); std_vector_Vector__10 *std_vector_Vector__10_new(u32 capacity); -void std_vector_Vector__10_push(std_vector_Vector__10 *this, compiler_ast_scopes_Symbol *value); -std_vector_Iterator__11 std_vector_Vector__11_iter(std_vector_Vector__11 *this); -compiler_ast_nodes_MatchCond *std_vector_Iterator__11_cur(std_vector_Iterator__11 *this); -void std_vector_Iterator__11_next(std_vector_Iterator__11 *this); -bool std_vector_Iterator__11_has_value(std_vector_Iterator__11 *this); -std_vector_Iterator__11 std_vector_Iterator__11_make(std_vector_Vector__11 *vec); -compiler_ast_nodes_MatchCond *std_vector_Vector__11_at(std_vector_Vector__11 *this, u32 i); +void std_vector_Vector__10_push(std_vector_Vector__10 *this, compiler_ast_nodes_MatchCond *value); +compiler_tokens_Token *std_vector_Vector__11_at(std_vector_Vector__11 *this, u32 i); +void std_vector_Vector__11_free(std_vector_Vector__11 *this); +compiler_tokens_Token *std_vector_Vector__11_unchecked_at(std_vector_Vector__11 *this, u32 i); void std_vector_Vector__11_resize(std_vector_Vector__11 *this, u32 new_capacity); std_vector_Vector__11 *std_vector_Vector__11_new(u32 capacity); -void std_vector_Vector__11_push(std_vector_Vector__11 *this, compiler_ast_nodes_MatchCond *value); -compiler_tokens_Token *std_vector_Vector__12_at(std_vector_Vector__12 *this, u32 i); +void std_vector_Vector__11_push(std_vector_Vector__11 *this, compiler_tokens_Token *value); +std_vector_Iterator__12 std_vector_Vector__12_iter(std_vector_Vector__12 *this); +compiler_attributes_Attribute *std_vector_Iterator__12_cur(std_vector_Iterator__12 *this); +void std_vector_Iterator__12_next(std_vector_Iterator__12 *this); +bool std_vector_Iterator__12_has_value(std_vector_Iterator__12 *this); +std_vector_Iterator__12 std_vector_Iterator__12_make(std_vector_Vector__12 *vec); void std_vector_Vector__12_free(std_vector_Vector__12 *this); -compiler_tokens_Token *std_vector_Vector__12_unchecked_at(std_vector_Vector__12 *this, u32 i); void std_vector_Vector__12_resize(std_vector_Vector__12 *this, u32 new_capacity); std_vector_Vector__12 *std_vector_Vector__12_new(u32 capacity); -void std_vector_Vector__12_push(std_vector_Vector__12 *this, compiler_tokens_Token *value); +void std_vector_Vector__12_push(std_vector_Vector__12 *this, compiler_attributes_Attribute *value); +void std_vector_Vector__12_clear(std_vector_Vector__12 *this); std_vector_Iterator__13 std_vector_Vector__13_iter(std_vector_Vector__13 *this); -compiler_attributes_Attribute *std_vector_Iterator__13_cur(std_vector_Iterator__13 *this); +compiler_errors_Error *std_vector_Iterator__13_cur(std_vector_Iterator__13 *this); void std_vector_Iterator__13_next(std_vector_Iterator__13 *this); bool std_vector_Iterator__13_has_value(std_vector_Iterator__13 *this); std_vector_Iterator__13 std_vector_Iterator__13_make(std_vector_Vector__13 *vec); +compiler_errors_Error *std_vector_Vector__13_at(std_vector_Vector__13 *this, u32 i); void std_vector_Vector__13_free(std_vector_Vector__13 *this); +bool std_vector_Vector__13_is_empty(std_vector_Vector__13 *this); void std_vector_Vector__13_resize(std_vector_Vector__13 *this, u32 new_capacity); std_vector_Vector__13 *std_vector_Vector__13_new(u32 capacity); -void std_vector_Vector__13_push(std_vector_Vector__13 *this, compiler_attributes_Attribute *value); -void std_vector_Vector__13_clear(std_vector_Vector__13 *this); +void std_vector_Vector__13_push(std_vector_Vector__13 *this, compiler_errors_Error *value); std_vector_Iterator__14 std_vector_Vector__14_iter(std_vector_Vector__14 *this); -compiler_errors_Error *std_vector_Iterator__14_cur(std_vector_Iterator__14 *this); +compiler_ast_nodes_Structure *std_vector_Iterator__14_cur(std_vector_Iterator__14 *this); void std_vector_Iterator__14_next(std_vector_Iterator__14 *this); bool std_vector_Iterator__14_has_value(std_vector_Iterator__14 *this); std_vector_Iterator__14 std_vector_Iterator__14_make(std_vector_Vector__14 *vec); -compiler_errors_Error *std_vector_Vector__14_at(std_vector_Vector__14 *this, u32 i); -void std_vector_Vector__14_free(std_vector_Vector__14 *this); bool std_vector_Vector__14_is_empty(std_vector_Vector__14 *this); void std_vector_Vector__14_resize(std_vector_Vector__14 *this, u32 new_capacity); std_vector_Vector__14 *std_vector_Vector__14_new(u32 capacity); -void std_vector_Vector__14_push(std_vector_Vector__14 *this, compiler_errors_Error *value); +void std_vector_Vector__14_push(std_vector_Vector__14 *this, compiler_ast_nodes_Structure *value); std_vector_Iterator__15 std_vector_Vector__15_iter(std_vector_Vector__15 *this); compiler_ast_nodes_Enum *std_vector_Iterator__15_cur(std_vector_Iterator__15 *this); void std_vector_Iterator__15_next(std_vector_Iterator__15 *this); @@ -3736,10 +3737,10 @@ std_value_Value *compiler_docgen_DocGenerator_gen_methods(compiler_docgen_DocGen std_value_Value *methods_doc = std_value_Value_new(std_value_ValueType_Dictionary); #line 191 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" - for (std_map_Iterator__9 __iter = std_map_Map__9_iter(type->methods); std_map_Iterator__9_has_value(&__iter); std_map_Iterator__9_next(&__iter)) { + for (std_map_Iterator__8 __iter = std_map_Map__8_iter(type->methods); std_map_Iterator__8_has_value(&__iter); std_map_Iterator__8_next(&__iter)) { #line 191 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" - std_map_Item__9 *it = std_map_Iterator__9_cur(&__iter); + std_map_Item__8 *it = std_map_Iterator__8_cur(&__iter); #line 191 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" { @@ -3907,10 +3908,10 @@ std_value_Value *compiler_docgen_DocGenerator_gen_struct(compiler_docgen_DocGene std_value_Value *params_doc = std_value_Value_new(std_value_ValueType_List); #line 262 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" - for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(struc->sym->template->params); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { + for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(struc->sym->template->params); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { #line 262 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" - compiler_ast_scopes_Symbol *sym = std_vector_Iterator__10_cur(&__iter); + compiler_ast_scopes_Symbol *sym = std_vector_Iterator__9_cur(&__iter); #line 262 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" { @@ -4043,7 +4044,7 @@ std_value_Value *compiler_docgen_DocGenerator_gen_ns(compiler_docgen_DocGenerato } #line 314 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" - if (!(std_vector_Vector__9_is_empty(ns->structs))) { + if (!(std_vector_Vector__14_is_empty(ns->structs))) { #line 315 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" std_value_Value *structs_doc = std_value_Value_new(std_value_ValueType_Dictionary); @@ -4052,10 +4053,10 @@ std_value_Value *compiler_docgen_DocGenerator_gen_ns(compiler_docgen_DocGenerato std_value_Value *unions_doc = std_value_Value_new(std_value_ValueType_Dictionary); #line 317 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" - for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(ns->structs); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { + for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(ns->structs); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { #line 317 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" - compiler_ast_nodes_Structure *struc = std_vector_Iterator__9_cur(&__iter); + compiler_ast_nodes_Structure *struc = std_vector_Iterator__14_cur(&__iter); #line 317 "/Users/mustafa/ocen-lang/ocen/compiler/docgen.oc" { @@ -4424,10 +4425,10 @@ void compiler_passes_run_typecheck_passes(compiler_ast_program_Program *program) char *compiler_passes_run_codegen_passes(compiler_ast_program_Program *program) { #line 19 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mod.oc" - compiler_passes_reorder_structs_ReorderStructs_run(program); + compiler_passes_mark_dead_code_MarkDeadCode_run(program); #line 20 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mod.oc" - compiler_passes_mark_dead_code_MarkDeadCode_run(program); + compiler_passes_reorder_symbols_ReorderSymbols_run(program); #line 21 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mod.oc" char *code = compiler_passes_code_generator_CodeGenerator_run(program); @@ -4574,7 +4575,7 @@ void compiler_passes_register_types_RegisterTypes_add_dbg_method_for_enum(compil func->type=typ; #line 78 "/Users/mustafa/ocen-lang/ocen/compiler/passes/register_types.oc" - std_map_Map__9_insert(enom->type->methods, "dbg", func); + std_map_Map__8_insert(enom->type->methods, "dbg", func); } @@ -4585,10 +4586,10 @@ void compiler_passes_register_types_RegisterTypes_register_namespace(compiler_pa compiler_passes_generic_pass_GenericPass_push_scope(this->o, ns->scope); #line 83 "/Users/mustafa/ocen-lang/ocen/compiler/passes/register_types.oc" - for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(ns->structs); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { + for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(ns->structs); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { #line 83 "/Users/mustafa/ocen-lang/ocen/compiler/passes/register_types.oc" - compiler_ast_nodes_Structure *struc = std_vector_Iterator__9_cur(&__iter); + compiler_ast_nodes_Structure *struc = std_vector_Iterator__14_cur(&__iter); #line 83 "/Users/mustafa/ocen-lang/ocen/compiler/passes/register_types.oc" { @@ -5035,26 +5036,29 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(compiler_passes_mark_d } #line 40 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + sym->is_dead=false; + +#line 41 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Function: m_3_0: { -#line 41 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 42 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_function(this, sym->u.func); } break; case compiler_ast_scopes_SymbolType_Structure: m_3_1: { -#line 42 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 43 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_struct(this, sym->u.struc); } break; case compiler_ast_scopes_SymbolType_Enum: m_3_2: { -#line 43 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 44 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_enum(this, sym->u.enom); } break; case compiler_ast_scopes_SymbolType_Constant: @@ -5069,7 +5073,28 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(compiler_passes_mark_d compiler_passes_mark_dead_code_MarkDeadCode_mark(this, sym->u.var->default_value); #line 48 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - sym->u.var->is_dead=false; + sym->u.var->sym->is_dead=false; + } break; + case compiler_ast_scopes_SymbolType_Closure: + m_3_4: + { + +#line 50 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_passes_mark_dead_code_MarkDeadCode_mark_function(this, sym->u.closure); + } break; + case compiler_ast_scopes_SymbolType_ClosureType: + m_3_5: + { + +#line 51 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, sym->u.type_def); + } break; + case compiler_ast_scopes_SymbolType_ClosedVariable: + m_3_6: + { + +#line 52 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, sym->u.closed_var.orig->sym); } break; default: { @@ -5078,88 +5103,95 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(compiler_passes_mark_d } -#line 54 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 57 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" void compiler_passes_mark_dead_code_MarkDeadCode_mark_function(compiler_passes_mark_dead_code_MarkDeadCode *this, compiler_ast_nodes_Function *f) { -#line 55 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 58 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (!(((bool)f)) || std_set_Set__0_contains(this->done, ((u64)f))) { -#line 55 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 58 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" return; } -#line 56 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 59 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" std_set_Set__0_add(this->done, ((u64)f)); -#line 58 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - f->is_dead=false; +#line 61 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + f->sym->is_dead=false; -#line 59 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 62 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, f->body); -#line 61 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 64 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(f->params); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 61 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 64 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Variable *param = std_vector_Iterator__3_cur(&__iter); -#line 61 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 64 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 62 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 65 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, param->type); } } + +#line 68 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, f->type->sym); + +#line 69 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, f->return_type); } -#line 66 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 72 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" void compiler_passes_mark_dead_code_MarkDeadCode_mark_type(compiler_passes_mark_dead_code_MarkDeadCode *this, compiler_types_Type *typ) { -#line 67 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 73 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (!(((bool)typ))) { -#line 67 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 73 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" return; } -#line 68 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 74 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" switch ((typ->base)) { case compiler_types_BaseType_Pointer: case compiler_types_BaseType_Alias: m_4_0: { -#line 69 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 75 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, typ->u.ptr); } break; case compiler_types_BaseType_Array: m_4_1: { -#line 70 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 76 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, typ->u.arr.elem_type); } break; case compiler_types_BaseType_FunctionPtr: + case compiler_types_BaseType_Closure: m_4_2: { -#line 72 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 78 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_types_FunctionType ft = typ->u.func; -#line 73 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 79 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, ft.return_type); -#line 74 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 80 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(ft.params); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 74 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 80 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Variable *param = std_vector_Iterator__3_cur(&__iter); -#line 74 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 80 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 75 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 81 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, param->type); } } @@ -5167,22 +5199,22 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark_type(compiler_passes_mark_ default: { -#line 79 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 85 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, typ->sym); -#line 80 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 86 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (((bool)typ->template_instance)) { -#line 81 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 87 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__0 __iter = std_vector_Vector__0_iter(typ->template_instance->args); std_vector_Iterator__0_has_value(&__iter); std_vector_Iterator__0_next(&__iter)) { -#line 81 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 87 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_types_Type *arg = std_vector_Iterator__0_cur(&__iter); -#line 81 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 87 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 82 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 88 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, arg); } } @@ -5192,124 +5224,124 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark_type(compiler_passes_mark_ } -#line 89 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 95 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" void compiler_passes_mark_dead_code_MarkDeadCode_mark_struct(compiler_passes_mark_dead_code_MarkDeadCode *this, compiler_ast_nodes_Structure *s) { -#line 90 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 96 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (!(((bool)s)) || std_set_Set__0_contains(this->done, ((u64)s))) { -#line 90 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 96 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" return; } -#line 91 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 97 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" std_set_Set__0_add(this->done, ((u64)s)); -#line 93 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - s->is_dead=false; +#line 99 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + s->sym->is_dead=false; -#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(s->fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 95 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 101 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, field->type); } } } -#line 99 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 105 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" void compiler_passes_mark_dead_code_MarkDeadCode_mark_enum(compiler_passes_mark_dead_code_MarkDeadCode *this, compiler_ast_nodes_Enum *e) { -#line 100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (!(((bool)e)) || std_set_Set__0_contains(this->done, ((u64)e))) { -#line 100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" return; } -#line 101 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 107 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" std_set_Set__0_add(this->done, ((u64)e)); -#line 103 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - e->is_dead=false; +#line 109 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + e->sym->is_dead=false; -#line 104 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 110 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(e->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 104 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 110 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_EnumVariant *var = std_vector_Iterator__20_cur(&__iter); -#line 104 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 110 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 105 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 111 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, var->sym); -#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 112 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(var->specific_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 112 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 112 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 107 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, field->sym); -#line 108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 114 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, field->type); -#line 109 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 115 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, field->default_value); } } } } -#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 119 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(e->shared_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 119 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Variable *var = std_vector_Iterator__3_cur(&__iter); -#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 119 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 114 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 120 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, var->sym); -#line 115 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, var->type); -#line 116 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 122 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, var->default_value); } } } -#line 120 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 126 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" void compiler_passes_mark_dead_code_MarkDeadCode_mark(compiler_passes_mark_dead_code_MarkDeadCode *this, compiler_ast_nodes_AST *node) { -#line 121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (!(((bool)node))) { -#line 121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" return; } -#line 122 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 128 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, node->resolved_symbol); -#line 124 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 130 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_Import: case compiler_ast_nodes_ASTType_Break: @@ -5328,23 +5360,23 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark(compiler_passes_mark_dead_ m_5_1: { -#line 128 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 134 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.child); } break; case compiler_ast_nodes_ASTType_CreateNew: m_5_2: { -#line 130 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 136 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.child); -#line 131 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 137 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (this->o->program->did_cache_symbols) { -#line 132 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 138 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, this->o->program->cached_symbols.mem_alloc_fn); -#line 133 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 139 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, this->o->program->cached_symbols.mem_allocator); } } break; @@ -5352,44 +5384,44 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark(compiler_passes_mark_dead_ m_5_3: { -#line 136 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.ret.expr); } break; case compiler_ast_nodes_ASTType_UnaryOp: m_5_4: { -#line 137 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 143 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.unary.expr); } break; case compiler_ast_nodes_ASTType_SizeOf: m_5_5: { -#line 139 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 145 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, node->u.size_of_type); } break; case compiler_ast_nodes_ASTType_VarDeclaration: m_5_6: { -#line 140 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 146 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, node->u.var_decl->sym); } break; case compiler_ast_nodes_ASTType_Block: m_5_7: { -#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(node->u.block.statements); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_AST *statement = std_vector_Iterator__16_cur(&__iter); -#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 143 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 149 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, statement); } } @@ -5398,76 +5430,76 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark(compiler_passes_mark_dead_ m_5_8: { -#line 146 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 152 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_function(this, node->u.closure); } break; case compiler_ast_nodes_ASTType_If: m_5_9: { -#line 148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 154 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__23 __iter = std_vector_Vector__23_iter(node->u.if_stmt.branches); std_vector_Iterator__23_has_value(&__iter); std_vector_Iterator__23_next(&__iter)) { -#line 148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 154 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_IfBranch branch = std_vector_Iterator__23_cur(&__iter); -#line 148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 154 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 149 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 155 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, branch.cond); -#line 150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 156 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, branch.body); } } -#line 152 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 158 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.if_stmt.els); } break; case compiler_ast_nodes_ASTType_Match: m_5_10: { -#line 155 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 161 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.match_stmt.expr); -#line 156 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 162 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__24 __iter = std_vector_Vector__24_iter(node->u.match_stmt.cases); std_vector_Iterator__24_has_value(&__iter); std_vector_Iterator__24_next(&__iter)) { -#line 156 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 162 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_MatchCase c = std_vector_Iterator__24_cur(&__iter); -#line 156 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 162 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 157 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - for (std_vector_Iterator__11 __iter = std_vector_Vector__11_iter(c.conds); std_vector_Iterator__11_has_value(&__iter); std_vector_Iterator__11_next(&__iter)) { +#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(c.conds); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { -#line 157 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__11_cur(&__iter); +#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__10_cur(&__iter); -#line 157 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 158 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 164 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, cond->expr); -#line 159 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 165 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (((bool)cond->cmp_fn)) { -#line 160 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 166 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_function(this, cond->cmp_fn); } } } -#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 169 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, c.body); } } -#line 165 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 171 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.match_stmt.defolt); } break; case compiler_ast_nodes_ASTType_While: @@ -5475,49 +5507,49 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark(compiler_passes_mark_dead_ m_5_11: { -#line 168 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 174 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.loop.init); -#line 169 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 175 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.loop.cond); -#line 170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 176 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.loop.step); -#line 171 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 177 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.loop.body); } break; case compiler_ast_nodes_ASTType_Assert: m_5_12: { -#line 174 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 180 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.assertion.expr); -#line 175 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.assertion.msg); } break; case compiler_ast_nodes_ASTType_FormatStringLiteral: m_5_13: { -#line 178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 184 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (this->o->program->did_cache_symbols) { -#line 179 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 185 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(this, this->o->program->cached_symbols.fmt_string_fn); } -#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 187 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(node->u.fmt_str.exprs); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 187 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_AST *expr = std_vector_Iterator__16_cur(&__iter); -#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 187 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 182 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 188 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, expr); } } @@ -5526,7 +5558,7 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark(compiler_passes_mark_dead_ m_5_14: { -#line 186 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 192 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.member.lhs); } break; case compiler_ast_nodes_ASTType_Identifier: @@ -5539,26 +5571,26 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark(compiler_passes_mark_dead_ m_5_16: { -#line 189 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 195 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.lookup.lhs); } break; case compiler_ast_nodes_ASTType_Call: m_5_17: { -#line 191 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 197 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.call.callee); -#line 192 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 198 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__7 __iter = std_vector_Vector__7_iter(node->u.call.args); std_vector_Iterator__7_has_value(&__iter); std_vector_Iterator__7_next(&__iter)) { -#line 192 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 198 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Argument *arg = std_vector_Iterator__7_cur(&__iter); -#line 192 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 198 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 193 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 199 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, arg->expr); } } @@ -5567,36 +5599,36 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark(compiler_passes_mark_dead_ m_5_18: { -#line 197 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 203 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.binary.lhs); -#line 198 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 204 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.binary.rhs); } break; case compiler_ast_nodes_ASTType_Cast: m_5_19: { -#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, node->u.cast.lhs); -#line 202 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 208 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_type(this, node->u.cast.to); } break; case compiler_ast_nodes_ASTType_ArrayLiteral: m_5_20: { -#line 205 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 211 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(node->u.array_literal.elements); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 205 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 211 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_AST *expr = std_vector_Iterator__16_cur(&__iter); -#line 205 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 211 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 206 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 212 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark(this, expr); } } @@ -5604,38 +5636,38 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark(compiler_passes_mark_dead_ default: { -#line 209 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_generic_pass_GenericPass_error(this->o, compiler_errors_Error_new(node->span, std_format("Unhandled expression type in MarkDeadCode: %s", compiler_ast_nodes_ASTType_dbg(node->type)))); } break; } } -#line 213 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 219 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Function *compiler_passes_mark_dead_code_MarkDeadCode_find_main_function(compiler_passes_mark_dead_code_MarkDeadCode *this, compiler_ast_program_Program *program) { -#line 214 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 220 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (compiler_ast_program_NSIterator __iter = compiler_ast_program_Program_iter_namespaces(program); compiler_ast_program_NSIterator_has_value(&__iter); compiler_ast_program_NSIterator_next(&__iter)) { -#line 214 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 220 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_program_Namespace *ns = compiler_ast_program_NSIterator_cur(&__iter); -#line 214 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 220 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(ns->functions); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Function *f = std_vector_Iterator__6_cur(&__iter); -#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 216 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 222 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (str_eq(f->sym->full_name, "main")) { -#line 217 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" return f; } } @@ -5643,70 +5675,37 @@ compiler_ast_nodes_Function *compiler_passes_mark_dead_code_MarkDeadCode_find_ma } } -#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" return NULL; } -#line 224 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" void compiler_passes_mark_dead_code_MarkDeadCode_mark_sym_as_dead_by_default(compiler_passes_mark_dead_code_MarkDeadCode *this, compiler_ast_scopes_Symbol *sym) { -#line 225 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (!(((bool)sym))) { -#line 225 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" return; } -#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - switch ((sym->type)) { - case compiler_ast_scopes_SymbolType_Function: - m_6_0: - { - -#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - sym->u.func->is_dead=true; - } break; - case compiler_ast_scopes_SymbolType_Structure: - m_6_1: - { - -#line 229 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - sym->u.struc->is_dead=true; - } break; - case compiler_ast_scopes_SymbolType_Enum: - m_6_2: - { +#line 232 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + sym->is_dead=true; -#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - sym->u.enom->is_dead=true; - } break; - case compiler_ast_scopes_SymbolType_Constant: - case compiler_ast_scopes_SymbolType_Variable: - m_6_3: - { - -#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - sym->u.var->is_dead=true; - } break; - default: - { - } break; - } - -#line 235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 234 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (((bool)sym->template)) { -#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__4 __iter = std_vector_Vector__4_iter(sym->template->instances); std_vector_Iterator__4_has_value(&__iter); std_vector_Iterator__4_next(&__iter)) { -#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_scopes_TemplateInstance *instance = std_vector_Iterator__4_cur(&__iter); -#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym_as_dead_by_default(this, instance->resolved); } } @@ -5714,146 +5713,174 @@ void compiler_passes_mark_dead_code_MarkDeadCode_mark_sym_as_dead_by_default(com } -#line 242 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" void compiler_passes_mark_dead_code_MarkDeadCode_run(compiler_ast_program_Program *program) { -#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 242 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode *pass = compiler_passes_mark_dead_code_MarkDeadCode_new(program); -#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" -#line 246 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Function *main = compiler_passes_mark_dead_code_MarkDeadCode_find_main_function(pass, program); -#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - if (!(((bool)main)) && std_vector_Vector__10_is_empty(program->explicit_alive_symbols)) { +#line 246 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + if (!(((bool)main)) && std_vector_Vector__9_is_empty(program->explicit_alive_symbols)) { -#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" printf("[+] No alive functions found, not marking any functions as dead.""\n"); -#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" /* defers */ -#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_free(pass); return; } -#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" if (program->keep_all_code) { -#line 253 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" /* defers */ -#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_free(pass); return; } -#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 256 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (compiler_ast_program_NSIterator __iter = compiler_ast_program_Program_iter_namespaces(program); compiler_ast_program_NSIterator_has_value(&__iter); compiler_ast_program_NSIterator_next(&__iter)) { -#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 256 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_program_Namespace *ns = compiler_ast_program_NSIterator_cur(&__iter); -#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 256 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(ns->functions); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Function *f = std_vector_Iterator__6_cur(&__iter); -#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 259 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym_as_dead_by_default(pass, f->sym); } } -#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(ns->structs); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { +#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(ns->structs); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { -#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - compiler_ast_nodes_Structure *s = std_vector_Iterator__9_cur(&__iter); +#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_ast_nodes_Structure *s = std_vector_Iterator__14_cur(&__iter); -#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym_as_dead_by_default(pass, s->sym); } } -#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 263 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__15 __iter = std_vector_Vector__15_iter(ns->enums); std_vector_Iterator__15_has_value(&__iter); std_vector_Iterator__15_next(&__iter)) { -#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 263 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_Enum *e = std_vector_Iterator__15_cur(&__iter); -#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 263 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym_as_dead_by_default(pass, e->sym); } } -#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->variables); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_AST *v = std_vector_Iterator__16_cur(&__iter); -#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 268 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym_as_dead_by_default(pass, v->u.var_decl->sym); } } -#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->constants); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_ast_nodes_AST *c = std_vector_Iterator__16_cur(&__iter); -#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 271 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym_as_dead_by_default(pass, c->u.var_decl->sym); } } } } +#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + for (std_vector_Iterator__0 __iter = std_vector_Vector__0_iter(program->closure_types); std_vector_Iterator__0_has_value(&__iter); std_vector_Iterator__0_next(&__iter)) { + +#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_types_Type *cty = std_vector_Iterator__0_cur(&__iter); + +#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + { + +#line 274 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_passes_mark_dead_code_MarkDeadCode_mark_sym_as_dead_by_default(pass, cty->sym); + } + } + #line 276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - if (((bool)main)) { + for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(program->closures); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { + +#line 276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_ast_nodes_Function *clos = std_vector_Iterator__6_cur(&__iter); + +#line 276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + { #line 277 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_passes_mark_dead_code_MarkDeadCode_mark_sym_as_dead_by_default(pass, clos->sym); + } + } + +#line 281 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + if (((bool)main)) { + +#line 282 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_function(pass, main); } -#line 279 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(program->explicit_alive_symbols); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { +#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(program->explicit_alive_symbols); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { -#line 279 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" - compiler_ast_scopes_Symbol *sym = std_vector_Iterator__10_cur(&__iter); +#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" + compiler_ast_scopes_Symbol *sym = std_vector_Iterator__9_cur(&__iter); -#line 279 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" { -#line 280 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 285 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_mark_sym(pass, sym); } } /* defers */ -#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" +#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/mark_dead_code.oc" compiler_passes_mark_dead_code_MarkDeadCode_free(pass); } @@ -5961,7 +5988,7 @@ compiler_ast_program_Namespace *compiler_passes_generic_pass_GenericPass_ns(comp compiler_errors_Error *compiler_passes_generic_pass_GenericPass_error(compiler_passes_generic_pass_GenericPass *this, compiler_errors_Error *err) { #line 72 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" - std_vector_Vector__14_push(this->program->errors, err); + std_vector_Vector__13_push(this->program->errors, err); #line 73 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" return err; @@ -6039,12 +6066,12 @@ compiler_ast_scopes_Symbol *compiler_passes_generic_pass_GenericPass_find_in_sym #line 107 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Namespace: - m_7_0: + m_6_0: { __yield_0 = compiler_ast_program_Namespace_find_importable_symbol(sym->u.ns, name); } break; case compiler_ast_scopes_SymbolType_Structure: - m_7_1: + m_6_1: { #line 110 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" @@ -6058,7 +6085,7 @@ compiler_ast_scopes_Symbol *compiler_passes_generic_pass_GenericPass_find_in_sym compiler_ast_nodes_Structure *struc = sym->u.struc; #line 112 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" - compiler_ast_nodes_Function *method = std_map_Map__9_get(struc->type->methods, name, NULL); + compiler_ast_nodes_Function *method = std_map_Map__8_get(struc->type->methods, name, NULL); #line 113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" if (!(((bool)method))) { @@ -6071,14 +6098,14 @@ compiler_ast_scopes_Symbol *compiler_passes_generic_pass_GenericPass_find_in_sym __yield_0 = method->sym; } break; case compiler_ast_scopes_SymbolType_TypeDef: - m_7_2: + m_6_2: { #line 117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" compiler_types_Type *type_def = sym->u.type_def; #line 118 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" - compiler_ast_nodes_Function *method = std_map_Map__9_get(type_def->methods, name, NULL); + compiler_ast_nodes_Function *method = std_map_Map__8_get(type_def->methods, name, NULL); #line 119 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" if (!(((bool)method))) { @@ -6091,7 +6118,7 @@ compiler_ast_scopes_Symbol *compiler_passes_generic_pass_GenericPass_find_in_sym __yield_0 = method->sym; } break; case compiler_ast_scopes_SymbolType_Enum: - m_7_3: + m_6_3: { #line 123 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" @@ -6108,7 +6135,7 @@ compiler_ast_scopes_Symbol *compiler_passes_generic_pass_GenericPass_find_in_sym } #line 127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" - compiler_ast_nodes_Function *method = std_map_Map__9_get(enom->type->methods, name, NULL); + compiler_ast_nodes_Function *method = std_map_Map__8_get(enom->type->methods, name, NULL); #line 128 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" if (((bool)method)) { @@ -6153,28 +6180,28 @@ compiler_ast_scopes_Symbol *compiler_passes_generic_pass_GenericPass_find_in_sym #line 146 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Namespace: - m_8_0: + m_7_0: { #line 147 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" compiler_passes_generic_pass_GenericPass_error(this, compiler_errors_Error_new(span, std_format("Could not find symbol %s in namespace %s", name, sym->display))); } break; case compiler_ast_scopes_SymbolType_Structure: - m_8_1: + m_7_1: { #line 148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" compiler_passes_generic_pass_GenericPass_error(this, compiler_errors_Error_new(span, std_format("Could not find method %s in structure %s", name, sym->display))); } break; case compiler_ast_scopes_SymbolType_TypeDef: - m_8_2: + m_7_2: { #line 149 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" compiler_passes_generic_pass_GenericPass_error(this, compiler_errors_Error_new(span, std_format("Could not find method %s in type %s", name, sym->display))); } break; case compiler_ast_scopes_SymbolType_Enum: - m_8_3: + m_7_3: { #line 150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" @@ -6215,10 +6242,10 @@ void compiler_passes_generic_pass_GenericPass_import_all_from_namespace(compiler } #line 163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" - for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(ns->structs); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { + for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(ns->structs); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { #line 163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" - compiler_ast_nodes_Structure *struc = std_vector_Iterator__9_cur(&__iter); + compiler_ast_nodes_Structure *struc = std_vector_Iterator__14_cur(&__iter); #line 163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" { @@ -6312,21 +6339,21 @@ void compiler_passes_generic_pass_GenericPass_import_all_from_symbol(compiler_pa #line 191 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Namespace: - m_9_0: + m_8_0: { #line 192 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" compiler_passes_generic_pass_GenericPass_import_all_from_namespace(this, sym->u.ns, export); } break; case compiler_ast_scopes_SymbolType_TypeDef: - m_9_1: + m_8_1: { #line 194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" - for (std_map_ValueIterator__9 __iter = std_map_Map__9_iter_values(sym->u.type_def->methods); std_map_ValueIterator__9_has_value(&__iter); std_map_ValueIterator__9_next(&__iter)) { + for (std_map_ValueIterator__8 __iter = std_map_Map__8_iter_values(sym->u.type_def->methods); std_map_ValueIterator__8_has_value(&__iter); std_map_ValueIterator__8_next(&__iter)) { #line 194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" - compiler_ast_nodes_Function *method = std_map_ValueIterator__9_cur(&__iter); + compiler_ast_nodes_Function *method = std_map_ValueIterator__8_cur(&__iter); #line 194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" { @@ -6337,14 +6364,14 @@ void compiler_passes_generic_pass_GenericPass_import_all_from_symbol(compiler_pa } } break; case compiler_ast_scopes_SymbolType_Structure: - m_9_2: + m_8_2: { #line 199 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" - for (std_map_ValueIterator__9 __iter = std_map_Map__9_iter_values(sym->u.struc->type->methods); std_map_ValueIterator__9_has_value(&__iter); std_map_ValueIterator__9_next(&__iter)) { + for (std_map_ValueIterator__8 __iter = std_map_Map__8_iter_values(sym->u.struc->type->methods); std_map_ValueIterator__8_has_value(&__iter); std_map_ValueIterator__8_next(&__iter)) { #line 199 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" - compiler_ast_nodes_Function *method = std_map_ValueIterator__9_cur(&__iter); + compiler_ast_nodes_Function *method = std_map_ValueIterator__8_cur(&__iter); #line 199 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" { @@ -6355,7 +6382,7 @@ void compiler_passes_generic_pass_GenericPass_import_all_from_symbol(compiler_pa } } break; case compiler_ast_scopes_SymbolType_Enum: - m_9_3: + m_8_3: { #line 204 "/Users/mustafa/ocen-lang/ocen/compiler/passes/generic_pass.oc" @@ -6436,20 +6463,20 @@ void compiler_passes_typechecker_TypeChecker_set_resolved_symbol(compiler_passes #line 45 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_Identifier: - m_10_0: + m_9_0: { __yield_0 = node->span; } break; case compiler_ast_nodes_ASTType_Import: case compiler_ast_nodes_ASTType_Specialization: - m_10_1: + m_9_1: { #line 49 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } break; case compiler_ast_nodes_ASTType_OverloadedOperator: - m_10_2: + m_9_2: { #line 52 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" @@ -6459,12 +6486,12 @@ void compiler_passes_typechecker_TypeChecker_set_resolved_symbol(compiler_passes __yield_0 = node->u.operator_span; } break; case compiler_ast_nodes_ASTType_NSLookup: - m_10_3: + m_9_3: { __yield_0 = node->u.lookup.rhs_span; } break; case compiler_ast_nodes_ASTType_Member: - m_10_4: + m_9_4: { #line 58 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" @@ -6505,344 +6532,344 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_get_closure_type(co #line 75 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)canon))) { -#line 76 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 77 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_span_Span span = (((bool)old) ? old->span : std_span_Span_default()); + +#line 79 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)old)) { -#line 77 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 80 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_FunctionType func_ty = old->u.func; -#line 78 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 81 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" canon=compiler_types_Type_shallow_copy(old); -#line 79 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 82 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" canon->u.func=(compiler_types_FunctionType){.orig=func_ty.orig, .params=params, .return_type=return_type, .is_variadic=func_ty.is_variadic}; } else { -#line 82 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - canon=compiler_types_Type_new_resolved(compiler_types_BaseType_Closure, old->span); +#line 85 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + canon=compiler_types_Type_new_resolved(compiler_types_BaseType_Closure, span); -#line 83 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 86 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" canon->u.func=(compiler_types_FunctionType){.orig=NULL, .params=params, .return_type=return_type, .is_variadic=false}; } -#line 86 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 89 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *closure_name = std_format("_ClosureTy_%u", this->o->program->closure_types->size); -#line 87 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 90 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__0_push(this->o->program->closure_types, canon); -#line 89 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType_TypeDef, NULL, closure_name, closure_name, closure_name, old->span); +#line 92 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType_ClosureType, NULL, closure_name, closure_name, closure_name, span); -#line 90 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 93 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" sym->u.type_def=canon; -#line 91 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" canon->sym=sym; } -#line 93 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - printf("Resolved closure type %p to %s\n", old, canon->sym->name); - -#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 96 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return canon; } -#line 97 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 99 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_resolve_type(compiler_passes_typechecker_TypeChecker *this, compiler_types_Type *old, bool allow_incomplete, bool error, bool resolve_templates) { -#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool p_a = allow_incomplete; -#line 107 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 109 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool p_e = error; -#line 108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 110 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool p_r = resolve_templates; -#line 110 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 112 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *resolved = old; -#line 111 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)old))) { -#line 111 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 115 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((old->base)) { case compiler_types_BaseType_Pointer: - m_11_0: + m_10_0: { -#line 115 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *ptr = compiler_passes_typechecker_TypeChecker_resolve_type(this, old->u.ptr, p_a, p_e, p_r); -#line 116 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 118 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)ptr))) { -#line 116 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 118 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 119 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((ptr->base)) { case compiler_types_BaseType_Char: - m_12_0: + m_11_0: { -#line 118 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 120 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=compiler_ast_program_Program_get_type_by_name(this->o->program, "str", old->span); } break; case compiler_types_BaseType_Void: - m_12_1: + m_11_1: { -#line 119 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=compiler_ast_program_Program_get_type_by_name(this->o->program, "untyped_ptr", old->span); } break; default: { -#line 121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 123 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=compiler_types_Type_shallow_copy(old); -#line 122 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 124 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved->u.ptr=ptr; } break; } } break; case compiler_types_BaseType_Alias: - m_11_1: + m_10_1: { -#line 127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 129 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)old->u.ptr))) { -#line 128 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 130 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(old->span, "This type does not point to anything", "Cannot use a typedef for a type when defining any of it's members.\nUse fully qualified type for all field / method definitions.")); -#line 132 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 134 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 134 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 136 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_resolve_type(this, old->u.ptr, p_a, p_e, p_r); } break; case compiler_types_BaseType_Closure: case compiler_types_BaseType_FunctionPtr: - m_11_2: + m_10_2: { -#line 137 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 139 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__3 *checked_params = std_vector_Vector__3_new(16); -#line 139 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 141 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_FunctionType func = old->u.func; -#line 140 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(func.params); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 140 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *var = std_vector_Iterator__3_cur(&__iter); -#line 140 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 144 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" var->type=compiler_passes_typechecker_TypeChecker_resolve_type(this, var->type, p_a, p_e, p_r); -#line 143 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 145 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)var->type))) { -#line 143 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 145 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 144 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 146 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__3_push(checked_params, var); } } -#line 147 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 149 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *return_type = compiler_passes_typechecker_TypeChecker_resolve_type(this, func.return_type, p_a, p_e, p_r); -#line 148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)return_type))) { -#line 148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 151 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 153 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (old->base==compiler_types_BaseType_Closure) { -#line 152 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 154 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=compiler_passes_typechecker_TypeChecker_get_closure_type(this, checked_params, return_type, old); } else { -#line 155 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 157 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=compiler_types_Type_shallow_copy(old); -#line 156 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 158 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved->u.func=(compiler_types_FunctionType){.orig=func.orig, .params=checked_params, .return_type=return_type, .is_variadic=func.is_variadic}; } } break; case compiler_types_BaseType_Unresolved: - m_11_3: + m_10_3: { -#line 160 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 162 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *node = old->u.unresolved; -#line 161 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *res = compiler_passes_typechecker_TypeChecker_resolve_scoped_identifier(this, node, p_e, NULL, p_r); -#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 165 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res)) { -#line 164 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 166 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((res->type)) { case compiler_ast_scopes_SymbolType_TypeDef: - m_13_0: + m_12_0: { -#line 165 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 167 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=compiler_passes_typechecker_TypeChecker_resolve_type(this, res->u.type_def, p_a, p_e, p_r); } break; case compiler_ast_scopes_SymbolType_Structure: - m_13_1: + m_12_1: { -#line 167 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 169 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Structure *struc = res->u.struc; -#line 168 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_scopes_Symbol_is_templated(res) && !(allow_incomplete)) { -#line 169 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 171 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (error) { -#line 170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 172 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(old->span, std_format("Cannot use templated struct %s as a type", struc->sym->name))); } -#line 172 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 174 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return resolved; } -#line 174 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 176 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=res->u.struc->type; -#line 175 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 177 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (node->type==compiler_ast_nodes_ASTType_Specialization && compiler_ast_scopes_Symbol_is_templated(res)) { -#line 176 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if(!(!(resolve_templates))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:176:36: Assertion failed: `not resolve_templates`", "Should have been errored in resolve_scoped_identifier"); } +#line 178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + if(!(!(resolve_templates))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:178:36: Assertion failed: `not resolve_templates`", "Should have been errored in resolve_scoped_identifier"); } -#line 177 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 179 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *type = compiler_types_Type_new_resolved(compiler_types_BaseType_UnresolvedTemplate, node->span); -#line 178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 180 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" type->u.unresolved_spec=(compiler_types_UnresolvedTemplate){.base=resolved, .args=node->u.spec.template_args}; -#line 179 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=type; } } break; case compiler_ast_scopes_SymbolType_Function: - m_13_2: + m_12_2: { -#line 183 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 185 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *func = res->u.func; -#line 184 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 186 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_scopes_Symbol_is_templated(res) && !(allow_incomplete)) { -#line 185 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 187 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (error) { -#line 186 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 188 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(old->span, std_format("Cannot use templated function %s as a type", func->sym->name))); } -#line 188 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 190 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return resolved; } -#line 190 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 192 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=res->u.func->type; -#line 191 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 193 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (node->type==compiler_ast_nodes_ASTType_Specialization && compiler_ast_scopes_Symbol_is_templated(res)) { -#line 192 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if(!(!(resolve_templates))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:192:36: Assertion failed: `not resolve_templates`", "Should have been errored in resolve_scoped_identifier"); } +#line 194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + if(!(!(resolve_templates))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:194:36: Assertion failed: `not resolve_templates`", "Should have been errored in resolve_scoped_identifier"); } -#line 193 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 195 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *type = compiler_types_Type_new_resolved(compiler_types_BaseType_UnresolvedTemplate, node->span); -#line 194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 196 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" type->u.unresolved_spec=(compiler_types_UnresolvedTemplate){.base=resolved, .args=node->u.spec.template_args}; -#line 195 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 197 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=type; } } break; case compiler_ast_scopes_SymbolType_Enum: - m_13_3: + m_12_3: { -#line 198 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 200 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=res->u.enom->type; } break; default: { -#line 200 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 202 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (error) { -#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 203 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(res->span, std_format("Cannot use %s as a type", res->display))); -#line 202 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 204 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=NULL; } } break; } } else { -#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 209 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (error) { -#line 208 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 210 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=NULL; } } } break; case compiler_types_BaseType_Array: - m_11_4: + m_10_4: { -#line 213 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_ArrayType arr = old->u.arr; -#line 214 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 216 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *elem_type = compiler_passes_typechecker_TypeChecker_resolve_type(this, arr.elem_type, p_a, p_e, p_r); -#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 217 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_check_expression(this, arr.size_expr, NULL); -#line 216 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 218 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=compiler_types_Type_shallow_copy(old); -#line 217 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 219 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved->u.arr.elem_type=elem_type; -#line 219 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_try_infer_array_size(this, &resolved->u.arr); } break; case compiler_types_BaseType_Structure: @@ -6860,464 +6887,464 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_resolve_type(compil case compiler_types_BaseType_F32: case compiler_types_BaseType_F64: case compiler_types_BaseType_Enum: - m_11_5: + m_10_5: { } break; default: { -#line 226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (error) { -#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 229 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(old->span, std_format("Unhandled type in resolve %s", compiler_types_BaseType_str(old->base)))); -#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved=NULL; } } break; } -#line 232 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 234 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return resolved; } -#line 235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_try_infer_array_size(compiler_passes_typechecker_TypeChecker *this, compiler_types_ArrayType *arr_typ) { -#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *size_expr = arr_typ->size_expr; -#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (size_expr->type==compiler_ast_nodes_ASTType_IntLiteral) { -#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)size_expr->u.num_literal.suffix)) { -#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 242 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(size_expr->span, "Array size literal cannot have a suffix")); } -#line 242 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arr_typ->size_known=true; -#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arr_typ->size=str_to_u32(size_expr->u.num_literal.text); } } -#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 253 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_resolve_templated_struct_methods(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Structure *old, compiler_ast_nodes_Structure *cur) { -#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 254 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *old_type = old->type; -#line 253 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_types_Type *cur_type = cur->type; - #line 255 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__9 *old_methods = old_type->methods; + compiler_types_Type *cur_type = cur->type; -#line 256 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__9 *cur_methods = cur_type->methods; +#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__8 *old_methods = old_type->methods; #line 258 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_ast_program_Namespace *parent_ns = old->sym->ns; + std_map_Map__8 *cur_methods = cur_type->methods; #line 260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - for (std_map_Iterator__9 __iter = std_map_Map__9_iter(old_methods); std_map_Iterator__9_has_value(&__iter); std_map_Iterator__9_next(&__iter)) { + compiler_ast_program_Namespace *parent_ns = old->sym->ns; -#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Item__9 *iter = std_map_Iterator__9_cur(&__iter); +#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + for (std_map_Iterator__8 __iter = std_map_Map__8_iter(old_methods); std_map_Iterator__8_has_value(&__iter); std_map_Iterator__8_next(&__iter)) { -#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Item__8 *iter = std_map_Iterator__8_cur(&__iter); + +#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 263 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *name = iter->key; -#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *method = iter->value; -#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *new_method = compiler_ast_program_Program_get_function_deep_copy(this->o->program, method, parent_ns); -#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" new_method->parent_type=cur_type; -#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__9_insert(cur_methods, name, new_method); - #line 268 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__8_insert(cur_methods, name, new_method); + +#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol_update_parent(new_method->sym, cur_type->sym); -#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 271 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__6_push(parent_ns->functions, new_method); -#line 271 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(method->is_static)) { -#line 272 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 274 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *this_param = std_vector_Vector__3_at(new_method->params, 0); -#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 275 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (this_param->type->base==compiler_types_BaseType_Pointer) { -#line 274 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" this_param->type->u.ptr=cur_type; } else { -#line 276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 278 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" this_param->type=cur_type; } } -#line 280 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 282 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" new_method->scope=compiler_passes_typechecker_TypeChecker_scope(this); -#line 281 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 283 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_function_declaration(this, new_method); -#line 285 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 287 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__6_push(this->unchecked_functions, new_method); } } } -#line 289 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 291 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_resolve_templated_struct(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Structure *struc, compiler_ast_scopes_TemplateInstance *instance) { -#line 290 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 292 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *sym = instance->resolved; -#line 291 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 293 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Structure *resolved_struc = compiler_ast_program_Program_get_struct_deep_copy(this->o->program, struc, struc->sym->ns); -#line 292 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 294 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved_struc->sym->template=NULL; -#line 293 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 295 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved_struc->sym=sym; -#line 294 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 296 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" sym->u.struc=resolved_struc; -#line 296 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved_struc->format_spec=struc->format_spec; -#line 297 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 299 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved_struc->format_args=struc->format_args; -#line 299 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 301 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_types_Type_new_resolved(compiler_types_BaseType_Structure, sym->span); -#line 300 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 302 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" typ->u.struc=resolved_struc; -#line 301 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 303 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved_struc->type=typ; -#line 302 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 304 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" typ->sym=sym; -#line 303 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" typ->template_instance=instance; -#line 305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 307 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_struct(this, resolved_struc); -#line 306 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 308 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_templated_struct_methods(this, struc, resolved_struc); } -#line 309 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 311 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_resolve_templated_function(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Function *func, compiler_ast_scopes_TemplateInstance *instance) { -#line 310 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 312 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *sym = instance->resolved; -#line 311 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 313 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *resolved_func = compiler_ast_program_Program_get_function_deep_copy(this->o->program, func, func->sym->ns); -#line 312 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 314 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved_func->sym->template=NULL; -#line 313 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved_func->sym=sym; -#line 314 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 316 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)func->parent_type)) { -#line 315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 317 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol_update_parent(sym, func->parent_type->sym); } -#line 317 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 319 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" sym->u.func=resolved_func; -#line 318 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 320 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved_func->scope=compiler_passes_typechecker_TypeChecker_scope(this); -#line 320 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 322 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_function_declaration(this, resolved_func); -#line 321 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 323 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolved_func->type->template_instance=instance; -#line 323 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 325 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__6_push(this->unchecked_functions, resolved_func); } -#line 327 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 329 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *compiler_passes_typechecker_TypeChecker_find_template_instance(compiler_passes_typechecker_TypeChecker *this, std_vector_Vector__4 *template_instances, std_vector_Vector__0 *args) { -#line 328 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 330 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__4 __iter = std_vector_Vector__4_iter(template_instances); std_vector_Iterator__4_has_value(&__iter); std_vector_Iterator__4_next(&__iter)) { -#line 328 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 330 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_TemplateInstance *instance = std_vector_Iterator__4_cur(&__iter); -#line 328 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 330 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 329 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 331 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_scopes_TemplateInstance_matches(instance, args)) { -#line 329 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 331 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return instance->resolved; } } } -#line 331 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 333 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 334 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 336 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *compiler_passes_typechecker_TypeChecker_resolve_templated_symbol(compiler_passes_typechecker_TypeChecker *this, compiler_ast_scopes_Symbol *sym, compiler_ast_nodes_AST *node) { -#line 336 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 338 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 337 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 339 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *found = compiler_passes_typechecker_TypeChecker_find_template_instance(this, sym->template->instances, node->u.spec.template_args); -#line 338 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 340 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)found)) { -#line 338 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 340 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return found; } } -#line 341 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 343 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_program_Namespace *parent_ns = sym->ns; -#line 342 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 344 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__0 *template_args = node->u.spec.template_args; -#line 343 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_vector_Vector__10 *template_params = sym->template->params; - #line 345 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_vector_Vector__9 *template_params = sym->template->params; + +#line 347 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (template_params->size != template_args->size) { -#line 346 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 348 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Invalid number of template arguments for %s", sym->name))); -#line 347 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 349 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 351 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 353 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer new_display_name = std_buffer_Buffer_make(16); -#line 352 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 354 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str(&new_display_name, sym->name); -#line 353 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 355 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str(&new_display_name, "<"); -#line 356 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 358 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Scope *scope = compiler_ast_scopes_Scope_new(sym->ns->scope); -#line 357 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 359 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, scope); -#line 363 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 365 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool was_in_template_instance = this->in_template_instance; -#line 364 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" this->in_template_instance=true; -#line 365 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 367 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" -#line 368 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 370 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = 0; i < template_params->size; i+=1) { -#line 369 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_ast_scopes_Symbol *sym = std_vector_Vector__10_at(template_params, i); +#line 371 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_ast_scopes_Symbol *sym = std_vector_Vector__9_at(template_params, i); -#line 370 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 372 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *arg = std_vector_Vector__0_at(template_args, i); -#line 372 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 374 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (i > 0) { -#line 372 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 374 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str(&new_display_name, ", "); } -#line 373 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 375 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str(&new_display_name, compiler_types_Type_str(arg)); -#line 375 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 377 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *cur_sym = compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType_TypeDef, NULL, sym->name, sym->name, sym->name, sym->span); -#line 383 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" cur_sym->u.type_def=arg; -#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 386 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_insert_into_scope_checked(this->o, cur_sym, NULL); } -#line 387 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 389 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str(&new_display_name, ">"); -#line 390 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *new_out_name = std_format("%s__%u", sym->name, sym->template->instances->size); -#line 391 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 393 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *new_sym = compiler_ast_scopes_Symbol_new_with_parent(sym->type, parent_ns, parent_ns->sym, new_out_name, sym->span); -#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 394 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" new_sym->display=std_buffer_Buffer_str(new_display_name); -#line 394 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 396 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_TemplateInstance *instance = compiler_ast_scopes_TemplateInstance_new(template_args, sym, new_sym); -#line 395 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 397 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__4_push(sym->template->instances, instance); -#line 397 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 399 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Structure: - m_14_0: + m_13_0: { -#line 398 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 400 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_templated_struct(this, sym->u.struc, instance); } break; case compiler_ast_scopes_SymbolType_Function: - m_14_1: + m_13_1: { -#line 399 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 401 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_templated_function(this, sym->u.func, instance); } break; default: { -#line 401 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 403 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot specialize non-templated symbol %s", sym->name))); -#line 402 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 404 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" /* defers */ -#line 365 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 367 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" this->in_template_instance=was_in_template_instance; return NULL; } break; } -#line 405 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); -#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 409 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" /* defers */ -#line 365 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 367 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" this->in_template_instance=was_in_template_instance; return new_sym; } -#line 411 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 413 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *compiler_passes_typechecker_TypeChecker_resolve_scoped_identifier(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, bool error, compiler_types_Type *hint, bool resolve_templates) { -#line 412 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_NSLookup: - m_15_0: + m_14_0: { -#line 414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_span_Span lhs_span = node->u.lookup.lhs->span; -#line 415 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 417 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *lhs = compiler_passes_typechecker_TypeChecker_resolve_scoped_identifier(this, node->u.lookup.lhs, error, NULL, resolve_templates); -#line 416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 418 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)lhs))) { -#line 416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 418 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 418 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 420 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *name = node->u.lookup.rhs_name; -#line 419 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 421 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)name))) { -#line 419 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 421 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 421 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 423 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *res = compiler_passes_generic_pass_GenericPass_find_in_symbol_or_error(this->o, lhs, name, node->span, error); -#line 422 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 424 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_set_resolved_symbol(this, node, res); -#line 423 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 425 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return res; } break; case compiler_ast_nodes_ASTType_Identifier: - m_15_1: + m_14_1: { -#line 426 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 428 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *name = node->u.ident.name; -#line 427 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 429 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *res = ((compiler_ast_scopes_Symbol *)NULL); -#line 431 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 433 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)hint)) { -#line 432 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 434 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((hint->base)) { case compiler_types_BaseType_Enum: - m_16_0: + m_15_0: { -#line 434 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 436 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Enum *enom = hint->u.enom; -#line 435 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 437 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_EnumVariant *variant = compiler_ast_nodes_Enum_get_variant(enom, name); -#line 436 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)variant)) { -#line 437 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 439 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" res=variant->sym; } } break; @@ -7327,841 +7354,859 @@ compiler_ast_scopes_Symbol *compiler_passes_typechecker_TypeChecker_resolve_scop } } -#line 444 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 446 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)res))) { -#line 445 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 447 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" res=compiler_ast_scopes_Scope_lookup_recursive(compiler_passes_typechecker_TypeChecker_scope(this), name); } -#line 448 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 450 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)res))) { -#line 451 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 453 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Scope *scope = compiler_passes_typechecker_TypeChecker_scope(this); -#line 452 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 454 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)scope->cur_func)) { -#line 453 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 455 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *cur_func = scope->cur_func; -#line 454 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 456 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (cur_func->kind==compiler_ast_nodes_FunctionKind_Closure) { -#line 455 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - res=compiler_ast_scopes_Scope_lookup_recursive(scope->cur_func->closure_scope, name); +#line 457 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_ast_scopes_Symbol *tmp = compiler_ast_scopes_Scope_lookup_recursive(scope->cur_func->closure_scope, name); #line 458 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if (res->type != compiler_ast_scopes_SymbolType_Variable) { + if (!(((bool)tmp))) { + } else if (tmp->type != compiler_ast_scopes_SymbolType_Variable) { -#line 459 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 462 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Can't close over non-variable %s", name))); - } + } else { -#line 461 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if (((bool)res)) { +#line 465 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Item__4 *it = std_map_Map__4_get_item(cur_func->closed_vars, name); -#line 462 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__7_insert(cur_func->closed_vars, res->display, res->u.var); +#line 466 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + if (((bool)it)) { + +#line 467 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + res=it->value; + } else { + +#line 469 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_ast_scopes_Symbol *closed_sym = compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType_ClosedVariable, NULL, name, name, name, node->span); + +#line 470 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + closed_sym->u.closed_var=(compiler_ast_scopes_ClosedVariable){.orig=tmp->u.var, .closure=cur_func}; + +#line 471 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__4_insert(cur_func->closed_vars, name, closed_sym); + +#line 472 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + res=closed_sym; + } } } } } -#line 468 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 480 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_set_resolved_symbol(this, node, res); -#line 469 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 481 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (error && !(((bool)res))) { -#line 470 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 482 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Couldn't find this identifier: %s", name))); } -#line 472 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 484 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return res; } break; case compiler_ast_nodes_ASTType_Specialization: - m_15_2: + m_14_2: { -#line 475 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 487 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *base = compiler_passes_typechecker_TypeChecker_resolve_scoped_identifier(this, node->u.spec.base, error, hint, resolve_templates); -#line 476 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 488 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)base))) { -#line 476 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 488 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 478 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 490 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" base=compiler_ast_scopes_Symbol_remove_alias(base); -#line 479 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 491 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_ast_scopes_Symbol_is_templated(base))) { -#line 480 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 492 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot specialize non-templated symbol %s", base->name))); -#line 481 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 493 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 484 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 496 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__0 *args = node->u.spec.parsed_template_args; -#line 485 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 497 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__0 *resolved_args = std_vector_Vector__0_new(args->size); -#line 486 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 498 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool failed = false; -#line 487 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 499 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = 0; i < args->size; i+=1) { -#line 488 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 500 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *resolved_arg = compiler_passes_typechecker_TypeChecker_resolve_type(this, std_vector_Vector__0_at(args, i), true, error, resolve_templates); -#line 489 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 501 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)resolved_arg))) { -#line 490 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 502 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" failed=true; -#line 491 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 503 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 493 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 505 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__0_push(resolved_args, resolved_arg); } -#line 495 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 507 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (failed) { -#line 495 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 507 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 496 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 508 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.spec.template_args=resolved_args; -#line 498 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 510 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(resolve_templates)) { -#line 499 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 511 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_set_resolved_symbol(this, node, base); -#line 500 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 512 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return base; } -#line 503 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 515 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_resolve_templated_symbol(this, base, node); } break; default: { -#line 506 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 518 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (error) { -#line 507 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 519 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Don't know how to resolve node type %s", compiler_ast_nodes_ASTType_dbg(node->type)))); } -#line 509 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 521 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } break; } } -#line 514 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_block(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, bool is_expr, compiler_types_Type *hint) { -#line 515 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 527 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Block *block = &node->u.block; -#line 517 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 529 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Scope *scope = compiler_ast_scopes_Scope_new(compiler_passes_typechecker_TypeChecker_scope(this)); -#line 518 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 530 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" scope->can_yield=(scope->can_yield || is_expr); -#line 519 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 531 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" block->scope=scope; -#line 521 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 533 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, block->scope); -#line 522 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 534 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__16 *stmts = block->statements; -#line 523 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 535 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_span_Span yield_span = std_span_Span_default(); -#line 524 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 536 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(stmts); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 524 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 536 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *stmt = std_vector_Iterator__16_cur(&__iter); -#line 524 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 536 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 525 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 537 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_statement(this, stmt); -#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 538 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (stmt->returns) { -#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 538 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->returns=true; } -#line 528 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 540 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (stmt->type != compiler_ast_nodes_ASTType_Yield) { -#line 528 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 540 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 529 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 541 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)node->etype)) { -#line 530 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 542 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(stmt->span, "Cannot yield multiple times in a block", yield_span, "Previously yielded here")); } -#line 535 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 547 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->etype=stmt->etype; -#line 536 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 548 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" yield_span=stmt->span; -#line 537 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 549 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.block.final_stmt=stmt; } } -#line 539 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 551 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); } -#line 542 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 554 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_method_call(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Function *method, compiler_ast_nodes_AST *node) { -#line 543 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 555 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *callee = node->u.call.callee; -#line 544 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 556 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if ((callee->type != compiler_ast_nodes_ASTType_Member) && (callee->type != compiler_ast_nodes_ASTType_NSLookup)) { -#line 545 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 557 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(callee->span, "Method call is not to a member, internal compiler error")); -#line 546 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 558 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 549 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 561 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (callee->type != compiler_ast_nodes_ASTType_Member) { -#line 549 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 561 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 550 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 562 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (method->params->size==0) { -#line 552 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 564 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(callee->span, "Instance method should have `this` argument, internal error")); -#line 553 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 565 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 555 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 567 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *method_param = std_vector_Vector__3_at(method->params, 0)->type; -#line 556 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 568 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)method_param))) { -#line 556 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 568 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 558 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 570 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Member member = callee->u.member; -#line 559 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 571 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *first_arg = member.lhs; -#line 561 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (member.is_pointer && (method_param->base != compiler_types_BaseType_Pointer)) { -#line 562 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 574 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" first_arg=compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator_Dereference, first_arg->span, first_arg); } else if (!(member.is_pointer) && method_param->base==compiler_types_BaseType_Pointer) { -#line 564 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 576 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" first_arg=compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator_Address, first_arg->span, first_arg); } -#line 566 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 578 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7_push_front(node->u.call.args, compiler_ast_nodes_Argument_new(first_arg, NULL)); } -#line 569 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 581 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_union_constructor(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, std_vector_Vector__3 *params) { -#line 570 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 582 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7 *args = node->u.call.args; -#line 571 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 583 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (args->size != 1) { -#line 572 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 584 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Union constructors must have exactly one field"))); -#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 585 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__7 __iter = std_vector_Vector__7_iter(args); std_vector_Iterator__7_has_value(&__iter); std_vector_Iterator__7_next(&__iter)) { -#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 585 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *arg = std_vector_Iterator__7_cur(&__iter); -#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 585 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 574 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 586 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, arg->expr, NULL); } } -#line 576 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 588 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 579 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 591 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, 0); -#line 580 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 592 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)arg->label))) { -#line 581 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 593 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->expr->span, std_format("Union constructors must have a label for the field"))); -#line 582 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 594 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, arg->expr, NULL); -#line 583 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 595 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 586 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 598 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *param = NULL; -#line 587 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 599 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(params); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 587 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 599 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *p = std_vector_Iterator__3_cur(&__iter); -#line 587 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 599 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 588 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 600 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)p->sym) && str_eq(p->sym->name, arg->label)) { -#line 589 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 601 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" param=p; -#line 590 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 602 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" break; } } } -#line 593 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 605 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)param))) { -#line 594 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 606 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->expr->span, std_format("Unknown field %s in union constructor", arg->label))); -#line 595 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 607 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, arg->expr, NULL); -#line 596 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 608 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 599 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 611 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *arg_type = compiler_passes_typechecker_TypeChecker_check_expression(this, arg->expr, param->type); -#line 600 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)arg_type) && !(compiler_types_Type_eq(arg_type, param->type, false))) { -#line 601 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 613 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(arg->expr->span, std_format("Expected `%s` with type %s, but got %s", arg->label, compiler_types_Type_str(param->type), compiler_types_Type_str(arg_type)), param->sym->span, "Parameter defined here")); } } -#line 608 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 620 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_constructor(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node) { -#line 609 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 621 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.call.call_type=compiler_ast_nodes_CallType_StructConstructor; -#line 611 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 623 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *callee = node->u.call.callee; -#line 612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 624 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *type_sym = compiler_ast_scopes_Symbol_remove_alias(callee->resolved_symbol); -#line 614 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if(!(type_sym->type==compiler_ast_scopes_SymbolType_Structure)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:614:12: Assertion failed: `type_sym.type == Structure`", std_format("Got non-struct type in check_constructor: %s", compiler_ast_scopes_SymbolType_dbg(type_sym->type))); } +#line 626 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + if(!(type_sym->type==compiler_ast_scopes_SymbolType_Structure)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:626:12: Assertion failed: `type_sym.type == Structure`", std_format("Got non-struct type in check_constructor: %s", compiler_ast_scopes_SymbolType_dbg(type_sym->type))); } -#line 615 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Structure *struc = type_sym->u.struc; -#line 617 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 629 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__3 *params = struc->fields; -#line 618 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (struc->is_union) { -#line 619 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 631 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_union_constructor(this, node, params); } else { -#line 620 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 632 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_call_args(this, node, params, false); } -#line 624 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 636 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return struc->type; } -#line 627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 639 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_enum_constructor(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node) { -#line 628 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 640 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.call.call_type=compiler_ast_nodes_CallType_EnumConstructor; -#line 630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 642 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *callee = node->u.call.callee; -#line 631 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 643 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *type_sym = compiler_ast_scopes_Symbol_remove_alias(callee->resolved_symbol); -#line 633 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if(!(type_sym->type==compiler_ast_scopes_SymbolType_EnumVariant)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:633:12: Assertion failed: `type_sym.type == EnumVariant`", std_format("Got non-struct type in check_constructor: %s", compiler_ast_scopes_SymbolType_dbg(type_sym->type))); } +#line 645 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + if(!(type_sym->type==compiler_ast_scopes_SymbolType_EnumVariant)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:645:12: Assertion failed: `type_sym.type == EnumVariant`", std_format("Got non-struct type in check_constructor: %s", compiler_ast_scopes_SymbolType_dbg(type_sym->type))); } -#line 634 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 646 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_EnumVariant *variant = type_sym->u.enum_var; -#line 635 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 647 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Enum *enom = variant->parent; -#line 637 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 649 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" u32 num_expected_fields = compiler_ast_nodes_EnumVariant_num_fields(variant); -#line 638 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 650 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__3 *params = std_vector_Vector__3_new(16); -#line 639 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 651 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = 0; i < num_expected_fields; i+=1) { -#line 640 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 652 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *field = compiler_ast_nodes_EnumVariant_get_field_by_idx(variant, i); -#line 641 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 653 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__3_push(params, field); } -#line 644 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 656 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7 *args = node->u.call.args; -#line 645 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 657 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (num_expected_fields==0 && args->size==0) { -#line 646 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 658 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_span_Span span = std_span_Span_join(node->u.call.open_paren_span, node->u.call.close_paren_span); -#line 647 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 659 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(span, std_format("Unnecessary empty constructor for %s, no fields expected", variant->sym->display))); -#line 648 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 660 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return variant->parent->type; } -#line 651 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 663 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_call_args(this, node, params, false); -#line 652 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 664 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__3_clear(params); -#line 653 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 665 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return enom->type; } -#line 656 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 668 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_call_args_labelled(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, std_vector_Vector__3 *params, u32 start) { -#line 657 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 669 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7 *args = node->u.call.args; -#line 658 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 670 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *callee = node->u.call.callee; -#line 659 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 671 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7 *new_args = std_vector_Vector__7_new(16); -#line 661 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__10 *kwargs = std_map_Map__10_new(8); +#line 673 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__9 *kwargs = std_map_Map__9_new(8); -#line 662 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__7 *expected_params = std_map_Map__7_new(8); +#line 674 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__10 *expected_params = std_map_Map__10_new(8); -#line 664 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 676 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = 0; i < params->size; i++) { -#line 665 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 677 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *param = std_vector_Vector__3_at(params, i); -#line 666 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 678 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)param->sym))) { -#line 667 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 679 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(param->type->span, "Not allowed to have unlabeled parameter here")); -#line 668 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 680 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 670 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__7_insert(expected_params, param->sym->name, param); +#line 682 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__10_insert(expected_params, param->sym->name, param); -#line 671 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 683 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (i < start) { -#line 672 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 684 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); -#line 673 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__10_insert(kwargs, param->sym->name, arg); +#line 685 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__9_insert(kwargs, param->sym->name, arg); -#line 674 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 686 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7_push(new_args, std_vector_Vector__7_at(args, i)); } } -#line 678 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 690 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = start; i < args->size; i++) { -#line 679 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 691 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); -#line 681 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 693 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)arg->label))) { -#line 682 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 694 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->expr->span, "Can't have positional arguments after labelled arguments")); -#line 683 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 695 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 685 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Item__7 *param_item = std_map_Map__7_get_item(expected_params, arg->label); +#line 697 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Item__10 *param_item = std_map_Map__10_get_item(expected_params, arg->label); -#line 686 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Item__10 *kwarg_item = std_map_Map__10_get_item(kwargs, arg->label); +#line 698 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Item__9 *kwarg_item = std_map_Map__9_get_item(kwargs, arg->label); -#line 688 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 700 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *expected_type = NULL; -#line 689 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 701 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)param_item))) { -#line 690 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 702 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->label_span, std_format("Unknown labelled argument `%s`", arg->label))); } else if (((bool)kwarg_item)) { -#line 693 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 705 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(arg->label_span, std_format("Duplicate argument for parameter `%s`", arg->label), kwarg_item->value->expr->span, "Previously specified here")); } else { -#line 698 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__10_insert(kwargs, arg->label, arg); +#line 710 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__9_insert(kwargs, arg->label, arg); -#line 699 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 711 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" expected_type=param_item->value->type; } -#line 702 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 714 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *arg_type = compiler_passes_typechecker_TypeChecker_check_expression(this, arg->expr, expected_type); -#line 703 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 715 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if ((((bool)arg_type) && ((bool)expected_type)) && !(compiler_types_Type_eq(arg_type, expected_type, false))) { -#line 704 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 716 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(arg->expr->span, std_format("Expected `%s` with type %s, but got %s", arg->label, compiler_types_Type_str(expected_type), compiler_types_Type_str(arg_type)), param_item->value->sym->span, "Parameter defined here")); } } -#line 711 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 723 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = start; i < params->size; i++) { -#line 712 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 724 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *param = std_vector_Vector__3_at(params, i); -#line 713 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if(!(((bool)param->sym))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:713:16: Assertion failed: `param.sym?`", std_format("Expected a symbol for parameter %u", i)); } +#line 725 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + if(!(((bool)param->sym))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:725:16: Assertion failed: `param.sym?`", std_format("Expected a symbol for parameter %u", i)); } -#line 715 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Item__10 *item = std_map_Map__10_get_item(kwargs, param->sym->name); +#line 727 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Item__9 *item = std_map_Map__9_get_item(kwargs, param->sym->name); -#line 716 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 728 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)item)) { -#line 717 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 729 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7_push(new_args, item->value); } else if (((bool)param->default_value)) { -#line 720 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 732 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *new_arg = compiler_ast_nodes_Argument_new(param->default_value, NULL); -#line 721 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 733 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7_push(new_args, new_arg); } else { -#line 728 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 740 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(node->u.call.close_paren_span, std_format("Missing required argument `%s` of type %s", param->sym->name, compiler_types_Type_str(param->type)), param->sym->span, "Parameter defined here")); } } -#line 735 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 747 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7_free(args); -#line 736 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__10_free(kwargs); +#line 748 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__9_free(kwargs); -#line 737 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__7_free(expected_params); +#line 749 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__10_free(expected_params); -#line 738 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 750 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.call.args=new_args; } -#line 742 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 754 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_call_args(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, std_vector_Vector__3 *params, bool is_variadic) { -#line 743 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 755 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7 *args = node->u.call.args; -#line 745 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 757 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = 0; i < params->size; i++) { -#line 746 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 758 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *param = std_vector_Vector__3_at(params, i); -#line 749 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 761 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (i >= args->size) { -#line 750 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 762 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)param->default_value)) { -#line 751 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 763 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *new_arg = compiler_ast_nodes_Argument_new(param->default_value, NULL); -#line 752 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 764 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7_push(args, new_arg); } else { -#line 754 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 766 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)param->sym)) { -#line 755 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 767 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(node->u.call.close_paren_span, std_format("Missing required argument `%s` of type %s", param->sym->name, compiler_types_Type_str(param->type)), param->sym->span, "Parameter defined here")); } else { -#line 760 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 772 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->u.call.close_paren_span, std_format("Missing required field %u of type %s", i, compiler_types_Type_str(param->type)))); } } -#line 763 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 775 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 766 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 778 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); -#line 767 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 779 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)arg->label)) { -#line 768 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 780 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)param->sym))) { -#line 769 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 781 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->label_span, "Cannot use a labelled argument for a non-labeled parameter")); } else if (!(str_eq(arg->label, param->sym->name))) { -#line 776 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 788 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_variadic) { -#line 777 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 789 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->label_span, std_format("Variadic functions not allowed with default arguments"))); } -#line 782 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 794 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_call_args_labelled(this, node, params, i); -#line 783 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 795 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" break; } else { } } -#line 790 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 802 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *arg_type = compiler_passes_typechecker_TypeChecker_check_expression(this, arg->expr, param->type); -#line 791 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 803 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)arg_type)) || !(((bool)param->type))) { -#line 792 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 804 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 794 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 806 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_eq(arg_type, param->type, false))) { -#line 795 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 807 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)param->sym)) { -#line 796 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 808 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(arg->expr->span, std_format("Expected `%s` with type %s, but got %s", param->sym->name, compiler_types_Type_str(param->type), compiler_types_Type_str(arg_type)), param->sym->span, "Parameter defined here")); } else { -#line 801 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 813 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->expr->span, std_format("Expected field %u with type %s, but got %s", i, compiler_types_Type_str(param->type), compiler_types_Type_str(arg_type)))); } } } -#line 807 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 819 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" args=node->u.call.args; -#line 809 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 821 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_variadic) { -#line 810 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 822 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = params->size; i < args->size; i++) { -#line 811 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 823 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); -#line 812 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 824 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *arg_type = compiler_passes_typechecker_TypeChecker_check_expression(this, arg->expr, NULL); -#line 813 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 825 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)arg_type))) { -#line 814 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 826 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } } } else { -#line 818 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 830 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = params->size; i < args->size; i++) { -#line 819 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 831 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); -#line 820 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 832 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *arg_type = compiler_passes_typechecker_TypeChecker_check_expression(this, arg->expr, NULL); -#line 821 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 833 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->expr->span, std_format("Unexpected argument, expected only %u", params->size))); } } } -#line 826 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 838 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_call(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, compiler_types_Type *hint) { -#line 827 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 839 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *callee = node->u.call.callee; -#line 828 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 840 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7 *args = node->u.call.args; -#line 830 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 842 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = ({ compiler_types_Type *__yield_0; -#line 830 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 842 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((callee->type)) { case compiler_ast_nodes_ASTType_Member: - m_17_0: + m_16_0: { __yield_0 = compiler_passes_typechecker_TypeChecker_check_member(this, callee, true, NULL); } break; case compiler_ast_nodes_ASTType_Identifier: case compiler_ast_nodes_ASTType_NSLookup: case compiler_ast_nodes_ASTType_Specialization: - m_17_1: + m_16_1: { -#line 833 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 845 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *sym = compiler_passes_typechecker_TypeChecker_resolve_scoped_identifier(this, callee, true, hint, true); -#line 834 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 846 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = ({ compiler_types_Type *__yield_1; -#line 834 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 846 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)sym)) { -#line 836 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 848 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" sym=compiler_ast_scopes_Symbol_remove_alias(sym); -#line 837 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 849 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_set_resolved_symbol(this, callee, sym); -#line 839 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 851 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_1 = ({ compiler_types_Type *__yield_2; -#line 839 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 851 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Structure: case compiler_ast_scopes_SymbolType_TypeDef: - m_18_0: + m_17_0: { -#line 841 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 853 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.call.call_type=compiler_ast_nodes_CallType_StructConstructor; -#line 842 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 854 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_constructor(this, node); } break; case compiler_ast_scopes_SymbolType_EnumVariant: - m_18_1: + m_17_1: { -#line 845 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 857 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.call.call_type=compiler_ast_nodes_CallType_EnumConstructor; -#line 846 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 858 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_enum_constructor(this, node); } break; default: @@ -8184,261 +8229,264 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_call(compiler __yield_0; }); -#line 857 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 869 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.call.call_type=compiler_ast_nodes_CallType_Normal; -#line 858 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 870 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res)) { -#line 859 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 871 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (res->base==compiler_types_BaseType_Pointer && res->u.ptr->base==compiler_types_BaseType_FunctionPtr) { -#line 860 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 872 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" res=res->u.ptr; } else if (!(compiler_types_BaseType_is_callable(res->base))) { -#line 863 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 875 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(callee->span, std_format("Cannot call a non-function type: %s", compiler_types_Type_str(res)))); -#line 865 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 877 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" res=this->o->error_type; } } else { -#line 870 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 882 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" res=this->o->error_type; } -#line 876 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 888 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (res->base==compiler_types_BaseType_Error) { -#line 877 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 889 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__7 __iter = std_vector_Vector__7_iter(args); std_vector_Iterator__7_has_value(&__iter); std_vector_Iterator__7_next(&__iter)) { -#line 877 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 889 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *arg = std_vector_Iterator__7_cur(&__iter); -#line 877 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 889 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 878 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 890 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, arg->expr, NULL); } } -#line 880 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 892 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 883 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 895 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_FunctionType func = res->u.func; -#line 884 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 896 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)func.orig) && func.orig->exits) { -#line 884 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 896 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->returns=true; } -#line 885 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 897 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__3 *params = func.params; -#line 887 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 899 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if ((((bool)func.orig) && func.orig->kind==compiler_ast_nodes_FunctionKind_Method) && !(func.orig->is_static)) { -#line 888 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 900 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_method_call(this, func.orig, node); } -#line 891 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 903 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (res->base==compiler_types_BaseType_Closure) { + +#line 904 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + node->u.call.call_type=compiler_ast_nodes_CallType_Closure; } -#line 896 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 907 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_call_args(this, node, params, func.is_variadic); -#line 898 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 909 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool is_variadic_format = (((bool)func.orig) && func.orig->is_variadic_format); -#line 899 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 910 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_variadic_format && (args->size >= params->size)) { -#line 900 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 911 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7 *args = node->u.call.args; -#line 902 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 913 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *param = std_vector_Vector__3_back(params, 0); -#line 903 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 914 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *arg = std_vector_Vector__7_at(args, (params->size - 1))->expr; -#line 905 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 916 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_is_str(param->type))) { -#line 906 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 917 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(func.orig->sym->span, "Variadic-format function must have last positional argument of type 'str'")); } -#line 910 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 921 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((arg->type)) { case compiler_ast_nodes_ASTType_StringLiteral: case compiler_ast_nodes_ASTType_FormatStringLiteral: - m_19_0: + m_18_0: { } break; default: -#line 916 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 927 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (arg->etype==compiler_passes_typechecker_TypeChecker_get_type_by_name(this, "str", arg->span)) { -#line 917 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 928 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->span, "Expected a string literal for variadic-format function")); } break; } -#line 924 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 935 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = params->size; i < args->size; i++) { -#line 925 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 936 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); -#line 926 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 937 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_call_dbg_on_enum_value(this, &arg->expr); } } -#line 930 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 941 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)func.orig)) { -#line 931 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 942 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.call.is_function_pointer=false; -#line 932 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 943 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.call.func=func.orig; } -#line 935 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 946 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return func.return_type; } -#line 938 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 949 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_pointer_arith(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, compiler_types_Type *lhs, compiler_types_Type *rhs) { -#line 939 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 950 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_operators_Operator op = node->u.binary.op; -#line 940 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 951 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (op==compiler_ast_operators_Operator_Plus || op==compiler_ast_operators_Operator_Minus) { -#line 941 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 952 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (lhs->base==compiler_types_BaseType_Pointer && compiler_types_Type_is_integer(rhs)) { -#line 942 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 953 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return lhs; } -#line 944 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 955 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_types_Type_is_integer(lhs) && rhs->base==compiler_types_BaseType_Pointer) { -#line 945 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 956 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return rhs; } -#line 947 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 958 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_types_Type_eq(lhs, rhs, false) && lhs->base==compiler_types_BaseType_Pointer) { -#line 948 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (op==compiler_ast_operators_Operator_Minus) { -#line 949 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 960 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_I64, node->span); } } } -#line 953 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 964 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Invalid pointer arithmetic")); -#line 954 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 965 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 957 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 968 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_find_and_replace_overloaded_op(compiler_passes_typechecker_TypeChecker *this, compiler_ast_operators_Operator op, compiler_ast_nodes_AST *node, compiler_ast_nodes_AST *arg1, compiler_ast_nodes_AST *arg2, compiler_ast_nodes_AST *arg3) { -#line 958 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 969 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_operators_Operator_needs_lhs_pointer_for_overload(op)) { -#line 960 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 971 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_nodes_AST_is_lvalue(arg1) && (arg1->etype->base != compiler_types_BaseType_Pointer)) { -#line 961 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 972 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arg1=compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator_Address, arg1->span, arg1); -#line 962 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 973 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)compiler_passes_typechecker_TypeChecker_check_expression(this, arg1, NULL)))) { -#line 962 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 973 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } } } -#line 966 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 977 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_operators_OperatorOverload overload = {0}; -#line 967 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 978 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.op=op; -#line 968 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 979 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)arg1)) { -#line 968 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 979 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.type1=arg1->etype; } -#line 969 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 980 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)arg2)) { -#line 969 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 980 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.type2=arg2->etype; } -#line 970 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 981 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)arg3)) { -#line 970 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 981 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.type3=arg3->etype; } -#line 971 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 982 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *func = std_map_Map__5_get(this->o->program->operator_overloads, overload, NULL); -#line 972 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 983 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)func))) { -#line 972 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 983 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 974 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 985 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *callee = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_OverloadedOperator, node->u.binary.op_span); -#line 975 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 986 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" callee->u.operator_span=({ std_span_Span __yield_0; -#line 975 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 986 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_BinaryOp: - m_20_0: + m_19_0: { __yield_0 = node->u.binary.op_span; } break; case compiler_ast_nodes_ASTType_UnaryOp: - m_20_1: + m_19_1: { __yield_0 = node->u.unary.op_span; } break; @@ -8450,97 +8498,97 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_find_and_replace_ov __yield_0; }); -#line 980 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 991 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_set_resolved_symbol(this, callee, func->sym); -#line 982 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 993 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7 *args = std_vector_Vector__7_new(16); -#line 983 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 994 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)arg1)) { -#line 983 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 994 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7_push(args, compiler_ast_nodes_Argument_new(arg1, NULL)); } -#line 984 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 995 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)arg2)) { -#line 984 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 995 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7_push(args, compiler_ast_nodes_Argument_new(arg2, NULL)); } -#line 985 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 996 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)arg3)) { -#line 985 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 996 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__7_push(args, compiler_ast_nodes_Argument_new(arg3, NULL)); } -#line 987 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 998 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->type=compiler_ast_nodes_ASTType_Call; -#line 988 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 999 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.call.callee=callee; -#line 989 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1000 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.call.args=args; -#line 990 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1001 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->etype=func->return_type; -#line 991 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1002 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return func->return_type; } -#line 994 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1005 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_binary_op(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, compiler_types_Type *lhs, compiler_types_Type *rhs) { -#line 995 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1006 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_operators_Operator op = node->u.binary.op; -#line 996 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1007 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_find_and_replace_overloaded_op(this, op, node, node->u.binary.lhs, node->u.binary.rhs, NULL); -#line 997 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1008 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res)) { -#line 997 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1008 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return res; } -#line 999 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1010 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((op)) { case compiler_ast_operators_Operator_Plus: case compiler_ast_operators_Operator_Minus: case compiler_ast_operators_Operator_Multiply: case compiler_ast_operators_Operator_Divide: - m_21_0: + m_20_0: { -#line 1001 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1012 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (lhs->base==compiler_types_BaseType_Pointer || rhs->base==compiler_types_BaseType_Pointer) { -#line 1002 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1013 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_pointer_arith(this, node, lhs, rhs); } else if (!(compiler_types_Type_is_numeric(lhs)) || !(compiler_types_Type_is_numeric(rhs))) { -#line 1005 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1016 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Operator `%s` does not support `%s` and `%s`", compiler_ast_operators_Operator_dbg(op), compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); -#line 1008 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1019 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } else if (!(compiler_types_Type_eq(lhs, rhs, false))) { -#line 1011 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1022 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(node->span, "Operands must be of the same type", std_format("Got types '%s' and '%s'", compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); -#line 1015 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1026 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } else { -#line 1017 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1028 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return lhs; } } break; @@ -8548,83 +8596,83 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_binary_op(com case compiler_ast_operators_Operator_MinusEquals: case compiler_ast_operators_Operator_DivideEquals: case compiler_ast_operators_Operator_MultiplyEquals: - m_21_1: + m_20_1: { -#line 1021 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1032 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *lhs_node = node->u.binary.lhs; -#line 1022 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1033 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_ast_nodes_AST_is_lvalue(lhs_node))) { -#line 1023 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1034 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Left hand side of assignment must be assignable")); -#line 1024 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1035 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1026 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1037 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_is_numeric(lhs)) || !(compiler_types_Type_is_numeric(rhs))) { -#line 1027 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1038 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Operator `%s` does not support `%s` and `%s`", compiler_ast_operators_Operator_dbg(op), compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); -#line 1030 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1041 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1032 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1043 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_eq(lhs, rhs, false))) { -#line 1033 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1044 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(node->span, "Operands must be of the same type", std_format("Got types '%s' and '%s'", compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); -#line 1037 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1048 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1039 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1050 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return lhs; } break; case compiler_ast_operators_Operator_LessThan: case compiler_ast_operators_Operator_LessThanEquals: case compiler_ast_operators_Operator_GreaterThan: case compiler_ast_operators_Operator_GreaterThanEquals: - m_21_2: + m_20_2: { -#line 1042 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1053 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_eq(lhs, rhs, false))) { -#line 1043 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1054 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(node->span, "Operands must be of the same type", std_format("Got types '%s' and '%s'", compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); } -#line 1048 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1059 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" lhs=compiler_types_Type_unaliased(lhs); -#line 1049 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1060 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_is_numeric_or_char(lhs)) && (lhs->base != compiler_types_BaseType_Pointer)) { -#line 1050 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1061 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Operator `%s` does not support `%s` and `%s`", compiler_ast_operators_Operator_dbg(op), compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); -#line 1053 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1064 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1055 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1066 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span); } break; case compiler_ast_operators_Operator_Equals: - m_21_3: + m_20_3: { -#line 1058 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1069 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool is_invalid = ({ bool __yield_0; -#line 1058 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1069 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_eq(lhs, rhs, false))) { __yield_0 = true; } else if (lhs->base==compiler_types_BaseType_Structure) { @@ -8632,13 +8680,13 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_binary_op(com } else if (lhs->base==compiler_types_BaseType_Enum) { __yield_0 = ({ bool __yield_1; -#line 1061 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1072 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (lhs->u.enom->has_values) { -#line 1063 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1074 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Operator `%s` does not support non-trivial enum `%s`", compiler_ast_operators_Operator_dbg(op), compiler_types_Type_str(lhs)))); -#line 1064 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1075 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span); } else { __yield_1 = false; @@ -8650,24 +8698,24 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_binary_op(com __yield_0; }); -#line 1070 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1081 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_invalid) { -#line 1071 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1082 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Operator `%s` does not support `%s` and `%s`", compiler_ast_operators_Operator_dbg(op), compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); } -#line 1075 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1086 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span); } break; case compiler_ast_operators_Operator_NotEquals: - m_21_4: + m_20_4: { -#line 1078 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1089 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool is_invalid = ({ bool __yield_0; -#line 1078 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1089 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_eq(lhs, rhs, false))) { __yield_0 = true; } else if (lhs->base==compiler_types_BaseType_Structure) { @@ -8680,80 +8728,80 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_binary_op(com __yield_0; }); -#line 1084 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1095 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_invalid) { -#line 1086 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1097 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_find_and_replace_overloaded_op(this, compiler_ast_operators_Operator_Equals, node, node->u.binary.lhs, node->u.binary.rhs, NULL); -#line 1087 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1098 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res)) { -#line 1089 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *copy = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_UnaryOp, node->span); -#line 1090 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1101 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" (*copy)=(*node); -#line 1091 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1102 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" (*node)=(*compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator_Not, node->span, copy)); -#line 1092 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1103 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, node, NULL); } else if (lhs->base==compiler_types_BaseType_Enum) { -#line 1094 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1105 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Operator `%s` does not support non-trivial enum `%s`", compiler_ast_operators_Operator_dbg(op), compiler_types_Type_str(lhs)))); } else { -#line 1097 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Operator `%s` does not support `%s` and `%s`", compiler_ast_operators_Operator_dbg(op), compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); } } -#line 1102 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span); } break; case compiler_ast_operators_Operator_And: case compiler_ast_operators_Operator_Or: - m_21_5: + m_20_5: { -#line 1105 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1116 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_eq(lhs, rhs, false)) || (lhs->base != compiler_types_BaseType_Bool)) { -#line 1106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Operator `%s` does not support `%s` and `%s`", compiler_ast_operators_Operator_dbg(op), compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); -#line 1109 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1120 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1111 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1122 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span); } break; case compiler_ast_operators_Operator_BitwiseXor: - m_21_6: + m_20_6: { -#line 1114 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1125 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_eq(lhs, rhs, false))) { -#line 1115 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1126 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Operator `%s` does not support `%s` and `%s`", compiler_ast_operators_Operator_dbg(op), compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); -#line 1118 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1129 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1120 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1131 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if ((lhs->base != compiler_types_BaseType_Bool) && !(compiler_types_Type_is_integer(lhs))) { -#line 1121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1132 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Operator requires integer types")); } -#line 1123 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1134 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return lhs; } break; case compiler_ast_operators_Operator_Modulus: @@ -8763,42 +8811,42 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_binary_op(com case compiler_ast_operators_Operator_RightShift: case compiler_ast_operators_Operator_LeftShiftEquals: case compiler_ast_operators_Operator_RightShiftEquals: - m_21_7: + m_20_7: { -#line 1126 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1137 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_is_integer(lhs)) || !(compiler_types_Type_is_integer(rhs))) { -#line 1127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1138 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Operator `%s` does not support `%s` and `%s`", compiler_ast_operators_Operator_dbg(op), compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); -#line 1130 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1141 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1132 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1143 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_eq(lhs, rhs, false))) { -#line 1133 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1144 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(node->span, "Operands must be of the same type", std_format("Got types '%s' and '%s'", compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); } -#line 1139 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *lhs_node = node->u.binary.lhs; -#line 1140 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1151 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((op)) { case compiler_ast_operators_Operator_LeftShiftEquals: case compiler_ast_operators_Operator_RightShiftEquals: - m_22_0: + m_21_0: -#line 1141 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1152 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_ast_nodes_AST_is_lvalue(lhs_node))) { -#line 1142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1153 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(lhs_node->span, std_format("Must be an l-value"))); -#line 1143 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1154 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } break; @@ -8807,68 +8855,68 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_binary_op(com } break; } -#line 1148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1159 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return lhs; } break; default: { -#line 1150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1161 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_panic(std_format("Internal error: unhandled op in check_binary_op: %s", compiler_ast_nodes_ASTType_dbg(node->type))); } break; } } -#line 1154 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1165 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_format_string(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node) { -#line 1155 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1166 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__8 *parts = node->u.fmt_str.parts; -#line 1156 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1167 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__16 *exprs = node->u.fmt_str.exprs; -#line 1158 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1169 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (parts->size != (exprs->size + 1)) { -#line 1159 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Number of format string parts does not match number of expressions")); } -#line 1162 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1173 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = 0; i < exprs->size; i+=1) { -#line 1163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1174 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *expr = std_vector_Vector__16_at(exprs, i); -#line 1164 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1175 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_expression(this, expr, NULL); -#line 1165 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1176 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1165 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1176 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 1167 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" typ=compiler_passes_typechecker_TypeChecker_call_dbg_on_enum_value(this, &expr); -#line 1168 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1179 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" exprs->data[i]=expr; -#line 1170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 1171 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1182 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" typ=compiler_types_Type_unaliased(typ); -#line 1173 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1184 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((typ->base)) { case compiler_types_BaseType_Bool: case compiler_types_BaseType_Char: @@ -8883,162 +8931,162 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_format_string case compiler_types_BaseType_F32: case compiler_types_BaseType_F64: case compiler_types_BaseType_Pointer: - m_23_0: + m_22_0: { } break; default: { -#line 1177 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1188 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool can_format = false; -#line 1178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1189 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (typ->base==compiler_types_BaseType_Structure) { -#line 1179 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1190 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Structure *struc = typ->u.struc; -#line 1180 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1191 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)struc) && ((bool)struc->format_spec)) { -#line 1181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1192 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" can_format=true; } } -#line 1185 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1196 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (can_format) { -#line 1191 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1202 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((expr->type)) { case compiler_ast_nodes_ASTType_Identifier: case compiler_ast_nodes_ASTType_Member: case compiler_ast_nodes_ASTType_NSLookup: - m_24_0: + m_23_0: { -#line 1192 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1203 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } break; default: { -#line 1194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1205 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(expr->span, std_format("Can only format %s in simple expressions", typ->sym->display), "Try moving the expression into a variable and formatting that instead")); } break; } } else { -#line 1202 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1213 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(expr->span, std_format("Type '%s' cannot be formatted automatically", compiler_types_Type_str(typ)))); } } break; } } -#line 1210 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_type_by_name(this, "str", node->span); } -#line 1213 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1224 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_member(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, bool is_being_called, compiler_types_Type *hint) { -#line 1214 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1225 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *lhs = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.member.lhs, NULL); -#line 1215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)lhs))) { -#line 1215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1218 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1229 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool is_pointer = false; -#line 1219 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1230 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (lhs->base==compiler_types_BaseType_Pointer) { -#line 1220 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1231 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" is_pointer=true; -#line 1222 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1233 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)lhs->u.ptr))) { -#line 1223 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1234 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(lhs->span, "Got unresolved type")); -#line 1224 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return hint; } -#line 1226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1237 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" lhs=lhs->u.ptr; } -#line 1231 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1242 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (lhs->base==compiler_types_BaseType_UnresolvedTemplate) { -#line 1232 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" lhs=lhs->u.unresolved_spec.base; } -#line 1235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1246 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *rhs_name = node->u.member.rhs_name; -#line 1236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1247 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)rhs_name))) { -#line 1236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1247 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return hint; } -#line 1238 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1249 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((lhs->base)) { case compiler_types_BaseType_Structure: - m_25_0: + m_24_0: { -#line 1240 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1251 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Structure *struc = lhs->u.struc; -#line 1241 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1252 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *field = compiler_ast_nodes_Structure_get_field(struc, rhs_name); -#line 1242 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1253 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)field)) { -#line 1243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1254 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.member.is_pointer=is_pointer; -#line 1244 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1255 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_set_resolved_symbol(this, node, field->sym); -#line 1245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1256 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return field->type; } } break; case compiler_types_BaseType_Enum: - m_25_1: + m_24_1: { -#line 1249 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Enum *enom = lhs->u.enom; -#line 1250 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *field = compiler_ast_nodes_Enum_get_shared_field(enom, rhs_name); -#line 1251 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)field)) { -#line 1252 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1263 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.member.is_pointer=is_pointer; -#line 1253 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_set_resolved_symbol(this, node, field->sym); -#line 1254 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1265 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return field->type; } } break; @@ -9047,317 +9095,319 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_member(compil } break; } -#line 1262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1273 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_types_Type_can_have_methods(lhs)) { -#line 1263 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_ast_nodes_Function *method = std_map_Map__9_get(lhs->methods, rhs_name, NULL); +#line 1274 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_ast_nodes_Function *method = std_map_Map__8_get(lhs->methods, rhs_name, NULL); -#line 1264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1275 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)method)) { -#line 1265 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(is_being_called)) { -#line 1266 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1277 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Cannot access method without calling it")); -#line 1267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1278 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return hint; } -#line 1269 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1280 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (method->is_static) { -#line 1270 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1281 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Cannot call static method as instance method")); -#line 1271 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1282 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return hint; } -#line 1273 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1284 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.member.is_pointer=is_pointer; -#line 1274 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1285 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_set_resolved_symbol(this, node, method->sym); -#line 1275 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1286 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return method->type; } } -#line 1279 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1290 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Type %s has no member named '%s'", compiler_types_Type_str(lhs), rhs_name))); -#line 1282 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1293 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return hint; } -#line 1288 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1299 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_expression(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, compiler_types_Type *hint) { -#line 1289 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1300 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)node->etype)) { -#line 1289 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1300 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return node->etype; } -#line 1291 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1302 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_expression_helper(this, node, hint); -#line 1292 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1303 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)typ) && (node->type != compiler_ast_nodes_ASTType_ArrayLiteral)) { -#line 1292 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1303 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" typ=compiler_types_Type_decay_array(typ); } -#line 1293 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1304 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->etype=typ; -#line 1294 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->hint=(((bool)typ) ? typ : hint); -#line 1295 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1306 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return typ; } -#line 1298 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1309 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_index(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, compiler_types_Type *hint, bool is_being_assigned) { -#line 1299 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1310 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *lhs = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.binary.lhs, NULL); -#line 1300 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1311 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *rhs = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.binary.rhs, NULL); -#line 1301 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1312 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)lhs)) || !(((bool)rhs))) { -#line 1301 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1312 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1303 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1314 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(is_being_assigned)) { -#line 1304 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_find_and_replace_overloaded_op(this, compiler_ast_operators_Operator_Index, node, node->u.binary.lhs, node->u.binary.rhs, NULL); -#line 1305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1316 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res)) { -#line 1305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1316 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return res; } } -#line 1308 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1319 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" rhs=compiler_types_Type_unaliased(rhs); -#line 1309 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1320 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_is_integer(rhs))) { -#line 1310 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1321 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Index must be an integer, got %s", compiler_types_Type_str(rhs)))); -#line 1311 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1322 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1313 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1324 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" lhs=compiler_types_Type_unaliased(lhs); -#line 1314 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1325 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((lhs->base)) { case compiler_types_BaseType_Array: - m_26_0: + m_25_0: { -#line 1315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1326 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return lhs->u.arr.elem_type; } break; case compiler_types_BaseType_Pointer: - m_26_1: + m_25_1: { -#line 1316 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1327 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return lhs->u.ptr; } break; default: { -#line 1318 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1329 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot index type %s", compiler_types_Type_str(lhs)))); -#line 1319 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1330 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } break; } } -#line 1326 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1337 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_assignment(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, compiler_types_Type *lhs, compiler_types_Type *rhs) { -#line 1327 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1338 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_ast_nodes_AST_is_lvalue(node->u.binary.lhs))) { -#line 1328 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1339 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->u.binary.lhs->span, "Must be an l-value")); } -#line 1330 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1341 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_eq(lhs, rhs, false))) { -#line 1331 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1342 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->u.binary.rhs->span, std_format("Variable type does not match assignment type, Expected type '%s', got '%s'", compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)))); } -#line 1335 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1346 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return lhs; } -#line 1338 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1349 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_expression_helper(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, compiler_types_Type *hint) { -#line 1339 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1350 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_IntLiteral: - m_27_0: + m_26_0: { -#line 1341 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1352 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)node->u.num_literal.suffix)) { -#line 1342 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1353 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_resolve_type(this, node->u.num_literal.suffix, false, true, true); } -#line 1344 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1355 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)hint) && compiler_types_Type_is_integer(hint)) { -#line 1344 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1355 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return hint; } -#line 1345 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1356 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_U32, node->span); } break; case compiler_ast_nodes_ASTType_FloatLiteral: - m_27_1: + m_26_1: { -#line 1348 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1359 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)node->u.num_literal.suffix)) { -#line 1349 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1360 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_resolve_type(this, node->u.num_literal.suffix, false, true, true); } -#line 1351 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1362 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)hint) && compiler_types_Type_is_float(hint)) { -#line 1351 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1362 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return hint; } -#line 1352 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1363 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_F32, node->span); } break; case compiler_ast_nodes_ASTType_StringLiteral: - m_27_2: + m_26_2: { -#line 1355 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_type_by_name(this, "str", node->span); } break; case compiler_ast_nodes_ASTType_Null: - m_27_3: + m_26_3: { -#line 1358 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1369 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)hint)) { -#line 1359 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if (hint->base==compiler_types_BaseType_Pointer) { - -#line 1359 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - return hint; - } - -#line 1360 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if (hint->base==compiler_types_BaseType_FunctionPtr) { +#line 1370 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + switch ((hint->base)) { + case compiler_types_BaseType_Pointer: + case compiler_types_BaseType_FunctionPtr: + case compiler_types_BaseType_Closure: + m_27_0: + { -#line 1360 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - return hint; +#line 1371 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + return hint; + } break; + default: + { + } break; } } -#line 1363 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1376 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_type_by_name(this, "untyped_ptr", node->span); } break; case compiler_ast_nodes_ASTType_Cast: - m_27_4: + m_26_4: { -#line 1366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1379 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.cast.lhs, NULL); -#line 1367 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1380 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1367 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1380 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1368 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1381 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *target = compiler_passes_typechecker_TypeChecker_resolve_type(this, node->u.cast.to, false, true, true); -#line 1369 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1382 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)target))) { -#line 1369 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1382 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1370 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1383 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.cast.to=target; -#line 1372 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1385 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return target; } break; case compiler_ast_nodes_ASTType_FormatStringLiteral: - m_27_5: + m_26_5: { -#line 1375 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1388 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_format_string(this, node); } break; case compiler_ast_nodes_ASTType_CharLiteral: - m_27_6: + m_26_6: { -#line 1378 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1391 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Char, node->span); } break; case compiler_ast_nodes_ASTType_BoolLiteral: - m_27_7: + m_26_7: { -#line 1381 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1394 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span); } break; case compiler_ast_nodes_ASTType_UnaryOp: - m_27_8: + m_26_8: { -#line 1383 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1396 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((node->u.unary.op)) { case compiler_ast_operators_Operator_PreIncrement: case compiler_ast_operators_Operator_PostIncrement: @@ -9366,191 +9416,203 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_expression_he m_28_0: { -#line 1385 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1398 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *lhs = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.unary.expr, NULL); -#line 1386 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1399 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)lhs))) { -#line 1386 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1399 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1387 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1400 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_is_integer(lhs)) && (lhs->base != compiler_types_BaseType_Pointer)) { -#line 1388 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1401 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot increment or decrement non-integer type: %s", compiler_types_Type_str(lhs)))); -#line 1389 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1402 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1391 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1404 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_ast_nodes_AST_is_lvalue(node->u.unary.expr))) { -#line 1392 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1405 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Can't perform %s on a non-lvalue", compiler_ast_operators_Operator_dbg(node->u.unary.op)))); } -#line 1394 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1407 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return lhs; } break; case compiler_ast_operators_Operator_Negate: m_28_1: { -#line 1397 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1410 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!((((bool)hint) && compiler_types_Type_is_numeric(hint)))) { -#line 1398 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1411 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" hint=compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_I32, node->span); } -#line 1400 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1413 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.unary.expr, hint); -#line 1401 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1401 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1402 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1415 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_is_numeric(typ))) { -#line 1403 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot negate non-numeric type: %s", compiler_types_Type_str(typ)))); -#line 1404 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1417 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1406 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1419 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return typ; } break; case compiler_ast_operators_Operator_BitwiseNot: m_28_2: { -#line 1409 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1422 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.unary.expr, hint); -#line 1410 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1423 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1410 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1423 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1411 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1424 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_is_integer(typ))) { -#line 1412 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1425 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot do bitwise-not on non-integer type: %s", compiler_types_Type_str(typ)))); -#line 1413 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1426 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1415 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1428 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return typ; } break; case compiler_ast_operators_Operator_IsNotNull: m_28_3: { -#line 1418 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1431 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.unary.expr, NULL); -#line 1419 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1432 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1419 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1432 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1420 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1433 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" typ=compiler_types_Type_unaliased(typ); -#line 1421 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if (typ->base != compiler_types_BaseType_Pointer) { +#line 1434 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + switch ((typ->base)) { + case compiler_types_BaseType_Pointer: + case compiler_types_BaseType_FunctionPtr: + case compiler_types_BaseType_Closure: + m_29_0: + { + } break; + default: + { -#line 1422 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Can only use ? on pointer types, got %s", compiler_types_Type_str(typ)))); +#line 1437 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Can only use ? on pointer types, got %s", compiler_types_Type_str(typ)))); + +#line 1438 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + return NULL; + } break; } -#line 1424 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1441 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span); } break; case compiler_ast_operators_Operator_Not: m_28_4: { -#line 1427 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1444 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.unary.expr, compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span)); -#line 1428 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1445 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1428 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1445 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1429 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1446 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (typ->base != compiler_types_BaseType_Bool) { -#line 1430 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1447 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot negate non-boolean type: %s", compiler_types_Type_str(typ)))); -#line 1431 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1448 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1433 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1450 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return typ; } break; case compiler_ast_operators_Operator_Address: m_28_5: { -#line 1436 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1453 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.unary.expr, NULL); -#line 1437 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1454 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1437 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1454 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1439 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1456 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((typ->base)) { case compiler_types_BaseType_Char: - m_29_0: + m_30_0: { -#line 1440 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1457 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_type_by_name(this, "str", node->span); } break; case compiler_types_BaseType_Void: - m_29_1: + m_30_1: { -#line 1441 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1458 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_type_by_name(this, "untyped_ptr", node->span); } break; default: { -#line 1443 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1460 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *ptr = compiler_types_Type_new_resolved(compiler_types_BaseType_Pointer, node->span); -#line 1444 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1461 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" ptr->u.ptr=typ; -#line 1445 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1462 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return ptr; } break; } @@ -9559,207 +9621,214 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_expression_he m_28_6: { -#line 1450 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1467 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.unary.expr, NULL); -#line 1451 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1468 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1451 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1468 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1452 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1469 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (typ->base != compiler_types_BaseType_Pointer) { -#line 1453 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1470 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot dereference non-pointer type: %s", compiler_types_Type_str(typ)))); -#line 1454 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1471 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1456 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1473 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return typ->u.ptr; } break; default: { -#line 1459 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1476 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Unknown unary operator in check_expression: %s", compiler_ast_operators_Operator_dbg(node->u.unary.op)))); -#line 1460 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1477 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } break; } } break; case compiler_ast_nodes_ASTType_Member: - m_27_9: + m_26_9: { -#line 1464 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1481 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_member(this, node, false, hint); } break; case compiler_ast_nodes_ASTType_SizeOf: - m_27_10: + m_26_10: { -#line 1466 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1483 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_resolve_type(this, node->u.size_of_type, false, true, true); -#line 1467 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1484 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1467 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1484 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1468 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1485 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.size_of_type=typ; -#line 1469 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1486 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_U32, node->span); } break; case compiler_ast_nodes_ASTType_If: - m_27_11: + m_26_11: { -#line 1472 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1489 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_if(this, node, true, hint); -#line 1473 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1490 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return node->etype; } break; case compiler_ast_nodes_ASTType_Block: - m_27_12: + m_26_12: { -#line 1476 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1493 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_block(this, node, true, hint); -#line 1477 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1494 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return node->etype; } break; case compiler_ast_nodes_ASTType_Match: - m_27_13: + m_26_13: { -#line 1480 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1497 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_match(this, node, true, hint); -#line 1481 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1498 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return node->etype; } break; case compiler_ast_nodes_ASTType_Identifier: case compiler_ast_nodes_ASTType_NSLookup: case compiler_ast_nodes_ASTType_Specialization: - m_27_14: + m_26_14: { -#line 1484 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1501 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *item = compiler_passes_typechecker_TypeChecker_resolve_scoped_identifier(this, node, true, hint, true); -#line 1485 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1502 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)item))) { -#line 1485 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1502 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1487 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1504 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" item=compiler_ast_scopes_Symbol_remove_alias(item); -#line 1488 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1505 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((item->type)) { case compiler_ast_scopes_SymbolType_Function: - m_30_0: + m_31_0: { -#line 1489 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1506 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return item->u.func->type; } break; case compiler_ast_scopes_SymbolType_Variable: case compiler_ast_scopes_SymbolType_Constant: - m_30_1: + m_31_1: { -#line 1490 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1507 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return item->u.var->type; } break; + case compiler_ast_scopes_SymbolType_ClosedVariable: + m_31_2: + { + +#line 1508 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + return item->u.closed_var.orig->type; + } break; case compiler_ast_scopes_SymbolType_EnumVariant: - m_30_2: + m_31_3: { -#line 1492 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1510 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_EnumVariant *variant = item->u.enum_var; -#line 1493 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1511 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_nodes_EnumVariant_num_fields(variant) != 0) { -#line 1494 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1512 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("%s needs %u fields to construct", item->display, compiler_ast_nodes_EnumVariant_num_fields(variant)))); -#line 1495 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1513 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1497 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1515 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return variant->parent->type; } break; case compiler_ast_scopes_SymbolType_TypeDef: - m_30_3: + m_31_4: { -#line 1501 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1519 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot use type `%s` as an expression", item->name))); -#line 1502 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1520 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } break; case compiler_ast_scopes_SymbolType_Structure: case compiler_ast_scopes_SymbolType_Namespace: case compiler_ast_scopes_SymbolType_Enum: - m_30_4: + m_31_5: { -#line 1505 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1523 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot use %s `%s` as an expression", compiler_ast_scopes_SymbolType_dbg(item->type), item->name))); -#line 1506 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1524 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } break; default: { -#line 1509 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1527 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Should not get %s `%s` as an expression", compiler_ast_scopes_SymbolType_dbg(item->type), item->name))); -#line 1510 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1528 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } break; } } break; case compiler_ast_nodes_ASTType_Call: - m_27_15: + m_26_15: { -#line 1514 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1532 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_call(this, node, hint); } break; case compiler_ast_nodes_ASTType_BinaryOp: - m_27_16: + m_26_16: { -#line 1518 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1536 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *lhs_node = node->u.binary.lhs; -#line 1519 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1537 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *rhs_node = node->u.binary.rhs; -#line 1520 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1538 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_operators_Operator op = node->u.binary.op; -#line 1521 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1539 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((op)) { case compiler_ast_operators_Operator_Plus: case compiler_ast_operators_Operator_Minus: @@ -9785,993 +9854,967 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_expression_he case compiler_ast_operators_Operator_RightShiftEquals: case compiler_ast_operators_Operator_LeftShift: case compiler_ast_operators_Operator_RightShift: - m_31_0: + m_32_0: { -#line 1546 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1564 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *lhs = compiler_passes_typechecker_TypeChecker_check_expression(this, lhs_node, NULL); -#line 1547 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1565 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *rhs = compiler_passes_typechecker_TypeChecker_check_expression(this, rhs_node, lhs); -#line 1548 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1566 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)lhs)) || !(((bool)rhs))) { -#line 1548 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1566 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1549 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1567 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_binary_op(this, node, compiler_types_Type_unaliased(lhs), compiler_types_Type_unaliased(rhs)); } break; case compiler_ast_operators_Operator_In: - m_31_1: + m_32_1: { -#line 1553 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1571 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *lhs = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.binary.lhs, NULL); -#line 1554 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1572 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *rhs = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.binary.rhs, NULL); -#line 1555 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)lhs)) || !(((bool)rhs))) { -#line 1555 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span); } -#line 1556 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1574 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_find_and_replace_overloaded_op(this, compiler_ast_operators_Operator_In, node, node->u.binary.rhs, node->u.binary.lhs, NULL); -#line 1557 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1575 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span); } break; case compiler_ast_operators_Operator_Index: - m_31_2: + m_32_2: { -#line 1559 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1577 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_index(this, node, hint, false); } break; case compiler_ast_operators_Operator_Assignment: - m_31_3: + m_32_3: { -#line 1561 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1579 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *lhs = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.binary.lhs, NULL); -#line 1562 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1580 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *rhs = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.binary.rhs, lhs); -#line 1563 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1581 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)lhs)) || !(((bool)rhs))) { -#line 1563 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1581 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1564 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1582 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_assignment(this, node, lhs, rhs); } break; case compiler_ast_operators_Operator_IndexAssign: - m_31_4: + m_32_4: { -#line 1571 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1589 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *index = node->u.binary.lhs; -#line 1572 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1590 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *arg1 = index->u.binary.lhs; -#line 1573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1591 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *arg2 = index->u.binary.rhs; -#line 1574 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1592 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *arg3 = node->u.binary.rhs; -#line 1575 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1593 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)compiler_passes_typechecker_TypeChecker_check_expression(this, arg1, NULL)))) { -#line 1575 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1593 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1576 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1594 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)compiler_passes_typechecker_TypeChecker_check_expression(this, arg2, NULL)))) { -#line 1576 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1594 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1579 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1597 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *arg3_hint = NULL; -#line 1580 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1598 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *arg1_typ = compiler_types_Type_unaliased(arg1->etype); -#line 1581 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1599 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (arg1_typ->base==compiler_types_BaseType_Pointer) { -#line 1582 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1600 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arg3_hint=arg1_typ->u.ptr; } -#line 1585 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1603 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)compiler_passes_typechecker_TypeChecker_check_expression(this, arg3, arg3_hint)))) { -#line 1585 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1603 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1587 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1605 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_find_and_replace_overloaded_op(this, compiler_ast_operators_Operator_IndexAssign, node, arg1, arg2, arg3); -#line 1588 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1606 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res)) { -#line 1588 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1606 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return res; } -#line 1590 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1608 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *lhs = compiler_passes_typechecker_TypeChecker_check_index(this, index, NULL, true); -#line 1591 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1609 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *rhs = compiler_passes_typechecker_TypeChecker_check_expression(this, arg3, lhs); -#line 1592 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1610 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)lhs)) || !(((bool)rhs))) { -#line 1592 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1610 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1593 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1611 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_assignment(this, node, lhs, rhs); } break; default: { -#line 1595 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1613 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_panic(std_format("Internal error: unhandled op in check_expression binary_op: %s", compiler_ast_nodes_ASTType_dbg(node->type))); } break; } } break; case compiler_ast_nodes_ASTType_ArrayLiteral: - m_27_17: + m_26_17: { -#line 1600 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1618 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *hint_elem_type = ((compiler_types_Type *)NULL); -#line 1601 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1619 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)hint) && hint->base==compiler_types_BaseType_Array) { -#line 1602 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1620 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" hint_elem_type=hint->u.arr.elem_type; } -#line 1605 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1623 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *elem_type = ((compiler_types_Type *)NULL); -#line 1606 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1624 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_span_Span first_span = std_span_Span_default(); -#line 1607 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1625 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(node->u.array_literal.elements); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 1607 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1625 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *elem = std_vector_Iterator__16_cur(&__iter); -#line 1607 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1625 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 1608 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1626 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_expression(this, elem, hint_elem_type); -#line 1609 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 1609 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 1611 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1629 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)elem_type))) { -#line 1612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" elem_type=typ; -#line 1614 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1632 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" hint_elem_type=elem_type; -#line 1615 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1633 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" first_span=elem->span; } else if (!(compiler_types_Type_eq(elem_type, typ, false))) { -#line 1618 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1636 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(elem->span, std_format("Expected type %s, but got %s", compiler_types_Type_str(elem_type), compiler_types_Type_str(typ)), first_span, std_format("First element was of type %s", compiler_types_Type_str(elem_type)))); -#line 1622 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1640 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } } } -#line 1625 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1643 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)elem_type))) { -#line 1626 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1644 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Array literal must have at least one element")); -#line 1627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1645 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1629 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1647 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *arr = compiler_types_Type_new_resolved(compiler_types_BaseType_Array, node->span); -#line 1630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1648 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arr->u.arr.elem_type=elem_type; -#line 1631 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1649 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arr->u.arr.size_known=true; -#line 1632 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1650 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arr->u.arr.size=node->u.array_literal.elements->size; -#line 1633 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1651 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return arr; } break; case compiler_ast_nodes_ASTType_CreateNew: - m_27_18: + m_26_18: { -#line 1636 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1654 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(this->o->program->did_cache_symbols)) { -#line 1637 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1655 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Cannot use `@new` without using stdlib")); } -#line 1640 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1658 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *child_typ = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.child, NULL); -#line 1641 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1659 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)child_typ))) { -#line 1641 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1659 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1643 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1661 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (child_typ->base==compiler_types_BaseType_Pointer) { -#line 1645 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1663 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Cannot use `@new` on a pointer type")); } -#line 1648 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1666 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_types_Type_new_resolved(compiler_types_BaseType_Pointer, node->span); -#line 1649 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1667 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" typ->u.ptr=child_typ; -#line 1650 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1668 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return typ; } break; case compiler_ast_nodes_ASTType_CreateClosure: - m_27_19: + m_26_19: { -#line 1653 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1671 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *clos = node->u.closure; -#line 1654 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1672 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + clos->scope=compiler_passes_generic_pass_GenericPass_ns(this->o)->scope; + +#line 1674 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" clos->closure_scope=compiler_passes_generic_pass_GenericPass_scope(this->o); -#line 1655 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - clos->closed_vars=std_map_Map__7_new(8); +#line 1675 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + clos->closed_vars=std_map_Map__4_new(8); -#line 1657 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1677 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_function_declaration(this, clos); -#line 1658 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1678 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_function(this, clos); -#line 1661 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_ast_nodes_Variable *param = compiler_ast_nodes_Variable_new(clos->type); - -#line 1662 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - param->sym=compiler_ast_scopes_Symbol_from_local_variable("ctx", param, node->span); - -#line 1663 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_vector_Vector__3_push_front(clos->params, param); - -#line 1665 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - printf("Closure type: %s\n", compiler_types_Type_str(clos->type)); - -#line 1666 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - printf("Closed vars:""\n"); - -#line 1667 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - for (std_map_Iterator__7 __iter = std_map_Map__7_iter(clos->closed_vars); std_map_Iterator__7_has_value(&__iter); std_map_Iterator__7_next(&__iter)) { - -#line 1667 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Item__7 *it = std_map_Iterator__7_cur(&__iter); - -#line 1667 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - { - -#line 1668 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - printf(" %s : %s\n", it->key, compiler_types_Type_str(it->value->type)); - } - } - -#line 1670 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1679 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return clos->type; } break; case compiler_ast_nodes_ASTType_Error: - m_27_20: + m_26_20: { -#line 1673 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1682 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return hint; } break; default: { -#line 1676 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1685 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Invalid expression in TypeChecker::check_expression: %s", compiler_ast_nodes_ASTType_dbg(node->type)))); -#line 1677 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1686 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } break; } } -#line 1684 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1693 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_call_dbg_on_enum_value(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST **node_ptr) { -#line 1685 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1694 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *node = (*node_ptr); -#line 1687 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1696 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)node->etype))) { -#line 1687 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1696 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1688 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1697 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((node->etype->base)) { case compiler_types_BaseType_Enum: - m_32_0: + m_33_0: { } break; default: { -#line 1690 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1699 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return node->etype; } break; } -#line 1693 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1702 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *member = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Member, node->span); -#line 1694 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1703 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" member->u.member.lhs=node; -#line 1695 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1704 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" member->u.member.rhs_name="dbg"; -#line 1696 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1705 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" member->u.member.rhs_span=node->span; -#line 1698 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1707 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *call = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Call, node->span); -#line 1699 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1708 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" call->u.call.callee=member; -#line 1700 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1709 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" call->u.call.args=std_vector_Vector__7_new(16); -#line 1702 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1711 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" (*node_ptr)=call; -#line 1704 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1713 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return compiler_passes_typechecker_TypeChecker_check_expression(this, call, NULL); } -#line 1707 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1716 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_match_for_enum(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Enum *enom, compiler_ast_nodes_AST *node, bool is_expr, compiler_types_Type *hint) { -#line 1708 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1717 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__11 *mapping = std_map_Map__11_new(8); -#line 1709 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1718 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" -#line 1711 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1720 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__24 *cases = node->u.match_stmt.cases; -#line 1712 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1721 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->returns=(cases->size > 0); -#line 1715 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1724 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__2 *current_args = std_map_Map__2_new(8); -#line 1716 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1725 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__24 __iter = std_vector_Vector__24_iter(cases); std_vector_Iterator__24_has_value(&__iter); std_vector_Iterator__24_next(&__iter)) { -#line 1716 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1725 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_MatchCase _case = std_vector_Iterator__24_cur(&__iter); -#line 1716 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1725 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 1717 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_vector_Vector__11 *conds = _case.conds; +#line 1726 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_vector_Vector__10 *conds = _case.conds; -#line 1719 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1728 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__2_clear(current_args); -#line 1720 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1729 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = 0; i < conds->size; i++) { -#line 1721 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_ast_nodes_MatchCond *cond = std_vector_Vector__11_at(conds, i); +#line 1730 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_ast_nodes_MatchCond *cond = std_vector_Vector__10_at(conds, i); -#line 1722 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1731 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *name; -#line 1724 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1733 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *expr = cond->expr; -#line 1725 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1734 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" expr->hint=enom->type; -#line 1726 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1735 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((expr->type)) { case compiler_ast_nodes_ASTType_Identifier: case compiler_ast_nodes_ASTType_NSLookup: case compiler_ast_nodes_ASTType_Specialization: - m_33_0: + m_34_0: { } break; default: { -#line 1729 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1738 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(expr->span, std_format("Expected value enum variant, got %s", compiler_ast_nodes_ASTType_dbg(expr->type)))); -#line 1730 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1739 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } break; } -#line 1734 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1743 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *resolved_sym = compiler_passes_typechecker_TypeChecker_resolve_scoped_identifier(this, expr, true, enom->type, true); -#line 1735 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1744 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)resolved_sym))) { -#line 1735 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1744 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 1736 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1745 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (resolved_sym->type != compiler_ast_scopes_SymbolType_EnumVariant) { -#line 1737 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1746 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(expr->span, std_format("Expected value enum variant, got %s (%s)", compiler_ast_scopes_SymbolType_dbg(resolved_sym->type), resolved_sym->display))); -#line 1740 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1749 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 1742 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1751 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_EnumVariant *variant = resolved_sym->u.enum_var; -#line 1744 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1753 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (variant->parent != enom) { -#line 1745 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1754 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(expr->span, "Condition does not match expression type", node->u.match_stmt.expr->span, std_format("Match expression is of type '%s'", compiler_types_Type_str(enom->type)))); } -#line 1750 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1759 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" expr->etype=enom->type; -#line 1752 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1761 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__19 *args = cond->args; -#line 1755 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1764 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (i==0) { -#line 1756 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1765 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)args)) { -#line 1757 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1766 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 j = 0; j < args->size; j+=1) { -#line 1758 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1767 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_MatchCondArg *arg = std_vector_Vector__19_at(args, j); -#line 1764 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1773 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *sp_field = compiler_ast_nodes_EnumVariant_get_specific_field(variant, arg->var->sym->name); -#line 1765 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1774 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *sh_field = compiler_ast_nodes_Enum_get_shared_field(enom, arg->var->sym->name); -#line 1766 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1775 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *field = ({ compiler_ast_nodes_Variable *__yield_0; -#line 1766 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1775 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)sp_field)) { __yield_0 = sp_field; } else if (((bool)sh_field)) { -#line 1769 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1778 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arg->is_shared=true; -#line 1770 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1779 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = sh_field; } else { -#line 1773 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1782 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->var->sym->span, std_format("Field `%s` does not exist in enum variant %s", arg->var->sym->name, variant->sym->display))); -#line 1776 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1785 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = NULL; } __yield_0; }); -#line 1779 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1788 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)field)) { -#line 1780 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1789 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arg->var->type=field->type; -#line 1781 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1790 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__2_insert(current_args, arg->var->sym->name, field->type); } } } } else { -#line 1789 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1798 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" u32 found_args = 0; -#line 1790 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1799 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 j = 0; ((bool)args) && (j < args->size); j+=1) { -#line 1791 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1800 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_MatchCondArg *arg = std_vector_Vector__19_at(args, j); -#line 1794 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1803 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *sp_field = compiler_ast_nodes_EnumVariant_get_specific_field(variant, arg->var->sym->name); -#line 1795 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1804 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *sh_field = compiler_ast_nodes_Enum_get_shared_field(enom, arg->var->sym->name); -#line 1796 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1805 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *field = ({ compiler_ast_nodes_Variable *__yield_0; -#line 1796 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1805 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)sp_field)) { __yield_0 = sp_field; } else if (((bool)sh_field)) { -#line 1799 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1808 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arg->is_shared=true; -#line 1800 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1809 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = sh_field; } else { -#line 1803 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1812 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->var->sym->span, "Field does not exist in enum variant")); -#line 1806 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1815 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = NULL; } __yield_0; }); -#line 1811 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1820 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)field)) { -#line 1812 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1821 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" arg->var->type=field->type; } -#line 1815 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1824 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Item__2 *item = std_map_Map__2_get_item(current_args, arg->var->sym->name); -#line 1816 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1825 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)item))) { -#line 1817 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1826 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->var->sym->span, "All conditions in this branch must have the same fields")); -#line 1820 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1829 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 1823 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1832 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" found_args+=1; -#line 1824 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1833 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)field) && !(compiler_types_Type_eq(item->value, field->type, false))) { -#line 1825 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1834 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(arg->var->sym->span, std_format("Field type does not match previous branch: %s", compiler_types_Type_str(item->value)))); -#line 1828 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1837 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } } -#line 1831 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1840 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (found_args != current_args->size) { -#line 1832 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1841 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(expr->span, "All conditions in this branch must have the same fields")); } } -#line 1838 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1847 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" name=expr->resolved_symbol->name; -#line 1839 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1848 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_MatchCond *prev = std_map_Map__11_get(mapping, name, NULL); -#line 1840 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1849 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)prev)) { -#line 1841 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1850 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(expr->span, "Duplicate condition name in match", prev->expr->span, "This condition was previously used here")); } -#line 1846 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1855 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__11_insert(mapping, name, cond); } -#line 1849 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1858 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)_case.body)) { -#line 1850 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1859 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, compiler_ast_scopes_Scope_new(compiler_passes_generic_pass_GenericPass_scope(this->o))); -#line 1851 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1860 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_map_Iterator__2 __iter = std_map_Map__2_iter(current_args); std_map_Iterator__2_has_value(&__iter); std_map_Iterator__2_next(&__iter)) { -#line 1851 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1860 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Item__2 *arg = std_map_Iterator__2_cur(&__iter); -#line 1851 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1860 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 1852 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1861 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *var = compiler_ast_nodes_Variable_new(arg->value); -#line 1853 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1862 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" var->sym=compiler_ast_scopes_Symbol_from_local_variable(arg->key, var, arg->value->span); -#line 1854 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1863 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_insert_into_scope_checked(this->o, var->sym, NULL); } } -#line 1857 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1866 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression_statement(this, node, _case.body, is_expr, hint); -#line 1858 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1867 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); } } } -#line 1862 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1871 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *defolt = node->u.match_stmt.defolt; -#line 1863 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1872 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (mapping->size != enom->variants->size) { -#line 1864 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1873 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer buf = std_buffer_Buffer_make(16); -#line 1865 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1874 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str(&buf, "Remaining fields: "); -#line 1866 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1875 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool first = true; -#line 1867 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1876 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(enom->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 1867 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1876 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 1867 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1876 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 1868 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1877 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(std_map_Map__11_contains(mapping, variant->sym->name))) { -#line 1869 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1878 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(first)) { -#line 1869 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1878 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str(&buf, " | "); } -#line 1870 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1879 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str(&buf, variant->sym->name); -#line 1871 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1880 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" first=false; } } } -#line 1874 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1883 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)defolt))) { -#line 1875 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1884 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(node->u.match_stmt.expr->span, std_format("Match does not cover all cases (Only %u of %u)", mapping->size, enom->variants->size), std_buffer_Buffer_str(buf))); } else { -#line 1880 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1889 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression_statement(this, node, defolt, is_expr, hint); } } else { -#line 1883 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1892 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)defolt)) { -#line 1884 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1893 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->u.match_stmt.defolt_span, "`else` case is not needed for this match")); } } -#line 1888 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1897 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_expr && !(((bool)node->etype))) { -#line 1889 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1898 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->u.match_stmt.match_span, "Expression-match must yield a value")); } /* defers */ -#line 1709 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1718 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__11_free(mapping); } -#line 1894 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1903 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_match_for_bool(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, bool is_expr, compiler_types_Type *hint) { -#line 1895 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1904 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Match *match_stmt = &node->u.match_stmt; -#line 1896 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1905 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if ((match_stmt->cases->size != 2) || ((bool)match_stmt->defolt)) { -#line 1897 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1906 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(match_stmt->match_span, "Match for bool must have exactly `true` and `false` cases")); } -#line 1900 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1909 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool seen_true = false; -#line 1901 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1910 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool seen_false = false; -#line 1902 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1911 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->returns=true; -#line 1904 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1913 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__24 __iter = std_vector_Vector__24_iter(match_stmt->cases); std_vector_Iterator__24_has_value(&__iter); std_vector_Iterator__24_next(&__iter)) { -#line 1904 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1913 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_MatchCase _case = std_vector_Iterator__24_cur(&__iter); -#line 1904 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1913 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 1905 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - for (std_vector_Iterator__11 __iter = std_vector_Vector__11_iter(_case.conds); std_vector_Iterator__11_has_value(&__iter); std_vector_Iterator__11_next(&__iter)) { +#line 1914 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(_case.conds); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { -#line 1905 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__11_cur(&__iter); +#line 1914 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__10_cur(&__iter); -#line 1905 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1914 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 1906 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1915 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *expr = cond->expr; -#line 1907 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1916 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, expr, NULL); -#line 1908 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1917 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (expr->type != compiler_ast_nodes_ASTType_BoolLiteral) { -#line 1909 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1918 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(expr->span, "Expected either `true` or `false`")); } else { -#line 1911 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1920 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (expr->u.bool_literal) { -#line 1912 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1921 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" seen_true=true; } else { -#line 1914 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1923 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" seen_false=true; } } } } -#line 1918 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1927 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)_case.body)) { -#line 1919 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1928 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression_statement(this, node, _case.body, is_expr, hint); } else { -#line 1934 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1943 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Case must have a body")); } } } -#line 1938 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1947 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(seen_true)) { -#line 1938 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1947 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(match_stmt->match_span, "Missing `true` case")); } -#line 1939 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1948 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(seen_false)) { -#line 1939 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1948 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(match_stmt->match_span, "Missing `false` case")); } -#line 1941 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1950 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_expr && !(((bool)node->etype))) { -#line 1942 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1951 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(match_stmt->match_span, "Expression-match must yield a value")); } } -#line 1946 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1955 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *compiler_passes_typechecker_TypeChecker_check_match_case_and_find_overload(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *expr, compiler_ast_nodes_MatchCond *cond) { -#line 1947 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1956 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *lhs = expr->etype; -#line 1948 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1957 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *rhs = cond->expr->etype; -#line 1950 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_types_Type_eq(lhs, rhs, false)) { -#line 1951 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1960 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_types_Type_is_numeric_or_char(lhs)) { -#line 1951 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1960 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1952 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1961 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (lhs->base==compiler_types_BaseType_Bool) { -#line 1952 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1961 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } } -#line 1956 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1965 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_operators_OperatorOverload overload = {0}; -#line 1957 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1966 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.op=compiler_ast_operators_Operator_Equals; -#line 1958 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1967 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.type1=lhs; -#line 1959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1968 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.type2=rhs; -#line 1960 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1969 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *func = std_map_Map__5_get(this->o->program->operator_overloads, overload, NULL); -#line 1961 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1970 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)func))) { -#line 1962 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1971 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(cond->expr->span, std_format("Cannot match %s with this case: %s", compiler_types_Type_str(lhs), compiler_types_Type_str(rhs)), expr->span, std_format("Match expression is of type %s", compiler_types_Type_str(lhs)))); -#line 1966 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1975 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1969 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1978 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *ret = compiler_types_Type_unaliased(func->return_type); -#line 1970 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1979 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (ret->base != compiler_types_BaseType_Bool) { -#line 1971 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1980 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(cond->expr->span, std_format("Overload %s must return a boolean", func->sym->display), func->sym->span, std_format("Defined here, return type is %s", compiler_types_Type_str(ret)))); -#line 1975 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1984 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 1978 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1987 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" cond->cmp_fn=func; -#line 1979 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1988 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return func; } -#line 1983 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1992 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_match(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, bool is_expr, compiler_types_Type *hint) { -#line 1984 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1993 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Match *match_stmt = &node->u.match_stmt; -#line 1985 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1994 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *expr = match_stmt->expr; -#line 1986 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1995 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *expr_type = compiler_passes_typechecker_TypeChecker_check_expression(this, expr, NULL); -#line 1987 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1996 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)expr_type))) { -#line 1988 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1997 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(match_stmt->match_span, "Match statement must have a valid expression")); -#line 1989 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 1998 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 1992 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2001 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((expr_type->base)) { case compiler_types_BaseType_Enum: - m_34_0: + m_35_0: { -#line 1994 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2003 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_match_for_enum(this, expr_type->u.enom, node, is_expr, hint); -#line 1995 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2004 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } break; case compiler_types_BaseType_Bool: - m_34_1: + m_35_1: { -#line 1998 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2007 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_match_for_bool(this, node, is_expr, hint); -#line 1999 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2008 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } break; default: @@ -10779,1301 +10822,1301 @@ void compiler_passes_typechecker_TypeChecker_check_match(compiler_passes_typeche } break; } -#line 2004 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2013 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__24 *cases = match_stmt->cases; -#line 2005 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2014 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->returns=(cases->size > 0); -#line 2007 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2016 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__24 __iter = std_vector_Vector__24_iter(cases); std_vector_Iterator__24_has_value(&__iter); std_vector_Iterator__24_next(&__iter)) { -#line 2007 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2016 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_MatchCase _case = std_vector_Iterator__24_cur(&__iter); -#line 2007 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2016 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2008 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - for (std_vector_Iterator__11 __iter = std_vector_Vector__11_iter(_case.conds); std_vector_Iterator__11_has_value(&__iter); std_vector_Iterator__11_next(&__iter)) { +#line 2017 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(_case.conds); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { -#line 2008 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__11_cur(&__iter); +#line 2017 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__10_cur(&__iter); -#line 2008 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2017 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2009 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2018 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *cond_expr = cond->expr; -#line 2010 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2019 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *cond_type = compiler_passes_typechecker_TypeChecker_check_expression(this, cond_expr, expr_type); -#line 2011 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2020 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)cond_type))) { -#line 2011 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2020 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 2013 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2022 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *cmp_fn = compiler_passes_typechecker_TypeChecker_check_match_case_and_find_overload(this, expr, cond); -#line 2014 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2023 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)cmp_fn)) { -#line 2015 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2024 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" match_stmt->is_custom_match=true; } else { -#line 2018 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2027 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool is_constant = (((bool)cond_expr->resolved_symbol) && cond_expr->resolved_symbol->type==compiler_ast_scopes_SymbolType_Constant); -#line 2020 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2029 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((cond_expr->type != compiler_ast_nodes_ASTType_IntLiteral) && (cond_expr->type != compiler_ast_nodes_ASTType_CharLiteral)) && !(is_constant)) { -#line 2022 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2031 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(cond_expr->span, "Match condition must use only literals")); } } } } -#line 2027 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2036 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)_case.body)) { -#line 2028 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2037 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression_statement(this, node, _case.body, is_expr, hint); } } } -#line 2032 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2041 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *defolt = node->u.match_stmt.defolt; -#line 2034 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2043 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)defolt))) { -#line 2035 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2044 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->u.match_stmt.match_span, "`else` case is missing")); } else { -#line 2037 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2046 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression_statement(this, node, defolt, is_expr, hint); } -#line 2040 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2049 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if ((is_expr && !(((bool)node->etype))) && !(node->returns)) { -#line 2041 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2050 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Expression-match must yield a value")); } } -#line 2045 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2054 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_if(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, bool is_expr, compiler_types_Type *hint) { -#line 2047 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2056 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->returns=true; -#line 2049 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2058 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__23 __iter = std_vector_Vector__23_iter(node->u.if_stmt.branches); std_vector_Iterator__23_has_value(&__iter); std_vector_Iterator__23_next(&__iter)) { -#line 2049 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2058 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_IfBranch branch = std_vector_Iterator__23_cur(&__iter); -#line 2049 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2058 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2050 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2059 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *cond_type = compiler_passes_typechecker_TypeChecker_check_expression(this, branch.cond, compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span)); -#line 2051 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2060 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)cond_type) && (cond_type->base != compiler_types_BaseType_Bool)) { -#line 2052 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2061 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(branch.cond->span, "Condition must be a boolean", std_format("Got type '%s'", compiler_types_Type_str(cond_type)))); } -#line 2057 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2066 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression_statement(this, node, branch.body, is_expr, hint); } } -#line 2060 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2069 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)node->u.if_stmt.els)) { -#line 2061 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2070 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *else_stmt = node->u.if_stmt.els; -#line 2062 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2071 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression_statement(this, node, else_stmt, is_expr, hint); } else if (is_expr) { -#line 2065 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2074 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->u.if_stmt.if_span, "If expressions must have an else branch")); } else { -#line 2071 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2080 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->returns=false; } } -#line 2075 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2084 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_expression_statement(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, compiler_ast_nodes_AST *body, bool is_expr, compiler_types_Type *hint) { -#line 2076 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2085 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((body->type)) { case compiler_ast_nodes_ASTType_Match: - m_35_0: + m_36_0: { -#line 2078 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2087 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_match(this, body, is_expr, hint); } break; case compiler_ast_nodes_ASTType_If: - m_35_1: + m_36_1: { -#line 2079 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2088 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_if(this, body, is_expr, hint); } break; case compiler_ast_nodes_ASTType_Block: - m_35_2: + m_36_2: { -#line 2081 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2090 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_block(this, body, is_expr, hint); } break; default: { -#line 2083 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2092 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_expr) { -#line 2084 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2093 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, body, hint); } else { -#line 2086 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2095 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_statement(this, body); } } break; } -#line 2091 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->returns=(node->returns && body->returns); -#line 2093 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2102 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(is_expr)) { -#line 2093 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2102 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2098 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2107 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *ret = body->etype; -#line 2099 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (body->returns) { } else if (!(((bool)ret))) { -#line 2102 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2111 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_span_Span start_span = (std_span_Span){.start=body->span.start, .end=body->span.start}; -#line 2103 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2112 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(start_span, std_format("Must yield a value in this branch, body type is %s", compiler_ast_nodes_ASTType_dbg(body->type)))); } else if (!(((bool)node->etype))) { -#line 2105 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2114 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->etype=ret; } else if (!(compiler_types_Type_eq(node->etype, ret, false))) { -#line 2107 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2116 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *yield_stmt = (node->type==compiler_ast_nodes_ASTType_Block ? node->u.block.final_stmt : body); -#line 2108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)yield_stmt))) { -#line 2108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" yield_stmt=body; } -#line 2109 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2118 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(compiler_ast_nodes_AST_display_span(yield_stmt), "Yield type of branch doesn't match previous branches", std_format("Expected type '%s', got '%s'", compiler_types_Type_str(node->etype), compiler_types_Type_str(ret)))); } } -#line 2117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2126 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_while(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node) { -#line 2118 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Scope *scope = compiler_ast_scopes_Scope_new(compiler_passes_typechecker_TypeChecker_scope(this)); -#line 2119 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2128 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" scope->loop_count+=1; -#line 2121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2130 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, scope); -#line 2122 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2131 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *cond = node->u.loop.cond; -#line 2123 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2132 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *body = node->u.loop.body; -#line 2125 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2134 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *cond_type = compiler_passes_typechecker_TypeChecker_check_expression(this, cond, compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span)); -#line 2126 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2135 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)cond_type) && (cond_type->base != compiler_types_BaseType_Bool)) { -#line 2127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2136 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(cond->span, "Condition must be a boolean", std_format("Got type '%s'", compiler_types_Type_str(cond_type)))); } -#line 2132 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2141 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_statement(this, body); -#line 2133 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); } -#line 2136 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2145 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_for(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node) { -#line 2137 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2146 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Scope *scope = compiler_ast_scopes_Scope_new(compiler_passes_typechecker_TypeChecker_scope(this)); -#line 2138 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2147 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" scope->loop_count+=1; -#line 2139 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, scope); -#line 2141 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *init = node->u.loop.init; -#line 2142 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2151 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *cond = node->u.loop.cond; -#line 2143 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2152 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *step = node->u.loop.step; -#line 2144 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2153 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *body = node->u.loop.body; -#line 2146 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2155 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)init)) { -#line 2146 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2155 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_statement(this, init); } -#line 2148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2157 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)cond)) { -#line 2149 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2158 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *cond_type = compiler_passes_typechecker_TypeChecker_check_expression(this, cond, compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span)); -#line 2150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2159 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)cond_type) && (cond_type->base != compiler_types_BaseType_Bool)) { -#line 2151 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2160 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(cond->span, "Condition must be a boolean", std_format("Got type '%s'", compiler_types_Type_str(cond_type)))); } } -#line 2158 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2167 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)step)) { -#line 2158 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2167 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, step, NULL); } -#line 2159 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2168 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)body)) { -#line 2159 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2168 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_statement(this, body); } -#line 2161 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); } -#line 2164 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2173 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_statement(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node) { -#line 2165 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2174 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_Return: - m_36_0: + m_37_0: { -#line 2167 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2176 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *cur_func = compiler_passes_typechecker_TypeChecker_scope(this)->cur_func; -#line 2168 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2177 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)cur_func))) { -#line 2169 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Cannot return from outside a function")); -#line 2170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2179 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2173 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2182 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *expected = cur_func->return_type; -#line 2175 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2184 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = NULL; -#line 2176 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2185 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *child = node->u.ret.expr; -#line 2177 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2186 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_span_Span ret_span = node->u.ret.return_span; -#line 2178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2187 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)child)) { -#line 2178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2187 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" res=compiler_passes_typechecker_TypeChecker_check_expression(this, child, expected); } -#line 2180 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2189 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)child) && child->returns) { } else if (expected->base==compiler_types_BaseType_Void) { -#line 2185 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)node->u.child)) { -#line 2186 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2195 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(ret_span, "Cannot return a value from a void function")); } } else if (((bool)child)) { -#line 2189 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2198 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res) && !(compiler_types_Type_eq(res, expected, false))) { -#line 2190 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2199 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(ret_span, std_format("Return type %s does not match function return type %s", compiler_types_Type_str(res), compiler_types_Type_str(expected)))); } } else { -#line 2193 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2202 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(ret_span, "Expected a return value for non-void function")); } -#line 2195 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2204 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->returns=true; } break; case compiler_ast_nodes_ASTType_Assert: - m_36_1: + m_37_1: { -#line 2198 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2207 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *expr = node->u.assertion.expr; -#line 2199 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2208 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *expr_typ = compiler_passes_typechecker_TypeChecker_check_expression(this, expr, compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span)); -#line 2200 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2209 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)expr_typ) && (expr_typ->base != compiler_types_BaseType_Bool)) { -#line 2201 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2210 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Can only assert boolean types, got %s", compiler_types_Type_str(expr_typ)))); } -#line 2204 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2213 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)node->u.assertion.msg)) { -#line 2205 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2214 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *msg_typ = compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.assertion.msg, NULL); -#line 2206 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)msg_typ) && (msg_typ != compiler_passes_typechecker_TypeChecker_get_type_by_name(this, "str", node->span))) { -#line 2207 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2216 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Can only assert strings, got %s", compiler_types_Type_str(msg_typ)))); } } -#line 2211 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2220 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (expr->type==compiler_ast_nodes_ASTType_BoolLiteral && expr->u.bool_literal==false) { -#line 2212 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->returns=true; } } break; case compiler_ast_nodes_ASTType_Defer: - m_36_2: + m_37_2: { -#line 2215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2224 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_statement(this, node->u.child); } break; case compiler_ast_nodes_ASTType_Yield: - m_36_3: + m_37_3: { -#line 2217 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_passes_typechecker_TypeChecker_scope(this)->can_yield)) { -#line 2218 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2227 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Cannot yield here")); } -#line 2220 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2229 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->etype=compiler_passes_typechecker_TypeChecker_check_expression(this, node->u.child, NULL); } break; case compiler_ast_nodes_ASTType_Import: - m_36_4: + m_37_4: { -#line 2223 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2232 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_handle_import_statement(this, node); } break; case compiler_ast_nodes_ASTType_Break: case compiler_ast_nodes_ASTType_Continue: - m_36_5: + m_37_5: { -#line 2226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_passes_typechecker_TypeChecker_scope(this)->loop_count==0) { -#line 2227 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("%s statement outside of loop", compiler_ast_nodes_ASTType_dbg(node->type)))); } } break; case compiler_ast_nodes_ASTType_If: - m_36_6: + m_37_6: { -#line 2230 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2239 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_if(this, node, false, NULL); } break; case compiler_ast_nodes_ASTType_While: - m_36_7: + m_37_7: { -#line 2231 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2240 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_while(this, node); } break; case compiler_ast_nodes_ASTType_For: - m_36_8: + m_37_8: { -#line 2232 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2241 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_for(this, node); } break; case compiler_ast_nodes_ASTType_Block: - m_36_9: + m_37_9: { -#line 2233 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2242 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_block(this, node, false, NULL); } break; case compiler_ast_nodes_ASTType_Match: - m_36_10: + m_37_10: { -#line 2234 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_match(this, node, false, NULL); } break; case compiler_ast_nodes_ASTType_VarDeclaration: - m_36_11: + m_37_11: { -#line 2236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *var = node->u.var_decl; -#line 2237 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2246 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *res = compiler_ast_scopes_Scope_lookup_local(compiler_passes_typechecker_TypeChecker_scope(this), var->sym->name); -#line 2238 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2247 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res)) { -#line 2239 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Variable %s already exists in this scope", var->sym->name))); -#line 2240 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2249 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2252 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *sym = var->sym; -#line 2244 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2253 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Scope_insert(compiler_passes_typechecker_TypeChecker_scope(this), var->sym->name, sym); -#line 2246 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2255 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool is_inferred = var->type==NULL; -#line 2247 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2256 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_inferred) { -#line 2248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" var->type=compiler_types_Type_new_unresolved("", node->span); } else { -#line 2251 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" var->type=compiler_passes_typechecker_TypeChecker_resolve_type(this, var->type, false, true, true); -#line 2252 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)var->type))) { -#line 2252 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } } -#line 2255 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *init = node->u.var_decl->default_value; -#line 2256 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2265 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)init)) { -#line 2257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2266 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_check_expression(this, init, var->type); -#line 2258 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)res))) { -#line 2258 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2269 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_inferred) { -#line 2261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2270 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" var->type=res; } else if (!(compiler_types_Type_eq(res, var->type, false))) { -#line 2263 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2272 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(init->span, std_format("Variable %s has type %s but initializer has type %s", var->sym->name, compiler_types_Type_str(var->type), compiler_types_Type_str(res)))); } } else if (is_inferred) { -#line 2266 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2275 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Variable %s has no type and no initializer", var->sym->name))); } } break; default: { -#line 2270 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2279 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, node, NULL); } break; } } -#line 2275 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2284 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_function(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Function *func) { -#line 2276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2285 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_doc_links(this, func->sym); -#line 2278 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2287 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool is_templated = false; -#line 2279 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2288 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (func->kind==compiler_ast_nodes_FunctionKind_Method && func->parent_type->base==compiler_types_BaseType_Structure) { -#line 2280 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2289 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Structure *struc = func->parent_type->u.struc; -#line 2281 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2290 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_scopes_Symbol_is_templated(struc->sym)) { -#line 2281 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2290 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" is_templated=true; } } -#line 2283 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2292 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_scopes_Symbol_is_templated(func->sym)) { -#line 2283 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2292 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" is_templated=true; } -#line 2284 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2293 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (func->checked) { -#line 2284 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2293 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2285 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2294 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" func->checked=true; -#line 2287 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2296 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Scope *new_scope = compiler_ast_scopes_Scope_new(func->scope); -#line 2288 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2297 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__3 *params = func->params; -#line 2294 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2303 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool was_in_template_instance = this->in_template_instance; -#line 2295 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2304 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" this->in_template_instance=(this->in_template_instance || compiler_ast_nodes_Function_is_template_instance(func)); -#line 2296 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" -#line 2304 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2313 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" u32 error_count_before = this->o->program->errors->size; -#line 2306 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(params); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 2306 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *param = std_vector_Iterator__3_cur(&__iter); -#line 2306 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2307 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2316 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)param->type))) { -#line 2307 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2316 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 2308 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2317 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *default_expr = param->default_value; -#line 2309 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2318 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)default_expr)) { -#line 2313 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2322 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *default_type = compiler_passes_typechecker_TypeChecker_check_expression(this, default_expr, param->type); -#line 2315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2324 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)default_type) && !(compiler_types_Type_eq(default_type, param->type, false))) { -#line 2316 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2325 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(default_expr->span, std_format("Default argument has type %s but expected %s", compiler_types_Type_str(default_type), compiler_types_Type_str(param->type)))); } } -#line 2320 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2329 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__4_insert(new_scope->items, param->sym->name, param->sym); } } -#line 2322 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2331 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" new_scope->cur_func=func; -#line 2324 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2333 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)func->sym) && func->sym->is_extern) { -#line 2324 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2333 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" /* defers */ -#line 2296 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" this->in_template_instance=was_in_template_instance; return; } -#line 2326 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2335 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, new_scope); -#line 2327 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2336 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_statement(this, func->body); -#line 2328 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2337 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if ((!(func->body->returns) && (func->return_type->base != compiler_types_BaseType_Void)) && !(str_eq(func->sym->full_name, "main"))) { -#line 2329 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2338 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(func->sym->span, "Function does not always return")); } -#line 2331 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2340 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); -#line 2334 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2343 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_templated) { -#line 2335 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2344 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (this->o->program->errors->size > error_count_before) { -#line 2336 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2345 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" this->o->program->errors->size=error_count_before; } } /* defers */ -#line 2296 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" this->in_template_instance=was_in_template_instance; } -#line 2341 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2350 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_handle_imports(compiler_passes_typechecker_TypeChecker *this, compiler_ast_program_Namespace *ns, bool is_global) { -#line 2342 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2351 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_namespace(this->o, ns); -#line 2343 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2352 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, ns->scope); -#line 2345 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2354 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 2345 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2354 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_program_Namespace *child = std_map_ValueIterator__3_cur(&__iter); -#line 2345 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2354 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2346 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2355 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_handle_imports(this, child, false); } } -#line 2349 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2358 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->imports); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 2349 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2358 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *import_ = std_vector_Iterator__16_cur(&__iter); -#line 2349 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2358 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2350 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2359 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_handle_import_statement(this, import_); } } -#line 2353 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2362 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); -#line 2354 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2363 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_namespace(this->o); } -#line 2357 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_globals(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, bool is_const) { -#line 2358 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2367 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *var = node->u.var_decl; -#line 2359 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2368 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_doc_links(this, var->sym); -#line 2361 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2370 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *init = node->u.var_decl->default_value; -#line 2362 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2371 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (is_const) { -#line 2363 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2372 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)init)) { -#line 2364 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2373 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_const_expression(this, init, NULL); } else if (!(node->u.var_decl->sym->is_extern)) { -#line 2366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2375 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Constant must have an initializer")); } } else if (((bool)init)) { -#line 2370 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2379 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *init_type = compiler_passes_typechecker_TypeChecker_check_expression(this, init, var->type); -#line 2371 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2380 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)init_type)) || !(((bool)var->type))) { -#line 2371 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2380 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2373 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2382 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_eq(init_type, var->type, false))) { -#line 2374 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2383 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(init->span, std_format("Variable %s has type %s but got %s", var->sym->name, compiler_types_Type_str(var->type), compiler_types_Type_str(init_type)))); } } } -#line 2380 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2389 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_namespace(compiler_passes_typechecker_TypeChecker *this, compiler_ast_program_Namespace *ns) { -#line 2381 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2390 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, ns->scope); -#line 2382 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2391 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_namespace(this->o, ns); -#line 2383 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2392 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_doc_links(this, ns->sym); -#line 2385 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2394 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(ns->functions); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 2385 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2394 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *func = std_vector_Iterator__6_cur(&__iter); -#line 2385 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2394 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2386 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2395 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_function(this, func); } } -#line 2389 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2398 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->constants); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 2389 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2398 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *node = std_vector_Iterator__16_cur(&__iter); -#line 2389 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2398 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2390 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2399 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_globals(this, node, true); } } -#line 2393 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2402 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->variables); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 2393 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2402 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *node = std_vector_Iterator__16_cur(&__iter); -#line 2393 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2402 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2394 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2403 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_globals(this, node, false); } } -#line 2397 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2406 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__15 __iter = std_vector_Vector__15_iter(ns->enums); std_vector_Iterator__15_has_value(&__iter); std_vector_Iterator__15_next(&__iter)) { -#line 2397 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2406 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Enum *enom = std_vector_Iterator__15_cur(&__iter); -#line 2397 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2406 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2399 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2408 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_doc_links(this, enom->sym); -#line 2400 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2409 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(enom->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 2400 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2409 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 2400 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2409 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2401 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2410 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_doc_links(this, variant->sym); } } } } -#line 2405 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 2405 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_program_Namespace *child = std_map_ValueIterator__3_cur(&__iter); -#line 2405 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2406 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2415 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_namespace(this, child); } } -#line 2408 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2417 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_namespace(this->o); -#line 2409 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2418 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); } -#line 2413 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2422 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_resolve_doc_links(compiler_passes_typechecker_TypeChecker *this, compiler_ast_scopes_Symbol *sym) { -#line 2414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2423 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!((((bool)sym) && ((bool)sym->comment)))) { -#line 2414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2423 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2425 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer buffer = std_buffer_Buffer_make(16); -#line 2417 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2426 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" u32 prev = 0; -#line 2418 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2427 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *doc = sym->comment; -#line 2419 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2428 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" u32 doc_len = strlen(doc); -#line 2420 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2429 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = 0; i < (doc_len - 1); i++) { -#line 2421 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2430 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (doc[i]=='\\') { -#line 2422 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2431 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" i++; } else if (doc[i]==doc[(i + 1)] && doc[(i + 1)]=='{') { -#line 2424 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2433 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str_f(&buffer, str_substring(doc, prev, (i - prev))); -#line 2425 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2434 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" prev=(i + 2); -#line 2426 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2435 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" i++; } else if (doc[i]==doc[(i + 1)] && doc[(i + 1)]=='}') { -#line 2429 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2438 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *part = str_substring(doc, prev, (i - prev)); -#line 2434 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2443 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(this->o->program->check_doc_links)) { -#line 2435 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2444 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_char(&buffer, '`'); -#line 2436 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2445 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str_f(&buffer, part); -#line 2437 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2446 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_char(&buffer, '`'); -#line 2438 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2447 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" prev=(i + 2); -#line 2439 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2448 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" i++; -#line 2440 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2449 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 2444 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2453 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_lexer_Lexer lexer = compiler_lexer_Lexer_make(part, sym->span.start.filename); -#line 2445 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2454 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_span_Span span = (std_span_Span){.start=sym->comment_loc, .end=sym->comment_loc}; -#line 2446 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_vector_Vector__12 *tokens = compiler_lexer_Lexer_lex(&lexer); +#line 2455 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_vector_Vector__11 *tokens = compiler_lexer_Lexer_lex(&lexer); -#line 2448 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2457 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (lexer.errors->size > 0) { -#line 2449 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2458 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(span, std_format("Invalid link: '%s' in this doc", part))); -#line 2450 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2459 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2453 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2462 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_parser_Parser parser = compiler_parser_Parser_make(this->o->program, compiler_passes_generic_pass_GenericPass_ns(this->o)); -#line 2454 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2463 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" parser.tokens=tokens; -#line 2455 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2464 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" parser.curr=0; -#line 2457 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2466 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *ident = compiler_parser_Parser_parse_scoped_identifier(&parser, true); -#line 2458 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2467 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)ident))) { -#line 2459 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2468 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(span, std_format("Invalid link: '%s' in this doc", part))); -#line 2460 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2469 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2463 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2472 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *sym = compiler_passes_typechecker_TypeChecker_resolve_scoped_identifier(this, ident, false, NULL, true); -#line 2464 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2473 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)sym))) { -#line 2465 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2474 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(span, std_format("Couldn't find symbol '%s' in this doc link", part))); -#line 2466 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2475 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2469 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2478 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *linked_part = ({ char *__yield_0; -#line 2469 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2478 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Structure: - m_37_0: + m_38_0: { -#line 2471 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2480 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = sym->u.struc->type; -#line 2473 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2482 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)typ->template_instance)) { -#line 2474 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2483 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_note(span, std_format("Cannot link directly to specialezed type '%s'", part), "Try doing `{{A}}<{{B}}>` instead of `{{A}}`")); -#line 2478 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2487 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2480 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2489 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = std_format("%x", sym->u.struc->type); } break; case compiler_ast_scopes_SymbolType_Function: - m_37_1: + m_38_1: { __yield_0 = std_format("%x", sym->u.func); } break; case compiler_ast_scopes_SymbolType_Enum: - m_37_2: + m_38_2: { __yield_0 = std_format("%x", sym->u.enom); } break; case compiler_ast_scopes_SymbolType_EnumVariant: - m_37_3: + m_38_3: { __yield_0 = std_format("%x", sym->u.enum_var); } break; case compiler_ast_scopes_SymbolType_TypeDef: - m_37_4: + m_38_4: { __yield_0 = std_format("%x", sym->u.type_def); } break; case compiler_ast_scopes_SymbolType_Variable: - m_37_5: + m_38_5: { __yield_0 = std_format("%x", sym->u.var); } break; case compiler_ast_scopes_SymbolType_Constant: - m_37_6: + m_38_6: { __yield_0 = std_format("%x", sym->u.var); } break; case compiler_ast_scopes_SymbolType_Namespace: - m_37_7: + m_38_7: { __yield_0 = std_format("%x", sym->u.ns); } break; default: { -#line 2490 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2499 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(span, std_format("Cannot link to symbol of type %s", compiler_ast_scopes_SymbolType_dbg(sym->type)))); -#line 2491 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2500 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } break; } __yield_0; }); -#line 2495 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2504 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str(&buffer, "{{"); -#line 2496 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2505 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str_f(&buffer, linked_part); -#line 2497 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2506 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str(&buffer, "}}"); -#line 2498 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2507 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_mem_free(part); -#line 2500 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2509 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" prev=(i + 2); -#line 2501 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2510 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" i++; } } -#line 2504 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2513 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_buffer_Buffer_write_str_f(&buffer, str_substring(doc, prev, (doc_len - prev))); -#line 2505 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2514 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" sym->comment=std_buffer_Buffer_str(buffer); } -#line 2508 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2517 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_const_expression(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, compiler_types_Type *hint) { -#line 2509 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2518 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = ({ compiler_types_Type *__yield_0; -#line 2509 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2518 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_Identifier: case compiler_ast_nodes_ASTType_NSLookup: - m_38_0: + m_39_0: { -#line 2511 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2520 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *sym = compiler_passes_typechecker_TypeChecker_resolve_scoped_identifier(this, node, true, hint, true); -#line 2512 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2521 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)sym))) { -#line 2512 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2521 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 2513 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2522 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (sym->type != compiler_ast_scopes_SymbolType_Constant) { -#line 2514 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2523 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(node->span, "Cannot use a non-constant value in a constant expression", sym->span, "Value was defined here")); -#line 2518 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2527 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return hint; } -#line 2520 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2529 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = sym->u.var->type; } break; case compiler_ast_nodes_ASTType_IntLiteral: - m_38_1: + m_39_1: { __yield_0 = compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_I32, node->span); } break; case compiler_ast_nodes_ASTType_FloatLiteral: - m_38_2: + m_39_2: { __yield_0 = compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_F32, node->span); } break; case compiler_ast_nodes_ASTType_BoolLiteral: - m_38_3: + m_39_3: { __yield_0 = compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Bool, node->span); } break; case compiler_ast_nodes_ASTType_CharLiteral: - m_38_4: + m_39_4: { __yield_0 = compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Char, node->span); } break; case compiler_ast_nodes_ASTType_StringLiteral: - m_38_5: + m_39_5: { __yield_0 = compiler_passes_typechecker_TypeChecker_get_type_by_name(this, "str", node->span); } break; case compiler_ast_nodes_ASTType_BinaryOp: - m_38_6: + m_39_6: { -#line 2528 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2537 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *lhs = compiler_passes_typechecker_TypeChecker_check_const_expression(this, node->u.binary.lhs, NULL); -#line 2529 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2538 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *rhs = compiler_passes_typechecker_TypeChecker_check_const_expression(this, node->u.binary.rhs, NULL); -#line 2530 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2539 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)lhs)) || !(((bool)rhs))) { -#line 2530 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2539 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 2532 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2541 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (lhs->base==compiler_types_BaseType_Pointer || rhs->base==compiler_types_BaseType_Pointer) { -#line 2533 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2542 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Cannot do pointer arithmetic in constant expressions")); } -#line 2535 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2544 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = compiler_passes_typechecker_TypeChecker_check_binary_op(this, node, compiler_types_Type_unaliased(lhs), compiler_types_Type_unaliased(rhs)); } break; case compiler_ast_nodes_ASTType_UnaryOp: - m_38_7: + m_39_7: { __yield_0 = ({ compiler_types_Type *__yield_1; -#line 2537 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2546 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((node->u.unary.op)) { case compiler_ast_operators_Operator_BitwiseNot: case compiler_ast_operators_Operator_Negate: - m_39_0: + m_40_0: { -#line 2539 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2548 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)hint)) || !(compiler_types_Type_is_numeric(hint))) { -#line 2540 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2549 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" hint=compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_I32, node->span); } -#line 2542 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2551 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_passes_typechecker_TypeChecker_check_const_expression(this, node->u.unary.expr, hint); -#line 2543 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2552 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)typ))) { -#line 2543 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2552 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 2544 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2553 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_is_numeric(typ))) { -#line 2545 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2554 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Cannot negate non-numeric type: %s", compiler_types_Type_str(typ)))); -#line 2546 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2555 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } -#line 2548 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2557 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_1 = typ; } break; default: { -#line 2551 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2560 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("Unsupported operator in constant expression: %s", compiler_ast_operators_Operator_dbg(node->u.unary.op)))); -#line 2552 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2561 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } break; } @@ -12083,337 +12126,337 @@ compiler_types_Type *compiler_passes_typechecker_TypeChecker_check_const_express default: { -#line 2556 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2565 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Unsupported operator in constant expression")); -#line 2557 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2566 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return NULL; } break; } __yield_0; }); -#line 2560 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2569 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->etype=typ; -#line 2561 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2570 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return typ; } -#line 2564 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_handle_import_path_base(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, compiler_ast_nodes_Import *imp, std_vector_Vector__5 *parts, compiler_ast_scopes_Symbol *base, bool search_in_ns_scope, char *alias) { -#line 2572 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2581 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = 0; i < parts->size; i+=1) { -#line 2573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2582 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_ImportPart *part = std_vector_Vector__5_at(parts, i); -#line 2575 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2584 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((part->type)) { case compiler_ast_nodes_ImportPartType_Wildcard: - m_40_0: + m_41_0: { -#line 2577 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2586 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_import_all_from_symbol(this->o, base, imp->export); -#line 2578 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2587 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } break; case compiler_ast_nodes_ImportPartType_Multiple: - m_40_1: + m_41_1: { -#line 2581 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2590 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__22 *paths = part->u.multiple.paths; -#line 2582 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2591 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 j = 0; j < paths->size; j+=1) { -#line 2583 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2592 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__5 *path = std_vector_Vector__22_at(paths, j); -#line 2584 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2593 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_handle_import_path_base(this, node, imp, path, base, search_in_ns_scope, alias); } -#line 2586 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2595 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } break; case compiler_ast_nodes_ImportPartType_Single: - m_40_2: + m_41_2: { } break; } -#line 2591 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2600 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *name = part->u.single.name; -#line 2592 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2601 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)name))) { -#line 2592 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2601 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2594 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2603 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (str_eq(name, "this")) { -#line 2595 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2604 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if ((i + 1) != parts->size) { -#line 2596 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2605 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(part->span, "`this` can only be used as the last part of an import path")); -#line 2597 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2606 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2599 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2608 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)part->u.single.alias)) { -#line 2599 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2608 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" alias=part->u.single.alias; } -#line 2600 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2609 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" break; } -#line 2603 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_span_Span err_span = part->u.single.alias_span; -#line 2604 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2613 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *new_base = ({ compiler_ast_scopes_Symbol *__yield_0; -#line 2604 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2613 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (search_in_ns_scope) { -#line 2606 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2615 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (base->type != compiler_ast_scopes_SymbolType_Namespace) { -#line 2607 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2616 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(part->span, "Cannot scope-import from a non-namespace")); -#line 2608 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2617 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2610 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2619 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *res = compiler_ast_scopes_Scope_lookup_recursive(base->u.ns->scope, name); -#line 2611 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2620 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" search_in_ns_scope=false; -#line 2612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2621 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = res; } else { __yield_0 = compiler_passes_generic_pass_GenericPass_find_in_symbol(this->o, base, name, false); } __yield_0; }); -#line 2617 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2626 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)new_base))) { -#line 2618 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(part->span, std_format("Invalid import, %s::%s does not exist", base->name, name))); -#line 2619 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2628 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2622 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2631 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" base=new_base; -#line 2623 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2632 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" alias=part->u.single.alias; -#line 2624 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2633 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)alias))) { -#line 2624 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2633 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" alias=name; } -#line 2626 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2635 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" part->resolved_symbol=base; -#line 2627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2636 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol_add_reference(base, compiler_ast_scopes_ReferenceType_Normal, part->u.single.name_span); } -#line 2630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2639 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_insert_into_scope_checked(this->o, base, alias); -#line 2631 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2640 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (imp->export) { -#line 2632 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2641 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__4_insert(compiler_passes_generic_pass_GenericPass_ns(this->o)->exported_symbols, alias, base); } } -#line 2637 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2646 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_handle_import_statement(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node) { -#line 2638 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2647 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Import path = node->u.import_path; -#line 2640 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2649 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool search_in_ns_scope = false; -#line 2641 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2650 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_program_Namespace *base_ns = ({ compiler_ast_program_Namespace *__yield_0; -#line 2641 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2650 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((path.type)) { case compiler_ast_nodes_ImportType_GlobalNamespace: - m_41_0: + m_42_0: { __yield_0 = this->o->program->global; } break; case compiler_ast_nodes_ImportType_ProjectNamespace: - m_41_1: + m_42_1: { __yield_0 = compiler_ast_program_Namespace_get_project_root(compiler_passes_generic_pass_GenericPass_ns(this->o), node->span, this->o->program); } break; case compiler_ast_nodes_ImportType_ParentNamespace: - m_41_2: + m_42_2: { -#line 2645 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2654 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_program_Namespace *cur = compiler_passes_generic_pass_GenericPass_ns(this->o); -#line 2646 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2655 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (u32 i = 0; i < path.parent_count; i+=1) { -#line 2647 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2656 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)cur->parent))) { -#line 2649 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2658 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_errors_Error_panic(compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Cannot import from parent of root namespace"))); -#line 2650 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2659 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2652 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2661 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" cur=cur->parent; } -#line 2654 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2663 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = cur; } break; case compiler_ast_nodes_ImportType_CurrentScope: - m_41_3: + m_42_3: { -#line 2657 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2666 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" search_in_ns_scope=true; -#line 2658 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2667 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" __yield_0 = compiler_passes_generic_pass_GenericPass_ns(this->o); } break; } __yield_0; }); -#line 2662 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2671 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)base_ns))) { -#line 2663 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2672 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, "Couldn't resolve the search base for the import")); -#line 2664 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2673 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2667 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2676 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" node->u.import_path.root_sym=base_ns->sym; -#line 2668 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2677 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_handle_import_path_base(this, node, &path, path.parts, base_ns->sym, search_in_ns_scope, NULL); } -#line 2671 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2680 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_pre_check_function(compiler_passes_typechecker_TypeChecker *this, compiler_ast_program_Namespace *ns, compiler_ast_nodes_Function *func) { -#line 2672 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2681 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (func->kind==compiler_ast_nodes_FunctionKind_Method) { -#line 2673 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2682 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_span_Span parent_span = func->parent_type->span; -#line 2674 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2683 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *parent_type = compiler_passes_typechecker_TypeChecker_resolve_type(this, func->parent_type, true, true, true); -#line 2675 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2684 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)parent_type))) { -#line 2676 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2685 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_error(this->o, compiler_errors_Error_new(parent_span, "Could not find this type")); -#line 2677 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2686 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2680 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2689 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(compiler_types_Type_can_have_methods(parent_type))) { -#line 2681 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2690 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_error(this->o, compiler_errors_Error_new(parent_span, "This type cannot have methods")); -#line 2682 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2691 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2685 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2694 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((parent_type->base)) { case compiler_types_BaseType_Structure: - m_42_0: + m_43_0: { -#line 2687 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2696 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Structure *struc = parent_type->u.struc; -#line 2688 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2697 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *name = compiler_ast_nodes_Structure_get_field(struc, func->sym->name); -#line 2689 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2698 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)name)) { -#line 2690 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2699 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_error(this->o, compiler_errors_Error_new_hint(func->sym->span, std_format("Field with name `%s` already exists", func->sym->name), name->sym->span, "Previous definition here")); } } break; case compiler_types_BaseType_Enum: - m_42_1: + m_43_1: { -#line 2697 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2706 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Enum *enom = parent_type->u.enom; -#line 2698 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2707 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_EnumVariant *var = compiler_ast_nodes_Enum_get_variant(enom, func->sym->name); -#line 2699 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2708 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)var)) { -#line 2700 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2709 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_error(this->o, compiler_errors_Error_new_hint(func->sym->span, std_format("Enum variant with name `%s` already exists", func->sym->name), var->sym->span, "Previous definition here")); } -#line 2705 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2714 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *field = compiler_ast_nodes_Enum_get_shared_field(enom, func->sym->name); -#line 2706 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2715 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)field)) { -#line 2707 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2716 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_error(this->o, compiler_errors_Error_new_hint(func->sym->span, std_format("Field with name `%s` already exists", func->sym->name), field->sym->span, "Previous definition here")); } } break; @@ -12422,112 +12465,112 @@ void compiler_passes_typechecker_TypeChecker_pre_check_function(compiler_passes_ } break; } -#line 2717 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_ast_nodes_Function *res = std_map_Map__9_get(parent_type->methods, func->sym->name, NULL); +#line 2726 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_ast_nodes_Function *res = std_map_Map__8_get(parent_type->methods, func->sym->name, NULL); -#line 2718 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2727 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res)) { -#line 2719 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2728 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_error(this->o, compiler_errors_Error_new_hint(func->sym->span, "Method with this name already exists", res->sym->span, "Previous definition here")); -#line 2723 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2732 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2728 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2737 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol_update_parent(func->sym, parent_type->sym); -#line 2730 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - std_map_Map__9_insert(parent_type->methods, func->sym->name, func); +#line 2739 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + std_map_Map__8_insert(parent_type->methods, func->sym->name, func); -#line 2731 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2740 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" func->parent_type=parent_type; } else { -#line 2734 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2743 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *item = func->sym; -#line 2735 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2744 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_insert_into_scope_checked(this->o, item, NULL); } -#line 2738 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2747 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" func->scope=compiler_passes_typechecker_TypeChecker_scope(this); } -#line 2743 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2752 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_loosely_resolve_templated_struct(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Structure *struc) { -#line 2744 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2753 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(struc->fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 2744 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2753 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 2744 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2753 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2746 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2755 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_resolve_type(this, field->type, true, false, false); -#line 2747 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2756 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" field->type=res; } } } -#line 2751 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2760 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_resolve_struct(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Structure *struc) { -#line 2752 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2761 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_vector_Vector__3 *fields = struc->fields; -#line 2753 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2762 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_doc_links(this, struc->sym); -#line 2756 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2765 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_scopes_Symbol_is_templated(struc->sym)) { -#line 2757 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2766 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_loosely_resolve_templated_struct(this, struc); -#line 2758 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2767 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2761 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2770 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 2761 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2770 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 2761 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2770 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2762 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2771 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_resolve_type(this, field->type, false, true, true); -#line 2763 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2772 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_doc_links(this, field->sym); -#line 2764 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2773 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)res))) { -#line 2765 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2774 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_error(this->o, compiler_errors_Error_new(field->sym->span, "Couldn't resolve type")); } else { -#line 2767 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2776 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" field->type=res; } -#line 2769 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2778 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)field->default_value)) { -#line 2770 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2779 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, field->default_value, field->type); } } @@ -12535,80 +12578,80 @@ void compiler_passes_typechecker_TypeChecker_resolve_struct(compiler_passes_type } -#line 2775 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2784 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_resolve_enum(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Enum *enom) { -#line 2776 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2785 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__12 *seen_fields = std_map_Map__12_new(8); -#line 2777 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2786 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" -#line 2779 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2788 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(enom->shared_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 2779 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2788 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 2779 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2788 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2780 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2789 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_resolve_type(this, field->type, false, true, true); -#line 2781 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2790 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res)) { -#line 2782 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2791 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" field->type=res; } -#line 2784 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2793 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Item__12 *item = std_map_Map__12_get_item(seen_fields, field->sym->name); -#line 2785 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2794 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)item)) { -#line 2786 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2795 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(field->sym->span, std_format("Field with name `%s` already exists", field->sym->name), item->value, "Previous definition here")); } -#line 2791 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2800 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__12_insert(seen_fields, field->sym->name, field->sym->span); -#line 2792 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2801 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)field->default_value)) { -#line 2793 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2802 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_expression(this, field->default_value, field->type); } } } -#line 2796 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2805 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(enom->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 2796 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2805 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 2796 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2805 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2797 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2806 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(variant->specific_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 2797 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2806 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 2797 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2806 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2798 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2807 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_resolve_type(this, field->type, false, true, true); -#line 2799 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2808 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)res)) { -#line 2800 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2809 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" field->type=res; } } @@ -12617,61 +12660,61 @@ void compiler_passes_typechecker_TypeChecker_resolve_enum(compiler_passes_typech } /* defers */ -#line 2777 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2786 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__12_free(seen_fields); } -#line 2808 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2817 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_operator_overload_function(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Function *func, compiler_ast_operators_Operator op) { -#line 2809 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2818 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" u32 num_params_needed = compiler_ast_operators_Operator_num_overload_params(op); -#line 2810 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2819 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (num_params_needed != func->params->size) { -#line 2811 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2820 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(func->sym->span, std_format("Operator overload for %s must have %u parameters", compiler_ast_operators_Operator_dbg(op), num_params_needed))); -#line 2812 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2821 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2815 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2824 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_operators_Operator_needs_lhs_pointer_for_overload(op)) { -#line 2816 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2825 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *lhs = std_vector_Vector__3_at(func->params, 0); -#line 2817 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2826 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *lhs_type = compiler_types_Type_unaliased(lhs->type); -#line 2818 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2827 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (lhs_type->base != compiler_types_BaseType_Pointer) { -#line 2819 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2828 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(lhs->sym->span, std_format("First parameter of %s operator must be a pointer-type", compiler_ast_operators_Operator_dbg(op)))); -#line 2820 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2829 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } } -#line 2825 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2834 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((op)) { case compiler_ast_operators_Operator_Equals: case compiler_ast_operators_Operator_NotEquals: case compiler_ast_operators_Operator_IsNotNull: - m_43_0: + m_44_0: -#line 2827 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2836 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (func->return_type->base != compiler_types_BaseType_Bool) { -#line 2828 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2837 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(func->sym->span, "`==` operator must return a boolean")); -#line 2829 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2838 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } break; @@ -12680,94 +12723,94 @@ void compiler_passes_typechecker_TypeChecker_check_operator_overload_function(co } break; } -#line 2834 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2843 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_operators_OperatorOverload overload = {0}; -#line 2835 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2844 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.op=op; -#line 2836 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2845 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (num_params_needed > 0) { -#line 2836 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2845 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.type1=std_vector_Vector__3_at(func->params, 0)->type; } -#line 2837 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2846 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (num_params_needed > 1) { -#line 2837 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2846 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.type2=std_vector_Vector__3_at(func->params, 1)->type; } -#line 2838 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2847 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (num_params_needed > 2) { -#line 2838 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2847 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" overload.type3=std_vector_Vector__3_at(func->params, 2)->type; } -#line 2840 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2849 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Item__5 *it = std_map_Map__5_get_item(this->o->program->operator_overloads, overload); -#line 2841 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2850 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)it)) { -#line 2842 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2851 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (it->value != func) { -#line 2843 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2852 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new_hint(func->sym->span, std_format("Operator overload for %s already exists (%s)", compiler_ast_operators_Operator_dbg(op), func->sym->display), it->value->sym->span, std_format("Previous definition here (%s)", it->value->sym->display))); } -#line 2848 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2857 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2851 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2860 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Map__5_insert(this->o->program->operator_overloads, overload, func); } -#line 2854 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2863 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_function_declaration(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_Function *func) { -#line 2855 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2864 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool allow_incomplete = false; -#line 2856 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2865 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool error = true; -#line 2857 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2866 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" bool resolve_templates = true; -#line 2859 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2868 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (func->kind==compiler_ast_nodes_FunctionKind_Method && func->parent_type->base==compiler_types_BaseType_Structure) { -#line 2860 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2869 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Structure *struc = func->parent_type->u.struc; -#line 2861 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2870 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_ast_scopes_Symbol_is_templated(struc->sym)) { -#line 2862 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2871 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" allow_incomplete=true; -#line 2863 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2872 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" error=false; -#line 2864 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2873 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolve_templates=false; } } -#line 2867 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2876 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_span_Span func_span = ({ std_span_Span __yield_0; -#line 2867 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2876 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" switch ((func->kind)) { case compiler_ast_nodes_FunctionKind_Closure: - m_44_0: + m_45_0: { __yield_0 = func->span; } break; @@ -12779,345 +12822,351 @@ void compiler_passes_typechecker_TypeChecker_check_function_declaration(compiler __yield_0; }); -#line 2871 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2880 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)func->sym) && compiler_ast_scopes_Symbol_is_templated(func->sym)) { -#line 2872 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2881 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" allow_incomplete=true; -#line 2873 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2882 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" error=false; -#line 2874 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2883 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" resolve_templates=false; } -#line 2877 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2886 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" func->return_type=compiler_passes_typechecker_TypeChecker_resolve_type(this, func->return_type, allow_incomplete, error, resolve_templates); -#line 2878 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2887 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)func->return_type))) { -#line 2879 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2888 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" func->return_type=compiler_passes_typechecker_TypeChecker_get_base_type(this, compiler_types_BaseType_Void, func_span); } -#line 2882 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2891 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(func->params); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 2882 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2891 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *param = std_vector_Iterator__3_cur(&__iter); -#line 2882 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2891 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2883 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2892 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" param->type=compiler_passes_typechecker_TypeChecker_resolve_type(this, param->type, allow_incomplete, error, resolve_templates); } } -#line 2886 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2895 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)func->operator_overloads)) { -#line 2887 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2896 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__21 __iter = std_vector_Vector__21_iter(func->operator_overloads); std_vector_Iterator__21_has_value(&__iter); std_vector_Iterator__21_next(&__iter)) { -#line 2887 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2896 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_operators_Operator op = std_vector_Iterator__21_cur(&__iter); -#line 2887 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2896 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2888 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2897 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_operator_overload_function(this, func, op); } } } -#line 2894 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2903 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (((bool)func->name_ast) && func->name_ast->type==compiler_ast_nodes_ASTType_NSLookup) { -#line 2895 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2904 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_scoped_identifier(this, func->name_ast->u.lookup.lhs, false, NULL, false); } -#line 2900 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2909 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (func->kind==compiler_ast_nodes_FunctionKind_Closure) { -#line 2901 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2910 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" func->type=compiler_passes_typechecker_TypeChecker_get_closure_type(this, func->params, func->return_type, func->type); } else { -#line 2904 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2913 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *typ = compiler_types_Type_new_resolved(compiler_types_BaseType_FunctionPtr, func_span); -#line 2905 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2914 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" typ->u.func=(compiler_types_FunctionType){.orig=func, .params=func->params, .return_type=func->return_type, .is_variadic=func->is_variadic}; -#line 2906 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2915 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" func->type=typ; } } -#line 2910 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2919 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_try_resolve_typedefs_in_namespace(compiler_passes_typechecker_TypeChecker *this, compiler_ast_program_Namespace *ns, bool pre_import) { -#line 2911 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2920 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_map_Iterator__2 __iter = std_map_Map__2_iter(ns->typedefs); std_map_Iterator__2_has_value(&__iter); std_map_Iterator__2_next(&__iter)) { -#line 2911 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2920 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" std_map_Item__2 *it = std_map_Iterator__2_cur(&__iter); -#line 2911 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2920 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2912 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2921 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (compiler_types_Type_is_resolved(it->value)) { -#line 2912 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2921 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 2914 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2923 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Scope_lookup_recursive(compiler_passes_generic_pass_GenericPass_scope(this->o), it->key); -#line 2915 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if(!(((bool)sym))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:2915:16: Assertion failed: `sym?`", "Should have added the symbol into scope already"); } +#line 2924 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + if(!(((bool)sym))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:2924:16: Assertion failed: `sym?`", "Should have added the symbol into scope already"); } -#line 2919 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - if(!(sym->type==compiler_ast_scopes_SymbolType_TypeDef)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:2919:16: Assertion failed: `sym.type == TypeDef`", NULL); } +#line 2928 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + if(!(sym->type==compiler_ast_scopes_SymbolType_TypeDef)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc:2928:16: Assertion failed: `sym.type == TypeDef`", NULL); } -#line 2922 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2931 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *res = compiler_passes_typechecker_TypeChecker_resolve_type(this, it->value, false, !(pre_import), true); -#line 2927 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2936 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)res))) { -#line 2927 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2936 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" continue; } -#line 2928 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2937 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" sym->u.type_def->u.ptr=res; -#line 2929 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2938 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" sym->u.type_def=res; -#line 2930 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2939 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" it->value=res; } } } -#line 2934 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2943 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_post_import(compiler_passes_typechecker_TypeChecker *this, compiler_ast_program_Namespace *ns) { -#line 2935 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2944 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, ns->scope); -#line 2936 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2945 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_namespace(this->o, ns); -#line 2938 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2947 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(ns->functions); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 2938 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2947 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *func = std_vector_Iterator__6_cur(&__iter); -#line 2938 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2947 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2939 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2948 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_function_declaration(this, func); } } -#line 2942 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(ns->structs); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { +#line 2951 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(ns->structs); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { -#line 2942 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" - compiler_ast_nodes_Structure *struc = std_vector_Iterator__9_cur(&__iter); +#line 2951 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_ast_nodes_Structure *struc = std_vector_Iterator__14_cur(&__iter); -#line 2942 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2951 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2943 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2952 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_struct(this, struc); } } -#line 2946 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2955 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__15 __iter = std_vector_Vector__15_iter(ns->enums); std_vector_Iterator__15_has_value(&__iter); std_vector_Iterator__15_next(&__iter)) { -#line 2946 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2955 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Enum *enom = std_vector_Iterator__15_cur(&__iter); -#line 2946 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2955 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2947 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2956 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_resolve_enum(this, enom); } } -#line 2950 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->constants); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 2950 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *node = std_vector_Iterator__16_cur(&__iter); -#line 2950 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2951 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2960 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_pre_check_globals(this, node, true); } } -#line 2954 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2963 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->variables); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 2954 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2963 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_AST *node = std_vector_Iterator__16_cur(&__iter); -#line 2954 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2963 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2955 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2964 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_pre_check_globals(this, node, false); } } -#line 2959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2968 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_try_resolve_typedefs_in_namespace(this, ns, false); -#line 2961 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2970 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 2961 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2970 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_program_Namespace *child = std_map_ValueIterator__3_cur(&__iter); -#line 2961 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2970 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2962 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2971 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_post_import(this, child); } } -#line 2965 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2974 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); -#line 2966 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2975 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_namespace(this->o); } -#line 2969 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2978 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_pre_check_globals(compiler_passes_typechecker_TypeChecker *this, compiler_ast_nodes_AST *node, bool is_const) { -#line 2970 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2979 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Variable *var = node->u.var_decl; -#line 2971 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2980 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)var->type))) { -#line 2972 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2981 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" char *c = (is_const ? "Constant" : "Global variable"); -#line 2973 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2982 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_error(this, compiler_errors_Error_new(node->span, std_format("%s must have a type", c))); -#line 2974 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2983 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2976 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2985 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_types_Type *type = compiler_passes_typechecker_TypeChecker_resolve_type(this, var->type, false, true, true); -#line 2977 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2986 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" if (!(((bool)type))) { -#line 2977 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2986 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" return; } -#line 2978 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2987 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" var->type=type; } -#line 2981 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2990 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_check_pre_import(compiler_passes_typechecker_TypeChecker *this, compiler_ast_program_Namespace *ns) { -#line 2982 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2991 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, ns->scope); -#line 2984 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2993 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(ns->functions); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 2984 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2993 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *func = std_vector_Iterator__6_cur(&__iter); -#line 2984 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2993 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2985 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 2994 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_pre_check_function(this, ns, func); } } -#line 2991 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3000 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_try_resolve_typedefs_in_namespace(this, ns, true); -#line 2993 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3002 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 2993 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3002 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_program_Namespace *child = std_map_ValueIterator__3_cur(&__iter); -#line 2993 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3002 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" { -#line 2994 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3003 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_pre_import(this, child); } } -#line 2997 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3006 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); } -#line 3000 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3009 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" void compiler_passes_typechecker_TypeChecker_run(compiler_ast_program_Program *program) { -#line 3001 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3010 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker pass = (compiler_passes_typechecker_TypeChecker){.o=compiler_passes_generic_pass_GenericPass_new(program), .unchecked_functions=std_vector_Vector__6_new(16), .in_template_instance=false}; -#line 3006 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3015 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_pre_import(&pass, program->global); -#line 3007 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3016 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_handle_imports(&pass, program->global, true); -#line 3008 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3017 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_post_import(&pass, program->global); -#line 3010 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3019 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_namespace(&pass, program->global); -#line 3012 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3021 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_passes_generic_pass_GenericPass_push_namespace(pass.o, program->global); + +#line 3022 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" while (pass.unchecked_functions->size > 0) { -#line 3013 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3023 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_ast_nodes_Function *func = ((compiler_ast_nodes_Function *)std_vector_Vector__6_pop(pass.unchecked_functions)); -#line 3014 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" +#line 3024 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" compiler_passes_typechecker_TypeChecker_check_function(&pass, func); } + +#line 3026 "/Users/mustafa/ocen-lang/ocen/compiler/passes/typechecker.oc" + compiler_passes_generic_pass_GenericPass_pop_namespace(pass.o); } @@ -13190,135 +13239,135 @@ char *compiler_passes_code_generator_CodeGenerator_get_op(compiler_passes_code_g #line 45 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_BinaryOp: - m_45_0: + m_46_0: { __yield_0 = ({ char *__yield_1; #line 46 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((node->u.binary.op)) { case compiler_ast_operators_Operator_And: - m_46_0: + m_47_0: { __yield_1 = "&&"; } break; case compiler_ast_operators_Operator_Assignment: case compiler_ast_operators_Operator_IndexAssign: - m_46_1: + m_47_1: { __yield_1 = "="; } break; case compiler_ast_operators_Operator_BitwiseAnd: - m_46_2: + m_47_2: { __yield_1 = "&"; } break; case compiler_ast_operators_Operator_BitwiseOr: - m_46_3: + m_47_3: { __yield_1 = "|"; } break; case compiler_ast_operators_Operator_BitwiseXor: - m_46_4: + m_47_4: { __yield_1 = "^"; } break; case compiler_ast_operators_Operator_Divide: - m_46_5: + m_47_5: { __yield_1 = "/"; } break; case compiler_ast_operators_Operator_Equals: - m_46_6: + m_47_6: { __yield_1 = "=="; } break; case compiler_ast_operators_Operator_GreaterThan: - m_46_7: + m_47_7: { __yield_1 = ">"; } break; case compiler_ast_operators_Operator_GreaterThanEquals: - m_46_8: + m_47_8: { __yield_1 = ">="; } break; case compiler_ast_operators_Operator_LeftShift: - m_46_9: + m_47_9: { __yield_1 = "<<"; } break; case compiler_ast_operators_Operator_LessThan: - m_46_10: + m_47_10: { __yield_1 = "<"; } break; case compiler_ast_operators_Operator_LessThanEquals: - m_46_11: + m_47_11: { __yield_1 = "<="; } break; case compiler_ast_operators_Operator_Minus: - m_46_12: + m_47_12: { __yield_1 = "-"; } break; case compiler_ast_operators_Operator_Modulus: - m_46_13: + m_47_13: { __yield_1 = "%"; } break; case compiler_ast_operators_Operator_Multiply: - m_46_14: + m_47_14: { __yield_1 = "*"; } break; case compiler_ast_operators_Operator_NotEquals: - m_46_15: + m_47_15: { __yield_1 = "!="; } break; case compiler_ast_operators_Operator_Or: - m_46_16: + m_47_16: { __yield_1 = "||"; } break; case compiler_ast_operators_Operator_Plus: - m_46_17: + m_47_17: { __yield_1 = "+"; } break; case compiler_ast_operators_Operator_PlusEquals: - m_46_18: + m_47_18: { __yield_1 = "+="; } break; case compiler_ast_operators_Operator_MinusEquals: - m_46_19: + m_47_19: { __yield_1 = "-="; } break; case compiler_ast_operators_Operator_MultiplyEquals: - m_46_20: + m_47_20: { __yield_1 = "*="; } break; case compiler_ast_operators_Operator_DivideEquals: - m_46_21: + m_47_21: { __yield_1 = "/="; } break; case compiler_ast_operators_Operator_RightShift: - m_46_22: + m_47_22: { __yield_1 = ">>"; } break; case compiler_ast_operators_Operator_LeftShiftEquals: - m_46_23: + m_47_23: { __yield_1 = "<<="; } break; case compiler_ast_operators_Operator_RightShiftEquals: - m_46_24: + m_47_24: { __yield_1 = ">>="; } break; @@ -13331,29 +13380,29 @@ char *compiler_passes_code_generator_CodeGenerator_get_op(compiler_passes_code_g __yield_1; }); } break; case compiler_ast_nodes_ASTType_UnaryOp: - m_45_1: + m_46_1: { __yield_0 = ({ char *__yield_1; #line 74 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((node->u.unary.op)) { case compiler_ast_operators_Operator_PreDecrement: - m_47_0: + m_48_0: { __yield_1 = "--"; } break; case compiler_ast_operators_Operator_PreIncrement: - m_47_1: + m_48_1: { __yield_1 = "++"; } break; case compiler_ast_operators_Operator_PostDecrement: - m_47_2: + m_48_2: { __yield_1 = "--"; } break; case compiler_ast_operators_Operator_PostIncrement: - m_47_3: + m_48_3: { __yield_1 = "++"; } break; @@ -13375,128 +13424,128 @@ char *compiler_passes_code_generator_CodeGenerator_get_op(compiler_passes_code_g } -#line 86 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 93 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" bool compiler_passes_code_generator_CodeGenerator_gen_internal_print(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, bool newline_after, bool is_stderr) { -#line 87 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *callee = node->u.call.callee; -#line 88 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 95 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (is_stderr) { -#line 89 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 96 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "fprintf(stderr, "); } else { -#line 91 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 98 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "printf("); } -#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 101 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__7 *args = node->u.call.args; -#line 95 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 102 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Argument *first = std_vector_Vector__7_at(args, 0); -#line 96 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 103 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (first->expr->type==compiler_ast_nodes_ASTType_FormatStringLiteral) { -#line 97 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 104 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_format_string_variadic(this, first->expr, newline_after); -#line 98 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 105 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); -#line 99 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return true; } -#line 102 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 109 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < args->size; i+=1) { -#line 103 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 110 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (i > 0) { -#line 103 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 110 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ", "); } -#line 104 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 111 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); -#line 105 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 112 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, arg->expr, false); -#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (i==0 && newline_after) { -#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\"\\n\""); } } -#line 108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 115 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); -#line 110 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return true; } -#line 114 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_format_string_part(compiler_passes_code_generator_CodeGenerator *this, char *part) { -#line 115 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 122 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" u32 len = strlen(part); -#line 116 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 123 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < len; i+=1) { -#line 117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 124 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch (part[i]) { case '\\': { -#line 120 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" i+=1; -#line 121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 128 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch (part[i]) { case '`': case '{': case '}': { } break; default: { -#line 125 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 132 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, '\\'); } break; } -#line 127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 134 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, part[i]); } break; case '"': { -#line 131 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 138 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, '\\'); -#line 132 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 139 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, part[i]); } break; case '%': { -#line 136 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 143 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, '%'); -#line 137 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 144 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, part[i]); } break; case '\n': { -#line 141 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\\n"); } break; default: { -#line 143 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, part[i]); } break; } @@ -13504,25 +13553,25 @@ void compiler_passes_code_generator_CodeGenerator_gen_format_string_part(compile } -#line 149 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 156 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_string_literal(compiler_passes_code_generator_CodeGenerator *this, char *literal) { -#line 150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 157 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" u32 len = strlen(literal); -#line 151 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 158 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < len; i+=1) { -#line 152 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 159 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch (literal[i]) { case '\n': { -#line 155 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 162 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\\n"); } break; default: { -#line 157 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 164 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, literal[i]); } break; } @@ -13530,206 +13579,206 @@ void compiler_passes_code_generator_CodeGenerator_gen_string_literal(compiler_pa } -#line 162 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 169 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_format_string_custom_specifier(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *type, compiler_ast_nodes_AST *expr) { -#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (type->base==compiler_types_BaseType_Structure) { -#line 164 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 171 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Structure *struc = type->u.struc; -#line 165 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 172 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)struc) && ((bool)struc->format_spec)) { -#line 166 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 173 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, struc->format_spec); -#line 167 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 174 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } } -#line 171 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_error(this, compiler_errors_Error_new(expr->span, std_format("Invalid type in CodeGenerator::format_string_custom_specifier: '%s'", compiler_types_Type_str(type)))); -#line 174 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%s"); } -#line 177 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 184 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_format_string_custom_argument(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *type, compiler_ast_nodes_AST *expr) { -#line 178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 185 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (type->base==compiler_types_BaseType_Structure) { -#line 179 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 186 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Structure *struc = type->u.struc; -#line 180 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 187 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)struc) && ((bool)struc->format_args)) { -#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 188 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_CharIterator __iter = str_chars(struc->format_args, 0); std_CharIterator_has_value(&__iter); std_CharIterator_next(&__iter)) { -#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 188 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char c = std_CharIterator_cur(&__iter); -#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 188 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 182 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 189 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (c=='$') { -#line 183 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 190 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "("); -#line 184 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 191 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); -#line 185 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 192 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } else { -#line 187 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, c); } } } -#line 190 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 197 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } } -#line 194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_error(this, compiler_errors_Error_new(expr->span, std_format("Invalid type in CodeGenerator::format_string_custom_argument: '%s'", compiler_types_Type_str(type)))); -#line 197 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 204 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); } -#line 200 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_format_string_variadic(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, bool newline_after) { -#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 208 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__8 *parts = node->u.fmt_str.parts; -#line 202 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 209 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__16 *exprs = node->u.fmt_str.exprs; -#line 203 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 210 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__8 *specs = node->u.fmt_str.specs; -#line 205 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 212 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, '"'); -#line 206 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 213 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < exprs->size; i+=1) { -#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 214 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *part = std_vector_Vector__8_at(parts, i); -#line 208 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = std_vector_Vector__16_at(exprs, i); -#line 210 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 217 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_format_string_part(this, part); -#line 212 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 219 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *spec = std_vector_Vector__8_at(specs, i); -#line 213 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 220 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)spec)) { -#line 214 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%"); -#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 222 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, spec); -#line 216 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" continue; } -#line 219 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_types_Type *expr_type = compiler_types_Type_unaliased(expr->etype); -#line 220 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((expr_type->base)) { case compiler_types_BaseType_I8: case compiler_types_BaseType_I16: case compiler_types_BaseType_I32: - m_48_0: + m_49_0: { -#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%d"); } break; case compiler_types_BaseType_U8: case compiler_types_BaseType_U16: case compiler_types_BaseType_U32: - m_48_1: + m_49_1: { -#line 222 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 229 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%u"); } break; case compiler_types_BaseType_I64: - m_48_2: + m_49_2: { -#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%\" PRId64 \""); } break; case compiler_types_BaseType_U64: - m_48_3: + m_49_3: { -#line 224 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%\" PRIu64 \""); } break; case compiler_types_BaseType_Bool: - m_48_4: + m_49_4: { -#line 225 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 232 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%s"); } break; case compiler_types_BaseType_F32: case compiler_types_BaseType_F64: - m_48_5: + m_49_5: { -#line 226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 233 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%f"); } break; case compiler_types_BaseType_Char: - m_48_6: + m_49_6: { -#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 234 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%c"); } break; case compiler_types_BaseType_Pointer: - m_48_7: + m_49_7: { -#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((expr_type->u.ptr->base)) { case compiler_types_BaseType_Char: - m_49_0: + m_50_0: { -#line 229 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%s"); } break; default: { -#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "%p"); } break; } @@ -13737,44 +13786,44 @@ void compiler_passes_code_generator_CodeGenerator_gen_format_string_variadic(com default: { -#line 232 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_format_string_custom_specifier(this, expr_type, expr); } break; } } -#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *part = std_vector_Vector__8_back(parts, 0); -#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_format_string_part(this, part); -#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (newline_after) { -#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\\n"); } -#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 246 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, '"'); -#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(exprs); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = std_vector_Iterator__16_cur(&__iter); -#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 242 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_types_Type *expr_type = compiler_types_Type_unaliased(expr->etype); -#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ", "); -#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((expr_type->base)) { case compiler_types_BaseType_I8: case compiler_types_BaseType_I16: @@ -13788,29 +13837,29 @@ void compiler_passes_code_generator_CodeGenerator_gen_format_string_variadic(com case compiler_types_BaseType_F64: case compiler_types_BaseType_Char: case compiler_types_BaseType_Pointer: - m_50_0: + m_51_0: { -#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); } break; case compiler_types_BaseType_Bool: - m_50_1: + m_51_1: { -#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "(("); -#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 259 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); -#line 253 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ") ? \"true\" : \"false\")"); } break; default: { -#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_format_string_custom_argument(this, expr_type, expr); } break; } @@ -13819,791 +13868,932 @@ void compiler_passes_code_generator_CodeGenerator_gen_format_string_variadic(com } -#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_format_string(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node) { -#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 268 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (this->o->program->did_cache_symbols) { -#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, this->o->program->cached_symbols.fmt_string_fn->full_name); } else { -#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 271 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_error(this, compiler_errors_Error_new(node->span, "Can't use format string without using stdlib")); -#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 272 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "unknown"); } -#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 274 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "("); -#line 268 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 275 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_format_string_variadic(this, node, false); -#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } -#line 272 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 279 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_yield_expression(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *expr) { -#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 280 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *yield_var = std_vector_Vector__8_back(this->yield_vars, 0); -#line 274 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 281 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 275 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 282 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(expr->returns)) { -#line 276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 283 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, yield_var); -#line 277 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " = "); } -#line 279 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 286 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); -#line 280 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 287 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } -#line 283 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 290 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_constant(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node) { -#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 291 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *const_ = node->u.var_decl; -#line 285 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if (const_->is_dead) { +#line 292 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (const_->sym->is_dead) { -#line 285 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 292 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 287 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 294 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(const_->sym->is_extern)) { -#line 288 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 295 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 289 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 296 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "#define "); -#line 290 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 297 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(const_->sym)); -#line 291 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " ("); -#line 292 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 299 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, node->u.var_decl->default_value, false); -#line 293 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 300 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")\n"); } } -#line 297 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 304 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_constants(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_program_Namespace *ns) { -#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->constants); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *const_ = std_vector_Iterator__16_cur(&__iter); -#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 299 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 306 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_constant(this, const_); } } -#line 302 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 309 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 302 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 309 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_program_Namespace *child = std_map_ValueIterator__3_cur(&__iter); -#line 302 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 309 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 303 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 310 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_constants(this, child); } } } -#line 307 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 314 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_global_variables(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_program_Namespace *ns) { -#line 308 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->variables); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 308 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *node = std_vector_Iterator__16_cur(&__iter); -#line 308 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 309 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 316 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *var = node->u.var_decl; -#line 310 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if (var->is_dead) { +#line 317 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (var->sym->is_dead) { -#line 310 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 317 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" continue; } -#line 311 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 318 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(var->sym->is_extern)) { -#line 312 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 319 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_var_declaration(this, node); -#line 313 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 320 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } } } -#line 317 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 324 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 317 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 324 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_program_Namespace *child = std_map_ValueIterator__3_cur(&__iter); -#line 317 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 324 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 318 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 325 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_global_variables(this, child); } } } -#line 322 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 329 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_control_body(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, compiler_ast_nodes_AST *body) { -#line 323 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 330 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (body->type==compiler_ast_nodes_ASTType_Block) { -#line 324 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 331 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_block(this, body, true); } else { -#line 327 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 334 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" bool is_elif = body->type==compiler_ast_nodes_ASTType_If; -#line 328 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 335 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(is_elif)) { -#line 328 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 335 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "{\n"); } -#line 329 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 336 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 331 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 338 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)node->etype) && (body->type != compiler_ast_nodes_ASTType_Yield)) { -#line 332 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 339 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_yield_expression(this, body); } else { -#line 334 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 341 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_statement(this, body); } -#line 336 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 343 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; -#line 338 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 345 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 339 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 346 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(is_elif)) { -#line 339 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 346 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}"); } } } -#line 343 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 350 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_in_yield_context(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node) { -#line 347 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 354 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *yield_var = std_format("__yield_%u", this->yield_vars->size); -#line 348 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 355 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__8_push(this->yield_vars, yield_var); -#line 350 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 357 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_types_Type *ret_type = node->etype; -#line 352 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 359 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "({ "); -#line 353 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 360 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, ret_type, yield_var); -#line 354 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 361 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); -#line 356 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 363 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (node->type==compiler_ast_nodes_ASTType_Block) { -#line 357 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 364 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_block(this, node, false); } else { -#line 359 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 360 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 367 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_statement(this, node); -#line 361 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 368 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; } -#line 364 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 371 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n"); -#line 365 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 372 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 373 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, yield_var); -#line 367 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 374 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "; })"); -#line 369 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 376 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__8_pop(this->yield_vars); } -#line 372 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 379 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_enum_constructor(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_EnumVariant *variant, std_vector_Vector__7 *args) { -#line 373 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 380 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Enum *enom = variant->parent; -#line 376 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 383 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(enom->has_values)) { -#line 377 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(variant->sym)); -#line 378 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 381 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 388 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("(%s){", compiler_ast_scopes_Symbol_out_name(enom->sym))); -#line 382 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 389 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(".tag=%s,", compiler_ast_scopes_Symbol_out_name(variant->sym))); -#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 391 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__3 *shared_fields = enom->shared_fields; -#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" u32 i = 0; -#line 386 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 393 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (NULL; i < shared_fields->size; i+=1) { -#line 387 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 394 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); -#line 388 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 395 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *field = std_vector_Vector__3_at(shared_fields, i); -#line 389 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 396 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(".%s=", compiler_ast_scopes_Symbol_out_name(field->sym))); -#line 390 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 397 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, arg->expr, false); -#line 391 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 398 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ", "); } -#line 393 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 400 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)args) && (i < args->size)) { -#line 394 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 401 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(".%s={", compiler_ast_scopes_Symbol_out_name(variant->sym))); -#line 395 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 402 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (NULL; i < args->size; i+=1) { -#line 396 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 403 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); -#line 397 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 404 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, arg->expr, false); -#line 398 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 405 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ", "); } -#line 400 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}"); } -#line 402 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 409 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}"); } -#line 405 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 412 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_constructor(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, compiler_ast_nodes_Structure *struc) { -#line 406 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 413 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("(%s){", compiler_ast_scopes_Symbol_out_name(struc->sym))); -#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__3 *fields = struc->fields; -#line 408 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 415 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__7 *args = node->u.call.args; -#line 410 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 417 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (struc->is_union) { -#line 411 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(args->size==1)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:411:16: Assertion failed: `args.size == 1`", "Should have been checked in the type checker"); } +#line 418 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(args->size==1)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:418:16: Assertion failed: `args.size == 1`", "Should have been checked in the type checker"); } -#line 412 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 419 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, 0); -#line 413 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(((bool)arg->label))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:413:16: Assertion failed: `arg.label?`", "Should have been checked in the type checker"); } +#line 420 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(((bool)arg->label))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:420:16: Assertion failed: `arg.label?`", "Should have been checked in the type checker"); } -#line 415 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 422 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *field = NULL; -#line 416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 423 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 423 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *f = std_vector_Iterator__3_cur(&__iter); -#line 416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 423 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 417 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 424 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)f->sym) && str_eq(f->sym->name, arg->label)) { -#line 418 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 425 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" field=f; -#line 419 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 426 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" break; } } } -#line 422 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(((bool)field))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:422:16: Assertion failed: `field?`", "Should have been checked in the type checker"); } +#line 429 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(((bool)field))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:429:16: Assertion failed: `field?`", "Should have been checked in the type checker"); } -#line 423 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 430 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(".%s=", compiler_ast_scopes_Symbol_out_name(field->sym))); -#line 424 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 431 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, arg->expr, false); } else { -#line 427 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 434 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < args->size; i+=1) { -#line 428 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 435 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (i != 0) { -#line 428 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 435 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ", "); } -#line 429 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 436 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); -#line 430 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 437 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *field = std_vector_Vector__3_at(fields, i); -#line 431 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(".%s=", compiler_ast_scopes_Symbol_out_name(field->sym))); -#line 432 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 439 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, arg->expr, false); } } -#line 436 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 443 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}"); } -#line 439 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 446 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_create_new(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node) { -#line 440 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(node->type==compiler_ast_nodes_ASTType_CreateNew)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:440:12: Assertion failed: `node.type == CreateNew`", std_format("Expected CreateNew, got %s", compiler_ast_nodes_ASTType_dbg(node->type))); } +#line 447 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(node->type==compiler_ast_nodes_ASTType_CreateNew)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:447:12: Assertion failed: `node.type == CreateNew`", std_format("Expected CreateNew, got %s", compiler_ast_nodes_ASTType_dbg(node->type))); } -#line 441 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 448 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *child = node->u.child; -#line 442 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 449 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *var_name = std_format("_new_%u", this->o->program->uid++); -#line 449 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 456 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "({"); -#line 450 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 457 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, node->etype, var_name); -#line 451 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " = "); -#line 452 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 459 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(this->o->program->cached_symbols.mem_alloc_fn)); -#line 453 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 460 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "("); -#line 454 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 461 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(this->o->program->cached_symbols.mem_allocator)); -#line 455 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 462 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ", sizeof("); -#line 456 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 463 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type(this, child->etype); -#line 457 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 464 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(")); *%s = ", var_name)); -#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 465 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, child, false); -#line 459 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 466 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("; %s; ", var_name)); -#line 460 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 467 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "})"); -#line 462 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 469 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_free(&var_name); } -#line 466 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 472 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +void compiler_passes_code_generator_CodeGenerator_gen_call_args(compiler_passes_code_generator_CodeGenerator *this, std_vector_Vector__7 *args, bool is_variadic_format) { + +#line 473 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + for (u32 i = 0; i < args->size; i+=1) { + +#line 474 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (i != 0) { + +#line 474 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, ", "); + } + +#line 475 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); + +#line 477 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if ((i==(args->size - 1) && is_variadic_format) && arg->expr->type==compiler_ast_nodes_ASTType_FormatStringLiteral) { + +#line 482 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_format_string_variadic(this, arg->expr, false); + } else { + +#line 484 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_expression(this, arg->expr, false); + } + } +} + + +#line 489 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +void compiler_passes_code_generator_CodeGenerator_gen_closure_call(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, compiler_ast_scopes_Symbol *sym) { + +#line 490 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_AST *callee = node->u.call.callee; + +#line 492 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_expression(this, callee, false); + +#line 493 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, std_format(".%s(", compiler_passes_code_generator_cls_fn_field_name)); + +#line 494 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_expression(this, callee, false); + +#line 495 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "."); + +#line 496 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, compiler_passes_code_generator_cls_ctx_name); + +#line 497 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (node->u.call.args->size > 0) { + +#line 498 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, ", "); + +#line 499 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_call_args(this, node->u.call.args, false); + } + +#line 501 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, ")"); +} + + +#line 505 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_expression(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, bool is_top_level) { -#line 467 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 506 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_IntLiteral: - m_51_0: + m_52_0: { -#line 469 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 508 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_NumLiteral *num_lit = &node->u.num_literal; -#line 470 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 509 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if ((node->etype->base != compiler_types_BaseType_I32) && (node->etype->base != compiler_types_BaseType_U32)) { -#line 471 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 510 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "(("); -#line 472 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 511 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type(this, node->etype); -#line 473 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 512 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); -#line 474 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 513 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, num_lit->text); -#line 475 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 514 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } else { -#line 477 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 516 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, num_lit->text); } } break; case compiler_ast_nodes_ASTType_CreateClosure: - m_51_1: + m_52_1: { -#line 480 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, "null"); +#line 520 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_Function *func = node->u.closure; + +#line 521 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "({"); + +#line 522 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *ctx_name = std_format("%s%u", compiler_passes_code_generator_cls_ctx_name, this->o->program->uid++); + +#line 523 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *ctx_typ = compiler_passes_code_generator_cls_ctx_type(func); + +#line 525 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, std_format("%s *%s = alloca(sizeof(%s));", ctx_typ, ctx_name, ctx_typ)); + +#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + for (std_map_Iterator__4 __iter = std_map_Map__4_iter(func->closed_vars); std_map_Iterator__4_has_value(&__iter); std_map_Iterator__4_next(&__iter)) { + +#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_map_Item__4 *it = std_map_Iterator__4_cur(&__iter); + +#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + { + +#line 527 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_Variable *var = it->value->u.closed_var.orig; + +#line 528 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, ctx_name); + +#line 529 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "->"); + +#line 530 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(var->sym)); + +#line 531 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, " = &"); + +#line 532 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(var->sym)); + +#line 533 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, ";"); + } + } + +#line 536 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *cls_name = std_format("_ci%u", this->o->program->uid++); + +#line 537 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, std_format("%s %s = {", compiler_ast_scopes_Symbol_out_name(func->type->sym), cls_name)); + +#line 538 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, std_format(".%s=%s, .%s=&%s};", compiler_passes_code_generator_cls_ctx_name, ctx_name, compiler_passes_code_generator_cls_fn_field_name, compiler_ast_scopes_Symbol_out_name(func->sym))); + +#line 539 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, cls_name); + +#line 540 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "; })"); } break; case compiler_ast_nodes_ASTType_FloatLiteral: - m_51_2: + m_52_2: { -#line 482 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 543 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_NumLiteral *num_lit = &node->u.num_literal; -#line 483 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 544 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, num_lit->text); -#line 484 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 545 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (node->etype->base==compiler_types_BaseType_F32) { -#line 485 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 546 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "f"); } } break; case compiler_ast_nodes_ASTType_ArrayLiteral: - m_51_3: + m_52_3: { -#line 489 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 550 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__16 *elements = node->u.array_literal.elements; -#line 490 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 551 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "{"); -#line 491 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 552 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < elements->size; i+=1) { -#line 492 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 553 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (i != 0) { -#line 492 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 553 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ", "); } -#line 493 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 554 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = std_vector_Vector__16_at(elements, i); -#line 494 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 555 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); } -#line 496 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 557 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}"); } break; case compiler_ast_nodes_ASTType_FormatStringLiteral: - m_51_4: + m_52_4: { -#line 498 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 559 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_format_string(this, node); } break; case compiler_ast_nodes_ASTType_StringLiteral: - m_51_5: + m_52_5: { -#line 500 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 561 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *str_lit = node->u.string_literal; -#line 501 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 562 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\""); -#line 502 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 563 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_string_literal(this, str_lit); -#line 503 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 564 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\""); } break; case compiler_ast_nodes_ASTType_CharLiteral: - m_51_6: + m_52_6: { -#line 506 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 567 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *char_lit = node->u.char_literal; -#line 507 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 568 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "'"); -#line 508 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 569 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, char_lit); -#line 509 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 570 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "'"); } break; case compiler_ast_nodes_ASTType_If: - m_51_7: + m_52_7: { -#line 512 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__23 *branches = node->u.if_stmt.branches; -#line 513 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 574 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *els = node->u.if_stmt.els; -#line 518 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 579 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((branches->size==1 && (std_vector_Vector__23_at(branches, 0).body->type != compiler_ast_nodes_ASTType_Block)) && ((bool)els)) && (els->type != compiler_ast_nodes_ASTType_Block)) { -#line 523 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 584 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_IfBranch branch = std_vector_Vector__23_at(branches, 0); -#line 524 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 585 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "("); -#line 525 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 586 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, branch.cond, false); -#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 587 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " ? "); -#line 527 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 588 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, branch.body, false); -#line 528 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 589 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " : "); -#line 529 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 590 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, els, false); -#line 530 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 591 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } else { -#line 534 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 595 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_in_yield_context(this, node); } } break; case compiler_ast_nodes_ASTType_Match: - m_51_8: + m_52_8: { -#line 537 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 598 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_in_yield_context(this, node); } break; case compiler_ast_nodes_ASTType_Block: - m_51_9: + m_52_9: { -#line 538 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 599 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_in_yield_context(this, node); } break; case compiler_ast_nodes_ASTType_Member: - m_51_10: + m_52_10: { -#line 540 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 601 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_Symbol *sym = node->resolved_symbol; -#line 541 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 602 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)sym) && sym->type==compiler_ast_scopes_SymbolType_Function) { -#line 543 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 604 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(sym)); -#line 544 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 605 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 547 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 608 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *lhs = node->u.member.lhs; -#line 548 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 609 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, lhs, false); -#line 549 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 610 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (node->u.member.is_pointer) { -#line 550 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 611 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "->"); } else { -#line 552 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 613 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "."); } -#line 554 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 615 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, node->u.member.rhs_name); } break; case compiler_ast_nodes_ASTType_Identifier: case compiler_ast_nodes_ASTType_NSLookup: case compiler_ast_nodes_ASTType_Specialization: case compiler_ast_nodes_ASTType_OverloadedOperator: - m_51_11: + m_52_11: { -#line 557 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 618 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_Symbol *sym = node->resolved_symbol; -#line 558 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 619 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(((bool)sym))) { -#line 559 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 620 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_error(this, compiler_errors_Error_new(node->span, "Symbol not found in CodeGenerator::gen_expression")); -#line 560 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 621 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 562 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 623 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Function: case compiler_ast_scopes_SymbolType_Variable: case compiler_ast_scopes_SymbolType_Constant: - m_52_0: + m_53_0: { -#line 563 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 624 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(sym)); } break; case compiler_ast_scopes_SymbolType_EnumVariant: - m_52_1: + m_53_1: { -#line 564 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 625 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_enum_constructor(this, sym->u.enum_var, NULL); } break; + case compiler_ast_scopes_SymbolType_ClosedVariable: + m_53_2: + { + +#line 627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_Variable *var = sym->u.closed_var.orig; + +#line 628 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, std_format("(*%s->", compiler_passes_code_generator_cls_ctx_name)); + +#line 629 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(var->sym)); + +#line 630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, ")"); + } break; default: { -#line 565 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(false)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:565:32: Assertion failed: `false`", std_format("Unhandled symbol type: %s", compiler_ast_scopes_SymbolType_dbg(sym->type))); exit(1); } +#line 632 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(false)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:632:32: Assertion failed: `false`", std_format("Unhandled symbol type: %s", compiler_ast_scopes_SymbolType_dbg(sym->type))); exit(1); } } break; } } break; case compiler_ast_nodes_ASTType_Call: - m_51_12: + m_52_12: { -#line 569 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 636 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *callee = node->u.call.callee; -#line 572 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 639 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (callee->type==compiler_ast_nodes_ASTType_Identifier) { -#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 640 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" bool matched = ({ bool __yield_0; -#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 640 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { - char *__match_var_53 = callee->u.ident.name; - if (str_eq(__match_var_53, "print")) { + char *__match_var_54 = callee->u.ident.name; + if (str_eq(__match_var_54, "print")) { __yield_0 = compiler_passes_code_generator_CodeGenerator_gen_internal_print(this, node, false, false); - } else if (str_eq(__match_var_53, "println")) { + } else if (str_eq(__match_var_54, "println")) { __yield_0 = compiler_passes_code_generator_CodeGenerator_gen_internal_print(this, node, true, false); - } else if (str_eq(__match_var_53, "eprint")) { + } else if (str_eq(__match_var_54, "eprint")) { __yield_0 = compiler_passes_code_generator_CodeGenerator_gen_internal_print(this, node, false, true); - } else if (str_eq(__match_var_53, "eprintln")) { + } else if (str_eq(__match_var_54, "eprintln")) { __yield_0 = compiler_passes_code_generator_CodeGenerator_gen_internal_print(this, node, true, true); } else { __yield_0 = false; @@ -14612,46 +14802,56 @@ void compiler_passes_code_generator_CodeGenerator_gen_expression(compiler_passes __yield_0; }); -#line 580 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 647 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (matched) { -#line 580 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 647 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } } -#line 583 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 650 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_Symbol *sym = compiler_ast_nodes_AST_symbol(callee); -#line 584 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 651 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)sym)) { -#line 585 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 652 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((node->u.call.call_type)) { case compiler_ast_nodes_CallType_StructConstructor: - m_54_0: + m_55_0: { -#line 587 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(sym->type==compiler_ast_scopes_SymbolType_Structure)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:587:32: Assertion failed: `sym.type == Structure`", NULL); } +#line 654 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(sym->type==compiler_ast_scopes_SymbolType_Structure)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:654:32: Assertion failed: `sym.type == Structure`", NULL); } -#line 588 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 655 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_constructor(this, node, sym->u.struc); -#line 589 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 656 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } break; case compiler_ast_nodes_CallType_EnumConstructor: - m_54_1: + m_55_1: { -#line 592 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(sym->type==compiler_ast_scopes_SymbolType_EnumVariant)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:592:32: Assertion failed: `sym.type == EnumVariant`", NULL); } +#line 659 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(sym->type==compiler_ast_scopes_SymbolType_EnumVariant)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:659:32: Assertion failed: `sym.type == EnumVariant`", NULL); } -#line 593 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 660 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_enum_constructor(this, sym->u.enum_var, node->u.call.args); -#line 594 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 661 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + return; + } break; + case compiler_ast_nodes_CallType_Closure: + m_55_2: + { + +#line 664 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_closure_call(this, node, sym); + +#line 665 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } break; default: @@ -14660,257 +14860,263 @@ void compiler_passes_code_generator_CodeGenerator_gen_expression(compiler_passes } } -#line 602 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 673 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, callee, false); -#line 604 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 675 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" bool is_variadic_format = (((((bool)sym) && sym->type==compiler_ast_scopes_SymbolType_Function) && ((bool)sym->u.func)) && sym->u.func->is_variadic_format); -#line 611 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 682 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "("); -#line 612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_vector_Vector__7 *args = node->u.call.args; +#line 683 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_call_args(this, node->u.call.args, is_variadic_format); -#line 613 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - for (u32 i = 0; i < args->size; i+=1) { +#line 684 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, ")"); + } break; + case compiler_ast_nodes_ASTType_BoolLiteral: + m_52_13: + { -#line 614 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if (i != 0) { - -#line 614 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, ", "); - } - -#line 615 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_ast_nodes_Argument *arg = std_vector_Vector__7_at(args, i); - -#line 617 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if ((i==(args->size - 1) && is_variadic_format) && arg->expr->type==compiler_ast_nodes_ASTType_FormatStringLiteral) { - -#line 622 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_format_string_variadic(this, arg->expr, false); - } else { - -#line 624 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_expression(this, arg->expr, false); - } - } - -#line 627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, ")"); - } break; - case compiler_ast_nodes_ASTType_BoolLiteral: - m_51_13: - { - -#line 630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 687 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" bool bool_lit = node->u.bool_literal; -#line 631 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 688 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, (bool_lit ? "true" : "false")); } break; case compiler_ast_nodes_ASTType_CreateNew: - m_51_14: + m_52_14: { -#line 633 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 690 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_create_new(this, node); } break; case compiler_ast_nodes_ASTType_UnaryOp: - m_51_15: + m_52_15: { -#line 634 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 691 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((node->u.unary.op)) { case compiler_ast_operators_Operator_Address: - m_55_0: + m_56_0: { -#line 636 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 693 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = node->u.unary.expr; -#line 637 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 694 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "&"); -#line 638 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 695 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); } break; case compiler_ast_operators_Operator_Dereference: - m_55_1: + m_56_1: { -#line 641 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 698 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = node->u.unary.expr; -#line 642 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 699 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "(*"); -#line 643 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 700 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); -#line 644 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 701 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } break; case compiler_ast_operators_Operator_Negate: - m_55_2: + m_56_2: { -#line 647 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 704 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = node->u.unary.expr; -#line 648 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 705 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "-"); -#line 649 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 706 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); } break; case compiler_ast_operators_Operator_BitwiseNot: - m_55_3: + m_56_3: { -#line 652 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 709 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = node->u.unary.expr; -#line 653 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 710 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "~"); -#line 654 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 711 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); } break; case compiler_ast_operators_Operator_Not: - m_55_4: + m_56_4: { -#line 657 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 714 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = node->u.unary.expr; -#line 658 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 715 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "!("); -#line 659 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 716 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); -#line 660 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 717 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } break; case compiler_ast_operators_Operator_IsNotNull: - m_55_5: + m_56_5: { -#line 663 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 720 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = node->u.unary.expr; -#line 664 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 721 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "((bool)"); -#line 665 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); +#line 723 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_types_Type *type = expr->etype; + +#line 727 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (((bool)type) && type->base==compiler_types_BaseType_Closure) { + +#line 728 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); -#line 666 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 729 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "."); + +#line 730 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, compiler_passes_code_generator_cls_fn_field_name); + } else { + +#line 733 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); + } + +#line 736 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } break; case compiler_ast_operators_Operator_PreIncrement: case compiler_ast_operators_Operator_PreDecrement: - m_55_6: + m_56_6: { -#line 669 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 739 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_passes_code_generator_CodeGenerator_get_op(this, node)); -#line 670 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 740 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, node->u.unary.expr, false); } break; case compiler_ast_operators_Operator_PostIncrement: case compiler_ast_operators_Operator_PostDecrement: - m_55_7: + m_56_7: { -#line 674 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 744 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, node->u.unary.expr, false); -#line 675 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 745 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_passes_code_generator_CodeGenerator_get_op(this, node)); } break; default: { -#line 677 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 747 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_error(this, compiler_errors_Error_new(node->span, std_format("Unhandled unary op type in CodeGenerator: %s", compiler_ast_operators_Operator_dbg(node->u.unary.op)))); } break; } } break; case compiler_ast_nodes_ASTType_Cast: - m_51_16: + m_52_16: { -#line 680 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 750 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = node->u.cast.lhs; -#line 681 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 751 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_types_Type *type = node->etype; -#line 682 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 752 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "(("); -#line 683 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 753 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_passes_code_generator_CodeGenerator_get_type_name_string(this, type, "", false)); -#line 684 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 754 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); -#line 685 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 755 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); -#line 686 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 756 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } break; case compiler_ast_nodes_ASTType_SizeOf: - m_51_17: + m_52_17: { -#line 689 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 759 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "((u32)sizeof("); -#line 690 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 760 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type(this, node->u.size_of_type); -#line 691 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 761 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "))"); } break; case compiler_ast_nodes_ASTType_Null: - m_51_18: + m_52_18: { -#line 693 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, "NULL"); +#line 763 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + switch ((node->etype->base)) { + case compiler_types_BaseType_Closure: + m_57_0: + { + +#line 767 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, std_format("((%s){0})", compiler_ast_scopes_Symbol_out_name(node->etype->sym))); + } break; + default: + { + +#line 768 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "NULL"); + } break; + } } break; case compiler_ast_nodes_ASTType_BinaryOp: - m_51_19: + m_52_19: { -#line 694 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 770 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((node->u.binary.op)) { case compiler_ast_operators_Operator_Index: - m_56_0: + m_58_0: { -#line 696 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 772 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *lhs = node->u.binary.lhs; -#line 697 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 773 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *rhs = node->u.binary.rhs; -#line 698 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 774 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, lhs, false); -#line 699 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 775 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "["); -#line 700 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 776 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, rhs, false); -#line 701 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 777 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "]"); } break; case compiler_ast_operators_Operator_And: @@ -14932,41 +15138,41 @@ void compiler_passes_code_generator_CodeGenerator_gen_expression(compiler_passes case compiler_ast_operators_Operator_Or: case compiler_ast_operators_Operator_Plus: case compiler_ast_operators_Operator_RightShift: - m_56_1: + m_58_1: { -#line 722 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 798 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *lhs = node->u.binary.lhs; -#line 723 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 799 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *rhs = node->u.binary.rhs; -#line 724 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 800 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(is_top_level)) { -#line 724 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 800 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "("); } -#line 725 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 801 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, lhs, false); -#line 726 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 802 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " "); -#line 727 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 803 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_passes_code_generator_CodeGenerator_get_op(this, node)); -#line 728 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 804 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " "); -#line 729 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 805 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, rhs, false); -#line 730 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 806 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(is_top_level)) { -#line 730 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 806 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } } break; @@ -14977,22 +15183,22 @@ void compiler_passes_code_generator_CodeGenerator_gen_expression(compiler_passes case compiler_ast_operators_Operator_MinusEquals: case compiler_ast_operators_Operator_DivideEquals: case compiler_ast_operators_Operator_MultiplyEquals: - m_56_2: + m_58_2: { -#line 739 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 815 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, node->u.binary.lhs, false); -#line 740 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 816 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_passes_code_generator_CodeGenerator_get_op(this, node)); -#line 741 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 817 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, node->u.binary.rhs, false); } break; default: { -#line 743 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 819 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_error(this, compiler_errors_Error_new(node->span, std_format("Unhandled binary op type in CodeGenerator: %s", compiler_ast_operators_Operator_dbg(node->u.binary.op)))); } break; } @@ -15000,47 +15206,47 @@ void compiler_passes_code_generator_CodeGenerator_gen_expression(compiler_passes default: { -#line 746 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 822 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_error(this, compiler_errors_Error_new(node->span, std_format("Unhandled expression type in CodeGenerator: %s", compiler_ast_nodes_ASTType_dbg(node->type)))); } break; } } -#line 750 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 826 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_var_declaration(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node) { -#line 751 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 827 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *var = node->u.var_decl; -#line 753 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 829 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (var->is_atomic) { -#line 754 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 830 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "_Atomic "); } -#line 757 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 833 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, var->type, compiler_ast_scopes_Symbol_out_name(var->sym)); -#line 758 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 834 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)node->u.var_decl->default_value)) { -#line 759 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 835 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " = "); -#line 760 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 836 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, node->u.var_decl->default_value, false); } else if (!(var->is_atomic)) { -#line 764 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 840 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((var->type->base)) { case compiler_types_BaseType_Array: case compiler_types_BaseType_Structure: - m_57_0: + m_59_0: { -#line 765 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 841 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " = {0}"); } break; default: @@ -15051,563 +15257,563 @@ void compiler_passes_code_generator_CodeGenerator_gen_var_declaration(compiler_p } -#line 771 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 847 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_match_case_body(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, compiler_ast_nodes_AST *body) { -#line 772 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 848 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (body->type==compiler_ast_nodes_ASTType_Block) { -#line 773 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 849 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " "); -#line 774 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 850 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_block(this, body, true); } else if (body->type==compiler_ast_nodes_ASTType_Call && body->returns) { -#line 778 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 854 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " "); -#line 779 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 855 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, body, false); -#line 780 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 856 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";"); } else if (((bool)node->etype) && (body->type != compiler_ast_nodes_ASTType_Yield)) { -#line 784 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 860 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " {\n"); -#line 785 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 861 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 786 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 862 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_yield_expression(this, body); -#line 787 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 863 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; -#line 788 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 864 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 789 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 865 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}"); } else { -#line 792 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 868 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " {\n"); -#line 793 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 869 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 794 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 870 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_statement(this, body); -#line 795 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 871 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; -#line 796 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 872 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 797 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 873 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}"); } } -#line 801 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 877 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_custom_match(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node) { -#line 802 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 878 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Match stmt = node->u.match_stmt; -#line 803 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 879 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 804 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 880 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "{\n"); -#line 806 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 882 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *match_var = std_format("__match_var_%u", this->o->program->uid++); -#line 808 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 884 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 809 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 885 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 810 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 886 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, stmt.expr->etype, match_var); -#line 811 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 887 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " = "); -#line 812 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 888 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, stmt.expr, false); -#line 813 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 889 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); -#line 815 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 891 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__24 *cases = stmt.cases; -#line 816 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 892 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 818 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 894 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < cases->size; i++) { -#line 819 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 895 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_MatchCase _case = std_vector_Vector__24_at(cases, i); -#line 821 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 897 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "if ("); -#line 822 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 898 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" bool first = true; -#line 823 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - for (std_vector_Iterator__11 __iter = std_vector_Vector__11_iter(_case.conds); std_vector_Iterator__11_has_value(&__iter); std_vector_Iterator__11_next(&__iter)) { +#line 899 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(_case.conds); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { -#line 823 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__11_cur(&__iter); +#line 899 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__10_cur(&__iter); -#line 823 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 899 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 824 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 900 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(first)) { -#line 824 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 900 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " || "); } -#line 825 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 901 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" first=false; -#line 826 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 902 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)cond->cmp_fn)) { -#line 827 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 903 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(cond->cmp_fn->sym)); -#line 828 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 904 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "("); -#line 829 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 905 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, match_var); -#line 830 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 906 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ", "); -#line 831 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 907 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, cond->expr, false); -#line 832 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 908 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } else { -#line 835 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 911 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, std_format("(%s == ", match_var)); -#line 836 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 912 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, cond->expr, false); -#line 837 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 913 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); } } } -#line 840 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 916 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")"); -#line 841 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 917 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_match_case_body(this, node, _case.body); -#line 842 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 918 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " else "); } -#line 844 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 920 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)stmt.defolt)) { -#line 845 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 921 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_match_case_body(this, node, stmt.defolt); } -#line 847 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 923 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n"); -#line 849 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 925 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; -#line 850 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 926 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 851 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 927 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}\n"); } -#line 854 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 930 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_match_enum(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node) { -#line 855 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 931 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Match *match_stmt = &node->u.match_stmt; -#line 856 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 932 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = match_stmt->expr; -#line 857 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(((bool)expr->etype) && expr->etype->base==compiler_types_BaseType_Enum)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:857:12: Assertion failed: `expr.etype? and expr.etype.base == Enum`", NULL); } +#line 933 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(((bool)expr->etype) && expr->etype->base==compiler_types_BaseType_Enum)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:933:12: Assertion failed: `expr.etype? and expr.etype.base == Enum`", NULL); } -#line 859 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 935 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Enum *enom = expr->etype->u.enom; -#line 860 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 936 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__3 *shared_fields = enom->shared_fields; -#line 862 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 938 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 863 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 939 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "switch (("); -#line 864 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 940 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); -#line 865 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 941 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (enom->has_values) { -#line 866 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 942 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ").tag) {\n"); } else { -#line 868 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 944 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")) {\n"); } -#line 871 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 947 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" u32 uid = this->o->program->uid++; -#line 872 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 948 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 873 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 949 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < match_stmt->cases->size; i+=1) { -#line 874 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 950 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_MatchCase _case = std_vector_Vector__24_at(match_stmt->cases, i); -#line 876 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - bool has_args = ((_case.conds->size > 0) && ((bool)std_vector_Vector__11_at(_case.conds, 0)->args)); +#line 952 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + bool has_args = ((_case.conds->size > 0) && ((bool)std_vector_Vector__10_at(_case.conds, 0)->args)); -#line 878 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 954 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (has_args) { -#line 879 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_vector_Vector__19 *args = std_vector_Vector__11_at(_case.conds, 0)->args; +#line 955 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_vector_Vector__19 *args = std_vector_Vector__10_at(_case.conds, 0)->args; -#line 880 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 956 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 881 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 957 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "{\n"); -#line 882 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 958 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 883 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__19 __iter = std_vector_Vector__19_iter(args); std_vector_Iterator__19_has_value(&__iter); std_vector_Iterator__19_next(&__iter)) { -#line 883 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_MatchCondArg *arg = std_vector_Iterator__19_cur(&__iter); -#line 883 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 884 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 960 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(str_eq(arg->var->sym->name, "_"))) { -#line 885 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 961 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 886 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 962 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, arg->var->type, compiler_ast_scopes_Symbol_out_name(arg->var->sym)); -#line 887 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 963 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } } } } -#line 892 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 968 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 j = 0; j < _case.conds->size; j++) { -#line 893 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_ast_nodes_MatchCond *cond = std_vector_Vector__11_at(_case.conds, j); +#line 969 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_MatchCond *cond = std_vector_Vector__10_at(_case.conds, j); -#line 895 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 971 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_Symbol *resolved = cond->expr->resolved_symbol; -#line 896 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(((bool)resolved) && resolved->type==compiler_ast_scopes_SymbolType_EnumVariant)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:896:20: Assertion failed: `resolved? and resolved.type == EnumVariant`", NULL); } +#line 972 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(((bool)resolved) && resolved->type==compiler_ast_scopes_SymbolType_EnumVariant)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:972:20: Assertion failed: `resolved? and resolved.type == EnumVariant`", NULL); } -#line 897 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 973 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_EnumVariant *variant = resolved->u.enum_var; -#line 899 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 975 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 900 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 976 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "case "); -#line 901 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 977 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(variant->sym)); -#line 902 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 978 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ":\n"); -#line 904 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 980 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 905 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 981 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)cond->args)) { -#line 906 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 982 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__19 *args = cond->args; -#line 907 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 983 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < args->size; i+=1) { -#line 908 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 984 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_MatchCondArg *arg = std_vector_Vector__19_at(args, i); -#line 909 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 985 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (arg->is_shared) { -#line 910 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 986 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 912 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 988 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(arg->var->sym)); -#line 913 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 989 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " = ("); -#line 914 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 990 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); -#line 915 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 991 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")."); -#line 919 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 995 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(arg->var->sym)); -#line 920 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 996 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } else { -#line 923 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 999 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 924 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1000 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(arg->var->sym)); -#line 925 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1001 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " = ("); -#line 926 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1002 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, false); -#line 927 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1003 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")."); -#line 928 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1004 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(variant->sym)); -#line 929 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1005 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(".%s;\n", compiler_ast_scopes_Symbol_out_name(arg->var->sym))); } } -#line 932 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1008 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 933 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1009 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, std_format("goto m_%u_%u;\n", uid, i)); } -#line 935 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1011 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; } -#line 939 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1015 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)_case.body)) { -#line 940 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1016 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 941 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1017 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, std_format("m_%u_%u:\n", uid, i)); -#line 942 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1018 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 943 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1019 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 944 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1020 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_control_body(this, node, _case.body); -#line 945 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1021 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " break;\n"); -#line 946 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1022 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; } -#line 949 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1025 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (has_args) { -#line 950 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1026 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; -#line 951 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1027 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 952 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1028 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}\n"); } } -#line 956 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1032 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)match_stmt->defolt)) { -#line 957 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1033 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 958 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1034 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "default:\n"); -#line 959 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1035 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 960 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1036 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 961 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1037 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_control_body(this, node, match_stmt->defolt); -#line 962 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1038 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " break;\n"); -#line 963 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1039 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; } -#line 966 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1042 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; -#line 967 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1043 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 968 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1044 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}\n"); } -#line 972 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1048 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_match_bool(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node) { -#line 973 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1049 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Match stmt = node->u.match_stmt; -#line 975 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1051 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_MatchCase true_case = std_vector_Vector__24_at(stmt.cases, 0); -#line 976 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1052 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_MatchCase false_case = std_vector_Vector__24_at(stmt.cases, 1); -#line 978 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_ast_nodes_AST *true_expr = std_vector_Vector__11_at(true_case.conds, 0)->expr; +#line 1054 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_AST *true_expr = std_vector_Vector__10_at(true_case.conds, 0)->expr; -#line 979 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(true_expr->type==compiler_ast_nodes_ASTType_BoolLiteral)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:979:12: Assertion failed: `true_expr.type == BoolLiteral`", "Expected a boolean literal in gen_match_bool"); } +#line 1055 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(true_expr->type==compiler_ast_nodes_ASTType_BoolLiteral)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1055:12: Assertion failed: `true_expr.type == BoolLiteral`", "Expected a boolean literal in gen_match_bool"); } -#line 980 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1056 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(true_expr->u.bool_literal)) { -#line 981 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1057 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_MatchCase tmp = true_case; -#line 982 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1058 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" true_case=false_case; -#line 983 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1059 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" false_case=tmp; } -#line 986 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1062 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 987 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1063 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "if ("); -#line 988 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1064 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, stmt.expr, false); -#line 989 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1065 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ") "); -#line 990 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1066 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_control_body(this, node, true_case.body); -#line 991 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1067 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " else "); -#line 992 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1068 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_control_body(this, node, false_case.body); } -#line 995 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1071 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_match(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node) { -#line 996 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1072 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Match stmt = node->u.match_stmt; -#line 998 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1074 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (stmt.is_custom_match) { -#line 999 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1075 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_custom_match(this, node); -#line 1000 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1076 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1004 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1080 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((stmt.expr->etype->base)) { case compiler_types_BaseType_Bool: - m_58_0: + m_60_0: { -#line 1006 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1082 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_match_bool(this, node); -#line 1007 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1083 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } break; case compiler_types_BaseType_Enum: - m_58_1: + m_60_1: { -#line 1010 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1086 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_match_enum(this, node); -#line 1011 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1087 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } break; default: @@ -15615,661 +15821,672 @@ void compiler_passes_code_generator_CodeGenerator_gen_match(compiler_passes_code } break; } -#line 1016 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1092 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1017 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1093 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "switch ("); -#line 1018 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1094 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, stmt.expr, false); -#line 1019 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1095 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ") {\n"); -#line 1021 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1097 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__24 *cases = stmt.cases; -#line 1022 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1098 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 1023 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1099 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__24 __iter = std_vector_Vector__24_iter(cases); std_vector_Iterator__24_has_value(&__iter); std_vector_Iterator__24_next(&__iter)) { -#line 1023 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1099 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_MatchCase _case = std_vector_Iterator__24_cur(&__iter); -#line 1023 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1099 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1024 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - for (std_vector_Iterator__11 __iter = std_vector_Vector__11_iter(_case.conds); std_vector_Iterator__11_has_value(&__iter); std_vector_Iterator__11_next(&__iter)) { +#line 1100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(_case.conds); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { -#line 1024 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__11_cur(&__iter); +#line 1100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__10_cur(&__iter); -#line 1024 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1025 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1101 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1026 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1102 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "case "); -#line 1027 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1103 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, cond->expr, false); -#line 1028 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1104 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ":"); } } -#line 1030 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)_case.body)) { -#line 1031 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1107 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_match_case_body(this, node, _case.body); -#line 1032 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " break;\n"); } else { -#line 1035 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1111 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n"); } } } -#line 1038 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1114 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)stmt.defolt)) { -#line 1039 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1115 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1040 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1116 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "default:"); -#line 1041 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_match_case_body(this, node, stmt.defolt); -#line 1042 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1118 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " break;\n"); } -#line 1044 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1120 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; -#line 1045 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1046 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1122 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}\n"); } -#line 1049 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1125 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_defers_upto(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_scopes_Scope *end_scope) { -#line 1050 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1126 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" bool first = true; -#line 1051 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (compiler_ast_scopes_Scope *cur = compiler_passes_code_generator_CodeGenerator_scope(this); ((bool)cur); cur=cur->parent) { -#line 1052 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1128 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < cur->defers->size; i+=1) { -#line 1053 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1129 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (first) { -#line 1054 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1130 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" first=false; -#line 1055 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1131 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1056 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1132 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "/* defers */\n"); } -#line 1060 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1136 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" u32 idx = ((cur->defers->size - i) - 1); -#line 1061 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1137 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *stmt = std_vector_Vector__16_at(cur->defers, idx); -#line 1062 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1138 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_statement(this, stmt); } -#line 1064 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1140 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (cur==end_scope) { -#line 1064 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1140 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" break; } } } -#line 1068 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1144 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_statement(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node) { -#line 1069 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1145 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_debug_info(this, node->span, false); -#line 1070 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1146 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_Return: - m_59_0: + m_61_0: { -#line 1072 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_Scope *upto = compiler_passes_code_generator_CodeGenerator_scope(this); -#line 1073 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1149 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (compiler_ast_scopes_Scope *cur = compiler_passes_code_generator_CodeGenerator_scope(this); ((bool)cur) && ((bool)cur->cur_func); cur=cur->parent) { -#line 1074 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" upto=cur; } -#line 1076 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1152 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_defers_upto(this, upto); -#line 1077 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1153 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1079 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1155 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = node->u.ret.expr; -#line 1080 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1156 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)expr)) { -#line 1081 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1157 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(expr->returns)) { -#line 1082 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1158 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "return "); } -#line 1084 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1160 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, true); -#line 1085 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1161 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } else { -#line 1087 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "return;\n"); } } break; case compiler_ast_nodes_ASTType_Yield: - m_59_1: + m_61_1: { -#line 1090 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1166 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_yield_expression(this, node->u.child); } break; case compiler_ast_nodes_ASTType_Import: - m_59_2: + m_61_2: { } break; case compiler_ast_nodes_ASTType_Break: case compiler_ast_nodes_ASTType_Continue: - m_59_3: + m_61_3: { -#line 1093 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1169 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" u32 loop_count = compiler_passes_code_generator_CodeGenerator_scope(this)->loop_count; -#line 1094 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_Scope *upto = compiler_passes_code_generator_CodeGenerator_scope(this); -#line 1095 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1171 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (compiler_ast_scopes_Scope *cur = compiler_passes_code_generator_CodeGenerator_scope(this); ((bool)cur) && cur->loop_count==loop_count; cur=cur->parent) { -#line 1096 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1172 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" upto=cur; } -#line 1098 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1174 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_defers_upto(this, upto); -#line 1100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1176 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1101 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1177 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (node->type==compiler_ast_nodes_ASTType_Break) { -#line 1102 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "break;\n"); } else { -#line 1104 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1180 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "continue;\n"); } } break; case compiler_ast_nodes_ASTType_VarDeclaration: - m_59_4: + m_61_4: { -#line 1108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1184 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1109 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1185 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_var_declaration(this, node); -#line 1110 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1186 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } break; case compiler_ast_nodes_ASTType_Block: - m_59_5: + m_61_5: { -#line 1113 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1189 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1114 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1190 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_block(this, node, true); -#line 1115 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1191 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n"); } break; case compiler_ast_nodes_ASTType_Defer: - m_59_6: + m_61_6: { -#line 1118 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__16_push(compiler_passes_code_generator_CodeGenerator_scope(this)->defers, node->u.child); } break; case compiler_ast_nodes_ASTType_If: - m_59_7: + m_61_7: { -#line 1121 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1197 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1123 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1199 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__23 *branches = node->u.if_stmt.branches; -#line 1124 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1200 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < branches->size; i+=1) { -#line 1125 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1201 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_IfBranch branch = std_vector_Vector__23_at(branches, i); -#line 1126 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1202 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (i > 0) { -#line 1126 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1202 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " else "); } -#line 1127 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1203 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "if ("); -#line 1128 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1204 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, branch.cond, true); -#line 1129 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1205 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ") "); -#line 1130 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1206 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_control_body(this, node, branch.body); } -#line 1133 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1209 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *else_body = node->u.if_stmt.els; -#line 1135 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1211 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)else_body)) { -#line 1136 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1212 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " else "); -#line 1137 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1213 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_control_body(this, node, else_body); -#line 1138 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1214 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n"); } else { -#line 1140 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1216 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n"); } } break; case compiler_ast_nodes_ASTType_Match: - m_59_8: + m_61_8: { -#line 1143 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1219 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_match(this, node); } break; case compiler_ast_nodes_ASTType_While: - m_59_9: + m_61_9: { -#line 1145 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *cond = node->u.loop.cond; -#line 1146 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1222 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *body = node->u.loop.body; -#line 1147 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1223 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1148 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1224 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "while ("); -#line 1149 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1225 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, cond, true); -#line 1150 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ") "); -#line 1151 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1227 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_block(this, body, true); -#line 1152 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1228 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n"); } break; case compiler_ast_nodes_ASTType_For: - m_59_10: + m_61_10: { -#line 1155 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1231 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *init = node->u.loop.init; -#line 1156 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1232 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *cond = node->u.loop.cond; -#line 1157 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1233 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *step = node->u.loop.step; -#line 1158 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1234 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *body = node->u.loop.body; -#line 1159 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1160 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1236 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "for ("); -#line 1161 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1237 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)init)) { -#line 1162 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1238 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (init->type==compiler_ast_nodes_ASTType_VarDeclaration) { -#line 1163 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1239 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_var_declaration(this, init); } else { -#line 1165 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1241 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, init, true); } } -#line 1168 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1244 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "; "); -#line 1169 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)cond)) { -#line 1169 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, cond, true); } -#line 1170 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1246 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "; "); -#line 1171 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1247 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)step)) { -#line 1171 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1247 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, step, true); } -#line 1172 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ") "); -#line 1173 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1249 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_block(this, body, true); -#line 1174 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1250 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n"); } break; case compiler_ast_nodes_ASTType_Assert: - m_59_11: + m_61_11: { -#line 1177 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1253 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *expr = node->u.assertion.expr; -#line 1178 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1254 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1179 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1255 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "if(!("); -#line 1180 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1256 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, expr, true); -#line 1181 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ")) { ae_assert_fail("); -#line 1182 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1258 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1183 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1259 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\""); -#line 1184 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1260 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_span_Location_str(&expr->span.start)); -#line 1185 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *expr_str = compiler_ast_program_Program_get_source_text(this->o->program, expr->span); -#line 1186 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ": Assertion failed: `"); -#line 1187 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1263 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" u32 len = strlen(expr_str); -#line 1188 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1264 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < len; i+=1) { -#line 1189 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1265 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch (expr_str[i]) { case '"': { -#line 1190 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1266 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\\\""); } break; default: { -#line 1191 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1267 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_char(&this->out, expr_str[i]); } break; } } -#line 1194 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1270 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "`\""); } -#line 1196 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1272 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ", "); -#line 1197 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1273 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)node->u.assertion.msg)) { -#line 1198 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1274 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, node->u.assertion.msg, false); } else { -#line 1200 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "NULL"); } -#line 1202 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1278 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ");"); -#line 1206 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1282 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (expr->type==compiler_ast_nodes_ASTType_BoolLiteral && expr->u.bool_literal==false) { -#line 1207 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1283 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " exit(1);"); } -#line 1209 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1285 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " }\n"); } break; default: { -#line 1212 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1288 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1213 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1289 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, node, true); -#line 1214 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1290 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } break; } } -#line 1219 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1295 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_block(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_AST *node, bool with_braces) { -#line 1220 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1296 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (with_braces) { -#line 1220 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1296 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "{\n"); } -#line 1221 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1297 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_Scope *scope = node->u.block.scope; -#line 1222 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1298 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, node->u.block.scope); -#line 1224 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1300 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__16 *statements = node->u.block.statements; -#line 1225 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1301 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 1226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1302 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(statements); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 1226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1302 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_AST *statement = std_vector_Iterator__16_cur(&__iter); -#line 1226 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1302 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1227 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1303 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_statement(this, statement); } } -#line 1230 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1306 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (!(node->returns)) { -#line 1231 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1307 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_defers_upto(this, scope); } -#line 1234 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1310 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; -#line 1235 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1311 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1237 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1313 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (with_braces) { -#line 1237 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1313 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}"); } -#line 1238 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1314 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); } -#line 1241 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" -char *compiler_passes_code_generator_CodeGenerator_helper_gen_function_type(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *top, compiler_types_Type *cur, char *acc, bool is_func_def) { +#line 1317 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +char *compiler_passes_code_generator_CodeGenerator_helper_gen_function_type(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *top, compiler_types_Type *cur, char *acc, bool is_func_def, char *param_prefix, std_vector_Vector__3 *params) { -#line 1242 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1326 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer args_str = std_buffer_Buffer_make(16); -#line 1243 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_vector_Vector__3 *params = cur->u.func.params; +#line 1327 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (!(((bool)params))) { -#line 1245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1328 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + params=cur->u.func.params; + } + +#line 1331 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (params->size==0) { -#line 1245 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1331 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&args_str, "void"); } -#line 1247 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1332 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (((bool)param_prefix)) { + +#line 1332 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&args_str, param_prefix); + } + +#line 1333 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < params->size; i+=1) { -#line 1248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1334 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (i != 0) { -#line 1248 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1334 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&args_str, ", "); } -#line 1249 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1335 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *var = std_vector_Vector__3_at(params, i); -#line 1250 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1336 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *arg_str = compiler_passes_code_generator_CodeGenerator_get_type_name_string(this, var->type, compiler_ast_scopes_Symbol_out_name(var->sym), false); -#line 1251 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1337 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&args_str, arg_str); } -#line 1253 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1339 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (cur->u.func.is_variadic) { -#line 1253 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1339 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&args_str, ", ..."); } -#line 1255 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1341 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (is_func_def && cur==top) { -#line 1257 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1343 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_replace(&acc, std_format("%s(%s)", acc, std_buffer_Buffer_str(args_str))); } else { -#line 1259 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1345 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_replace(&acc, std_format("(*%s)(%s)", acc, std_buffer_Buffer_str(args_str))); } -#line 1261 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1347 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_mem_free(args_str.data); -#line 1262 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1348 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return compiler_passes_code_generator_CodeGenerator_helper_gen_type(this, top, cur->u.func.return_type, acc, false); } -#line 1270 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1356 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *compiler_passes_code_generator_CodeGenerator_helper_gen_type(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *top, compiler_types_Type *cur, char *acc, bool is_func_def) { -#line 1271 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1357 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((cur->base)) { case compiler_types_BaseType_Void: case compiler_types_BaseType_Bool: @@ -16284,1339 +16501,1535 @@ char *compiler_passes_code_generator_CodeGenerator_helper_gen_type(compiler_pass case compiler_types_BaseType_U64: case compiler_types_BaseType_F32: case compiler_types_BaseType_F64: - m_60_0: + m_62_0: { -#line 1276 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1362 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_replace(&acc, std_format("%s %s", compiler_types_BaseType_str(cur->base), acc)); } break; case compiler_types_BaseType_Structure: - m_60_1: + m_62_1: { -#line 1277 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1363 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_replace(&acc, std_format("%s %s", compiler_ast_scopes_Symbol_out_name(cur->u.struc->sym), acc)); } break; case compiler_types_BaseType_Enum: - m_60_2: + m_62_2: { -#line 1278 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1364 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_replace(&acc, std_format("%s %s", compiler_ast_scopes_Symbol_out_name(cur->u.enom->sym), acc)); } break; case compiler_types_BaseType_Alias: - m_60_3: + m_62_3: { -#line 1280 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" acc=compiler_passes_code_generator_CodeGenerator_helper_gen_type(this, top, cur->u.ptr, acc, false); } break; case compiler_types_BaseType_Closure: - m_60_4: + m_62_4: { -#line 1282 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1368 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_replace(&acc, std_format("%s %s", compiler_ast_scopes_Symbol_out_name(cur->sym), acc)); } break; case compiler_types_BaseType_FunctionPtr: - m_60_5: + m_62_5: { -#line 1283 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - acc=compiler_passes_code_generator_CodeGenerator_helper_gen_function_type(this, top, cur, acc, is_func_def); +#line 1369 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + acc=compiler_passes_code_generator_CodeGenerator_helper_gen_function_type(this, top, cur, acc, is_func_def, NULL, NULL); } break; case compiler_types_BaseType_Pointer: - m_60_6: + m_62_6: { -#line 1286 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1372 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" bool needs_parens = (((bool)cur->u.ptr) && cur->u.ptr->base==compiler_types_BaseType_Array); -#line 1287 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1373 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (cur->u.ptr->base==compiler_types_BaseType_FunctionPtr) { } else if (needs_parens) { -#line 1290 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1376 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_replace(&acc, std_format("(*%s)", acc)); } else { -#line 1292 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1378 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_replace(&acc, std_format("*%s", acc)); } -#line 1294 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1380 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" acc=compiler_passes_code_generator_CodeGenerator_helper_gen_type(this, top, cur->u.ptr, acc, false); } break; case compiler_types_BaseType_Array: - m_60_7: + m_62_7: { -#line 1299 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1385 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer prev_buffer = this->out; -#line 1301 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1387 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->out=std_buffer_Buffer_make(16); -#line 1303 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1389 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_types_ArrayType *arr_typ = &cur->u.arr; -#line 1304 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1390 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (((bool)arr_typ->size_expr)) { -#line 1305 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1391 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_expression(this, arr_typ->size_expr, false); } else if (arr_typ->size_known) { -#line 1307 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1393 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("%u", arr_typ->size)); } else { -#line 1309 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1395 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_error(this, compiler_errors_Error_new(cur->span, "Array size not known at compile time")); } -#line 1312 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1398 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_replace(&acc, std_format("%s[%s]", acc, std_buffer_Buffer_str(this->out))); -#line 1313 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1399 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_mem_free(this->out.data); -#line 1315 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1401 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->out=prev_buffer; -#line 1316 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1402 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" acc=compiler_passes_code_generator_CodeGenerator_helper_gen_type(this, top, cur->u.arr.elem_type, acc, false); } break; default: { -#line 1318 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1404 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_error(this, compiler_errors_Error_new(cur->span, std_format("Unhandled type found in CodeGenerator::helper_gen_type: %s: %s", compiler_types_BaseType_dbg(cur->base), compiler_types_Type_str(cur)))); } break; } -#line 1320 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1406 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return acc; } -#line 1324 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1410 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *compiler_passes_code_generator_CodeGenerator_get_type_name_string(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *type, char *name, bool is_func_def) { -#line 1325 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(type != NULL)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1325:12: Assertion failed: `type != null`", NULL); } +#line 1411 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(type != NULL)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1411:12: Assertion failed: `type != null`", NULL); } -#line 1326 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1412 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *final = compiler_passes_code_generator_CodeGenerator_helper_gen_type(this, type, type, strdup(name), is_func_def); -#line 1327 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1413 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" str_strip_trailing_whitespace(final); -#line 1328 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1414 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return final; } -#line 1332 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1418 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_type_and_name(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *type, char *name) { -#line 1333 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1419 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, compiler_passes_code_generator_CodeGenerator_get_type_name_string(this, type, name, false)); } -#line 1336 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1422 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_type(compiler_passes_code_generator_CodeGenerator *this, compiler_types_Type *type) { -#line 1338 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1424 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, type, ""); } -#line 1341 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1427 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_function(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *func) { -#line 1342 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1428 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (func->kind==compiler_ast_nodes_FunctionKind_Method && func->parent_type->base==compiler_types_BaseType_Structure) { -#line 1343 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1429 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Structure *struc = func->parent_type->u.struc; -#line 1344 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1430 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (compiler_ast_scopes_Symbol_is_templated(struc->sym)) { -#line 1344 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1430 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } } -#line 1346 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1432 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (compiler_ast_scopes_Symbol_is_templated(func->sym)) { -#line 1346 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1432 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1347 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if (func->is_dead) { +#line 1433 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (func->sym->is_dead) { -#line 1347 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1433 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1349 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1435 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_debug_info(this, func->sym->span, false); -#line 1350 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1436 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_function_decl(this, func); -#line 1351 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1437 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " "); -#line 1352 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1438 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_block(this, func->body, true); -#line 1353 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1439 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n\n"); } -#line 1356 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1442 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_function_decl(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *func) { -#line 1357 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1443 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *funfull_name = compiler_ast_scopes_Symbol_out_name(func->sym); -#line 1358 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1444 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *s = compiler_passes_code_generator_CodeGenerator_get_type_name_string(this, func->type, funfull_name, true); -#line 1359 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1445 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, s); } -#line 1362 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1448 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_functions(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_program_Namespace *ns) { -#line 1363 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1449 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_vector_Vector__6 *functions = ns->functions; -#line 1364 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1450 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_generic_pass_GenericPass_push_scope(this->o, ns->scope); -#line 1366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1452 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(functions); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 1366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1452 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Function *func = std_vector_Iterator__6_cur(&__iter); -#line 1366 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1452 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1367 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1453 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (func->sym->is_extern) { -#line 1367 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1453 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" continue; } -#line 1368 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1454 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (compiler_ast_scopes_Symbol_is_templated(func->sym)) { -#line 1369 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1455 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__4 __iter = std_vector_Vector__4_iter(func->sym->template->instances); std_vector_Iterator__4_has_value(&__iter); std_vector_Iterator__4_next(&__iter)) { -#line 1369 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1455 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_TemplateInstance *instance = std_vector_Iterator__4_cur(&__iter); -#line 1369 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1455 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1370 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1456 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_Symbol *sym = instance->resolved; -#line 1371 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(sym->type==compiler_ast_scopes_SymbolType_Function)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1371:24: Assertion failed: `sym.type == Function`", NULL); } +#line 1457 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(sym->type==compiler_ast_scopes_SymbolType_Function)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1457:24: Assertion failed: `sym.type == Function`", NULL); } -#line 1372 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1458 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Function *func = sym->u.func; -#line 1373 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1459 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_function(this, func); } } } else { -#line 1376 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1462 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_function(this, func); } } } -#line 1380 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1466 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 1380 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1466 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_program_Namespace *child = std_map_ValueIterator__3_cur(&__iter); -#line 1380 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1466 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1381 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1467 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_functions(this, child); } } -#line 1383 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1469 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_generic_pass_GenericPass_pop_scope(this->o); } -#line 1387 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1473 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_function_decl_toplevel(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *func) { -#line 1388 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1474 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (func->sym->is_extern) { -#line 1388 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1474 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1390 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1476 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (func->kind==compiler_ast_nodes_FunctionKind_Method && func->parent_type->base==compiler_types_BaseType_Structure) { -#line 1391 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1477 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Structure *struc = func->parent_type->u.struc; -#line 1392 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1478 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (compiler_ast_scopes_Symbol_is_templated(struc->sym)) { -#line 1392 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1478 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } } -#line 1395 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1481 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (compiler_ast_scopes_Symbol_is_templated(func->sym)) { -#line 1396 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1482 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__4 __iter = std_vector_Vector__4_iter(func->sym->template->instances); std_vector_Iterator__4_has_value(&__iter); std_vector_Iterator__4_next(&__iter)) { -#line 1396 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1482 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_TemplateInstance *instance = std_vector_Iterator__4_cur(&__iter); -#line 1396 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1482 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1397 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1483 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_scopes_Symbol *sym = instance->resolved; -#line 1398 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(sym->type==compiler_ast_scopes_SymbolType_Function)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1398:20: Assertion failed: `sym.type == Function`", NULL); } +#line 1484 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(sym->type==compiler_ast_scopes_SymbolType_Function)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1484:20: Assertion failed: `sym.type == Function`", NULL); } -#line 1399 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1485 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Function *func = sym->u.func; -#line 1400 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if (func->is_dead) { +#line 1486 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (func->sym->is_dead) { -#line 1400 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1486 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" continue; } -#line 1402 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1488 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_function_decl(this, func); -#line 1403 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1489 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (func->exits) { -#line 1403 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1489 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " __attribute__((noreturn))"); } -#line 1404 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1490 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } } -#line 1406 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1492 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1409 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if (func->is_dead) { +#line 1495 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (func->sym->is_dead) { -#line 1409 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1495 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1410 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1496 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_function_decl(this, func); -#line 1411 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1497 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (func->exits) { -#line 1411 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1497 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " __attribute__((noreturn))"); } -#line 1412 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1498 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } -#line 1415 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1501 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_function_decls(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_program_Namespace *ns) { -#line 1416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1502 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(ns->functions); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 1416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1502 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Function *func = std_vector_Iterator__6_cur(&__iter); -#line 1416 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1502 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1417 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1503 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_function_decl_toplevel(this, func); } } -#line 1420 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1506 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 1420 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1506 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_program_Namespace *child = std_map_ValueIterator__3_cur(&__iter); -#line 1420 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1506 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1421 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1507 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_function_decls(this, child); } } } -#line 1426 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1512 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_enum_dbg_method(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Enum *enom) { -#line 1427 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_ast_nodes_Function *dbg = std_map_Map__9_at(enom->type->methods, "dbg"); +#line 1513 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_Function *dbg = std_map_Map__8_at(enom->type->methods, "dbg"); -#line 1428 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1514 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_function_decl(this, dbg); -#line 1429 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1515 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " {\n"); -#line 1430 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1516 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 1431 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1517 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1433 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1519 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (enom->has_values) { -#line 1434 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1520 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "switch (this.tag) {\n"); } else { -#line 1436 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1522 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "switch (this) {\n"); } -#line 1439 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1525 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent+=1; -#line 1440 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1526 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(enom->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 1440 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1526 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 1440 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1526 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1441 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1527 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1442 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1528 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "case "); -#line 1443 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1529 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, compiler_ast_scopes_Symbol_out_name(variant->sym)); -#line 1444 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1530 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(": return \"%s\";\n", variant->sym->name)); } } -#line 1448 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1534 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1449 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1535 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("default: return \"\";\n")); -#line 1451 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1537 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; -#line 1452 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1538 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_indent(this); -#line 1453 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1539 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}\n"); -#line 1454 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1540 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" this->indent-=1; -#line 1455 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1541 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "}\n\n"); } -#line 1458 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1544 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_struct_typedef(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Structure *struc) { -#line 1459 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1545 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (struc->sym->is_extern) { -#line 1459 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1545 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1460 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if (struc->is_dead) { +#line 1546 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (struc->sym->is_dead) { -#line 1460 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1546 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1462 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1548 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *strufull_name = compiler_ast_scopes_Symbol_out_name(struc->sym); -#line 1463 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1549 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (struc->is_union) { -#line 1464 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1550 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("typedef union %s %s;\n", strufull_name, strufull_name)); } else { -#line 1466 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1552 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("typedef struct %s %s;\n", strufull_name, strufull_name)); } } -#line 1470 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1556 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_closure_type_typedef(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_scopes_Symbol *sym) { -#line 1471 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1557 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (sym->is_dead) { + +#line 1557 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + return; + } + +#line 1558 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *name = compiler_ast_scopes_Symbol_out_name(sym); -#line 1472 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1559 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("typedef struct %s %s;\n", name, name)); } -#line 1475 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1562 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_closure_type_def(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_scopes_Symbol *sym) { -#line 1476 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1563 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (sym->is_dead) { + +#line 1563 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + return; + } + +#line 1564 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *name = compiler_ast_scopes_Symbol_out_name(sym); -#line 1477 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1565 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_types_Type *type = sym->u.type_def; + +#line 1566 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("struct %s {\n", name)); -#line 1478 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, " void *ctx;\n"); +#line 1567 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, std_format(" void *%s;\n", compiler_passes_code_generator_cls_ctx_name)); -#line 1479 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1568 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " "); -#line 1480 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, sym->u.type_def, "fn"); +#line 1570 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *acc = strdup(compiler_passes_code_generator_cls_fn_field_name); -#line 1481 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, ";\n"); +#line 1571 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, compiler_passes_code_generator_CodeGenerator_helper_gen_function_type(this, type, type, acc, false, std_format("void *_%s, ", compiler_passes_code_generator_cls_ctx_name), NULL)); -#line 1482 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, "};\n\n"); +#line 1578 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, ";\n};\n"); } -#line 1485 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1581 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_closure_typedef(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *clos) { -#line 1486 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1582 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (clos->sym->is_dead) { + +#line 1582 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + return; + } + +#line 1583 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *name = compiler_ast_scopes_Symbol_out_name(clos->sym); -#line 1487 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str_f(&this->out, std_format("typedef struct %sCtx %sCtx;\n", name, name)); +#line 1584 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *type_name = compiler_passes_code_generator_cls_ctx_type(clos); + +#line 1585 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, std_format("typedef struct %s %s;\n", type_name, type_name)); } -#line 1490 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1588 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_closure_def(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *clos) { -#line 1491 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1589 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (clos->sym->is_dead) { + +#line 1589 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + return; + } + +#line 1590 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *name = compiler_ast_scopes_Symbol_out_name(clos->sym); -#line 1492 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str_f(&this->out, std_format("struct %sCtx {\n", name)); +#line 1592 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *type_name = compiler_passes_code_generator_cls_ctx_type(clos); + +#line 1593 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, std_format("struct %s {\n", type_name)); -#line 1493 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - for (std_map_Iterator__7 __iter = std_map_Map__7_iter(clos->closed_vars); std_map_Iterator__7_has_value(&__iter); std_map_Iterator__7_next(&__iter)) { +#line 1595 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_types_Type dummy_ptr_type = {0}; -#line 1493 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_map_Item__7 *it = std_map_Iterator__7_cur(&__iter); +#line 1596 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + dummy_ptr_type.base=compiler_types_BaseType_Pointer; + +#line 1598 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + for (std_map_Iterator__4 __iter = std_map_Map__4_iter(clos->closed_vars); std_map_Iterator__4_has_value(&__iter); std_map_Iterator__4_next(&__iter)) { + +#line 1598 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_map_Item__4 *it = std_map_Iterator__4_cur(&__iter); -#line 1493 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1598 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1494 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_ast_nodes_Variable *var = it->value; +#line 1599 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_scopes_Symbol *sym = it->value; -#line 1495 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1600 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(sym->type==compiler_ast_scopes_SymbolType_ClosedVariable)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1600:16: Assertion failed: `sym.type == ClosedVariable`", NULL); } + +#line 1601 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " "); -#line 1496 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, var->type, compiler_ast_scopes_Symbol_out_name(var->sym)); +#line 1602 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_Variable *var = sym->u.closed_var.orig; -#line 1497 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1604 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + dummy_ptr_type.u.ptr=var->type; + +#line 1605 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, &dummy_ptr_type, compiler_ast_scopes_Symbol_out_name(var->sym)); + +#line 1606 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } } -#line 1499 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1608 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "};\n"); } -#line 1502 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1611 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +void compiler_passes_code_generator_CodeGenerator_gen_closure_func_decl(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *clos) { + +#line 1612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (clos->sym->is_dead) { + +#line 1612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + return; + } + +#line 1613 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *name = compiler_ast_scopes_Symbol_out_name(clos->sym); + +#line 1614 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_types_Type *type = clos->type; + +#line 1616 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *acc = strdup(name); + +#line 1617 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, compiler_passes_code_generator_CodeGenerator_helper_gen_function_type(this, type, type, acc, true, std_format("void *_%s, ", compiler_passes_code_generator_cls_ctx_name), clos->params)); + +#line 1625 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, ";\n"); +} + + +#line 1628 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +void compiler_passes_code_generator_CodeGenerator_gen_closure_func(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Function *clos) { + +#line 1629 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (clos->sym->is_dead) { + +#line 1629 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + return; + } + +#line 1630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *name = compiler_ast_scopes_Symbol_out_name(clos->sym); + +#line 1631 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_types_Type *type = clos->type; + +#line 1633 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *ctx = compiler_passes_code_generator_cls_ctx_name; + +#line 1634 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *ctx_type = compiler_passes_code_generator_cls_ctx_type(clos); + +#line 1636 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + char *acc = strdup(name); + +#line 1637 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, compiler_passes_code_generator_CodeGenerator_helper_gen_function_type(this, type, type, acc, true, std_format("void *_%s, ", ctx), clos->params)); + +#line 1645 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, " {\n"); + +#line 1646 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str_f(&this->out, std_format(" %s *%s = (%s *)_%s;\n", ctx_type, ctx, ctx_type, ctx)); + +#line 1647 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_block(this, clos->body, true); + +#line 1648 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "\n}\n\n"); +} + + +#line 1652 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_sym_typedef(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_scopes_Symbol *sym) { -#line 1502 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1652 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Structure: - m_61_0: + m_63_0: { -#line 1503 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1653 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_struct_typedef(this, sym->u.struc); } break; case compiler_ast_scopes_SymbolType_Enum: - m_61_1: + m_63_1: { -#line 1504 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1654 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_enum_typedef(this, sym->u.enom); } break; + case compiler_ast_scopes_SymbolType_Closure: + m_63_2: + { + +#line 1655 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_closure_typedef(this, sym->u.func); + } break; + case compiler_ast_scopes_SymbolType_ClosureType: + m_63_3: + { + +#line 1656 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_closure_type_typedef(this, sym); + } break; default: { -#line 1505 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(false)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1505:20: Assertion failed: `false`", std_format("Unhandled symbol type in CodeGenerator::gen_typedef: %s", compiler_ast_scopes_SymbolType_dbg(sym->type))); exit(1); } +#line 1657 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(false)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1657:20: Assertion failed: `false`", std_format("Unhandled symbol type in CodeGenerator::gen_typedef: %s", compiler_ast_scopes_SymbolType_dbg(sym->type))); exit(1); } } break; } } -#line 1508 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1660 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_sym_def(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_scopes_Symbol *sym) { -#line 1508 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1660 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Structure: - m_62_0: + m_64_0: { -#line 1509 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1661 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_struct_def(this, sym->u.struc); } break; case compiler_ast_scopes_SymbolType_Enum: - m_62_1: + m_64_1: { -#line 1510 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1662 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_enum_def(this, sym->u.enom); } break; + case compiler_ast_scopes_SymbolType_Closure: + m_64_2: + { + +#line 1663 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_closure_def(this, sym->u.func); + } break; + case compiler_ast_scopes_SymbolType_ClosureType: + m_64_3: + { + +#line 1664 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_closure_type_def(this, sym); + } break; default: { -#line 1511 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if(!(false)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1511:20: Assertion failed: `false`", std_format("Unhandled symbol type in CodeGenerator::gen_def: %s", compiler_ast_scopes_SymbolType_dbg(sym->type))); exit(1); } +#line 1665 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if(!(false)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc:1665:20: Assertion failed: `false`", std_format("Unhandled symbol type in CodeGenerator::gen_def: %s", compiler_ast_scopes_SymbolType_dbg(sym->type))); exit(1); } } break; } } -#line 1514 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1668 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_enum_typedef(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Enum *enom) { -#line 1515 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1669 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (enom->sym->is_extern) { -#line 1515 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1669 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1516 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if (enom->is_dead) { +#line 1670 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (enom->sym->is_dead) { -#line 1516 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1670 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1518 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1672 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *name = compiler_ast_scopes_Symbol_out_name(enom->sym); -#line 1519 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1673 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (enom->has_values) { -#line 1520 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1674 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("typedef enum %s__kind %s__kind;\n", name, name)); -#line 1521 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1675 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("typedef struct %s %s;\n", name, name)); } else { -#line 1523 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1677 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("typedef enum %s %s;\n", name, name)); } } -#line 1527 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1681 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_struct_def(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Structure *struc) { -#line 1528 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1682 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (struc->sym->is_extern) { -#line 1528 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1682 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1529 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if (struc->is_dead) { +#line 1683 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (struc->sym->is_dead) { -#line 1529 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1683 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1531 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1685 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *strufull_name = compiler_ast_scopes_Symbol_out_name(struc->sym); -#line 1532 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1686 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (struc->is_union) { -#line 1533 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1687 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("union %s {\n", strufull_name)); } else { -#line 1535 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1689 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("struct %s {\n", strufull_name)); } -#line 1538 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1692 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(struc->fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 1538 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1692 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 1538 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1692 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1539 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1693 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " "); -#line 1540 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1694 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (field->is_atomic) { -#line 1541 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1695 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "_Atomic "); } -#line 1543 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1697 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, field->type, compiler_ast_scopes_Symbol_out_name(field->sym)); -#line 1544 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1698 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } } -#line 1546 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1700 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "};\n\n"); } -#line 1549 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1703 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" void compiler_passes_code_generator_CodeGenerator_gen_enum_def(compiler_passes_code_generator_CodeGenerator *this, compiler_ast_nodes_Enum *enom) { -#line 1550 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - if (enom->is_dead) { +#line 1704 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + if (enom->sym->is_dead) { -#line 1550 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1704 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return; } -#line 1552 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1706 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *name = compiler_ast_scopes_Symbol_out_name(enom->sym); -#line 1553 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1707 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" -#line 1555 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1709 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (enom->sym->is_extern) { -#line 1555 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1709 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" /* defers */ -#line 1553 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1707 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_enum_dbg_method(this, enom); return; } -#line 1558 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1712 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (enom->has_values) { -#line 1559 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1713 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("enum %s__kind {\n", name)); } else { -#line 1561 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1715 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("enum %s {\n", name)); } -#line 1563 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1717 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(enom->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 1563 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1717 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 1563 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1717 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1564 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1718 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(" %s,\n", compiler_ast_scopes_Symbol_out_name(variant->sym))); } } -#line 1566 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1720 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "};\n\n"); -#line 1568 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1722 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (enom->has_values) { -#line 1569 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1723 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("struct %s {\n", name)); -#line 1570 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1724 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(" %s__kind tag;\n", name)); -#line 1571 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1725 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(enom->shared_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 1571 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1725 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 1571 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1725 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1572 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1726 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " "); -#line 1573 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1727 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, field->type, compiler_ast_scopes_Symbol_out_name(field->sym)); -#line 1574 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1728 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } } -#line 1576 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1730 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " union {\n"); -#line 1577 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1731 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(enom->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 1577 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1731 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 1577 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1731 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1578 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1732 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" if (variant->specific_fields->size > 0) { -#line 1579 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1733 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " struct {\n"); -#line 1580 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1734 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (u32 i = 0; i < variant->specific_fields->size; i+=1) { -#line 1582 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1736 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Variable *field = std_vector_Vector__3_at(variant->specific_fields, i); -#line 1583 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1737 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *name = compiler_ast_scopes_Symbol_out_name(field->sym); -#line 1584 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1738 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " "); -#line 1585 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1739 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_type_and_name(this, field->type, name); -#line 1586 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1740 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, ";\n"); } -#line 1588 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1742 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format(" } %s;\n", compiler_ast_scopes_Symbol_out_name(variant->sym))); } } } -#line 1591 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1745 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, " };\n"); -#line 1592 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1746 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "};\n\n"); } /* defers */ -#line 1553 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1707 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_enum_dbg_method(this, enom); } -#line 1596 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1750 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *compiler_passes_code_generator_CodeGenerator_generate(compiler_passes_code_generator_CodeGenerator *this) { -#line 1597 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1751 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__8 __iter = std_vector_Vector__8_iter(this->o->program->c_includes); std_vector_Iterator__8_has_value(&__iter); std_vector_Iterator__8_next(&__iter)) { -#line 1597 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1751 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *include = std_vector_Iterator__8_cur(&__iter); -#line 1597 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1751 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1598 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1752 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("#include \"%s\"\n", include)); } } -#line 1600 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1754 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n"); -#line 1602 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1756 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_map_Iterator__6 __iter = std_map_Map__6_iter(this->o->program->c_embeds); std_map_Iterator__6_has_value(&__iter); std_map_Iterator__6_next(&__iter)) { -#line 1602 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1756 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_map_Item__6 *it = std_map_Iterator__6_cur(&__iter); -#line 1602 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1756 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1603 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1757 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str_f(&this->out, std_format("/* Embed: %s */\n", it->key)); -#line 1604 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1758 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, it->value); -#line 1605 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1759 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "\n\n"); } } -#line 1608 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1762 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "/* Constants */\n"); -#line 1609 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1763 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_constants(this, this->o->program->global); -#line 1611 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1765 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" std_buffer_Buffer_write_str(&this->out, "/* Typedefs */\n"); -#line 1612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(this->o->program->ordered_symbols); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { +#line 1766 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(this->o->program->ordered_symbols); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { -#line 1612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_ast_scopes_Symbol *sym = std_vector_Iterator__10_cur(&__iter); +#line 1766 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_scopes_Symbol *sym = std_vector_Iterator__9_cur(&__iter); -#line 1612 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1766 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1613 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1767 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator_gen_sym_typedef(this, sym); } } -#line 1615 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - for (std_vector_Iterator__0 __iter = std_vector_Vector__0_iter(this->o->program->closure_types); std_vector_Iterator__0_has_value(&__iter); std_vector_Iterator__0_next(&__iter)) { - -#line 1615 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_types_Type *cty = std_vector_Iterator__0_cur(&__iter); - -#line 1615 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - { +#line 1769 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "\n"); -#line 1616 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_closure_type_typedef(this, cty->sym); - } - } +#line 1771 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "/* Structs */\n"); -#line 1618 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(this->o->program->closures); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { +#line 1772 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(this->o->program->ordered_symbols); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { -#line 1618 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_ast_nodes_Function *clos = std_vector_Iterator__6_cur(&__iter); +#line 1772 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_scopes_Symbol *sym = std_vector_Iterator__9_cur(&__iter); -#line 1618 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1772 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1619 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_closure_typedef(this, clos); +#line 1773 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_sym_def(this, sym); } } -#line 1621 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, "\n"); +#line 1776 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "/* function declarations */\n"); -#line 1623 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, "/* Structs */\n"); +#line 1777 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_function_decls(this, this->o->program->global); -#line 1624 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(this->o->program->ordered_symbols); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { +#line 1778 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(this->o->program->closures); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 1624 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_ast_scopes_Symbol *sym = std_vector_Iterator__10_cur(&__iter); +#line 1778 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_ast_nodes_Function *clos = std_vector_Iterator__6_cur(&__iter); -#line 1624 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1778 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1625 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_sym_def(this, sym); +#line 1779 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_closure_func_decl(this, clos); } } -#line 1627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - for (std_vector_Iterator__0 __iter = std_vector_Vector__0_iter(this->o->program->closure_types); std_vector_Iterator__0_has_value(&__iter); std_vector_Iterator__0_next(&__iter)) { - -#line 1627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_types_Type *cty = std_vector_Iterator__0_cur(&__iter); +#line 1782 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_global_variables(this, this->o->program->global); -#line 1627 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - { +#line 1784 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + std_buffer_Buffer_write_str(&this->out, "/* function implementations */\n"); -#line 1628 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_closure_type_def(this, cty->sym); - } - } +#line 1785 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_functions(this, this->o->program->global); -#line 1630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1786 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(this->o->program->closures); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 1630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1786 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_ast_nodes_Function *clos = std_vector_Iterator__6_cur(&__iter); -#line 1630 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1786 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" { -#line 1631 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_closure_def(this, clos); +#line 1787 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + compiler_passes_code_generator_CodeGenerator_gen_closure_func(this, clos); } } -#line 1634 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, "/* function declarations */\n"); - -#line 1635 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_function_decls(this, this->o->program->global); - -#line 1637 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_global_variables(this, this->o->program->global); - -#line 1639 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - std_buffer_Buffer_write_str(&this->out, "/* function implementations */\n"); - -#line 1640 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" - compiler_passes_code_generator_CodeGenerator_gen_functions(this, this->o->program->global); - -#line 1642 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1790 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return std_buffer_Buffer_str(this->out); } -#line 1645 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1793 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator compiler_passes_code_generator_CodeGenerator_make(compiler_ast_program_Program *program) { -#line 1646 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1794 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return (compiler_passes_code_generator_CodeGenerator){.o=compiler_passes_generic_pass_GenericPass_new(program), .out=std_buffer_Buffer_make(16), .yield_vars=std_vector_Vector__8_new(16), .indent=0}; } -#line 1653 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1801 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" char *compiler_passes_code_generator_CodeGenerator_run(compiler_ast_program_Program *program) { -#line 1654 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1802 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" compiler_passes_code_generator_CodeGenerator pass = compiler_passes_code_generator_CodeGenerator_make(program); -#line 1655 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +#line 1803 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" return compiler_passes_code_generator_CodeGenerator_generate(&pass); } -#line 21 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" -compiler_passes_reorder_structs_ReorderStructs *compiler_passes_reorder_structs_ReorderStructs_new(compiler_ast_program_Program *program) { +#line 86 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" +char *compiler_passes_code_generator_cls_ctx_type(compiler_ast_nodes_Function *func) { + +#line 86 "/Users/mustafa/ocen-lang/ocen/compiler/passes/code_generator.oc" + return std_format("%sCtx", compiler_ast_scopes_Symbol_out_name(func->sym)); +} + + +#line 20 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" +compiler_passes_reorder_symbols_ReorderSymbols *compiler_passes_reorder_symbols_ReorderSymbols_new(compiler_ast_program_Program *program) { -#line 22 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_passes_reorder_structs_ReorderStructs *pass = std_mem_alloc__2(1); +#line 21 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols *pass = std_mem_alloc__2(1); -#line 23 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - (*pass)=(compiler_passes_reorder_structs_ReorderStructs){.o=compiler_passes_generic_pass_GenericPass_new(program), .all_structs=std_vector_Vector__9_new(16), .all_syms=std_vector_Vector__10_new(16), .done=std_set_Set__1_new()}; +#line 22 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + (*pass)=(compiler_passes_reorder_symbols_ReorderSymbols){.o=compiler_passes_generic_pass_GenericPass_new(program), .all_syms=std_vector_Vector__9_new(16), .done=std_set_Set__1_new()}; -#line 29 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 27 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" return pass; } -#line 32 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" -void compiler_passes_reorder_structs_ReorderStructs_free(compiler_passes_reorder_structs_ReorderStructs *this) { +#line 30 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" +void compiler_passes_reorder_symbols_ReorderSymbols_free(compiler_passes_reorder_symbols_ReorderSymbols *this) { -#line 33 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - std_vector_Vector__9_free(this->all_structs); +#line 31 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + std_vector_Vector__9_free(this->all_syms); -#line 34 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - std_vector_Vector__10_free(this->all_syms); - -#line 35 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 32 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" std_set_Set__1_free(this->done); -#line 36 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 33 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" std_mem_free(this->o); -#line 37 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 34 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" std_mem_free(this); } -#line 41 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" -void compiler_passes_reorder_structs_ReorderStructs_collect_all_structs(compiler_passes_reorder_structs_ReorderStructs *this, compiler_ast_program_Namespace *ns) { +#line 37 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" +void compiler_passes_reorder_symbols_ReorderSymbols_collect_sym(compiler_passes_reorder_symbols_ReorderSymbols *this, compiler_ast_scopes_Symbol *sym) { + +#line 38 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + if (((bool)sym) && !(sym->is_dead)) { + +#line 39 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + std_vector_Vector__9_push(this->all_syms, sym); + } +} + + +#line 44 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" +void compiler_passes_reorder_symbols_ReorderSymbols_collect_all_symbols_ns(compiler_passes_reorder_symbols_ReorderSymbols *this, compiler_ast_program_Namespace *ns) { -#line 42 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(ns->structs); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { +#line 45 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(ns->structs); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { -#line 42 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_ast_nodes_Structure *struc = std_vector_Iterator__9_cur(&__iter); +#line 45 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_ast_nodes_Structure *struc = std_vector_Iterator__14_cur(&__iter); -#line 42 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 45 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" { -#line 43 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 46 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" if (compiler_ast_scopes_Symbol_is_templated(struc->sym)) { -#line 44 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 47 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" for (std_vector_Iterator__4 __iter = std_vector_Vector__4_iter(struc->sym->template->instances); std_vector_Iterator__4_has_value(&__iter); std_vector_Iterator__4_next(&__iter)) { -#line 44 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 47 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" compiler_ast_scopes_TemplateInstance *instance = std_vector_Iterator__4_cur(&__iter); -#line 44 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 47 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" { -#line 45 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 48 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" compiler_ast_scopes_Symbol *sym = instance->resolved; -#line 46 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - if(!(sym->type==compiler_ast_scopes_SymbolType_Structure)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc:46:24: Assertion failed: `sym.type == Structure`", NULL); } - -#line 47 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - std_vector_Vector__9_push(this->all_structs, sym->u.struc); +#line 49 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + if(!(sym->type==compiler_ast_scopes_SymbolType_Structure)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc:49:24: Assertion failed: `sym.type == Structure`", NULL); } -#line 48 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - std_vector_Vector__10_push(this->all_syms, sym); +#line 50 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_collect_sym(this, sym); } } } else { -#line 52 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - std_vector_Vector__9_push(this->all_structs, struc); - -#line 53 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - std_vector_Vector__10_push(this->all_syms, struc->sym); +#line 54 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_collect_sym(this, struc->sym); } } } -#line 56 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 57 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" for (std_vector_Iterator__15 __iter = std_vector_Vector__15_iter(ns->enums); std_vector_Iterator__15_has_value(&__iter); std_vector_Iterator__15_next(&__iter)) { -#line 56 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 57 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" compiler_ast_nodes_Enum *enom = std_vector_Iterator__15_cur(&__iter); -#line 56 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 57 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" { -#line 57 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - std_vector_Vector__10_push(this->all_syms, enom->sym); +#line 58 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_collect_sym(this, enom->sym); } } -#line 59 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 60 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 59 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 60 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" compiler_ast_program_Namespace *child = std_map_ValueIterator__3_cur(&__iter); -#line 59 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 60 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + { + +#line 61 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_collect_all_symbols_ns(this, child); + } + } +} + + +#line 65 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" +void compiler_passes_reorder_symbols_ReorderSymbols_collect_all_symbols(compiler_passes_reorder_symbols_ReorderSymbols *this) { + +#line 66 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_collect_all_symbols_ns(this, this->o->program->global); + +#line 67 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + for (std_vector_Iterator__0 __iter = std_vector_Vector__0_iter(this->o->program->closure_types); std_vector_Iterator__0_has_value(&__iter); std_vector_Iterator__0_next(&__iter)) { + +#line 67 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_types_Type *cty = std_vector_Iterator__0_cur(&__iter); + +#line 67 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + { + +#line 68 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_collect_sym(this, cty->sym); + } + } + +#line 70 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(this->o->program->closures); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { + +#line 70 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_ast_nodes_Function *closure = std_vector_Iterator__6_cur(&__iter); + +#line 70 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" { -#line 60 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_passes_reorder_structs_ReorderStructs_collect_all_structs(this, child); +#line 71 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_collect_sym(this, closure->sym); } } } -#line 64 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" -void compiler_passes_reorder_structs_ReorderStructs_dfs(compiler_passes_reorder_structs_ReorderStructs *this, compiler_ast_scopes_Symbol *sym) { +#line 75 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" +void compiler_passes_reorder_symbols_ReorderSymbols_dfs(compiler_passes_reorder_symbols_ReorderSymbols *this, compiler_ast_scopes_Symbol *sym) { -#line 65 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 76 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" if (!(((bool)sym)) || std_set_Set__1_contains(this->done, sym)) { -#line 65 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 76 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" return; } -#line 66 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 77 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" std_set_Set__1_add(this->done, sym); -#line 68 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 79 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Structure: - m_63_0: + m_65_0: { -#line 70 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 81 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(sym->u.struc->fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 70 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 81 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 70 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 81 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" { -#line 71 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 82 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" if (((bool)field->type)) { -#line 72 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_passes_reorder_structs_ReorderStructs_dfs(this, field->type->sym); +#line 83 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_dfs(this, field->type->sym); } } } - -#line 75 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - std_vector_Vector__9_push(this->o->program->ordered_structs, sym->u.struc); } break; case compiler_ast_scopes_SymbolType_Enum: - m_63_1: + m_65_1: { -#line 78 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 88 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(sym->u.enom->shared_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 78 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 88 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 78 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 88 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" { -#line 79 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 89 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" if (((bool)field->type)) { -#line 80 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_passes_reorder_structs_ReorderStructs_dfs(this, field->type->sym); +#line 90 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_dfs(this, field->type->sym); } } } -#line 83 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 93 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(sym->u.enom->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 83 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 93 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 83 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 93 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" { -#line 84 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(variant->specific_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 84 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 84 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" { -#line 85 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 95 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" if (((bool)field->type)) { -#line 86 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_passes_reorder_structs_ReorderStructs_dfs(this, field->type->sym); +#line 96 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_dfs(this, field->type->sym); } } } } } } break; + case compiler_ast_scopes_SymbolType_Closure: + m_65_2: + { + +#line 102 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_ast_nodes_Function *func = sym->u.func; + +#line 103 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(func->params); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { + +#line 103 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_ast_nodes_Variable *param = std_vector_Iterator__3_cur(&__iter); + +#line 103 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + { + +#line 104 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_dfs(this, param->type->sym); + } + } + +#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_dfs(this, func->return_type->sym); + } break; + case compiler_ast_scopes_SymbolType_ClosureType: + m_65_3: + { + +#line 108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_dfs(this, sym->u.type_def->sym); + } break; default: { -#line 91 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 109 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" return; } break; } -#line 93 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - std_vector_Vector__10_push(this->o->program->ordered_symbols, sym); +#line 111 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + std_vector_Vector__9_push(this->o->program->ordered_symbols, sym); } -#line 98 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" -void compiler_passes_reorder_structs_ReorderStructs_reorder_structs(compiler_passes_reorder_structs_ReorderStructs *this) { +#line 116 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" +void compiler_passes_reorder_symbols_ReorderSymbols_reorder_structs(compiler_passes_reorder_symbols_ReorderSymbols *this) { -#line 99 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(this->all_syms); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { +#line 117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(this->all_syms); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { -#line 99 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_ast_scopes_Symbol *sym = std_vector_Iterator__10_cur(&__iter); +#line 117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_ast_scopes_Symbol *sym = std_vector_Iterator__9_cur(&__iter); -#line 99 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" +#line 117 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" { -#line 100 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_passes_reorder_structs_ReorderStructs_dfs(this, sym); +#line 118 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_dfs(this, sym); } } } -#line 104 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" -void compiler_passes_reorder_structs_ReorderStructs_run(compiler_ast_program_Program *program) { +#line 122 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" +void compiler_passes_reorder_symbols_ReorderSymbols_run(compiler_ast_program_Program *program) { -#line 105 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_passes_reorder_structs_ReorderStructs *pass = compiler_passes_reorder_structs_ReorderStructs_new(program); +#line 123 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols *pass = compiler_passes_reorder_symbols_ReorderSymbols_new(program); -#line 106 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_passes_reorder_structs_ReorderStructs_collect_all_structs(pass, program->global); +#line 124 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_collect_all_symbols(pass); -#line 107 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_passes_reorder_structs_ReorderStructs_reorder_structs(pass); +#line 125 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_reorder_structs(pass); -#line 108 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_structs.oc" - compiler_passes_reorder_structs_ReorderStructs_free(pass); +#line 126 "/Users/mustafa/ocen-lang/ocen/compiler/passes/reorder_symbols.oc" + compiler_passes_reorder_symbols_ReorderSymbols_free(pass); } @@ -17624,7 +18037,7 @@ void compiler_passes_reorder_structs_ReorderStructs_run(compiler_ast_program_Pro compiler_parser_Parser compiler_parser_Parser_make(compiler_ast_program_Program *program, compiler_ast_program_Namespace *ns) { #line 42 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - return (compiler_parser_Parser){.tokens=NULL, .curr=0, .curr_func=NULL, .program=program, .ns=ns, .attrs=std_vector_Vector__13_new(16), .attrs_span=std_span_Span_default(), .attrs_start_tok=NULL, .prev_expr_error_span=std_span_Span_default()}; + return (compiler_parser_Parser){.tokens=NULL, .curr=0, .curr_func=NULL, .program=program, .ns=ns, .attrs=std_vector_Vector__12_new(16), .attrs_span=std_span_Span_default(), .attrs_start_tok=NULL, .prev_expr_error_span=std_span_Span_default()}; } @@ -17632,7 +18045,7 @@ compiler_parser_Parser compiler_parser_Parser_make(compiler_ast_program_Program void compiler_parser_Parser_free(compiler_parser_Parser *this) { #line 58 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__13_free(this->attrs); + std_vector_Vector__12_free(this->attrs); } @@ -17646,7 +18059,7 @@ compiler_tokens_Token *compiler_parser_Parser_peek(compiler_parser_Parser *this, if(!((0 <= idx) && (idx < ((i32)this->tokens->size)))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/parser.oc:63:12: Assertion failed: `0i32 <= idx < (.tokens.size as i32)`", NULL); } #line 64 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - return std_vector_Vector__12_at(this->tokens, ((u32)idx)); + return std_vector_Vector__11_at(this->tokens, ((u32)idx)); } @@ -17657,7 +18070,7 @@ compiler_errors_Error *compiler_parser_Parser_error_msg(compiler_parser_Parser * compiler_errors_Error *err = compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, msg); #line 69 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__14_push(this->program->errors, err); + std_vector_Vector__13_push(this->program->errors, err); #line 70 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return err; @@ -17668,7 +18081,7 @@ compiler_errors_Error *compiler_parser_Parser_error_msg(compiler_parser_Parser * compiler_errors_Error *compiler_parser_Parser_error(compiler_parser_Parser *this, compiler_errors_Error *err) { #line 74 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__14_push(this->program->errors, err); + std_vector_Vector__13_push(this->program->errors, err); #line 75 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return err; @@ -17700,7 +18113,7 @@ compiler_tokens_Token *compiler_parser_Parser_token(compiler_parser_Parser *this } #line 89 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - return std_vector_Vector__12_unchecked_at(this->tokens, ((u32)this->curr)); + return std_vector_Vector__11_unchecked_at(this->tokens, ((u32)this->curr)); } @@ -17753,7 +18166,7 @@ bool compiler_parser_Parser_peek_token_is(compiler_parser_Parser *this, u32 off, } #line 108 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_tokens_Token *tok = std_vector_Vector__12_at(this->tokens, (this->curr + off)); + compiler_tokens_Token *tok = std_vector_Vector__11_at(this->tokens, (this->curr + off)); #line 109 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return tok->type==type; @@ -17897,10 +18310,10 @@ void compiler_parser_Parser_consume_end_of_statement(compiler_parser_Parser *thi void compiler_parser_Parser_clear_attributes(compiler_parser_Parser *this) { #line 162 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(this->attrs); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { + for (std_vector_Iterator__12 __iter = std_vector_Vector__12_iter(this->attrs); std_vector_Iterator__12_has_value(&__iter); std_vector_Iterator__12_next(&__iter)) { #line 162 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_attributes_Attribute *attr = std_vector_Iterator__13_cur(&__iter); + compiler_attributes_Attribute *attr = std_vector_Iterator__12_cur(&__iter); #line 162 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { @@ -17911,7 +18324,7 @@ void compiler_parser_Parser_clear_attributes(compiler_parser_Parser *this) { } #line 165 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__13_clear(this->attrs); + std_vector_Vector__12_clear(this->attrs); #line 166 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->attrs_start_tok=NULL; @@ -17927,22 +18340,22 @@ bool compiler_parser_Parser_is_compound_operator(compiler_parser_Parser *this, c #line 169 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((op)) { case compiler_ast_operators_Operator_LeftShift: - m_64_0: + m_66_0: { __yield_0 = (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_LessThan) && compiler_parser_Parser_peek_token_is(this, 1, compiler_tokens_TokenType_LessThan)); } break; case compiler_ast_operators_Operator_RightShift: - m_64_1: + m_66_1: { __yield_0 = (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_GreaterThan) && compiler_parser_Parser_peek_token_is(this, 1, compiler_tokens_TokenType_GreaterThan)); } break; case compiler_ast_operators_Operator_LeftShiftEquals: - m_64_2: + m_66_2: { __yield_0 = (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_LessThan) && compiler_parser_Parser_peek_token_is(this, 1, compiler_tokens_TokenType_LessThanEquals)); } break; case compiler_ast_operators_Operator_RightShiftEquals: - m_64_3: + m_66_3: { __yield_0 = (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_GreaterThan) && compiler_parser_Parser_peek_token_is(this, 1, compiler_tokens_TokenType_GreaterThanEquals)); } break; @@ -17965,7 +18378,7 @@ std_span_Span compiler_parser_Parser_consume_compound_operator(compiler_parser_P #line 179 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((op)) { case compiler_ast_operators_Operator_LeftShift: - m_65_0: + m_67_0: { #line 180 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -17975,7 +18388,7 @@ std_span_Span compiler_parser_Parser_consume_compound_operator(compiler_parser_P compiler_parser_Parser_consume(this, compiler_tokens_TokenType_LessThan); } break; case compiler_ast_operators_Operator_RightShift: - m_65_1: + m_67_1: { #line 181 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -17985,7 +18398,7 @@ std_span_Span compiler_parser_Parser_consume_compound_operator(compiler_parser_P compiler_parser_Parser_consume(this, compiler_tokens_TokenType_GreaterThan); } break; case compiler_ast_operators_Operator_LeftShiftEquals: - m_65_2: + m_67_2: { #line 182 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -17995,7 +18408,7 @@ std_span_Span compiler_parser_Parser_consume_compound_operator(compiler_parser_P compiler_parser_Parser_consume(this, compiler_tokens_TokenType_LessThanEquals); } break; case compiler_ast_operators_Operator_RightShiftEquals: - m_65_3: + m_67_3: { #line 183 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -18013,7 +18426,7 @@ std_span_Span compiler_parser_Parser_consume_compound_operator(compiler_parser_P } #line 188 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_tokens_Token *prev_token = std_vector_Vector__12_at(this->tokens, (this->curr - 1)); + compiler_tokens_Token *prev_token = std_vector_Vector__11_at(this->tokens, (this->curr - 1)); #line 189 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return std_span_Span_join(span, prev_token->span); @@ -18029,7 +18442,7 @@ compiler_types_Type *compiler_parser_Parser_parse_type(compiler_parser_Parser *t #line 194 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_Identifier: - m_66_0: + m_68_0: { #line 196 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -18048,7 +18461,7 @@ compiler_types_Type *compiler_parser_Parser_parse_type(compiler_parser_Parser *t __yield_0 = typ; } break; case compiler_tokens_TokenType_Ampersand: - m_66_1: + m_68_1: { #line 204 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -18068,7 +18481,7 @@ compiler_types_Type *compiler_parser_Parser_parse_type(compiler_parser_Parser *t } break; case compiler_tokens_TokenType_AtSign: case compiler_tokens_TokenType_Fn: - m_66_2: + m_68_2: { #line 212 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -18080,7 +18493,7 @@ compiler_types_Type *compiler_parser_Parser_parse_type(compiler_parser_Parser *t #line 213 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_AtSign: - m_67_0: + m_69_0: { #line 219 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -18093,7 +18506,7 @@ compiler_types_Type *compiler_parser_Parser_parse_type(compiler_parser_Parser *t __yield_1 = compiler_types_BaseType_Closure; } break; case compiler_tokens_TokenType_Fn: - m_67_1: + m_69_1: { #line 224 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -18182,7 +18595,7 @@ compiler_types_Type *compiler_parser_Parser_parse_type(compiler_parser_Parser *t __yield_0 = type; } break; case compiler_tokens_TokenType_OpenSquare: - m_66_3: + m_68_3: { #line 263 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -18256,7 +18669,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_scoped_identifier(compiler_ #line 291 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_ColonColon: - m_68_0: + m_70_0: { #line 293 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -18298,7 +18711,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_scoped_identifier(compiler_ } } break; case compiler_tokens_TokenType_LessThan: - m_68_1: + m_70_1: { #line 312 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -18309,7 +18722,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_scoped_identifier(compiler_ } #line 319 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_tokens_Token *prev_token = std_vector_Vector__12_at(this->tokens, (((u32)this->curr) - 1)); + compiler_tokens_Token *prev_token = std_vector_Vector__11_at(this->tokens, (((u32)this->curr) - 1)); #line 320 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(std_span_Span_starts_right_after(compiler_parser_Parser_token(this)->span, prev_token->span))) { @@ -18319,7 +18732,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_scoped_identifier(compiler_ } #line 325 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_tokens_Token *next_next_token = std_vector_Vector__12_at(this->tokens, (((u32)this->curr) + 2)); + compiler_tokens_Token *next_next_token = std_vector_Vector__11_at(this->tokens, (((u32)this->curr) + 2)); #line 326 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (next_next_token->type==compiler_tokens_TokenType_Dot) { @@ -18595,13 +19008,13 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_format_string(compiler_pars lexer.loc.col+=(start + 1); #line 460 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__12 *tokens = compiler_lexer_Lexer_lex(&lexer); + std_vector_Vector__11 *tokens = compiler_lexer_Lexer_lex(&lexer); #line 461 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(lexer.errors); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { + for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(lexer.errors); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { #line 461 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_errors_Error *error = std_vector_Iterator__14_cur(&__iter); + compiler_errors_Error *error = std_vector_Iterator__13_cur(&__iter); #line 461 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { @@ -18612,7 +19025,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_format_string(compiler_pars } #line 464 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__14_free(lexer.errors); + std_vector_Vector__13_free(lexer.errors); #line 466 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser sub_parser = compiler_parser_Parser_make(this->program, this->ns); @@ -18658,10 +19071,10 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_format_string(compiler_pars #line 485 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" -std_vector_Vector__11 *compiler_parser_Parser_parse_match_case_conds(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { +std_vector_Vector__10 *compiler_parser_Parser_parse_match_case_conds(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { #line 486 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__11 *conds = std_vector_Vector__11_new(16); + std_vector_Vector__10 *conds = std_vector_Vector__10_new(16); #line 487 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(compiler_parser_Parser_token_is_eof_or(this, end_type))) { @@ -18691,7 +19104,7 @@ std_vector_Vector__11 *compiler_parser_Parser_parse_match_case_conds(compiler_pa var->sym=compiler_ast_scopes_Symbol_from_local_variable(name->text, var, name->span); #line 497 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__19_push(args, ({compiler_ast_nodes_MatchCondArg *_new_69 = std_mem_state_alloc_fn(std_mem_state_allocator, sizeof(compiler_ast_nodes_MatchCondArg)); *_new_69 = (compiler_ast_nodes_MatchCondArg){.var=var, .is_shared=false}; _new_69; })); + std_vector_Vector__19_push(args, ({compiler_ast_nodes_MatchCondArg *_new_71 = std_mem_state_alloc_fn(std_mem_state_allocator, sizeof(compiler_ast_nodes_MatchCondArg)); *_new_71 = (compiler_ast_nodes_MatchCondArg){.var=var, .is_shared=false}; _new_71; })); #line 499 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Comma))) { @@ -18706,7 +19119,7 @@ std_vector_Vector__11 *compiler_parser_Parser_parse_match_case_conds(compiler_pa } #line 505 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__11_push(conds, compiler_ast_nodes_MatchCond_new(expr, args, NULL)); + std_vector_Vector__10_push(conds, compiler_ast_nodes_MatchCond_new(expr, args, NULL)); #line 506 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Line))) { @@ -18782,7 +19195,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_match(compiler_parser_Parse } else { #line 537 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__11 *conds = compiler_parser_Parser_parse_match_case_conds(this, compiler_tokens_TokenType_FatArrow); + std_vector_Vector__10 *conds = compiler_parser_Parser_parse_match_case_conds(this, compiler_tokens_TokenType_FatArrow); #line 538 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_FatArrow))) { @@ -19106,10 +19519,10 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_global_value(compiler_parse compiler_parser_Parser_parse_extern_into_symbol(this, var->sym); #line 689 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(this->attrs); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { + for (std_vector_Iterator__12 __iter = std_vector_Vector__12_iter(this->attrs); std_vector_Iterator__12_has_value(&__iter); std_vector_Iterator__12_next(&__iter)) { #line 689 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_attributes_Attribute *attr = std_vector_Iterator__13_cur(&__iter); + compiler_attributes_Attribute *attr = std_vector_Iterator__12_cur(&__iter); #line 689 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { @@ -19117,14 +19530,14 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_global_value(compiler_parse #line 690 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((attr->type)) { case compiler_attributes_AttributeType_Extern: - m_70_0: + m_72_0: { #line 691 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_get_extern_from_attr(this, var->sym, attr); } break; case compiler_attributes_AttributeType_Atomic: - m_70_1: + m_72_1: { #line 692 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19175,35 +19588,35 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser #line 711 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_If: - m_71_0: + m_73_0: { #line 712 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_parser_Parser_parse_if(this); } break; case compiler_tokens_TokenType_Match: - m_71_1: + m_73_1: { #line 713 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_parser_Parser_parse_match(this); } break; case compiler_tokens_TokenType_OpenCurly: - m_71_2: + m_73_2: { #line 714 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_parser_Parser_parse_block(this); } break; case compiler_tokens_TokenType_FormatStringLiteral: - m_71_3: + m_73_3: { #line 715 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_parser_Parser_parse_format_string(this); } break; case compiler_tokens_TokenType_Null: - m_71_4: + m_73_4: { #line 717 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19213,7 +19626,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser node=compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Null, tok->span); } break; case compiler_tokens_TokenType_IntLiteral: - m_71_5: + m_73_5: { #line 721 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19226,7 +19639,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser node->u.num_literal=(compiler_ast_nodes_NumLiteral){.text=tok->text, .suffix=compiler_parser_Parser_parse_literal_suffix_type(this, tok->suffix)}; } break; case compiler_tokens_TokenType_FloatLiteral: - m_71_6: + m_73_6: { #line 729 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19239,7 +19652,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser node->u.num_literal=(compiler_ast_nodes_NumLiteral){.text=tok->text, .suffix=compiler_parser_Parser_parse_literal_suffix_type(this, tok->suffix)}; } break; case compiler_tokens_TokenType_StringLiteral: - m_71_7: + m_73_7: { #line 737 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19252,7 +19665,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser node->u.string_literal=tok->text; } break; case compiler_tokens_TokenType_CharLiteral: - m_71_8: + m_73_8: { #line 742 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19265,7 +19678,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser node->u.char_literal=tok->text; } break; case compiler_tokens_TokenType_Identifier: - m_71_9: + m_73_9: { #line 746 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19273,7 +19686,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser } break; case compiler_tokens_TokenType_True: case compiler_tokens_TokenType_False: - m_71_10: + m_73_10: { #line 748 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19286,7 +19699,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser node->u.bool_literal=tok->type==compiler_tokens_TokenType_True; } break; case compiler_tokens_TokenType_OpenParen: - m_71_11: + m_73_11: { #line 753 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19302,7 +19715,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser node->span=std_span_Span_join(start->span, end->span); } break; case compiler_tokens_TokenType_Dot: - m_71_12: + m_73_12: { #line 759 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19357,7 +19770,7 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser } } break; case compiler_tokens_TokenType_EOF: - m_71_13: + m_73_13: { #line 783 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" @@ -19367,720 +19780,723 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_atom(compiler_parser_Parser return compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Error, compiler_parser_Parser_token(this)->span); } break; case compiler_tokens_TokenType_Line: - m_71_14: + m_73_14: { #line 787 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_nodes_Function *closure_func = compiler_parser_Parser_parse_closure(this); + std_span_Location start_loc = compiler_parser_Parser_token(this)->span.start; #line 788 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_CreateClosure, closure_func->span); + compiler_ast_nodes_Function *closure_func = compiler_parser_Parser_parse_closure(this); #line 789 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_CreateClosure, closure_func->span); + +#line 790 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.closure=closure_func; -#line 791 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 792 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *closure_name = std_format("_Closure_%u", this->program->closures->size); -#line 792 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 793 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__6_push(this->program->closures, closure_func); -#line 794 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 795 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_scopes_Symbol *parent_sym = (((bool)this->curr_func) ? this->curr_func->sym : this->ns->sym); -#line 798 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_Closure, this->ns, parent_sym, closure_name, closure_func->span); - #line 799 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - sym->u.func=closure_func; + compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_Closure, this->ns, parent_sym, closure_name, (std_span_Span){.start=start_loc, .end=start_loc}); #line 800 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - closure_func->sym=sym; + sym->u.func=closure_func; #line 801 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + closure_func->sym=sym; + +#line 802 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } break; default: { -#line 804 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_span_Span prev_span = std_vector_Vector__12_at(this->tokens, (this->curr - 1))->span; - #line 805 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + std_span_Span prev_span = std_vector_Vector__11_at(this->tokens, (this->curr - 1))->span; + +#line 806 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span cur_span = compiler_parser_Parser_token(this)->span; -#line 807 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 808 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span err_span = (std_span_Span){.start=prev_span.end, .end=cur_span.start}; -#line 808 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 809 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_token_is(this, end_type))) { -#line 809 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 810 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->curr+=1; -#line 810 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 811 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" err_span=cur_span; -#line 811 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 812 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_unhandled_type(this, "parse_expression"); } else if (std_span_Span_eq(this->prev_expr_error_span, err_span)) { -#line 817 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 818 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->curr+=1; } else { -#line 820 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 821 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->prev_expr_error_span=err_span; -#line 821 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 822 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_unhandled_type(this, "parse_expression"); } -#line 824 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 825 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Error, err_span); } break; } -#line 827 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 828 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } -#line 830 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 831 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_postfix(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 831 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 832 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_parser_Parser_parse_atom(this, end_type); -#line 833 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 834 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool running = true; -#line 834 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 835 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (running) { -#line 835 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 836 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 835 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 836 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 836 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 837 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_OpenParen: - m_72_0: + m_74_0: { -#line 837 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 838 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_parser_Parser_parse_call(this, node); } break; case compiler_tokens_TokenType_Dot: - m_72_1: + m_74_1: { -#line 839 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 840 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 839 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 840 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 840 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 841 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Dot); -#line 841 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 842 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *member = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Member, node->span); -#line 842 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 843 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" member->u.member.lhs=node; -#line 843 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 844 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=member; -#line 845 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 846 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type) || !(compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Identifier))) { -#line 846 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 847 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected identifier after `.`")); -#line 847 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 848 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->span.end=compiler_parser_Parser_token(this)->span.start; } else { -#line 850 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 851 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *ident = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 851 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 852 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->span=std_span_Span_join(node->span, ident->span); -#line 852 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 853 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.member.rhs_name=ident->text; -#line 853 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 854 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.member.rhs_span=ident->span; } } break; case compiler_tokens_TokenType_Question: - m_72_2: + m_74_2: { -#line 857 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 858 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *tok = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Question); -#line 858 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 859 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator_IsNotNull, std_span_Span_join(node->span, tok->span), node); } break; case compiler_tokens_TokenType_OpenSquare: - m_72_3: + m_74_3: { -#line 861 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 862 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *open = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenSquare); -#line 862 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 863 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *index = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_CloseSquare); -#line 863 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 864 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *close = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseSquare); -#line 867 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 868 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *op = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_BinaryOp, std_span_Span_join(node->span, close->span)); -#line 868 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 869 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op->u.binary.op=compiler_ast_operators_Operator_Index; -#line 869 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 870 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op->u.binary.lhs=node; -#line 870 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 871 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op->u.binary.rhs=index; -#line 871 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 872 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op->u.binary.op_span=open->span; -#line 872 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 873 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=op; } break; case compiler_tokens_TokenType_MinusMinus: case compiler_tokens_TokenType_PlusPlus: - m_72_4: + m_74_4: { -#line 875 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 876 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span span = std_span_Span_join(node->span, compiler_parser_Parser_token(this)->span); -#line 876 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 877 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = ({ compiler_ast_operators_Operator __yield_0; -#line 876 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 877 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_MinusMinus)) { -#line 877 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 878 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_MinusMinus); -#line 878 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 879 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_operators_Operator_PostDecrement; } else { -#line 880 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 881 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_PlusPlus); -#line 881 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 882 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_operators_Operator_PostIncrement; } __yield_0; }); -#line 883 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 884 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_ast_nodes_AST_new_unop(op, span, node); } break; default: { -#line 885 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 886 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" running=false; } break; } } -#line 889 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 890 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } -#line 892 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 893 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_prefix(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 893 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 894 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_Ampersand: - m_73_0: + m_75_0: { -#line 895 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 896 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *amp = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Ampersand); -#line 896 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 897 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_prefix(this, end_type); -#line 897 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 898 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator_Address, std_span_Span_join(amp->span, expr->span), expr); -#line 898 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 899 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } break; case compiler_tokens_TokenType_MinusMinus: case compiler_tokens_TokenType_PlusPlus: - m_73_1: + m_75_1: { -#line 901 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 902 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span start_span = compiler_parser_Parser_token(this)->span; -#line 902 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 903 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = ({ compiler_ast_operators_Operator __yield_0; -#line 902 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 903 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_MinusMinus)) { -#line 903 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 904 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_MinusMinus); -#line 904 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 905 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_operators_Operator_PreDecrement; } else { -#line 906 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 907 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_PlusPlus); -#line 907 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 908 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_operators_Operator_PreIncrement; } __yield_0; }); -#line 909 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 910 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_prefix(this, end_type); -#line 910 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 911 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_ast_nodes_AST_new_unop(op, std_span_Span_join(start_span, expr->span), expr); } break; case compiler_tokens_TokenType_SizeOf: - m_73_2: + m_75_2: { -#line 913 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 914 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_SizeOf); -#line 914 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 915 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenParen); -#line 915 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 916 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_types_Type *type = compiler_parser_Parser_parse_type(this); -#line 916 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 917 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *close = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseParen); -#line 917 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 918 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_SizeOf, std_span_Span_join(start->span, close->span)); -#line 918 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 919 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.size_of_type=type; -#line 919 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 920 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } break; case compiler_tokens_TokenType_AtSign: - m_73_3: + m_75_3: { -#line 923 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 924 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *atsign = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_AtSign); -#line 924 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 925 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Identifier))) { -#line 925 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 926 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected compiler operation after @")); -#line 926 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 927 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Error, atsign->span); } -#line 928 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 929 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *ident = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 929 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 930 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { - char *__match_var_74 = ident->text; - if (str_eq(__match_var_74, "new")) { + char *__match_var_76 = ident->text; + if (str_eq(__match_var_76, "new")) { -#line 931 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 932 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_prefix(this, end_type); -#line 932 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 933 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_CreateNew, std_span_Span_join(atsign->span, expr->span)); -#line 933 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 934 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.child=expr; -#line 934 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 935 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } else { -#line 937 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 938 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(ident->span, "Unknown compiler operation")); -#line 938 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 939 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Error, atsign->span); } } } break; case compiler_tokens_TokenType_Star: - m_73_4: + m_75_4: { -#line 943 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 944 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *star = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Star); -#line 944 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 945 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_prefix(this, end_type); -#line 945 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 946 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator_Dereference, std_span_Span_join(star->span, expr->span), expr); -#line 946 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 947 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } break; case compiler_tokens_TokenType_Minus: - m_73_5: + m_75_5: { -#line 949 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 950 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *minus = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Minus); -#line 950 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 951 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_prefix(this, end_type); -#line 951 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 952 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator_Negate, std_span_Span_join(minus->span, expr->span), expr); -#line 952 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 953 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } break; case compiler_tokens_TokenType_Tilde: - m_73_6: + m_75_6: { -#line 955 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 956 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *tok = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Tilde); -#line 956 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 957 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_prefix(this, end_type); -#line 957 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 958 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator_BitwiseNot, std_span_Span_join(tok->span, expr->span), expr); -#line 958 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 959 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } break; default: { -#line 960 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 961 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_parser_Parser_parse_postfix(this, end_type); } break; } } -#line 964 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 965 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_cast(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 965 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 966 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_prefix(this, end_type); -#line 966 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 967 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_As)) { -#line 967 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 968 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 967 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 968 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 968 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 969 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *tok = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_As); -#line 969 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 970 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_types_Type *type_node = compiler_parser_Parser_parse_type(this); -#line 970 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 971 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *op = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Cast, std_span_Span_join(lhs->span, type_node->span)); -#line 971 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 972 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op->u.cast.lhs=lhs; -#line 972 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 973 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op->u.cast.to=type_node; -#line 973 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 974 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op->u.cast.parsed_to=type_node; -#line 974 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 975 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" lhs=op; } -#line 976 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 977 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 979 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 980 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_term(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 980 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 981 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_cast(this, end_type); -#line 981 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 982 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while ((compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Star) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Slash)) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Percent)) { -#line 984 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 985 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 984 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 985 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 985 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 986 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *op_tok = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); -#line 986 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 987 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = compiler_ast_operators_Operator_from_token(op_tok); -#line 987 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 988 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *rhs = compiler_parser_Parser_parse_cast(this, end_type); -#line 988 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 989 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" lhs=compiler_ast_nodes_AST_new_binop(op, lhs, rhs, op_tok->span); } -#line 990 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 991 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 994 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 995 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_additive(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 995 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 996 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_term(this, end_type); -#line 996 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 997 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Plus) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Minus)) { -#line 997 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 998 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 997 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 998 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 998 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 999 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *op_tok = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); -#line 999 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1000 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = compiler_ast_operators_Operator_from_token(op_tok); -#line 1000 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1001 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *rhs = compiler_parser_Parser_parse_term(this, end_type); -#line 1001 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1002 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" lhs=compiler_ast_nodes_AST_new_binop(op, lhs, rhs, op_tok->span); } -#line 1003 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1004 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 1006 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1007 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_shift(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 1007 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1008 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_additive(this, end_type); -#line 1008 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1009 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (compiler_parser_Parser_is_compound_operator(this, compiler_ast_operators_Operator_LeftShift) || compiler_parser_Parser_is_compound_operator(this, compiler_ast_operators_Operator_RightShift)) { -#line 1011 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1012 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = ({ compiler_ast_operators_Operator __yield_0; -#line 1011 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1012 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token(this)->type==compiler_tokens_TokenType_LessThan) { -#line 1012 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1013 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_operators_Operator_LeftShift; } else { -#line 1014 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1015 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_operators_Operator_RightShift; } __yield_0; }); -#line 1016 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1017 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span op_span = compiler_parser_Parser_consume_compound_operator(this, op); -#line 1017 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1018 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *rhs = compiler_parser_Parser_parse_additive(this, end_type); -#line 1018 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1019 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" lhs=compiler_ast_nodes_AST_new_binop(op, lhs, rhs, op_span); } -#line 1020 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1021 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 1023 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1024 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_bw_and(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 1024 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1025 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_shift(this, end_type); -#line 1025 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1026 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Ampersand)) { -#line 1026 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1027 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 1026 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1027 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 1027 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1028 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *op_tok = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); -#line 1028 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1029 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = compiler_ast_operators_Operator_from_token(op_tok); -#line 1029 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1030 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *rhs = compiler_parser_Parser_parse_shift(this, end_type); -#line 1030 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1031 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" lhs=compiler_ast_nodes_AST_new_binop(op, lhs, rhs, op_tok->span); } -#line 1032 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1033 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 1035 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1036 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_bw_xor(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 1036 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1037 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_bw_and(this, end_type); -#line 1037 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1038 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Caret)) { -#line 1038 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1039 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 1038 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1039 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 1039 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1040 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *op_tok = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); -#line 1040 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1041 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = compiler_ast_operators_Operator_from_token(op_tok); -#line 1041 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1042 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *rhs = compiler_parser_Parser_parse_bw_and(this, end_type); -#line 1042 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1043 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" lhs=compiler_ast_nodes_AST_new_binop(op, lhs, rhs, op_tok->span); } -#line 1044 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1045 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 1047 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1048 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_bw_or(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 1048 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1049 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_bw_xor(this, end_type); -#line 1049 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1050 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Line)) { -#line 1050 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1051 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 1050 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1051 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 1051 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1052 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *op_tok = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); -#line 1052 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1053 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = compiler_ast_operators_Operator_from_token(op_tok); -#line 1053 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1054 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *rhs = compiler_parser_Parser_parse_bw_xor(this, end_type); -#line 1054 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1055 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" lhs=compiler_ast_nodes_AST_new_binop(op, lhs, rhs, op_tok->span); } -#line 1056 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1057 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 1059 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1060 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_relational(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 1060 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1061 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_bw_or(this, end_type); -#line 1062 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__16 *operands = NULL; - #line 1063 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__12 *operators = NULL; + std_vector_Vector__16 *operands = NULL; #line 1064 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + std_vector_Vector__11 *operators = NULL; + +#line 1065 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while ((((((compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_LessThan) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_GreaterThan)) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_LessThanEquals)) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_GreaterThanEquals)) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_EqualEquals)) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_NotEquals)) || compiler_parser_Parser_token_is_identifier(this, "in")) { -#line 1072 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1073 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 1072 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1073 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 1074 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1075 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool done = ({ bool __yield_0; -#line 1074 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1075 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_LessThan: - m_75_0: + m_77_0: { __yield_0 = compiler_parser_Parser_is_compound_operator(this, compiler_ast_operators_Operator_LeftShiftEquals); } break; case compiler_tokens_TokenType_GreaterThan: - m_75_1: + m_77_1: { __yield_0 = compiler_parser_Parser_is_compound_operator(this, compiler_ast_operators_Operator_RightShiftEquals); } break; @@ -20092,1866 +20508,1866 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_relational(compiler_parser_ __yield_0; }); -#line 1079 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1080 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (done) { -#line 1079 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1080 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 1081 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - if (!(((bool)operators))) { - #line 1082 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - operators=std_vector_Vector__12_new(2); + if (!(((bool)operators))) { #line 1083 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - operands=std_vector_Vector__16_new(3); + operators=std_vector_Vector__11_new(2); #line 1084 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + operands=std_vector_Vector__16_new(3); + +#line 1085 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_push(operands, lhs); } -#line 1087 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_tokens_Token *token = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); - #line 1088 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__12_push(operators, token); + compiler_tokens_Token *token = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); #line 1089 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_nodes_AST *term = compiler_parser_Parser_parse_bw_or(this, end_type); + std_vector_Vector__11_push(operators, token); #line 1090 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + compiler_ast_nodes_AST *term = compiler_parser_Parser_parse_bw_or(this, end_type); + +#line 1091 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_push(operands, term); } -#line 1093 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1094 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)operators))) { -#line 1093 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1094 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 1095 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_nodes_AST *root = ((compiler_ast_nodes_AST *)NULL); - #line 1096 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - for (u32 i = 0; i < operators->size; i+=1) { + compiler_ast_nodes_AST *root = ((compiler_ast_nodes_AST *)NULL); #line 1097 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_tokens_Token *tok = std_vector_Vector__12_at(operators, i); + for (u32 i = 0; i < operators->size; i+=1) { #line 1098 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_nodes_AST *lhs = std_vector_Vector__16_at(operands, i); + compiler_tokens_Token *tok = std_vector_Vector__11_at(operators, i); #line 1099 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_nodes_AST *rhs = std_vector_Vector__16_at(operands, (i + 1)); + compiler_ast_nodes_AST *lhs = std_vector_Vector__16_at(operands, i); #line 1100 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_nodes_AST *op = compiler_ast_nodes_AST_new_binop(compiler_ast_operators_Operator_from_token(tok), lhs, rhs, tok->span); + compiler_ast_nodes_AST *rhs = std_vector_Vector__16_at(operands, (i + 1)); #line 1101 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - if (((bool)root)) { + compiler_ast_nodes_AST *op = compiler_ast_nodes_AST_new_binop(compiler_ast_operators_Operator_from_token(tok), lhs, rhs, tok->span); #line 1102 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + if (((bool)root)) { + +#line 1103 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" root=compiler_ast_nodes_AST_new_binop(compiler_ast_operators_Operator_And, root, op, tok->span); } else { -#line 1104 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1105 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" root=op; } } -#line 1108 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1109 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_free(operands); -#line 1109 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__12_free(operators); +#line 1110 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + std_vector_Vector__11_free(operators); -#line 1111 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1112 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return root; } -#line 1114 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1115 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_logical_not(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 1115 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1116 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Not)) { -#line 1116 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1117 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *tok = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Not); -#line 1117 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1118 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_logical_not(this, end_type); -#line 1118 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1119 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator_Not, std_span_Span_join(tok->span, expr->span), expr); } -#line 1120 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1121 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_parser_Parser_parse_relational(this, end_type); } -#line 1123 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1124 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_logical_and(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 1124 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1125 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_logical_not(this, end_type); -#line 1125 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1126 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_And)) { -#line 1126 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1127 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 1126 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1127 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 1127 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1128 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *op_tok = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); -#line 1128 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1129 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = compiler_ast_operators_Operator_from_token(op_tok); -#line 1129 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1130 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *rhs = compiler_parser_Parser_parse_logical_not(this, end_type); -#line 1130 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1131 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" lhs=compiler_ast_nodes_AST_new_binop(op, lhs, rhs, op_tok->span); } -#line 1132 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1133 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 1135 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1136 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_logical_or(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 1136 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1137 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_logical_and(this, end_type); -#line 1137 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1138 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Or)) { -#line 1138 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1139 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 1138 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1139 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 1139 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1140 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *op_tok = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); -#line 1140 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1141 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = compiler_ast_operators_Operator_from_token(op_tok); -#line 1141 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1142 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *rhs = compiler_parser_Parser_parse_logical_and(this, end_type); -#line 1142 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1143 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" lhs=compiler_ast_nodes_AST_new_binop(op, lhs, rhs, op_tok->span); } -#line 1144 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1145 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 1148 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1149 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_expression(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 1149 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1150 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *lhs = compiler_parser_Parser_parse_logical_or(this, end_type); -#line 1150 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1151 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while ((((((compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Equals) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_PlusEquals)) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_MinusEquals)) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_StarEquals)) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_SlashEquals)) || compiler_parser_Parser_is_compound_operator(this, compiler_ast_operators_Operator_LeftShiftEquals)) || compiler_parser_Parser_is_compound_operator(this, compiler_ast_operators_Operator_RightShiftEquals)) { -#line 1157 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1158 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, end_type)) { -#line 1157 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1158 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 1159 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1160 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span op_span = {0}; -#line 1160 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1161 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = ({ compiler_ast_operators_Operator __yield_0; -#line 1160 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1161 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_LessThan: - m_76_0: + m_78_0: { -#line 1162 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1163 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op_span=compiler_parser_Parser_consume_compound_operator(this, compiler_ast_operators_Operator_LeftShiftEquals); -#line 1163 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1164 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_operators_Operator_LeftShiftEquals; } break; case compiler_tokens_TokenType_GreaterThan: - m_76_1: + m_78_1: { -#line 1166 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1167 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op_span=compiler_parser_Parser_consume_compound_operator(this, compiler_ast_operators_Operator_RightShiftEquals); -#line 1167 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1168 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_operators_Operator_RightShiftEquals; } break; default: { -#line 1170 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1171 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *tok = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); -#line 1171 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1172 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op_span=tok->span; -#line 1172 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1173 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_operators_Operator_from_token(tok); } break; } __yield_0; }); -#line 1180 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1181 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if ((op==compiler_ast_operators_Operator_Assignment && lhs->type==compiler_ast_nodes_ASTType_BinaryOp) && lhs->u.binary.op==compiler_ast_operators_Operator_Index) { -#line 1181 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1182 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" op=compiler_ast_operators_Operator_IndexAssign; } -#line 1184 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1185 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *rhs = compiler_parser_Parser_parse_expression(this, end_type); -#line 1185 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1186 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" lhs=compiler_ast_nodes_AST_new_binop(op, lhs, rhs, op_span); } -#line 1187 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1188 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return lhs; } -#line 1190 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1191 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_multi_if(compiler_parser_Parser *this, compiler_tokens_Token *start_tok) { -#line 1191 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1192 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span start_span = start_tok->span; -#line 1193 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1194 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_If, start_span); -#line 1194 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1195 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenCurly); -#line 1195 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1196 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__23 *branches = std_vector_Vector__23_new(16); -#line 1196 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1197 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.if_stmt.branches=branches; -#line 1197 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1198 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.if_stmt.if_span=start_span; -#line 1199 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1200 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(compiler_parser_Parser_token_is_eof_or(this, compiler_tokens_TokenType_CloseCurly))) { -#line 1200 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1201 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Else)) { -#line 1201 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1202 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.if_stmt.els_span=compiler_parser_Parser_token(this)->span; -#line 1202 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1203 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Else); -#line 1203 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1204 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_FatArrow); -#line 1204 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1205 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.if_stmt.els=compiler_parser_Parser_parse_statement(this); } else { -#line 1207 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1208 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *cond = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_FatArrow); -#line 1208 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1209 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_FatArrow))) { -#line 1209 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1210 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected `=>` after condition")); } -#line 1211 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1212 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *body = compiler_parser_Parser_parse_statement(this); -#line 1212 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1213 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__23_push(branches, (compiler_ast_nodes_IfBranch){.cond=cond, .body=body}); } -#line 1214 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1215 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Comma); } -#line 1216 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1217 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span end_span = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseCurly)->span; -#line 1217 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1218 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->span=std_span_Span_join(start_span, end_span); -#line 1218 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1219 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } -#line 1221 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1222 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_if(compiler_parser_Parser *this) { -#line 1222 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1223 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *start_tok = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_If); -#line 1223 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1224 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span start_span = start_tok->span; -#line 1225 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1226 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_OpenCurly)) { -#line 1225 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1226 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_parser_Parser_parse_multi_if(this, start_tok); } -#line 1227 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1228 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__23 *cases = std_vector_Vector__23_new(16); -#line 1228 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1229 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span end_span = start_span; -#line 1229 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1230 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (true) { -#line 1230 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1231 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *cond = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Newline); -#line 1231 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1232 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Then); -#line 1232 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1233 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *body = compiler_parser_Parser_parse_statement(this); -#line 1233 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1234 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__23_push(cases, (compiler_ast_nodes_IfBranch){.cond=cond, .body=body}); -#line 1234 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1235 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" end_span=body->span; -#line 1236 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1237 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Else) && compiler_parser_Parser_peek_token_is(this, 1, compiler_tokens_TokenType_If)) { -#line 1237 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1238 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Else); -#line 1238 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1239 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_If); } else { -#line 1241 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1242 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } } -#line 1244 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1245 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_If, std_span_Span_join(start_span, end_span)); -#line 1245 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1246 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.if_stmt.branches=cases; -#line 1246 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1247 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.if_stmt.if_span=start_span; -#line 1248 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1249 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Else)) { -#line 1249 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1250 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *els_tok = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Else); -#line 1250 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1251 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.if_stmt.els=compiler_parser_Parser_parse_statement(this); -#line 1251 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1252 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.if_stmt.els_span=els_tok->span; } -#line 1254 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1255 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->span=std_span_Span_join(start_span, end_span); -#line 1255 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1256 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } -#line 1274 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1275 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_for_each(compiler_parser_Parser *this, std_span_Span start_span) { -#line 1276 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1277 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *name = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 1277 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1278 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!((compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Colon) || compiler_parser_Parser_token_is_identifier(this, "in")))) { -#line 1278 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1279 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected `:` of `in` after for-each loop variable")); -#line 1279 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1280 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Error, start_span); } -#line 1281 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1282 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); -#line 1283 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1284 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Newline); -#line 1284 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1285 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *iter_var_name = "__iter"; -#line 1286 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1287 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *init = ({ compiler_ast_nodes_AST *__yield_0; -#line 1287 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1288 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_VarDeclaration, start_span); -#line 1288 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1289 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Variable *var = compiler_ast_nodes_Variable_new(NULL); -#line 1289 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1290 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->sym=compiler_ast_scopes_Symbol_from_local_variable(iter_var_name, var, start_span); -#line 1290 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1291 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->default_value=expr; -#line 1292 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1293 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.var_decl=var; -#line 1293 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1294 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = node; __yield_0; }); -#line 1296 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1297 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *cond = ({ compiler_ast_nodes_AST *__yield_0; -#line 1297 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1298 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *iter_name = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Identifier, start_span); -#line 1298 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1299 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" iter_name->u.ident.name=iter_var_name; -#line 1300 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1301 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *member = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Member, start_span); -#line 1301 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1302 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" member->u.member.lhs=iter_name; -#line 1302 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1303 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" member->u.member.rhs_name="has_value"; -#line 1303 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1304 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" member->u.member.rhs_span=expr->span; -#line 1305 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1306 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Call, start_span); -#line 1306 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1307 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.call.callee=member; -#line 1307 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1308 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.call.args=std_vector_Vector__7_new(16); -#line 1308 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1309 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.call.open_paren_span=name->span; -#line 1309 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1310 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.call.close_paren_span=name->span; -#line 1310 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1311 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = node; __yield_0; }); -#line 1313 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1314 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *step = ({ compiler_ast_nodes_AST *__yield_0; -#line 1314 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1315 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *iter_name = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Identifier, start_span); -#line 1315 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1316 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" iter_name->u.ident.name=iter_var_name; -#line 1317 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1318 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *member = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Member, start_span); -#line 1318 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1319 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" member->u.member.lhs=iter_name; -#line 1319 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1320 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" member->u.member.rhs_name="next"; -#line 1320 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1321 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" member->u.member.rhs_span=expr->span; -#line 1322 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1323 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Call, start_span); -#line 1323 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1324 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.call.callee=member; -#line 1324 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1325 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.call.args=std_vector_Vector__7_new(16); -#line 1325 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1326 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.call.open_paren_span=name->span; -#line 1326 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1327 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.call.close_paren_span=name->span; -#line 1327 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1328 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = node; __yield_0; }); -#line 1331 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1332 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *loop_var_decl = ({ compiler_ast_nodes_AST *__yield_0; -#line 1332 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1333 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Variable *var = compiler_ast_nodes_Variable_new(NULL); -#line 1333 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1334 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->sym=compiler_ast_scopes_Symbol_from_local_variable(name->text, var, name->span); -#line 1335 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1336 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *iter_name = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Identifier, start_span); -#line 1336 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1337 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" iter_name->u.ident.name=iter_var_name; -#line 1338 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1339 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *member = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Member, start_span); -#line 1339 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1340 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" member->u.member.lhs=iter_name; -#line 1340 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1341 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" member->u.member.rhs_name="cur"; -#line 1341 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1342 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" member->u.member.rhs_span=expr->span; -#line 1343 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1344 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *call = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Call, start_span); -#line 1344 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1345 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" call->u.call.callee=member; -#line 1345 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1346 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" call->u.call.args=std_vector_Vector__7_new(16); -#line 1346 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1347 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" call->u.call.open_paren_span=name->span; -#line 1347 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1348 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" call->u.call.close_paren_span=name->span; -#line 1349 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1350 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_VarDeclaration, start_span); -#line 1350 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1351 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->default_value=call; -#line 1351 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1352 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.var_decl=var; -#line 1352 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1353 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = node; __yield_0; }); -#line 1355 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1356 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *inner_body = compiler_parser_Parser_parse_block(this); -#line 1357 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1358 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16 *statements = std_vector_Vector__16_new(16); -#line 1358 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1359 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_push(statements, loop_var_decl); -#line 1359 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1360 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_push(statements, inner_body); -#line 1361 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1362 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *body = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Block, inner_body->span); -#line 1362 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1363 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" body->u.block.statements=statements; -#line 1364 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1365 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_For, std_span_Span_join(start_span, body->span)); -#line 1365 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1366 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.loop.init=init; -#line 1366 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1367 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.loop.cond=cond; -#line 1367 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1368 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.loop.step=step; -#line 1368 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1369 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.loop.body=body; -#line 1369 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1370 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } -#line 1372 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1373 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_for(compiler_parser_Parser *this) { -#line 1373 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1374 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *tok = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_For); -#line 1375 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1376 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Identifier) && (compiler_parser_Parser_peek(this, 1)->type==compiler_tokens_TokenType_Colon || compiler_tokens_Token_is_identifier((*compiler_parser_Parser_peek(this, 1)), "in"))) { -#line 1379 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1380 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_parser_Parser_parse_for_each(this, tok->span); } -#line 1382 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1383 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *init = ((compiler_ast_nodes_AST *)NULL); -#line 1383 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1384 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Let)) { -#line 1384 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1385 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" init=compiler_parser_Parser_parse_statement(this); } else { -#line 1386 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1387 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" init=compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Semicolon); -#line 1387 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1388 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Semicolon); } -#line 1389 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1390 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *cond = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Semicolon); -#line 1390 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1391 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Semicolon); -#line 1391 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1392 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *step = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_OpenCurly); -#line 1392 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1393 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *body = compiler_parser_Parser_parse_block(this); -#line 1393 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1394 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_For, std_span_Span_join(tok->span, body->span)); -#line 1394 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1395 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.loop.init=init; -#line 1395 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1396 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.loop.cond=cond; -#line 1396 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1397 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.loop.step=step; -#line 1397 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1398 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.loop.body=body; -#line 1398 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1399 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } -#line 1401 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1402 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_statement(compiler_parser_Parser *this) { -#line 1402 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1403 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = ((compiler_ast_nodes_AST *)NULL); -#line 1403 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1404 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span start_span = compiler_parser_Parser_token(this)->span; -#line 1405 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1406 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_OpenCurly: - m_77_0: + m_79_0: { -#line 1406 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1407 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_parser_Parser_parse_block(this); } break; case compiler_tokens_TokenType_Return: - m_77_1: + m_79_1: { -#line 1408 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1409 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *tok = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Return); -#line 1409 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1410 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = ((compiler_ast_nodes_AST *)NULL); -#line 1410 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1411 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_is_end_of_statement(this))) { -#line 1411 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1412 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" expr=compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Newline); } -#line 1413 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1414 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Return, std_span_Span_join(start_span, compiler_parser_Parser_token(this)->span)); -#line 1414 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1415 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.ret.expr=expr; -#line 1415 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1416 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.ret.return_span=tok->span; -#line 1416 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1417 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_end_of_statement(this); } break; case compiler_tokens_TokenType_Yield: - m_77_2: + m_79_2: { -#line 1419 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1420 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Yield); -#line 1420 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1421 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Newline); -#line 1421 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1422 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Yield, std_span_Span_join(start_span, compiler_parser_Parser_token(this)->span)); -#line 1422 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1423 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.child=expr; -#line 1423 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1424 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_end_of_statement(this); } break; case compiler_tokens_TokenType_Break: - m_77_3: + m_79_3: { -#line 1426 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1427 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Break); -#line 1427 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1428 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Break, std_span_Span_join(start_span, compiler_parser_Parser_token(this)->span)); -#line 1428 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1429 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_end_of_statement(this); } break; case compiler_tokens_TokenType_Continue: - m_77_4: + m_79_4: { -#line 1431 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1432 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Continue); -#line 1432 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1433 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Continue, std_span_Span_join(start_span, compiler_parser_Parser_token(this)->span)); -#line 1433 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1434 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_end_of_statement(this); } break; case compiler_tokens_TokenType_While: - m_77_5: + m_79_5: { -#line 1436 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1437 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *tok = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_While); -#line 1437 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1438 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *cond = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_OpenCurly); -#line 1438 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1439 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *body = compiler_parser_Parser_parse_block(this); -#line 1439 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1440 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_While, std_span_Span_join(tok->span, body->span)); -#line 1440 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1441 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.loop.cond=cond; -#line 1441 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1442 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.loop.body=body; } break; case compiler_tokens_TokenType_Assert: - m_77_6: + m_79_6: { -#line 1444 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1445 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Assert); -#line 1445 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1446 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Newline); -#line 1447 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1448 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *msg = ((compiler_ast_nodes_AST *)NULL); -#line 1448 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1449 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span end_span = expr->span; -#line 1450 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1451 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Comma)) { -#line 1451 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1452 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" msg=compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Newline); -#line 1452 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1453 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" end_span=msg->span; } -#line 1455 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1456 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Assert, std_span_Span_join(start->span, end_span)); -#line 1456 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1457 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.assertion.expr=expr; -#line 1457 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1458 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.assertion.msg=msg; -#line 1458 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1459 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } break; case compiler_tokens_TokenType_Defer: - m_77_7: + m_79_7: { -#line 1461 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1462 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Defer); -#line 1462 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1463 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *expr = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Newline); -#line 1463 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1464 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Defer, std_span_Span_join(start_span, compiler_parser_Parser_token(this)->span)); -#line 1464 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1465 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.child=expr; -#line 1465 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1466 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_end_of_statement(this); } break; case compiler_tokens_TokenType_Import: - m_77_8: + m_79_8: { -#line 1468 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1469 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_parser_Parser_parse_import(this); -#line 1469 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1470 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_end_of_statement(this); } break; case compiler_tokens_TokenType_For: - m_77_9: + m_79_9: { -#line 1471 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1472 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_parser_Parser_parse_for(this); } break; case compiler_tokens_TokenType_Let: - m_77_10: + m_79_10: { -#line 1473 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1474 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_parser_Parser_parse_var_declaration(this); } break; case compiler_tokens_TokenType_TypeDef: - m_77_11: + m_79_11: { -#line 1476 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1477 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "TypeDefs are only allowed in the global scope")); -#line 1477 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1478 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->curr+=1; -#line 1478 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1479 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_tokens_until_newline(this); } break; case compiler_tokens_TokenType_Const: - m_77_12: + m_79_12: { -#line 1481 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1482 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Constants are only allowed in the global scope")); -#line 1482 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1483 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->curr+=1; -#line 1483 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1484 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_tokens_until_newline(this); } break; default: { -#line 1486 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1487 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node=compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Newline); -#line 1487 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1488 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Semicolon); } break; } -#line 1491 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1492 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } -#line 1494 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1495 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_block(compiler_parser_Parser *this) { -#line 1495 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1496 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_OpenCurly))) { -#line 1496 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1497 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected '{'")); -#line 1497 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1498 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Error, compiler_parser_Parser_token(this)->span); } -#line 1499 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1500 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenCurly); -#line 1501 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1502 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16 *statements = std_vector_Vector__16_new(16); -#line 1502 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1503 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(compiler_parser_Parser_token_is_eof_or(this, compiler_tokens_TokenType_CloseCurly))) { -#line 1503 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1504 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *statement = compiler_parser_Parser_parse_statement(this); -#line 1504 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1505 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)statement)) { -#line 1504 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1505 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_push(statements, statement); } } -#line 1507 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1508 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_CloseCurly))) { -#line 1508 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1509 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected '}' at end of block")); -#line 1509 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1510 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Error, compiler_parser_Parser_token(this)->span); } -#line 1511 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1512 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *end = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseCurly); -#line 1513 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1514 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Block, std_span_Span_join(start->span, end->span)); -#line 1514 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1515 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.block.statements=statements; -#line 1515 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1516 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } -#line 1518 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" -void compiler_parser_Parser_parse_template_params(compiler_parser_Parser *this, compiler_ast_scopes_Symbol *sym, std_span_Span *out_span) { - #line 1519 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_span_Span start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_LessThan)->span; +void compiler_parser_Parser_parse_template_params(compiler_parser_Parser *this, compiler_ast_scopes_Symbol *sym, std_span_Span *out_span) { #line 1520 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__10 *params = std_vector_Vector__10_new(16); + std_span_Span start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_LessThan)->span; #line 1521 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - while (!(compiler_parser_Parser_token_is_eof_or(this, compiler_tokens_TokenType_GreaterThan))) { + std_vector_Vector__9 *params = std_vector_Vector__9_new(16); #line 1522 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_tokens_Token *type = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); + while (!(compiler_parser_Parser_token_is_eof_or(this, compiler_tokens_TokenType_GreaterThan))) { #line 1523 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - char *name = type->text; + compiler_tokens_Token *type = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); #line 1524 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType_TypeDef, this->ns, name, name, name, type->span); + char *name = type->text; #line 1525 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - sym->u.type_def=compiler_types_Type_new_unresolved(name, type->span); + compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType_TypeDef, this->ns, name, name, name, type->span); #line 1526 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + sym->u.type_def=compiler_types_Type_new_unresolved(name, type->span); + +#line 1527 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->u.type_def->sym=sym; -#line 1528 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__10_push(params, sym); +#line 1529 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + std_vector_Vector__9_push(params, sym); -#line 1530 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1531 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_GreaterThan))) { -#line 1531 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1532 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Comma); } } -#line 1534 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1535 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span end = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_GreaterThan)->span; -#line 1535 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1536 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)out_span)) { -#line 1536 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1537 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" (*out_span)=std_span_Span_join(start, end); } -#line 1539 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1540 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->template=compiler_ast_scopes_Template_new(params); } -#line 1542 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1543 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_add_doc_comment(compiler_parser_Parser *this, compiler_ast_scopes_Symbol *sym, compiler_tokens_Token *token) { -#line 1543 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1544 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)token->comment)) { -#line 1544 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1545 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->comment=token->comment; -#line 1545 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1546 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->comment_loc=token->comment_loc; } -#line 1548 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1549 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if ((this->attrs->size > 0) && ((bool)this->attrs_start_tok->comment)) { -#line 1549 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1550 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)sym->comment))) { -#line 1550 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1551 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->comment=this->attrs_start_tok->comment; -#line 1551 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1552 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->comment_loc=this->attrs_start_tok->comment_loc; } } } -#line 1556 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1557 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_parse_function_args(compiler_parser_Parser *this, compiler_ast_nodes_Function *func, compiler_tokens_TokenType end) { -#line 1557 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1558 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool seen_default = false; -#line 1558 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1559 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(compiler_parser_Parser_token_is_eof_or(this, end))) { -#line 1561 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1562 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Ellipsis)) { -#line 1562 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1563 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (seen_default) { -#line 1563 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1564 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Cannot have variadic parameters and default parameters")); } -#line 1565 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1566 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Ellipsis); -#line 1566 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1567 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->is_variadic=true; -#line 1567 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1568 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 1570 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1571 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool found_amp = compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Ampersand); -#line 1571 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1572 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *var_name = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 1572 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1573 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_types_Type *type = ((compiler_types_Type *)NULL); -#line 1573 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1574 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (std_vector_Vector__3_is_empty(func->params) && func->kind==compiler_ast_nodes_FunctionKind_Method) { -#line 1574 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1575 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (str_eq(var_name->text, "this")) { -#line 1575 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1576 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" type=func->parent_type; -#line 1576 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1577 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (found_amp) { -#line 1577 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1578 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" type=compiler_types_Type_new_resolved(compiler_types_BaseType_Pointer, func->parent_type->span); -#line 1578 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1579 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" type->u.ptr=func->parent_type; } -#line 1580 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1581 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->is_static=false; } else if (found_amp) { -#line 1582 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1583 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(var_name->span, "Expected 'this' over here")); } } -#line 1585 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1586 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)type))) { -#line 1586 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1587 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Colon); -#line 1587 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1588 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" type=compiler_parser_Parser_parse_type(this); } -#line 1590 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1591 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *default_value = ((compiler_ast_nodes_AST *)NULL); -#line 1591 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1592 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Equals)) { -#line 1592 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1593 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" default_value=compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Comma); -#line 1593 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1594 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" seen_default=true; } else if (seen_default) { -#line 1596 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1597 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(var_name->span, "Cannot have non-default parameters after default parameters")); } -#line 1599 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1600 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Variable *var = compiler_ast_nodes_Variable_new(type); -#line 1600 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1601 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->sym=compiler_ast_scopes_Symbol_from_local_variable(var_name->text, var, var_name->span); -#line 1601 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1602 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->default_value=default_value; -#line 1602 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1603 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__3_push(func->params, var); -#line 1604 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1605 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_add_doc_comment(this, var->sym, var_name); -#line 1606 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1607 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_token_is(this, end))) { -#line 1607 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1608 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Comma); } } } -#line 1612 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1613 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_function_body(compiler_parser_Parser *this, bool returns) { -#line 1613 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1614 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token(this)->type != compiler_tokens_TokenType_FatArrow) { -#line 1614 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1615 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return compiler_parser_Parser_parse_block(this); } -#line 1617 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1618 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *arrow = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_FatArrow); -#line 1618 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1619 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_OpenCurly)) { -#line 1619 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1620 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected an expression for an arrow function")); -#line 1620 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1621 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return NULL; } -#line 1623 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1624 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *stmt = compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Newline); -#line 1624 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1625 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (returns) { -#line 1625 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1626 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *ret = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Return, stmt->span); -#line 1626 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1627 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" ret->u.ret.expr=stmt; -#line 1627 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1628 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" ret->u.ret.return_span=arrow->span; -#line 1628 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1629 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" stmt=ret; } -#line 1631 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1632 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *body = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Block, stmt->span); -#line 1633 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1634 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16 *statements = std_vector_Vector__16_new(16); -#line 1634 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1635 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_push(statements, stmt); -#line 1635 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1636 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" body->u.block.statements=statements; -#line 1637 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1638 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return body; } -#line 1640 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1641 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Function *compiler_parser_Parser_parse_closure(compiler_parser_Parser *this) { -#line 1641 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1642 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Line); -#line 1642 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1643 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Function *func = compiler_ast_nodes_Function_new(); -#line 1643 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1644 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->name_ast=NULL; -#line 1644 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1645 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->kind=compiler_ast_nodes_FunctionKind_Closure; -#line 1646 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1647 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_function_args(this, func, compiler_tokens_TokenType_Line); -#line 1647 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1648 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span end_span = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Line)->span; -#line 1649 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1650 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool returns = false; -#line 1650 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1651 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Colon)) { -#line 1651 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1652 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->return_type=compiler_parser_Parser_parse_type(this); -#line 1652 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1653 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" end_span=func->return_type->span; -#line 1653 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1654 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" returns=true; } else { -#line 1655 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1656 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->return_type=compiler_types_Type_new_unresolved_base(compiler_types_BaseType_Void, start->span); } -#line 1658 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1659 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->parsed_return_type=func->return_type; -#line 1659 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1660 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->body=compiler_parser_Parser_parse_function_body(this, returns); -#line 1660 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1661 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->span=std_span_Span_join(start->span, func->body->span); -#line 1661 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1662 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return func; } -#line 1664 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1665 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Function *compiler_parser_Parser_parse_function(compiler_parser_Parser *this) { -#line 1665 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1666 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Def); -#line 1667 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1668 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_types_Type *parent_type = ((compiler_types_Type *)NULL); -#line 1668 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1669 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_FunctionKind kind = compiler_ast_nodes_FunctionKind_Normal; -#line 1670 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1671 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *ident = compiler_parser_Parser_parse_scoped_identifier(this, false); -#line 1671 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1672 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)ident))) { -#line 1671 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1672 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return NULL; } -#line 1673 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1674 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span name_span = ident->span; -#line 1675 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1676 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Function *func = compiler_ast_nodes_Function_new(); -#line 1676 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1677 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->name_ast=ident; -#line 1677 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1678 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->is_static=true; -#line 1678 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1679 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->kind=compiler_ast_nodes_FunctionKind_Normal; -#line 1679 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1680 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *name = ({ char *__yield_0; -#line 1679 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1680 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((ident->type)) { case compiler_ast_nodes_ASTType_Identifier: - m_78_0: + m_80_0: { __yield_0 = ident->u.ident.name; } break; case compiler_ast_nodes_ASTType_NSLookup: - m_78_1: + m_80_1: { -#line 1682 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1683 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" parent_type=compiler_types_Type_new_unresolved("", ident->span); -#line 1683 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1684 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" parent_type->u.unresolved=ident->u.lookup.lhs; -#line 1684 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1685 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" kind=compiler_ast_nodes_FunctionKind_Method; -#line 1685 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1686 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" name_span=ident->u.lookup.rhs_span; -#line 1686 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1687 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->parent_type=parent_type; -#line 1687 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1688 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->kind=compiler_ast_nodes_FunctionKind_Method; -#line 1688 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1689 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = ident->u.lookup.rhs_name; } break; default: { -#line 1691 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1692 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(ident->span, "Expected identifier")); -#line 1692 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1693 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = ""; } break; } __yield_0; }); -#line 1696 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1697 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->sym=compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_Function, this->ns, this->ns->sym, name, name_span); -#line 1697 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1698 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->sym->u.func=func; -#line 1698 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1699 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_add_doc_comment(this, func->sym, start); -#line 1700 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1701 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_LessThan)) { -#line 1701 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1702 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_template_params(this, func->sym, NULL); } -#line 1704 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1705 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenParen); -#line 1705 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1706 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_function_args(this, func, compiler_tokens_TokenType_CloseParen); -#line 1706 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1707 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span end_span = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseParen)->span; -#line 1708 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1709 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool returns = false; -#line 1709 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1710 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Colon)) { -#line 1710 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1711 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->return_type=compiler_parser_Parser_parse_type(this); -#line 1711 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1712 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" end_span=func->return_type->span; -#line 1712 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1713 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" returns=true; } else if (str_eq(func->sym->full_name, "main")) { -#line 1715 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1716 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->return_type=compiler_types_Type_new_unresolved_base(compiler_types_BaseType_I32, name_span); -#line 1716 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1717 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" returns=true; } else { -#line 1719 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1720 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->return_type=compiler_types_Type_new_unresolved_base(compiler_types_BaseType_Void, name_span); -#line 1722 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1723 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Identifier) && str_eq(compiler_parser_Parser_token(this)->text, "exits")) { -#line 1723 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1724 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" end_span=compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier)->span; -#line 1724 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1725 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->exits=true; } } -#line 1728 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1729 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->parsed_return_type=func->return_type; -#line 1731 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1732 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_extern_into_symbol(this, func->sym); -#line 1733 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(this->attrs); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { +#line 1734 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + for (std_vector_Iterator__12 __iter = std_vector_Vector__12_iter(this->attrs); std_vector_Iterator__12_has_value(&__iter); std_vector_Iterator__12_next(&__iter)) { -#line 1733 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_attributes_Attribute *attr = std_vector_Iterator__13_cur(&__iter); +#line 1734 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + compiler_attributes_Attribute *attr = std_vector_Iterator__12_cur(&__iter); -#line 1733 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1734 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { -#line 1734 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1735 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((attr->type)) { case compiler_attributes_AttributeType_Exits: - m_79_0: + m_81_0: { -#line 1735 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1736 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->exits=true; } break; case compiler_attributes_AttributeType_Extern: - m_79_1: + m_81_1: { -#line 1736 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1737 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_get_extern_from_attr(this, func->sym, attr); } break; case compiler_attributes_AttributeType_VariadicFormat: - m_79_2: + m_81_2: { -#line 1738 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1739 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(func->is_variadic)) { -#line 1739 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1740 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(attr->span, "Variadic format attribute can only be used on variadic functions")); } -#line 1743 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1744 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->is_variadic_format=true; } break; case compiler_attributes_AttributeType_Operator: - m_79_3: + m_81_3: { -#line 1746 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1747 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_operators_Operator op = compiler_ast_operators_Operator_from_operator_overload(std_vector_Vector__8_at(attr->args, 0), func->params); -#line 1747 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1748 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (op==compiler_ast_operators_Operator_Error) { -#line 1748 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1749 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(attr->span, "Invalid operator")); -#line 1749 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1750 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" continue; } -#line 1751 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1752 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)func->operator_overloads))) { -#line 1752 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1753 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->operator_overloads=std_vector_Vector__21_new(16); } -#line 1754 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1755 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__21_push(func->operator_overloads, op); } break; case compiler_attributes_AttributeType_Alive: - m_79_4: + m_81_4: { -#line 1756 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__10_push(this->program->explicit_alive_symbols, func->sym); +#line 1757 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + std_vector_Vector__9_push(this->program->explicit_alive_symbols, func->sym); } break; default: { -#line 1757 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1758 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(attr->span, std_format("Invalid attribute for function: %s", compiler_attributes_AttributeType_dbg(attr->type)))); } break; } } } -#line 1760 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1761 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_clear_attributes(this); -#line 1762 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1763 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (func->sym->is_extern) { -#line 1763 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1764 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->span=std_span_Span_join(start->span, end_span); -#line 1764 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1765 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return func; } -#line 1767 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1768 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->curr_func=func; -#line 1769 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1770 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->body=compiler_parser_Parser_parse_function_body(this, returns); -#line 1771 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1772 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->curr_func=NULL; -#line 1772 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1773 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" func->span=std_span_Span_join(start->span, func->body->span); -#line 1773 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1774 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return func; } -#line 1776 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1777 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_parse_extern_into_symbol(compiler_parser_Parser *this, compiler_ast_scopes_Symbol *sym) { -#line 1777 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1778 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Extern))) { -#line 1777 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1778 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 1778 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1779 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->is_extern=true; -#line 1779 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1780 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_OpenParen)) { -#line 1780 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1781 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenParen); -#line 1781 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1782 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *name = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_StringLiteral); -#line 1782 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1783 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseParen); -#line 1783 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1784 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->extern_name=name->text; } else { -#line 1785 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1786 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->extern_name=sym->name; } } -#line 1789 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" -void compiler_parser_Parser_get_extern_from_attr(compiler_parser_Parser *this, compiler_ast_scopes_Symbol *sym, compiler_attributes_Attribute *attr) { - #line 1790 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - if(!(attr->type==compiler_attributes_AttributeType_Extern)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/parser.oc:1790:12: Assertion failed: `attr.type == Extern`", NULL); } +void compiler_parser_Parser_get_extern_from_attr(compiler_parser_Parser *this, compiler_ast_scopes_Symbol *sym, compiler_attributes_Attribute *attr) { #line 1791 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - sym->is_extern=true; + if(!(attr->type==compiler_attributes_AttributeType_Extern)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/parser.oc:1791:12: Assertion failed: `attr.type == Extern`", NULL); } #line 1792 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - if (attr->args->size > 0) { + sym->is_extern=true; #line 1793 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + if (attr->args->size > 0) { + +#line 1794 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->extern_name=std_vector_Vector__8_at(attr->args, 0); } else { -#line 1795 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1796 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->extern_name=sym->name; } } -#line 1799 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1800 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__5 *compiler_parser_Parser_parse_import_path(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 1800 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1801 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__5 *parts = std_vector_Vector__5_new(16); -#line 1802 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1803 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (true) { -#line 1803 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1804 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool done = false; -#line 1805 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1806 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_token_is(this, end_type)) && compiler_tokens_Token_is_word((*compiler_parser_Parser_token(this)))) { -#line 1806 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1807 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *word = compiler_parser_Parser_token(this); -#line 1807 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1808 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->curr+=1; -#line 1809 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1810 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_ImportPart *part = compiler_ast_nodes_ImportPart_new(compiler_ast_nodes_ImportPartType_Single, word->span); -#line 1810 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1811 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" part->u.single.name=word->text; -#line 1811 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1812 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" part->u.single.name_span=word->span; -#line 1813 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1814 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_As)) { -#line 1814 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1815 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *alias = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 1815 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1816 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" part->u.single.alias=alias->text; -#line 1816 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1817 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" part->u.single.alias_span=alias->span; -#line 1817 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1818 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" done=true; } -#line 1820 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1821 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__5_push(parts, part); } else if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Star)) { -#line 1823 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1824 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *tok = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Star); -#line 1825 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1826 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_ImportPart *part = compiler_ast_nodes_ImportPart_new(compiler_ast_nodes_ImportPartType_Wildcard, tok->span); -#line 1826 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1827 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__5_push(parts, part); -#line 1827 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1828 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" done=true; } else if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_OpenCurly)) { -#line 1830 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1831 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *open = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenCurly); -#line 1832 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1833 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__22 *sub_paths = std_vector_Vector__22_new(16); -#line 1833 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1834 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(compiler_parser_Parser_token_is_eof_or(this, compiler_tokens_TokenType_CloseCurly))) { -#line 1834 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1835 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__5 *sub_path = compiler_parser_Parser_parse_import_path(this, compiler_tokens_TokenType_CloseCurly); -#line 1835 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1836 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)sub_path))) { -#line 1835 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1836 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return NULL; } -#line 1837 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1838 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__22_push(sub_paths, sub_path); -#line 1838 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1839 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Comma))) { -#line 1838 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1839 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } } -#line 1840 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1841 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *close = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseCurly); -#line 1842 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1843 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_ImportPart *part = compiler_ast_nodes_ImportPart_new(compiler_ast_nodes_ImportPartType_Multiple, std_span_Span_join(open->span, close->span)); -#line 1843 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1844 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" part->u.multiple.paths=sub_paths; -#line 1844 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1845 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" part->u.multiple.open_curly_span=open->span; -#line 1845 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1846 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" part->u.multiple.close_curly_span=close->span; -#line 1846 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1847 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__5_push(parts, part); -#line 1847 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1848 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" done=true; } else { -#line 1850 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected identifier")); - #line 1851 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_span_Span prev_tok = std_vector_Vector__12_at(this->tokens, (this->curr - 1))->span; + compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected identifier")); #line 1852 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_nodes_ImportPart *part = compiler_ast_nodes_ImportPart_new(compiler_ast_nodes_ImportPartType_Single, (std_span_Span){.start=prev_tok.end, .end=prev_tok.end}); + std_span_Span prev_tok = std_vector_Vector__11_at(this->tokens, (this->curr - 1))->span; #line 1853 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - part->u.single.name=NULL; + compiler_ast_nodes_ImportPart *part = compiler_ast_nodes_ImportPart_new(compiler_ast_nodes_ImportPartType_Single, (std_span_Span){.start=prev_tok.end, .end=prev_tok.end}); #line 1854 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - part->u.single.name_span=part->span; + part->u.single.name=NULL; #line 1855 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__5_push(parts, part); + part->u.single.name_span=part->span; #line 1856 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + std_vector_Vector__5_push(parts, part); + +#line 1857 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" done=true; } -#line 1859 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1860 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (done) { -#line 1859 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1860 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 1860 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1861 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_ColonColon))) { -#line 1860 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1861 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } } -#line 1862 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1863 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return parts; } -#line 1865 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1866 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *compiler_parser_Parser_parse_import(compiler_parser_Parser *this) { -#line 1866 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1867 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span span = compiler_parser_Parser_token(this)->span; -#line 1867 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1868 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Import); -#line 1869 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1870 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" u32 parent_count = 0; -#line 1870 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1871 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_ImportType type = ({ compiler_ast_nodes_ImportType __yield_0; -#line 1870 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1871 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_AtSign: - m_80_0: + m_82_0: { -#line 1872 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1873 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_AtSign); -#line 1873 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1874 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_nodes_ImportType_ProjectNamespace; } break; case compiler_tokens_TokenType_ColonColon: - m_80_1: + m_82_1: { -#line 1876 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1877 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_ColonColon); -#line 1877 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1878 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_nodes_ImportType_CurrentScope; } break; case compiler_tokens_TokenType_Dot: case compiler_tokens_TokenType_Ellipsis: - m_80_2: + m_82_2: { -#line 1880 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1881 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool done = false; -#line 1881 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1882 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(done)) { -#line 1882 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1883 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_Dot: - m_81_0: + m_83_0: { -#line 1884 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1885 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Dot); -#line 1885 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1886 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" parent_count+=1; } break; case compiler_tokens_TokenType_Ellipsis: - m_81_1: + m_83_1: { -#line 1888 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1889 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Ellipsis); -#line 1889 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1890 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" parent_count+=3; } break; default: { -#line 1891 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1892 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" done=true; } break; } } -#line 1894 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1895 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = compiler_ast_nodes_ImportType_ParentNamespace; } break; default: @@ -21962,155 +22378,155 @@ compiler_ast_nodes_AST *compiler_parser_Parser_parse_import(compiler_parser_Pars __yield_0; }); -#line 1900 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1901 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (this->ns->is_dir_with_mod) { -#line 1901 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1902 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" parent_count-=1; } -#line 1904 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1905 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__5 *parts = compiler_parser_Parser_parse_import_path(this, compiler_tokens_TokenType_Newline); -#line 1905 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1906 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)parts))) { -#line 1905 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1906 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return NULL; } -#line 1907 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1908 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (parts->size==0) { -#line 1908 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1909 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(span, "Invalid import statement")); -#line 1909 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1910 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return NULL; } -#line 1912 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1913 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *node = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_Import, span); -#line 1913 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1914 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.import_path=(compiler_ast_nodes_Import){.parts=parts, .type=type, .parent_count=parent_count, .export=false, .root_sym=NULL}; -#line 1921 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(this->attrs); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { +#line 1922 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + for (std_vector_Iterator__12 __iter = std_vector_Vector__12_iter(this->attrs); std_vector_Iterator__12_has_value(&__iter); std_vector_Iterator__12_next(&__iter)) { -#line 1921 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_attributes_Attribute *attr = std_vector_Iterator__13_cur(&__iter); +#line 1922 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + compiler_attributes_Attribute *attr = std_vector_Iterator__12_cur(&__iter); -#line 1921 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1922 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { -#line 1922 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1923 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((attr->type)) { case compiler_attributes_AttributeType_Export: - m_82_0: + m_84_0: { -#line 1923 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1924 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" node->u.import_path.export=true; } break; default: { -#line 1924 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1925 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(attr->span, "Invalid attribute for import")); } break; } } } -#line 1931 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1932 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_push(this->ns->unhandled_imports, node); -#line 1932 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1933 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return node; } -#line 1935 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1936 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool compiler_parser_Parser_parse_struct_field(compiler_parser_Parser *this, compiler_ast_nodes_Structure *struc) { -#line 1938 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1939 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__3 *fields = std_vector_Vector__3_new(1); -#line 1940 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1941 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_attributes_if_any(this); -#line 1941 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1942 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (true) { -#line 1942 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1943 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Identifier))) { -#line 1943 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1944 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected identifier for field name")); -#line 1944 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1945 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return false; } -#line 1947 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1948 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *name = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 1948 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1949 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Variable *var = compiler_ast_nodes_Variable_new(NULL); -#line 1949 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1950 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->sym=compiler_ast_scopes_Symbol_from_local_variable(name->text, var, name->span); -#line 1950 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1951 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_add_doc_comment(this, var->sym, name); -#line 1952 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1953 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__3_push(fields, var); -#line 1954 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1955 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Comma))) { -#line 1954 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1955 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } } -#line 1957 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1958 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (fields->size==1) { -#line 1958 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1959 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Variable *field = std_vector_Vector__3_at(fields, 0); -#line 1959 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(this->attrs); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { +#line 1960 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + for (std_vector_Iterator__12 __iter = std_vector_Vector__12_iter(this->attrs); std_vector_Iterator__12_has_value(&__iter); std_vector_Iterator__12_next(&__iter)) { -#line 1959 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_attributes_Attribute *attr = std_vector_Iterator__13_cur(&__iter); +#line 1960 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + compiler_attributes_Attribute *attr = std_vector_Iterator__12_cur(&__iter); -#line 1959 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1960 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { -#line 1960 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1961 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((attr->type)) { case compiler_attributes_AttributeType_Extern: - m_83_0: + m_85_0: { -#line 1961 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1962 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_get_extern_from_attr(this, field->sym, attr); } break; case compiler_attributes_AttributeType_Atomic: - m_83_1: + m_85_1: { -#line 1962 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1963 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" field->is_atomic=true; } break; default: { -#line 1963 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1964 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(attr->span, "Invalid attribute for field")); } break; } @@ -22118,1676 +22534,1676 @@ bool compiler_parser_Parser_parse_struct_field(compiler_parser_Parser *this, com } } else if ((fields->size > 1) && (this->attrs->size > 0)) { -#line 1968 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1969 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new_note(std_vector_Vector__3_at(fields, 0)->sym->span, "Can't use attributes on multi-field declaration", "Split this into separate field declarations")); } -#line 1974 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1975 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Colon))) { -#line 1975 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1976 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected ':' after struct field names for type")); -#line 1976 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1977 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return false; } -#line 1979 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1980 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_types_Type *type = compiler_parser_Parser_parse_type(this); -#line 1981 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1982 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *default_value = NULL; -#line 1982 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1983 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Equals)) { -#line 1983 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1984 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" default_value=compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Comma); } -#line 1986 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1987 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 1986 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1987 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Variable *var = std_vector_Iterator__3_cur(&__iter); -#line 1986 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1987 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { -#line 1987 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1988 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->type=type; -#line 1988 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1989 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->parsed_type=type; -#line 1989 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1990 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->default_value=default_value; -#line 1990 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1991 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__3_push(struc->fields, var); } } -#line 1993 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1994 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__3_free(fields); -#line 1994 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1995 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return true; } -#line 1997 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1998 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Structure *compiler_parser_Parser_parse_struct(compiler_parser_Parser *this) { -#line 1998 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 1999 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *start = compiler_parser_Parser_token(this); -#line 1999 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2000 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool is_union = ({ bool __yield_0; -#line 1999 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2000 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Union)) { -#line 2000 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2001 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Union); -#line 2001 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2002 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = true; } else { -#line 2003 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2004 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Struct); -#line 2004 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2005 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = false; } __yield_0; }); -#line 2007 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2008 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *name = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 2008 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2009 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Structure *struc = compiler_ast_nodes_Structure_new(); -#line 2009 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2010 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" struc->is_union=is_union; -#line 2010 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2011 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" struc->sym=compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_Structure, this->ns, this->ns->sym, name->text, name->span); -#line 2011 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2012 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" struc->sym->u.struc=struc; -#line 2012 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2013 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_add_doc_comment(this, struc->sym, start); -#line 2014 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2015 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_LessThan)) { -#line 2015 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2016 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_template_params(this, struc->sym, NULL); } -#line 2019 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2020 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_extern_into_symbol(this, struc->sym); -#line 2021 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(this->attrs); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { +#line 2022 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + for (std_vector_Iterator__12 __iter = std_vector_Vector__12_iter(this->attrs); std_vector_Iterator__12_has_value(&__iter); std_vector_Iterator__12_next(&__iter)) { -#line 2021 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_attributes_Attribute *attr = std_vector_Iterator__13_cur(&__iter); +#line 2022 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + compiler_attributes_Attribute *attr = std_vector_Iterator__12_cur(&__iter); -#line 2021 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2022 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { -#line 2022 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2023 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((attr->type)) { case compiler_attributes_AttributeType_Extern: - m_84_0: + m_86_0: { -#line 2023 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2024 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_get_extern_from_attr(this, struc->sym, attr); } break; case compiler_attributes_AttributeType_Formatting: - m_84_1: + m_86_1: { -#line 2025 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2026 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" struc->format_spec=std_vector_Vector__8_at(attr->args, 0); -#line 2026 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2027 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" struc->format_args=std_vector_Vector__8_at(attr->args, 1); } break; default: { -#line 2028 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2029 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(attr->span, "Invalid attribute for struct")); } break; } } } -#line 2033 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2034 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(struc->sym->is_extern) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_OpenCurly)) { -#line 2034 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2035 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenCurly); -#line 2035 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2036 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(compiler_parser_Parser_token_is_eof_or(this, compiler_tokens_TokenType_CloseCurly))) { -#line 2036 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2037 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_parse_struct_field(this, struc))) { -#line 2036 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2037 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 2037 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2038 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_CloseCurly))) { -#line 2038 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2039 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_newline_or(this, compiler_tokens_TokenType_Comma); } } -#line 2041 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2042 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *end = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseCurly); -#line 2042 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2043 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" struc->span=std_span_Span_join(start->span, end->span); } -#line 2045 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2046 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return struc; } -#line 2048 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2049 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Enum *compiler_parser_Parser_parse_enum(compiler_parser_Parser *this) { -#line 2049 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2050 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Enum); -#line 2050 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2051 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *name = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 2052 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2053 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Enum *enom = compiler_ast_nodes_Enum_new(start->span); -#line 2053 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2054 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_Enum, this->ns, this->ns->sym, name->text, name->span); -#line 2054 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2055 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->u.enom=enom; -#line 2055 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2056 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" enom->sym=sym; -#line 2056 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2057 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_add_doc_comment(this, sym, start); -#line 2057 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2058 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" enom->has_values=false; -#line 2059 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2060 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool is_extern = false; -#line 2060 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(this->attrs); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { +#line 2061 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + for (std_vector_Iterator__12 __iter = std_vector_Vector__12_iter(this->attrs); std_vector_Iterator__12_has_value(&__iter); std_vector_Iterator__12_next(&__iter)) { -#line 2060 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_attributes_Attribute *attr = std_vector_Iterator__13_cur(&__iter); +#line 2061 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + compiler_attributes_Attribute *attr = std_vector_Iterator__12_cur(&__iter); -#line 2060 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2061 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { -#line 2061 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2062 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((attr->type)) { case compiler_attributes_AttributeType_Extern: - m_85_0: + m_87_0: { -#line 2063 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2064 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_get_extern_from_attr(this, enom->sym, attr); -#line 2064 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2065 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" is_extern=true; } break; default: { -#line 2066 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2067 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(attr->span, "Invalid attribute for value enum")); } break; } } } -#line 2070 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2071 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Extern)) { -#line 2071 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2072 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_extern_into_symbol(this, enom->sym); } -#line 2074 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2075 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenCurly); -#line 2075 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2076 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(compiler_parser_Parser_token_is_eof_or(this, compiler_tokens_TokenType_CloseCurly))) { -#line 2077 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2078 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_attributes_if_any(this); -#line 2079 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2080 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *name = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 2082 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2083 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Colon)) { -#line 2083 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2084 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_types_Type *type = compiler_parser_Parser_parse_type(this); -#line 2084 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2085 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Variable *var = compiler_ast_nodes_Variable_new(type); -#line 2085 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2086 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->sym=compiler_ast_scopes_Symbol_from_local_variable(name->text, var, name->span); -#line 2086 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2087 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_add_doc_comment(this, var->sym, name); -#line 2087 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2088 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__3_push(enom->shared_fields, var); -#line 2089 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2090 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Equals)) { -#line 2090 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2091 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->default_value=compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Comma); } -#line 2093 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2094 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Comma); -#line 2094 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2095 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" enom->has_values=true; -#line 2095 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2096 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" continue; } -#line 2099 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2100 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_EnumVariant *variant = compiler_ast_nodes_EnumVariant_new(name->span); -#line 2100 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2101 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_scopes_Symbol *vsym = compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_EnumVariant, this->ns, sym, name->text, name->span); -#line 2101 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2102 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" vsym->u.enum_var=variant; -#line 2102 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2103 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" variant->sym=vsym; -#line 2103 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2104 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" variant->parent=enom; -#line 2104 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2105 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_add_doc_comment(this, vsym, name); -#line 2106 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2107 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_OpenParen)) { -#line 2107 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2108 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenParen); -#line 2108 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2109 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(compiler_parser_Parser_token_is_eof_or(this, compiler_tokens_TokenType_CloseParen))) { -#line 2109 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2110 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *ident = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 2110 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2111 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Colon); -#line 2111 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2112 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_types_Type *type = compiler_parser_Parser_parse_type(this); -#line 2112 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2113 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Variable *var = compiler_ast_nodes_Variable_new(type); -#line 2113 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2114 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->sym=compiler_ast_scopes_Symbol_from_local_variable(ident->text, var, ident->span); -#line 2115 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2116 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Equals)) { -#line 2116 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2117 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" var->default_value=compiler_parser_Parser_parse_expression(this, compiler_tokens_TokenType_Comma); } -#line 2119 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2120 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" enom->has_values=true; -#line 2120 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2121 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__3_push(variant->specific_fields, var); -#line 2121 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2122 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Comma); } -#line 2123 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2124 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *end = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseParen); -#line 2124 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2125 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (is_extern && (compiler_ast_nodes_EnumVariant_num_fields(variant) > 0)) { -#line 2125 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2126 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(std_span_Span_join(start->span, end->span), "Extern value enum variants cannot have fields")); } } -#line 2130 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2131 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Equals)) { -#line 2131 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2132 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_extern_into_symbol(this, variant->sym); -#line 2132 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2133 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (enom->has_values) { -#line 2133 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2134 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(variant->sym->span, "Non-trivial value enums can't be extern")); } } -#line 2136 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(this->attrs); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { +#line 2137 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + for (std_vector_Iterator__12 __iter = std_vector_Vector__12_iter(this->attrs); std_vector_Iterator__12_has_value(&__iter); std_vector_Iterator__12_next(&__iter)) { -#line 2136 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_attributes_Attribute *attr = std_vector_Iterator__13_cur(&__iter); +#line 2137 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + compiler_attributes_Attribute *attr = std_vector_Iterator__12_cur(&__iter); -#line 2136 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2137 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { -#line 2137 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2138 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((attr->type)) { case compiler_attributes_AttributeType_Extern: - m_86_0: + m_88_0: { -#line 2139 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2140 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_get_extern_from_attr(this, variant->sym, attr); -#line 2140 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2141 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (enom->has_values) { -#line 2141 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2142 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(variant->sym->span, "Non-trivial value enums can't be extern")); } } break; default: { -#line 2144 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2145 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(attr->span, "Invalid attribute for value enum variant")); } break; } } } -#line 2148 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2149 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__20_push(enom->variants, variant); -#line 2149 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2150 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_if(this, compiler_tokens_TokenType_Comma); } -#line 2151 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2152 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseCurly); -#line 2152 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2153 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return enom; } -#line 2155 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2156 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_parse_attribute(compiler_parser_Parser *this) { -#line 2156 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2157 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenSquare); -#line 2157 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2158 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (this->attrs->size==0) { -#line 2158 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2159 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->attrs_span=start->span; -#line 2159 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2160 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->attrs_start_tok=start; } -#line 2163 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2164 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!((compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Identifier) || compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_Extern)))) { -#line 2164 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2165 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Expected attribute name here")); -#line 2165 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2166 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 2168 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2169 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *name = compiler_parser_Parser_consume(this, compiler_parser_Parser_token(this)->type); -#line 2169 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2170 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_attributes_AttributeType attr_type = compiler_attributes_AttributeType_from_str(name->text); -#line 2170 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2171 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (attr_type==compiler_attributes_AttributeType_Invalid) { -#line 2171 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2172 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(name->span, "Unknown attribute type")); -#line 2172 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2173 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 2174 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2175 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_attributes_Attribute *attr = compiler_attributes_Attribute_new(attr_type, name->span); -#line 2176 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2177 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(compiler_parser_Parser_token_is_eof_or(this, compiler_tokens_TokenType_CloseSquare))) { -#line 2177 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2178 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_StringLiteral))) { -#line 2178 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2179 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Only string literals supported in attribute arguments")); -#line 2179 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2180 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->curr+=1; -#line 2180 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2181 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" continue; } -#line 2183 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2184 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *arg = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_StringLiteral); -#line 2184 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2185 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__8_push(attr->args, arg->text); } -#line 2186 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2187 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *close = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseSquare); -#line 2187 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2188 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->attrs_span=std_span_Span_join(this->attrs_span, close->span); -#line 2190 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2191 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(compiler_attributes_Attribute_validate(attr, this))) { -#line 2190 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2191 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 2192 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__13_push(this->attrs, attr); +#line 2193 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + std_vector_Vector__12_push(this->attrs, attr); } -#line 2196 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2197 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_parse_attributes_if_any(compiler_parser_Parser *this) { -#line 2197 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2198 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_clear_attributes(this); -#line 2198 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2199 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (compiler_parser_Parser_token_is(this, compiler_tokens_TokenType_OpenSquare)) { -#line 2199 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2200 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_attribute(this); } } -#line 2203 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2204 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_parse_namespace_until(compiler_parser_Parser *this, compiler_tokens_TokenType end_type) { -#line 2204 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2205 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_add_doc_comment(this, this->ns->sym, compiler_parser_Parser_token(this)); -#line 2206 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2207 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" jmp_buf *ctx = compiler_ast_program_Program_add_error_context(this->program); -#line 2207 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2208 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (setjmp((*ctx)) > 0) { -#line 2210 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2211 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_sync_toplevel(this); } -#line 2213 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2214 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (!(compiler_parser_Parser_token_is_eof_or(this, end_type))) { -#line 2215 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2216 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_attributes_if_any(this); -#line 2216 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2217 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((compiler_parser_Parser_token(this)->type)) { case compiler_tokens_TokenType_Def: - m_87_0: + m_89_0: { -#line 2218 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2219 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Function *func = compiler_parser_Parser_parse_function(this); -#line 2219 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2220 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)func)) { -#line 2219 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2220 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__6_push(this->ns->functions, func); } } break; case compiler_tokens_TokenType_Import: - m_87_1: + m_89_1: { -#line 2222 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2223 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *import_ = compiler_parser_Parser_parse_import(this); -#line 2223 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2224 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)import_)) { -#line 2223 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2224 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_push(this->ns->imports, import_); } } break; case compiler_tokens_TokenType_Namespace: - m_87_2: + m_89_2: { -#line 2226 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2227 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (this->attrs->size > 0) { -#line 2227 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2228 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Attributes are not allowed on namespaces")); } -#line 2230 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2231 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Namespace)->span; -#line 2231 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2232 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *name = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 2233 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2234 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *old_ns = this->ns; -#line 2234 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2235 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *new_ns = compiler_ast_program_Namespace_new(this->ns, this->ns->path); -#line 2235 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2236 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" new_ns->sym=compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_Namespace, old_ns, old_ns->sym, name->text, name->span); -#line 2236 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2237 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" new_ns->sym->u.ns=new_ns; -#line 2238 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2239 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" new_ns->always_add_to_scope=true; -#line 2239 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2240 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__3_insert(old_ns->namespaces, name->text, new_ns); -#line 2241 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2242 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->ns=new_ns; -#line 2242 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2243 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_OpenCurly); -#line 2243 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2244 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_namespace_until(this, compiler_tokens_TokenType_CloseCurly); -#line 2244 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2245 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span end = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_CloseCurly)->span; -#line 2245 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2246 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" new_ns->span=std_span_Span_join(start, end); -#line 2247 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2248 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->ns=old_ns; } break; case compiler_tokens_TokenType_Struct: case compiler_tokens_TokenType_Union: - m_87_3: + m_89_3: { -#line 2250 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2251 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Structure *struc = compiler_parser_Parser_parse_struct(this); -#line 2251 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2252 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)struc)) { -#line 2251 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__9_push(this->ns->structs, struc); +#line 2252 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + std_vector_Vector__14_push(this->ns->structs, struc); } } break; case compiler_tokens_TokenType_TypeDef: - m_87_4: + m_89_4: { -#line 2254 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2255 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (this->attrs->size > 0) { -#line 2255 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2256 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Attributes are not allowed on typedefs")); } -#line 2258 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2259 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span start = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_TypeDef)->span; -#line 2259 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2260 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *name = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 2260 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2261 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Equals); -#line 2261 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2262 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_types_Type *type = compiler_parser_Parser_parse_type(this); -#line 2262 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2263 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume_end_of_statement(this); -#line 2264 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2265 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType_TypeDef, this->ns, name->text, name->text, name->text, name->span); -#line 2265 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2266 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" sym->u.type_def=type; -#line 2266 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2267 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" type->sym=sym; -#line 2268 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2269 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)type)) { -#line 2269 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2270 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__2_insert(this->ns->typedefs, name->text, type); } } break; case compiler_tokens_TokenType_Enum: - m_87_5: + m_89_5: { -#line 2273 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2274 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Enum *enom = compiler_parser_Parser_parse_enum(this); -#line 2274 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2275 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)enom)) { -#line 2274 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2275 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__15_push(this->ns->enums, enom); } } break; case compiler_tokens_TokenType_Let: - m_87_6: + m_89_6: { -#line 2277 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2278 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *var = compiler_parser_Parser_parse_global_value(this, false); -#line 2278 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2279 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)var)) { -#line 2278 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2279 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_push(this->ns->variables, var); } } break; case compiler_tokens_TokenType_Const: - m_87_7: + m_89_7: { -#line 2281 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2282 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *con = compiler_parser_Parser_parse_global_value(this, true); -#line 2282 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2283 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)con)) { -#line 2282 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2283 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__16_push(this->ns->constants, con); } } break; case compiler_tokens_TokenType_AtSign: - m_87_8: + m_89_8: { -#line 2284 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2285 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_compiler_option(this); } break; default: { -#line 2286 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2287 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, std_format("Unexpected token in Parser: %s", compiler_tokens_TokenType_dbg(compiler_parser_Parser_token(this)->type)))); -#line 2287 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2288 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->curr+=1; } break; } } -#line 2292 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2293 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Program_pop_error_context(this->program); -#line 2295 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2296 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (this->ns->unhandled_imports->size > 0) { -#line 2296 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2297 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_AST *imp = std_vector_Vector__16_pop(this->ns->unhandled_imports); -#line 2297 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2298 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_load_import_path(this, imp); } } -#line 2301 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2302 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_parse_compiler_option(compiler_parser_Parser *this) { -#line 2302 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2303 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (this->attrs->size > 0) { -#line 2303 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2304 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler_parser_Parser_token(this)->span, "Attributes are not allowed on compiler options")); } -#line 2306 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2307 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_consume(this, compiler_tokens_TokenType_AtSign); -#line 2307 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2308 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *compiler = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 2308 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2309 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(str_eq(compiler->text, "compiler"))) { -#line 2309 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2310 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(compiler->span, "Expected 'compiler'")); } -#line 2312 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2313 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *name = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_Identifier); -#line 2313 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2314 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { - char *__match_var_88 = name->text; - if (str_eq(__match_var_88, "c_include")) { + char *__match_var_90 = name->text; + if (str_eq(__match_var_90, "c_include")) { -#line 2315 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2316 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *filename = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_StringLiteral); -#line 2316 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2317 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__8_push(this->program->c_includes, filename->text); - } else if (str_eq(__match_var_88, "c_flag")) { + } else if (str_eq(__match_var_90, "c_flag")) { -#line 2319 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2320 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *flag = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_StringLiteral); -#line 2320 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2321 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__8_push(this->program->c_flags, flag->text); - } else if (str_eq(__match_var_88, "c_embed")) { + } else if (str_eq(__match_var_90, "c_embed")) { -#line 2323 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2324 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_tokens_Token *path = compiler_parser_Parser_consume(this, compiler_tokens_TokenType_StringLiteral); -#line 2325 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2326 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *cur_dir = ({ char *__yield_0; -#line 2325 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2326 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (this->ns->is_dir_with_mod) { -#line 2326 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2327 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = this->ns->path; } else { -#line 2328 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2329 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = this->ns->parent->path; } __yield_0; }); -#line 2331 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2332 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *full_path = std_format("%s/%s", cur_dir, path->text); -#line 2332 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2333 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(std_fs_file_exists(full_path))) { -#line 2333 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2334 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(path->span, std_format("File '%s' does not exist", full_path))); -#line 2334 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2335 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 2337 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2338 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_buffer_Buffer contents = std_fs_read_file(full_path); -#line 2338 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2339 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__6_insert(this->program->c_embeds, full_path, std_buffer_Buffer_str(contents)); } else { -#line 2340 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2341 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(name->span, "Unknown compiler option")); } } } -#line 2344 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2345 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_try_load_mod_for_namespace(compiler_parser_Parser *this, compiler_ast_program_Namespace *ns) { -#line 2345 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2346 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *mod_path = std_format("%s/mod.oc", ns->path); -#line 2348 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2349 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (std_fs_file_exists(mod_path) && !(ns->is_dir_with_mod)) { -#line 2349 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2350 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" ns->is_dir_with_mod=true; -#line 2350 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2351 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser parser = compiler_parser_Parser_make(this->program, ns); -#line 2351 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2352 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_load_file(&parser, mod_path, NULL); } else { -#line 2353 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2354 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_mem_free(mod_path); } } -#line 2357 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2358 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *compiler_parser_Parser_load_single_import_part(compiler_parser_Parser *this, compiler_ast_program_Namespace *base, char *name, std_span_Span span) { -#line 2358 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2359 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_try_load_mod_for_namespace(this, base); -#line 2360 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2361 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)name))) { -#line 2360 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2361 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return NULL; } -#line 2361 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2362 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_scopes_Symbol *sym = compiler_ast_program_Namespace_find_importable_symbol(base, name); -#line 2365 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2366 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (str_eq(name, "this")) { -#line 2365 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2366 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return base; } -#line 2367 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2368 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (((bool)sym) && (sym->type != compiler_ast_scopes_SymbolType_Namespace)) { -#line 2367 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2368 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return base; } -#line 2368 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2369 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *next = (((bool)sym) ? sym->u.ns : NULL); -#line 2370 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2371 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *part_path = std_format("%s/%s", base->path, name); -#line 2371 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2372 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)next))) { -#line 2372 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2373 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool dir_exists = compiler_utils_directory_exists(part_path); -#line 2373 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2374 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *path = std_format("%s/%s.oc", base->path, name); -#line 2374 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2375 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool file_exists = std_fs_file_exists(path); -#line 2376 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2377 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(dir_exists) && !(file_exists)) { -#line 2377 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2378 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(span, std_format("Could not find import path %s(.oc)", part_path))); -#line 2378 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2379 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return NULL; } -#line 2381 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2382 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" next=compiler_ast_program_Namespace_new(base, part_path); -#line 2382 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2383 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" next->sym=compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_Namespace, base, base->sym, name, span); -#line 2389 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2390 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" next->sym->u.ns=next; -#line 2391 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2392 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__3_insert(base->namespaces, name, next); -#line 2393 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2394 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (file_exists) { -#line 2394 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2395 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser parser = compiler_parser_Parser_make(this->program, next); -#line 2395 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2396 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_load_file(&parser, strdup(path), NULL); } else { -#line 2398 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2399 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_try_load_mod_for_namespace(this, next); } -#line 2400 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2401 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_mem_free(path); } -#line 2403 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2404 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return next; } -#line 2406 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2407 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool compiler_parser_Parser_load_import_path_from_base(compiler_parser_Parser *this, std_vector_Vector__5 *parts, compiler_ast_program_Namespace *base) { -#line 2407 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2408 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" for (u32 i = 0; (i < parts->size) && (!(base->is_a_file) || base->is_dir_with_mod); i+=1) { -#line 2408 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2409 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_ImportPart *part = std_vector_Vector__5_at(parts, i); -#line 2410 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2411 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((part->type)) { case compiler_ast_nodes_ImportPartType_Wildcard: - m_89_0: + m_91_0: { -#line 2412 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2413 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(part->span, std_format("Wildcard import is not allowed from non-module"))); -#line 2413 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2414 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return false; } break; case compiler_ast_nodes_ImportPartType_Multiple: - m_89_1: + m_91_1: { -#line 2416 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2417 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__22 *paths = part->u.multiple.paths; -#line 2417 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2418 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool success = true; -#line 2418 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2419 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" for (std_vector_Iterator__22 __iter = std_vector_Vector__22_iter(paths); std_vector_Iterator__22_has_value(&__iter); std_vector_Iterator__22_next(&__iter)) { -#line 2418 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2419 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__5 *path = std_vector_Iterator__22_cur(&__iter); -#line 2418 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2419 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { -#line 2419 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2420 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" success=(compiler_parser_Parser_load_import_path_from_base(this, path, base) && success); } } -#line 2421 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2422 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return success; } break; case compiler_ast_nodes_ImportPartType_Single: - m_89_2: + m_91_2: { -#line 2424 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2425 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" base=compiler_parser_Parser_load_single_import_part(this, base, part->u.single.name, part->span); -#line 2425 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2426 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)base))) { -#line 2425 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2426 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return false; } } break; } } -#line 2429 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2430 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return true; } -#line 2437 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2438 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_LibraryInfo compiler_parser_Parser_find_external_library(compiler_parser_Parser *this, char *name) { -#line 2438 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2439 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" for (std_vector_Iterator__8 __iter = std_vector_Vector__8_iter(this->program->library_paths); std_vector_Iterator__8_has_value(&__iter); std_vector_Iterator__8_next(&__iter)) { -#line 2438 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2439 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *lib_path = std_vector_Iterator__8_cur(&__iter); -#line 2438 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2439 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" { -#line 2439 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2440 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *dir_path = ((strlen(lib_path) > 0) ? std_format("%s/%s", lib_path, name) : strdup(name)); -#line 2440 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2441 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (compiler_utils_directory_exists(dir_path)) { -#line 2441 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2442 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return (compiler_parser_LibraryInfo){.parent_dir=std_fs_realpath(lib_path), .path=std_fs_realpath(dir_path)}; } -#line 2446 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2447 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_mem_free(dir_path); -#line 2448 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2449 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *file_path = ((strlen(lib_path) > 0) ? std_format("%s/%s.oc", lib_path, name) : std_format("%s.oc", name)); -#line 2449 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2450 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (std_fs_file_exists(file_path)) { -#line 2450 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2451 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return (compiler_parser_LibraryInfo){.parent_dir=std_fs_realpath(lib_path), .path=std_fs_realpath(file_path)}; } -#line 2455 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2456 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_mem_free(file_path); } } -#line 2457 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2458 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return (compiler_parser_LibraryInfo){.parent_dir=NULL, .path=NULL}; } -#line 2461 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2462 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *compiler_parser_Parser_import_external_lib(compiler_parser_Parser *this, char *name) { -#line 2462 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2463 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_LibraryInfo lib = compiler_parser_Parser_find_external_library(this, name); -#line 2463 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2464 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)lib.path))) { -#line 2463 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2464 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return NULL; } -#line 2465 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2466 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *ns = compiler_ast_program_Namespace_new(this->program->global, lib.path); -#line 2466 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2467 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" ns->sym=compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_Namespace, this->program->global, this->program->global->sym, name, std_span_Span_default()); -#line 2473 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2474 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" ns->sym->u.ns=ns; -#line 2474 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2475 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" ns->always_add_to_scope=true; -#line 2475 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2476 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" ns->internal_project_root=ns; -#line 2477 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2478 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (std_fs_directory_exists(lib.path)) { -#line 2478 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2479 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_try_load_mod_for_namespace(this, ns); } else { -#line 2481 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2482 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser parser = compiler_parser_Parser_make(this->program, ns); -#line 2482 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2483 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_load_file(&parser, lib.path, NULL); -#line 2483 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2484 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_free(&parser); } -#line 2485 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2486 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return ns; } -#line 2488 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2489 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool compiler_parser_Parser_load_import_path(compiler_parser_Parser *this, compiler_ast_nodes_AST *import_stmt) { -#line 2489 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2490 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_Import *path = &import_stmt->u.import_path; -#line 2491 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2492 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *base = ({ compiler_ast_program_Namespace *__yield_0; -#line 2491 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2492 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" switch ((path->type)) { case compiler_ast_nodes_ImportType_GlobalNamespace: - m_90_0: + m_92_0: { -#line 2493 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - std_vector_Vector__5 *parts = path->parts; - #line 2494 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - if(!(parts->size > 0)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/parser.oc:2494:20: Assertion failed: `parts.size > 0`", "Expected at least one part in import path"); } + std_vector_Vector__5 *parts = path->parts; #line 2495 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - if(!(std_vector_Vector__5_at(parts, 0)->type==compiler_ast_nodes_ImportPartType_Single)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/parser.oc:2495:20: Assertion failed: `parts.at(0).type == Single`", "Expected first part to be a single import"); } + if(!(parts->size > 0)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/parser.oc:2495:20: Assertion failed: `parts.size > 0`", "Expected at least one part in import path"); } -#line 2497 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" - compiler_ast_nodes_ImportPartSingle first_part = std_vector_Vector__5_at(parts, 0)->u.single; +#line 2496 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + if(!(std_vector_Vector__5_at(parts, 0)->type==compiler_ast_nodes_ImportPartType_Single)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/parser.oc:2496:20: Assertion failed: `parts.at(0).type == Single`", "Expected first part to be a single import"); } #line 2498 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" + compiler_ast_nodes_ImportPartSingle first_part = std_vector_Vector__5_at(parts, 0)->u.single; + +#line 2499 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *lib_name = first_part.name; -#line 2500 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2501 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(std_map_Map__3_contains(this->program->global->namespaces, lib_name))) { -#line 2501 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2502 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *lib = compiler_parser_Parser_import_external_lib(this, lib_name); -#line 2502 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2503 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)lib))) { -#line 2503 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2504 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(import_stmt->span, std_format("Could not find library '%s'", lib_name))); -#line 2504 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2505 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return false; } -#line 2507 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2508 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__3_insert(this->program->global->namespaces, lib_name, lib); } -#line 2510 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2511 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = this->program->global; } break; case compiler_ast_nodes_ImportType_ProjectNamespace: - m_90_1: + m_92_1: { __yield_0 = compiler_ast_program_Namespace_get_project_root(this->ns, import_stmt->span, this->program); } break; case compiler_ast_nodes_ImportType_ParentNamespace: - m_90_2: + m_92_2: { -#line 2514 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2515 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *cur = this->ns; -#line 2515 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2516 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" for (u32 i = 0; i < path->parent_count; i+=1) { -#line 2516 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2517 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)cur->parent))) { -#line 2517 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2518 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_nodes_ImportPart *first_part = std_vector_Vector__5_at(path->parts, 0); -#line 2518 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2519 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(first_part->span, "Cannot import from parent of root namespace")); -#line 2519 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2520 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" longjmp((*compiler_ast_program_Program_get_error_context(this->program)), 1); } -#line 2521 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2522 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" cur=cur->parent; } -#line 2523 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2524 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" __yield_0 = cur; } break; case compiler_ast_nodes_ImportType_CurrentScope: - m_90_3: + m_92_3: { -#line 2528 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2529 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return true; } break; } __yield_0; }); -#line 2532 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2533 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)base))) { -#line 2532 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2533 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return false; } -#line 2533 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2534 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_load_import_path_from_base(this, path->parts, base); -#line 2534 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2535 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return true; } -#line 2537 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2538 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_load_file(compiler_parser_Parser *this, char *filename, char *contents) { -#line 2538 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2539 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (std_map_Map__6_contains(this->program->sources, filename)) { -#line 2538 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2539 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 2539 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2540 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Location loc = (std_span_Location){.filename=strdup(filename), .line=0, .col=0, .index=0}; -#line 2540 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2541 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span span = (std_span_Span){.start=loc, .end=loc}; -#line 2541 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2542 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->ns->span=span; -#line 2542 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2543 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->ns->sym->span=span; -#line 2544 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2545 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)contents))) { -#line 2545 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2546 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" contents=std_buffer_Buffer_str(std_fs_read_file(filename)); } -#line 2547 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2548 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__6_insert(this->program->sources, filename, contents); -#line 2549 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2550 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_lexer_Lexer lexer = compiler_lexer_Lexer_make(contents, filename); -#line 2550 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2551 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->tokens=compiler_lexer_Lexer_lex(&lexer); -#line 2551 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2552 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->curr=0; -#line 2553 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2554 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->ns->is_a_file=true; -#line 2555 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2556 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span start = compiler_parser_Parser_token(this)->span; -#line 2556 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2557 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_parse_namespace_until(this, compiler_tokens_TokenType_EOF); -#line 2557 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2558 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Span end = compiler_parser_Parser_token(this)->span; -#line 2558 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2559 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->ns->span=std_span_Span_join(start, end); } -#line 2561 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2562 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_couldnt_find_stdlib(compiler_parser_Parser *this) { -#line 2562 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2563 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" printf("--------------------------------------------------------------------------------""\n"); -#line 2563 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2564 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" printf(" Could not find standard library. Set OCEN_ROOT environment variable.""\n"); -#line 2564 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2565 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" printf(" Alternatively, compile from the root of `ocen` repository.""\n"); -#line 2565 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2566 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" printf("--------------------------------------------------------------------------------""\n"); -#line 2566 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2567 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" longjmp((*compiler_ast_program_Program_get_error_context(this->program)), 1); } -#line 2569 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2570 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_find_and_import_stdlib(compiler_parser_Parser *this) { -#line 2570 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2571 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *std_ns = compiler_parser_Parser_import_external_lib(this, "std"); -#line 2571 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2572 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__3_insert(this->program->global->namespaces, "std", std_ns); } -#line 2574 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2575 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_include_prelude_only(compiler_parser_Parser *this) { -#line 2576 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2577 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_LibraryInfo stdlib = compiler_parser_Parser_find_external_library(this, "std"); -#line 2577 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2578 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)stdlib.path))) { -#line 2578 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2579 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_couldnt_find_stdlib(this); } -#line 2580 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2581 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *prelude_path = std_format("%s/prelude.h", stdlib.path); -#line 2581 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2582 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(std_fs_file_exists(prelude_path))) { -#line 2582 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2583 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_couldnt_find_stdlib(this); } -#line 2584 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2585 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_buffer_Buffer content = std_fs_read_file(prelude_path); -#line 2585 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2586 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__6_insert(this->program->c_embeds, prelude_path, std_buffer_Buffer_str(content)); } -#line 2606 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2607 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_create_namespaces_for_initial_file(compiler_parser_Parser *this, char *filename, bool single_file) { -#line 2607 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2608 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(this->program->include_stdlib)) { -#line 2608 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2609 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_include_prelude_only(this); -#line 2609 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2610 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 2615 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2616 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *std_lib_ns = compiler_parser_Parser_import_external_lib(this, "std"); -#line 2616 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2617 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)std_lib_ns))) { -#line 2616 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2617 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_couldnt_find_stdlib(this); } -#line 2617 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2618 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *std_lib_ns_path = std_fs_realpath(std_lib_ns->path); -#line 2619 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2620 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *cur = std_fs_realpath(filename); -#line 2620 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2621 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)cur))) { -#line 2621 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2622 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_error(this, compiler_errors_Error_new(std_span_Span_default(), std_format("Could not find file: %s", filename))); -#line 2622 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2623 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" longjmp((*compiler_ast_program_Program_get_error_context(this->program)), 1); } -#line 2624 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2625 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__8 *namespace_paths = std_vector_Vector__8_new(16); -#line 2625 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2626 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool found_root = false; -#line 2626 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2627 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" while (true) { -#line 2627 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2628 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *base = strdup(dirname(strdup(cur))); -#line 2629 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2630 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_vector_Vector__8_push(namespace_paths, base); -#line 2630 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2631 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (str_eq(base, "/")) { -#line 2630 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2631 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 2632 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2633 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (single_file) { -#line 2632 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2633 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 2633 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2634 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *potential_main_path = std_format("%s/main.oc", base); -#line 2634 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2635 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" bool main_exists = std_fs_file_exists(potential_main_path); -#line 2635 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2636 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" str_free(&potential_main_path); -#line 2638 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2639 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (str_eq(base, std_lib_ns_path) || main_exists) { -#line 2639 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2640 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" found_root=true; -#line 2640 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2641 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" break; } -#line 2642 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2643 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" cur=base; } -#line 2647 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2648 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" i32 start = (found_root ? ((i32)namespace_paths->size) : 0); -#line 2650 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2651 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *cur_ns = this->program->global; -#line 2651 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2652 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" for (i32 i = (start - 1); i >= 0; i-=1) { -#line 2652 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2653 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *path = namespace_paths->data[i]; -#line 2653 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2654 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *t1 = strdup(path); -#line 2654 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2655 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *base = strdup(basename(t1)); -#line 2655 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2656 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" str_free(&t1); -#line 2659 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2660 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (std_map_Map__3_contains(cur_ns->namespaces, base)) { -#line 2660 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2661 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" cur_ns=std_map_Map__3_at(cur_ns->namespaces, base); -#line 2661 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2662 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" continue; } -#line 2664 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2665 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *new_ns = compiler_ast_program_Namespace_new(cur_ns, path); -#line 2665 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2666 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_span_Location loc = (std_span_Location){.filename=path, .line=0, .col=0, .index=0}; -#line 2666 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2667 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" new_ns->sym=compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_Namespace, cur_ns, cur_ns->sym, base, (std_span_Span){.start=loc, .end=loc}); -#line 2667 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2668 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" new_ns->sym->u.ns=new_ns; -#line 2669 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2670 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (i==(start - 1)) { -#line 2670 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2671 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" new_ns->internal_project_root=new_ns; } -#line 2673 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2674 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__3_insert(cur_ns->namespaces, base, new_ns); -#line 2674 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2675 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" cur_ns=new_ns; } -#line 2678 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2679 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *file_base = strdup(basename(filename)); -#line 2679 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2680 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (str_ends_with(file_base, ".oc")) { -#line 2680 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2681 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" file_base[(strlen(file_base) - 3)]='\0'; } -#line 2684 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2685 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (str_eq(file_base, "mod")) { -#line 2685 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2686 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" cur_ns->is_dir_with_mod=true; -#line 2686 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2687 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->ns=cur_ns; -#line 2687 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2688 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 2693 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2694 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (std_map_Map__3_contains(cur_ns->namespaces, file_base)) { -#line 2694 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2695 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->ns=std_map_Map__3_at(cur_ns->namespaces, file_base); -#line 2695 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2696 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 2699 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2700 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *child_ns = compiler_ast_program_Namespace_new(cur_ns, filename); -#line 2700 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2701 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" child_ns->sym=compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType_Namespace, cur_ns, file_base, "", "", std_span_Span_default()); -#line 2707 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2708 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" child_ns->sym->u.ns=child_ns; -#line 2708 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2709 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__3_insert(cur_ns->namespaces, file_base, child_ns); -#line 2712 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2713 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" child_ns->sym->full_name=""; -#line 2713 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2714 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" this->ns=child_ns; } -#line 2716 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2717 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" void compiler_parser_Parser_parse_toplevel(compiler_ast_program_Program *program, char *filename, char *file_contents, bool include_workspace_main) { -#line 2718 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2719 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" jmp_buf *ctx = compiler_ast_program_Program_add_error_context(program); -#line 2719 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2720 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (setjmp((*ctx)) > 0) { -#line 2720 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2721 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" printf("Error in parse_toplevel context""\n"); -#line 2721 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2722 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 2724 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2725 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser parser = compiler_parser_Parser_make(program, program->global); -#line 2725 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2726 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (program->include_stdlib) { -#line 2726 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2727 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_find_and_import_stdlib(&parser); } else { -#line 2728 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2729 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_include_prelude_only(&parser); } -#line 2730 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2731 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_create_namespaces_for_initial_file(&parser, filename, false); -#line 2731 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2732 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_load_file(&parser, filename, file_contents); -#line 2734 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2735 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *file_ns = parser.ns; -#line 2735 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2736 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (include_workspace_main && ((bool)file_ns->internal_project_root)) { -#line 2736 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2737 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" char *potential_main = std_format("%s/main.oc", file_ns->internal_project_root->path); -#line 2737 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2738 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (std_fs_file_exists(potential_main)) { -#line 2738 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2739 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *main_ns = std_map_Map__3_get(file_ns->internal_project_root->namespaces, "main", NULL); -#line 2739 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2740 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (main_ns==file_ns) { -#line 2739 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2740 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" return; } -#line 2741 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2742 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" if (!(((bool)main_ns))) { -#line 2743 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2744 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_ast_program_Namespace *root = file_ns->internal_project_root; -#line 2744 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2745 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" main_ns=compiler_ast_program_Namespace_new(root, "main"); -#line 2745 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2746 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" main_ns->sym=compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType_Namespace, root, root->sym, "main", std_span_Span_default()); -#line 2746 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2747 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" main_ns->sym->u.ns=main_ns; -#line 2747 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2748 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" std_map_Map__3_insert(root->namespaces, "main", main_ns); } -#line 2750 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2751 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" parser.ns=main_ns; -#line 2751 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2752 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" compiler_parser_Parser_load_file(&parser, potential_main, NULL); } else { -#line 2753 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" +#line 2754 "/Users/mustafa/ocen-lang/ocen/compiler/parser.oc" str_free(&potential_main); } } @@ -23822,7 +24238,7 @@ compiler_lexer_Lexer compiler_lexer_Lexer_make(char *source, char *filename) { std_span_Location start_loc = (std_span_Location){.filename=filename, .line=1, .col=1, .index=0}; #line 26 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" - return (compiler_lexer_Lexer){.source=source, .source_len=strlen(source), .i=0, .loc=start_loc, .seen_newline=false, .tokens=std_vector_Vector__12_new(16), .errors=std_vector_Vector__14_new(16), .in_comment=false, .comment=std_buffer_Buffer_make(16), .comment_start=start_loc}; + return (compiler_lexer_Lexer){.source=source, .source_len=strlen(source), .i=0, .loc=start_loc, .seen_newline=false, .tokens=std_vector_Vector__11_new(16), .errors=std_vector_Vector__13_new(16), .in_comment=false, .comment=std_buffer_Buffer_make(16), .comment_start=start_loc}; } @@ -23846,7 +24262,7 @@ void compiler_lexer_Lexer_push(compiler_lexer_Lexer *this, compiler_tokens_Token std_buffer_Buffer_clear(&this->comment); #line 48 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" - std_vector_Vector__12_push(this->tokens, token); + std_vector_Vector__11_push(this->tokens, token); #line 50 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" this->seen_newline=false; @@ -23954,7 +24370,7 @@ void compiler_lexer_Lexer_lex_char_literal(compiler_lexer_Lexer *this) { if (compiler_lexer_Lexer_cur(this) != '\'') { #line 103 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" - std_vector_Vector__14_push(this->errors, compiler_errors_Error_new((std_span_Span){.start=this->loc, .end=this->loc}, "Expected ' after character literal")); + std_vector_Vector__13_push(this->errors, compiler_errors_Error_new((std_span_Span){.start=this->loc, .end=this->loc}, "Expected ' after character literal")); } #line 106 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" @@ -24013,7 +24429,7 @@ void compiler_lexer_Lexer_lex_string_literal(compiler_lexer_Lexer *this, bool ha if (this->i >= this->source_len) { #line 133 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" - std_vector_Vector__14_push(this->errors, compiler_errors_Error_new((std_span_Span){.start=this->loc, .end=this->loc}, "Unterminated string literal")); + std_vector_Vector__13_push(this->errors, compiler_errors_Error_new((std_span_Span){.start=this->loc, .end=this->loc}, "Unterminated string literal")); } #line 136 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" @@ -24070,7 +24486,7 @@ void compiler_lexer_Lexer_lex_raw_string_literal(compiler_lexer_Lexer *this) { if (this->i >= this->source_len) { #line 159 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" - std_vector_Vector__14_push(this->errors, compiler_errors_Error_new((std_span_Span){.start=this->loc, .end=this->loc}, "Unterminated string literal")); + std_vector_Vector__13_push(this->errors, compiler_errors_Error_new((std_span_Span){.start=this->loc, .end=this->loc}, "Unterminated string literal")); } #line 162 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" @@ -24301,7 +24717,7 @@ void compiler_lexer_Lexer_lex_comment(compiler_lexer_Lexer *this) { #line 265 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" -std_vector_Vector__12 *compiler_lexer_Lexer_lex(compiler_lexer_Lexer *this) { +std_vector_Vector__11 *compiler_lexer_Lexer_lex(compiler_lexer_Lexer *this) { #line 266 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" while (this->i < this->source_len) { @@ -24624,7 +25040,7 @@ std_vector_Vector__12 *compiler_lexer_Lexer_lex(compiler_lexer_Lexer *this) { } else { #line 357 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" - std_vector_Vector__14_push(this->errors, compiler_errors_Error_new((std_span_Span){.start=this->loc, .end=this->loc}, std_format("Unrecognized char in lexer: '%c'", c))); + std_vector_Vector__13_push(this->errors, compiler_errors_Error_new((std_span_Span){.start=this->loc, .end=this->loc}, std_format("Unrecognized char in lexer: '%c'", c))); #line 358 "/Users/mustafa/ocen-lang/ocen/compiler/lexer.oc" compiler_lexer_Lexer_inc(this); @@ -24666,7 +25082,7 @@ compiler_ast_program_Namespace *compiler_ast_program_Namespace_new(compiler_ast_ ns->functions=std_vector_Vector__6_new(16); #line 64 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - ns->structs=std_vector_Vector__9_new(16); + ns->structs=std_vector_Vector__14_new(16); #line 65 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" ns->enums=std_vector_Vector__15_new(16); @@ -24787,10 +25203,10 @@ compiler_ast_scopes_Symbol *compiler_ast_program_Namespace_find_importable_symbo } #line 128 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(this->structs); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { + for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(this->structs); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { #line 128 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - compiler_ast_nodes_Structure *struc = std_vector_Iterator__9_cur(&__iter); + compiler_ast_nodes_Structure *struc = std_vector_Iterator__14_cur(&__iter); #line 128 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" { @@ -24859,136 +25275,133 @@ compiler_ast_program_Namespace *compiler_ast_program_Namespace_get_project_root( } -#line 197 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 196 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_program_Program *compiler_ast_program_Program_new(void) { -#line 198 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 197 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_program_Program *prog = std_mem_alloc__4(1); -#line 199 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 198 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->global=compiler_ast_program_Namespace_new(NULL, ""); -#line 200 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - prog->ordered_structs=std_vector_Vector__9_new(16); - -#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - prog->ordered_symbols=std_vector_Vector__10_new(16); +#line 199 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" + prog->ordered_symbols=std_vector_Vector__9_new(16); -#line 202 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 200 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->global->sym=compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType_Namespace, prog->global, "", "", "", std_span_Span_default()); -#line 210 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 208 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->global->sym->u.ns=prog->global; -#line 211 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 209 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->error_level=1; -#line 212 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - prog->errors=std_vector_Vector__14_new(16); +#line 210 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" + prog->errors=std_vector_Vector__13_new(16); -#line 213 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 211 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->c_includes=std_vector_Vector__8_new(16); -#line 214 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 212 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->c_flags=std_vector_Vector__8_new(16); -#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 213 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->c_embeds=std_map_Map__6_new(8); -#line 216 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 214 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->sources=std_map_Map__6_new(8); -#line 217 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->library_paths=std_vector_Vector__8_new(16); -#line 218 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 216 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->operator_overloads=std_map_Map__5_new(8); -#line 219 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 217 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->err_jmp_stack=std_vector_Vector__17_new(16); -#line 220 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - prog->explicit_alive_symbols=std_vector_Vector__10_new(16); +#line 218 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" + prog->explicit_alive_symbols=std_vector_Vector__9_new(16); -#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 219 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->closure_types=std_vector_Vector__0_new(16); -#line 222 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 220 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->closures=std_vector_Vector__6_new(16); -#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" prog->uid=0; -#line 224 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 222 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return prog; } -#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 225 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" jmp_buf *compiler_ast_program_Program_add_error_context(compiler_ast_program_Program *this) { -#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 226 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" std_vector_Vector__17_resize(this->err_jmp_stack, (this->err_jmp_stack->size + 1)); -#line 229 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" this->err_jmp_stack->size+=1; -#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return std_vector_Vector__17_back_ptr(this->err_jmp_stack, 0); } -#line 233 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" jmp_buf *compiler_ast_program_Program_get_error_context(compiler_ast_program_Program *this) { -#line 234 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 232 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return std_vector_Vector__17_back_ptr(this->err_jmp_stack, 0); } -#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 235 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" void compiler_ast_program_Program_pop_error_context(compiler_ast_program_Program *this) { -#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" this->err_jmp_stack->size-=1; } -#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" void compiler_ast_program_Program_setup_library_paths(compiler_ast_program_Program *this) { -#line 242 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" std_vector_Vector__8_push(this->library_paths, ""); -#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" char *ocen_root = getenv("OCEN_ROOT"); -#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 242 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (((bool)ocen_root) && (strlen(ocen_root) > 0)) { -#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" std_vector_Vector__8_push(this->library_paths, ocen_root); } -#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 246 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" char *ocen_lib = getenv("OCEN_LIB"); -#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (((bool)ocen_lib)) { -#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" std_sv_SV oc_sv = std_sv_SV_from_str(ocen_lib); -#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" for (std_sv_SVSplitIterator __iter = std_sv_SV_split_str(oc_sv, ":"); std_sv_SVSplitIterator_has_value(&__iter); std_sv_SVSplitIterator_next(&__iter)) { -#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" std_sv_SV part = std_sv_SVSplitIterator_cur(&__iter); -#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" { -#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" std_vector_Vector__8_push(this->library_paths, std_sv_SV_copy_data_to_cstr(part)); } } @@ -24996,520 +25409,520 @@ void compiler_ast_program_Program_setup_library_paths(compiler_ast_program_Progr } -#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" void compiler_ast_program_Program_exit_with_errors_if_any(compiler_ast_program_Program *this) { -#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - if (!(std_vector_Vector__14_is_empty(this->errors))) { +#line 256 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" + if (!(std_vector_Vector__13_is_empty(this->errors))) { -#line 259 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_errors_display_error_messages(this->errors, this->error_level); -#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" exit(1); } } -#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" char *compiler_ast_program_Program_get_source_text(compiler_ast_program_Program *this, std_span_Span span) { -#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 263 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" std_span_Location start = span.start; -#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" std_span_Location end = span.end; -#line 268 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" char *contents = ((char *)std_map_Map__6_get(this->sources, start.filename, NULL)); -#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (!(((bool)contents))) { -#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return NULL; } -#line 271 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" u32 len = (end.index - start.index); -#line 272 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return str_substring(contents, start.index, len); } -#line 275 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_errors_Error *compiler_ast_program_Program_error(compiler_ast_program_Program *this, compiler_errors_Error *err) { -#line 276 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - std_vector_Vector__14_push(this->errors, err); +#line 274 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" + std_vector_Vector__13_push(this->errors, err); -#line 277 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 275 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return err; } -#line 283 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 281 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_types_Type *compiler_ast_program_Program_find_closure_type(compiler_ast_program_Program *this, std_vector_Vector__3 *params, compiler_types_Type *ret) { -#line 286 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" for (std_vector_Iterator__0 __iter = std_vector_Vector__0_iter(this->closure_types); std_vector_Iterator__0_has_value(&__iter); std_vector_Iterator__0_next(&__iter)) { -#line 286 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_types_Type *c = std_vector_Iterator__0_cur(&__iter); -#line 286 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" { -#line 287 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 285 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_types_FunctionType clos = c->u.func; -#line 288 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 286 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (clos.params->size != params->size) { -#line 288 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 286 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" continue; } -#line 289 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 287 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (!(compiler_types_Type_eq(clos.return_type, ret, false))) { -#line 289 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 287 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" continue; } -#line 290 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 288 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" bool all_match = true; -#line 291 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 289 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" for (u32 i = 0; i < params->size; i+=1) { -#line 292 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 290 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (!(compiler_types_Type_eq(std_vector_Vector__3_at(clos.params, i)->type, std_vector_Vector__3_at(params, i)->type, false))) { -#line 293 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 291 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" all_match=false; -#line 294 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 292 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" break; } } -#line 297 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 295 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (!(all_match)) { -#line 297 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 295 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" continue; } -#line 299 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 297 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return c; } } -#line 301 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 299 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return NULL; } -#line 304 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 302 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_nodes_Function *compiler_ast_program_Program_get_function_deep_copy(compiler_ast_program_Program *this, compiler_ast_nodes_Function *old, compiler_ast_program_Namespace *ns) { -#line 309 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 307 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" char *func_text = compiler_ast_program_Program_get_source_text(this, old->span); -#line 310 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 308 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (!(((bool)func_text))) { -#line 310 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 308 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return NULL; } -#line 312 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 310 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_lexer_Lexer lexer = compiler_lexer_Lexer_make(func_text, old->span.start.filename); -#line 313 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 311 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" lexer.loc=old->span.start; -#line 315 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - std_vector_Vector__12 *tokens = compiler_lexer_Lexer_lex(&lexer); +#line 313 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" + std_vector_Vector__11 *tokens = compiler_lexer_Lexer_lex(&lexer); -#line 316 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 314 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_parser_Parser parser = compiler_parser_Parser_make(this, ns); -#line 318 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 316 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" parser.tokens=tokens; -#line 319 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 317 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" parser.curr=0; -#line 321 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 319 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_nodes_Function *func = compiler_parser_Parser_parse_function(&parser); -#line 322 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 320 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" func->operator_overloads=old->operator_overloads; -#line 323 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 321 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return func; } -#line 326 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 324 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_nodes_Structure *compiler_ast_program_Program_get_struct_deep_copy(compiler_ast_program_Program *this, compiler_ast_nodes_Structure *old, compiler_ast_program_Namespace *ns) { -#line 331 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 329 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" char *text = compiler_ast_program_Program_get_source_text(this, old->span); -#line 332 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 330 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (!(((bool)text))) { -#line 332 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 330 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return NULL; } -#line 334 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 332 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_lexer_Lexer lexer = compiler_lexer_Lexer_make(text, old->span.start.filename); -#line 335 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 333 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" lexer.loc=old->span.start; -#line 337 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" - std_vector_Vector__12 *tokens = compiler_lexer_Lexer_lex(&lexer); +#line 335 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" + std_vector_Vector__11 *tokens = compiler_lexer_Lexer_lex(&lexer); -#line 338 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 336 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_parser_Parser parser = compiler_parser_Parser_make(this, ns); -#line 340 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 338 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" parser.tokens=tokens; -#line 341 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 339 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" parser.curr=0; -#line 343 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 341 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_nodes_Structure *struc = compiler_parser_Parser_parse_struct(&parser); -#line 344 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 342 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return struc; } -#line 347 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 345 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_types_Type *compiler_ast_program_Program_get_base_type(compiler_ast_program_Program *this, compiler_types_BaseType base, std_span_Span span) { -#line 348 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 346 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Scope_lookup_local(this->global->scope, compiler_types_BaseType_str(base)); -#line 349 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 347 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (((bool)sym) && sym->type==compiler_ast_scopes_SymbolType_TypeDef) { -#line 350 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 348 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return sym->u.type_def; } else { -#line 352 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 350 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_program_Program_error(this, compiler_errors_Error_new(span, std_format("Internal compiler error, couldn't find base type %s", compiler_types_BaseType_dbg(base)))); -#line 353 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 351 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return NULL; } } -#line 357 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 355 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_types_Type *compiler_ast_program_Program_get_type_by_name(compiler_ast_program_Program *this, char *name, std_span_Span span) { -#line 358 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 356 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_scopes_Symbol *sym = compiler_ast_scopes_Scope_lookup_local(this->global->scope, name); -#line 359 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 357 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (((bool)sym) && sym->type==compiler_ast_scopes_SymbolType_TypeDef) { -#line 360 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 358 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return sym->u.type_def; } else { -#line 362 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 360 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_program_Program_error(this, compiler_errors_Error_new(span, std_format("Internal compiler error, couldn't find type %s", name))); -#line 363 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 361 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return NULL; } } -#line 373 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 371 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_program_NSIterator compiler_ast_program_Program_iter_namespaces(compiler_ast_program_Program *this) { -#line 374 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 372 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return (compiler_ast_program_NSIterator){.stack=std_vector_Vector__2_new(16), .curr=this->global}; } -#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 383 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" bool compiler_ast_program_NSIterator_has_value(compiler_ast_program_NSIterator *this) { -#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 383 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return ((bool)this->curr); } -#line 387 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" void compiler_ast_program_NSIterator_next(compiler_ast_program_NSIterator *this) { -#line 388 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 386 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(this->curr->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 388 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 386 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_program_Namespace *ns = std_map_ValueIterator__3_cur(&__iter); -#line 388 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 386 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" { -#line 389 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 387 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" std_vector_Vector__2_push(this->stack, ns); } } -#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 390 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" if (std_vector_Vector__2_is_empty(this->stack)) { -#line 393 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 391 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" this->curr=NULL; -#line 394 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" std_vector_Vector__2_free(this->stack); } else { -#line 396 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 394 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" this->curr=std_vector_Vector__2_pop(this->stack); } } -#line 400 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 398 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" compiler_ast_program_Namespace *compiler_ast_program_NSIterator_cur(compiler_ast_program_NSIterator *this) { -#line 400 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" +#line 398 "/Users/mustafa/ocen-lang/ocen/compiler/ast/program.oc" return this->curr; } -#line 33 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 36 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_TemplateInstance *compiler_ast_scopes_TemplateInstance_new(std_vector_Vector__0 *args, compiler_ast_scopes_Symbol *parent, compiler_ast_scopes_Symbol *resolved) { -#line 34 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 37 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_TemplateInstance *instance = std_mem_alloc__5(1); -#line 35 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 38 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" instance->args=args; -#line 36 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 39 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" instance->parent=parent; -#line 37 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 40 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" instance->resolved=resolved; -#line 38 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 41 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return instance; } -#line 41 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 44 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" bool compiler_ast_scopes_TemplateInstance_matches(compiler_ast_scopes_TemplateInstance *this, std_vector_Vector__0 *other) { -#line 42 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" - if(!(other->size==this->args->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc:42:12: Assertion failed: `other.size == .args.size`", NULL); } +#line 45 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" + if(!(other->size==this->args->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc:45:12: Assertion failed: `other.size == .args.size`", NULL); } -#line 43 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 46 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" for (u32 i = 0; i < other->size; i++) { -#line 44 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 47 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_types_Type *a = std_vector_Vector__0_at(this->args, i); -#line 45 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 48 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_types_Type *b = std_vector_Vector__0_at(other, i); -#line 46 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 49 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (!(compiler_types_Type_eq(a, b, true))) { -#line 46 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 49 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return false; } } -#line 48 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 51 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return true; } -#line 56 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" -compiler_ast_scopes_Template *compiler_ast_scopes_Template_new(std_vector_Vector__10 *params) { +#line 59 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +compiler_ast_scopes_Template *compiler_ast_scopes_Template_new(std_vector_Vector__9 *params) { -#line 57 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 60 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Template *templ = std_mem_alloc__6(1); -#line 58 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 61 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" templ->params=params; -#line 59 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 62 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" templ->instances=std_vector_Vector__4_new(16); -#line 60 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 63 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return templ; } -#line 123 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 133 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" char *compiler_ast_scopes_Symbol_out_name(compiler_ast_scopes_Symbol *this) { -#line 124 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 134 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (this->is_extern) { -#line 124 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 134 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return this->extern_name; } -#line 125 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 135 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return this->full_name; } -#line 128 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 138 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol *compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType type, compiler_ast_program_Namespace *ns, char *name, char *display, char *full_name, std_span_Span span) { -#line 129 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 139 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol *item = std_mem_alloc__7(1); -#line 130 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 140 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" item->name=name; -#line 131 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 141 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" item->display=display; -#line 132 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" item->references=std_vector_Vector__18_new(4); -#line 135 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 145 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" u32 full_name_len = strlen(full_name); -#line 136 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 146 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" for (u32 i = 0; i < full_name_len; i++) { -#line 137 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 147 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" char c = full_name[i]; -#line 138 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 148 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if ((i==0 && char_is_digit(c)) || (!(char_is_alnum(c)) && (c != '_'))) { -#line 139 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 149 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" full_name[i]='_'; } } -#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 152 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" item->full_name=full_name; -#line 144 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 154 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" item->span=span; -#line 145 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 155 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" item->type=type; -#line 146 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 156 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" item->ns=ns; -#line 147 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 157 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return item; } -#line 150 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 160 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" char *compiler_ast_scopes_Symbol_join_display(char *a, char *b) { -#line 150 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 160 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return (strlen(a)==0 ? b : std_format("%s::%s", a, b)); } -#line 151 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 161 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" char *compiler_ast_scopes_Symbol_join_full_name(char *a, char *b) { -#line 151 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 161 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return (strlen(a)==0 ? b : std_format("%s_%s", a, b)); } -#line 153 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" bool compiler_ast_scopes_Symbol_is_templated(compiler_ast_scopes_Symbol *this) { -#line 153 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return ((bool)this) && ((bool)this->template); } -#line 155 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 165 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol *compiler_ast_scopes_Symbol_new_with_parent(compiler_ast_scopes_SymbolType type, compiler_ast_program_Namespace *ns, compiler_ast_scopes_Symbol *parent, char *name, std_span_Span span) { -#line 156 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 166 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" char *display = compiler_ast_scopes_Symbol_join_display(parent->display, name); -#line 157 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 167 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" char *full_name = compiler_ast_scopes_Symbol_join_full_name(parent->full_name, name); -#line 158 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 168 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return compiler_ast_scopes_Symbol_new(type, ns, name, display, full_name, span); } -#line 161 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 171 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" void compiler_ast_scopes_Symbol_update_parent(compiler_ast_scopes_Symbol *this, compiler_ast_scopes_Symbol *parent) { -#line 162 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 172 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" this->display=compiler_ast_scopes_Symbol_join_display(parent->display, this->name); -#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 173 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (!(this->is_extern)) { -#line 164 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 174 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" this->full_name=compiler_ast_scopes_Symbol_join_full_name(parent->full_name, this->name); } } -#line 168 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 178 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol *compiler_ast_scopes_Symbol_from_local_variable(char *name, compiler_ast_nodes_Variable *var, std_span_Span span) { -#line 169 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 179 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol *item = compiler_ast_scopes_Symbol_new(compiler_ast_scopes_SymbolType_Variable, NULL, name, name, name, span); -#line 177 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 187 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" item->u.var=var; -#line 178 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 188 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return item; } -#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 191 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol *compiler_ast_scopes_Symbol_remove_alias(compiler_ast_scopes_Symbol *this) { -#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 191 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return ({ compiler_ast_scopes_Symbol *__yield_0; -#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 191 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" switch ((this->type)) { case compiler_ast_scopes_SymbolType_TypeDef: - m_91_0: + m_93_0: { -#line 183 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 193 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (this->u.type_def->sym != this) { -#line 184 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 194 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return compiler_ast_scopes_Symbol_remove_alias(this->u.type_def->sym); } -#line 186 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 196 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return this; } break; default: @@ -25522,41 +25935,41 @@ compiler_ast_scopes_Symbol *compiler_ast_scopes_Symbol_remove_alias(compiler_ast } -#line 191 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" void compiler_ast_scopes_Symbol_add_reference(compiler_ast_scopes_Symbol *this, compiler_ast_scopes_ReferenceType type, std_span_Span span) { -#line 192 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 202 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (!(((bool)this))) { -#line 192 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 202 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return; } -#line 193 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 203 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" std_vector_Vector__18_push(this->references, (compiler_ast_scopes_Reference){.type=type, .span=span}); -#line 195 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 205 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (this->type==compiler_ast_scopes_SymbolType_TypeDef && (this->u.type_def->sym != this)) { -#line 196 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 206 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol_add_reference(this->u.type_def->sym, type, span); -#line 197 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return; } -#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 211 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_types_Type *parent_type = ({ compiler_types_Type *__yield_0; -#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 211 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" switch ((this->type)) { case compiler_ast_scopes_SymbolType_Structure: - m_92_0: + m_94_0: { __yield_0 = this->u.struc->type; } break; case compiler_ast_scopes_SymbolType_Function: - m_92_1: + m_94_1: { __yield_0 = this->u.func->type; } break; @@ -25568,98 +25981,98 @@ void compiler_ast_scopes_Symbol_add_reference(compiler_ast_scopes_Symbol *this, __yield_0; }); -#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 217 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (!(((bool)parent_type))) { -#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 217 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return; } -#line 208 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 218 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (!(((bool)parent_type->template_instance))) { -#line 208 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 218 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return; } -#line 209 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 219 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol *child_sym = parent_type->template_instance->parent; -#line 210 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 220 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol_add_reference(child_sym, type, span); } -#line 224 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 234 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Scope *compiler_ast_scopes_Scope_new(compiler_ast_scopes_Scope *parent) { -#line 225 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 235 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Scope *scope = std_mem_alloc__8(1); -#line 226 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" scope->items=std_map_Map__4_new(8); -#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" scope->defers=std_vector_Vector__16_new(16); -#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (((bool)parent)) { -#line 229 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" scope->loop_count=parent->loop_count; -#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" scope->can_yield=parent->can_yield; -#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" scope->cur_func=parent->cur_func; -#line 232 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 242 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" scope->parent=parent; } -#line 234 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return scope; } -#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol *compiler_ast_scopes_Scope_lookup_recursive(compiler_ast_scopes_Scope *this, char *name) { -#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol *item = std_map_Map__4_get(this->items, name, NULL); -#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (((bool)item)) { -#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return item; } -#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" if (((bool)this->parent)) { -#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return compiler_ast_scopes_Scope_lookup_recursive(this->parent, name); } -#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return NULL; } -#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 254 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" compiler_ast_scopes_Symbol *compiler_ast_scopes_Scope_lookup_local(compiler_ast_scopes_Scope *this, char *name) { -#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" return std_map_Map__4_get(this->items, name, NULL); } -#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" void compiler_ast_scopes_Scope_insert(compiler_ast_scopes_Scope *this, char *name, compiler_ast_scopes_Symbol *symbol) { -#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" +#line 259 "/Users/mustafa/ocen-lang/ocen/compiler/ast/scopes.oc" std_map_Map__4_insert(this->items, name, symbol); } @@ -25672,10 +26085,10 @@ compiler_ast_operators_Operator compiler_ast_operators_Operator_from_operator_ov #line 63 "/Users/mustafa/ocen-lang/ocen/compiler/ast/operators.oc" { - char *__match_var_93 = s; - if (str_eq(__match_var_93, "+")) { + char *__match_var_95 = s; + if (str_eq(__match_var_95, "+")) { __yield_0 = compiler_ast_operators_Operator_Plus; - } else if (str_eq(__match_var_93, "-")) { + } else if (str_eq(__match_var_95, "-")) { __yield_0 = ({ compiler_ast_operators_Operator __yield_1; #line 65 "/Users/mustafa/ocen-lang/ocen/compiler/ast/operators.oc" @@ -25689,21 +26102,21 @@ compiler_ast_operators_Operator compiler_ast_operators_Operator_from_operator_ov } __yield_1; }); - } else if (str_eq(__match_var_93, "*")) { + } else if (str_eq(__match_var_95, "*")) { __yield_0 = compiler_ast_operators_Operator_Multiply; - } else if (str_eq(__match_var_93, "/")) { + } else if (str_eq(__match_var_95, "/")) { __yield_0 = compiler_ast_operators_Operator_Divide; - } else if (str_eq(__match_var_93, "==")) { + } else if (str_eq(__match_var_95, "==")) { __yield_0 = compiler_ast_operators_Operator_Equals; - } else if (str_eq(__match_var_93, "!=")) { + } else if (str_eq(__match_var_95, "!=")) { __yield_0 = compiler_ast_operators_Operator_NotEquals; - } else if (str_eq(__match_var_93, "[]")) { + } else if (str_eq(__match_var_95, "[]")) { __yield_0 = compiler_ast_operators_Operator_Index; - } else if (str_eq(__match_var_93, "<<")) { + } else if (str_eq(__match_var_95, "<<")) { __yield_0 = compiler_ast_operators_Operator_LeftShift; - } else if (str_eq(__match_var_93, ">>")) { + } else if (str_eq(__match_var_95, ">>")) { __yield_0 = compiler_ast_operators_Operator_RightShift; - } else if (str_eq(__match_var_93, "&")) { + } else if (str_eq(__match_var_95, "&")) { __yield_0 = ({ compiler_ast_operators_Operator __yield_1; #line 76 "/Users/mustafa/ocen-lang/ocen/compiler/ast/operators.oc" @@ -25717,29 +26130,29 @@ compiler_ast_operators_Operator compiler_ast_operators_Operator_from_operator_ov } __yield_1; }); - } else if (str_eq(__match_var_93, "|")) { + } else if (str_eq(__match_var_95, "|")) { __yield_0 = compiler_ast_operators_Operator_BitwiseOr; - } else if (str_eq(__match_var_93, "+=")) { + } else if (str_eq(__match_var_95, "+=")) { __yield_0 = compiler_ast_operators_Operator_PlusEquals; - } else if (str_eq(__match_var_93, "-=")) { + } else if (str_eq(__match_var_95, "-=")) { __yield_0 = compiler_ast_operators_Operator_MinusEquals; - } else if (str_eq(__match_var_93, "*=")) { + } else if (str_eq(__match_var_95, "*=")) { __yield_0 = compiler_ast_operators_Operator_MultiplyEquals; - } else if (str_eq(__match_var_93, "/=")) { + } else if (str_eq(__match_var_95, "/=")) { __yield_0 = compiler_ast_operators_Operator_DivideEquals; - } else if (str_eq(__match_var_93, "[]=")) { + } else if (str_eq(__match_var_95, "[]=")) { __yield_0 = compiler_ast_operators_Operator_IndexAssign; - } else if (str_eq(__match_var_93, "<<=")) { + } else if (str_eq(__match_var_95, "<<=")) { __yield_0 = compiler_ast_operators_Operator_LeftShiftEquals; - } else if (str_eq(__match_var_93, ">>=")) { + } else if (str_eq(__match_var_95, ">>=")) { __yield_0 = compiler_ast_operators_Operator_RightShiftEquals; - } else if (str_eq(__match_var_93, "%")) { + } else if (str_eq(__match_var_95, "%")) { __yield_0 = compiler_ast_operators_Operator_Modulus; - } else if (str_eq(__match_var_93, "in")) { + } else if (str_eq(__match_var_95, "in")) { __yield_0 = compiler_ast_operators_Operator_In; - } else if (str_eq(__match_var_93, "not")) { + } else if (str_eq(__match_var_95, "not")) { __yield_0 = compiler_ast_operators_Operator_Not; - } else if (str_eq(__match_var_93, "?")) { + } else if (str_eq(__match_var_95, "?")) { __yield_0 = compiler_ast_operators_Operator_IsNotNull; } else { __yield_0 = compiler_ast_operators_Operator_Error; @@ -25759,119 +26172,119 @@ compiler_ast_operators_Operator compiler_ast_operators_Operator_from_token(compi #line 95 "/Users/mustafa/ocen-lang/ocen/compiler/ast/operators.oc" switch ((tok->type)) { case compiler_tokens_TokenType_Ampersand: - m_94_0: + m_96_0: { __yield_0 = compiler_ast_operators_Operator_BitwiseAnd; } break; case compiler_tokens_TokenType_And: - m_94_1: + m_96_1: { __yield_0 = compiler_ast_operators_Operator_And; } break; case compiler_tokens_TokenType_Caret: - m_94_2: + m_96_2: { __yield_0 = compiler_ast_operators_Operator_BitwiseXor; } break; case compiler_tokens_TokenType_EqualEquals: - m_94_3: + m_96_3: { __yield_0 = compiler_ast_operators_Operator_Equals; } break; case compiler_tokens_TokenType_Equals: - m_94_4: + m_96_4: { __yield_0 = compiler_ast_operators_Operator_Assignment; } break; case compiler_tokens_TokenType_GreaterThan: - m_94_5: + m_96_5: { __yield_0 = compiler_ast_operators_Operator_GreaterThan; } break; case compiler_tokens_TokenType_GreaterThanEquals: - m_94_6: + m_96_6: { __yield_0 = compiler_ast_operators_Operator_GreaterThanEquals; } break; case compiler_tokens_TokenType_LessThan: - m_94_7: + m_96_7: { __yield_0 = compiler_ast_operators_Operator_LessThan; } break; case compiler_tokens_TokenType_LessThanEquals: - m_94_8: + m_96_8: { __yield_0 = compiler_ast_operators_Operator_LessThanEquals; } break; case compiler_tokens_TokenType_Line: - m_94_9: + m_96_9: { __yield_0 = compiler_ast_operators_Operator_BitwiseOr; } break; case compiler_tokens_TokenType_Minus: - m_94_10: + m_96_10: { __yield_0 = compiler_ast_operators_Operator_Minus; } break; case compiler_tokens_TokenType_MinusEquals: - m_94_11: + m_96_11: { __yield_0 = compiler_ast_operators_Operator_MinusEquals; } break; case compiler_tokens_TokenType_NotEquals: - m_94_12: + m_96_12: { __yield_0 = compiler_ast_operators_Operator_NotEquals; } break; case compiler_tokens_TokenType_Or: - m_94_13: + m_96_13: { __yield_0 = compiler_ast_operators_Operator_Or; } break; case compiler_tokens_TokenType_Percent: - m_94_14: + m_96_14: { __yield_0 = compiler_ast_operators_Operator_Modulus; } break; case compiler_tokens_TokenType_Plus: - m_94_15: + m_96_15: { __yield_0 = compiler_ast_operators_Operator_Plus; } break; case compiler_tokens_TokenType_PlusEquals: - m_94_16: + m_96_16: { __yield_0 = compiler_ast_operators_Operator_PlusEquals; } break; case compiler_tokens_TokenType_Slash: - m_94_17: + m_96_17: { __yield_0 = compiler_ast_operators_Operator_Divide; } break; case compiler_tokens_TokenType_SlashEquals: - m_94_18: + m_96_18: { __yield_0 = compiler_ast_operators_Operator_DivideEquals; } break; case compiler_tokens_TokenType_Star: - m_94_19: + m_96_19: { __yield_0 = compiler_ast_operators_Operator_Multiply; } break; case compiler_tokens_TokenType_StarEquals: - m_94_20: + m_96_20: { __yield_0 = compiler_ast_operators_Operator_MultiplyEquals; } break; case compiler_tokens_TokenType_Identifier: - m_94_21: + m_96_21: { __yield_0 = ({ compiler_ast_operators_Operator __yield_1; #line 117 "/Users/mustafa/ocen-lang/ocen/compiler/ast/operators.oc" { - char *__match_var_95 = tok->text; - if (str_eq(__match_var_95, "in")) { + char *__match_var_97 = tok->text; + if (str_eq(__match_var_97, "in")) { __yield_1 = compiler_ast_operators_Operator_In; } else std_panic(std_format("Unhandled identifier in Operator::from_token: %s", tok->text)); } @@ -25906,7 +26319,7 @@ u32 compiler_ast_operators_Operator_num_overload_params(compiler_ast_operators_O case compiler_ast_operators_Operator_PreDecrement: case compiler_ast_operators_Operator_PostIncrement: case compiler_ast_operators_Operator_PostDecrement: - m_96_0: + m_98_0: { __yield_0 = 1; } break; @@ -25937,17 +26350,17 @@ u32 compiler_ast_operators_Operator_num_overload_params(compiler_ast_operators_O case compiler_ast_operators_Operator_PlusEquals: case compiler_ast_operators_Operator_RightShift: case compiler_ast_operators_Operator_In: - m_96_1: + m_98_1: { __yield_0 = 2; } break; case compiler_ast_operators_Operator_IndexAssign: - m_96_2: + m_98_2: { __yield_0 = 3; } break; case compiler_ast_operators_Operator_Error: - m_96_3: + m_98_3: { __yield_0 = 0; } break; @@ -25966,37 +26379,37 @@ bool compiler_ast_operators_Operator_needs_lhs_pointer_for_overload(compiler_ast #line 139 "/Users/mustafa/ocen-lang/ocen/compiler/ast/operators.oc" switch ((this)) { case compiler_ast_operators_Operator_MultiplyEquals: - m_97_0: + m_99_0: { __yield_0 = true; } break; case compiler_ast_operators_Operator_DivideEquals: - m_97_1: + m_99_1: { __yield_0 = true; } break; case compiler_ast_operators_Operator_PlusEquals: - m_97_2: + m_99_2: { __yield_0 = true; } break; case compiler_ast_operators_Operator_MinusEquals: - m_97_3: + m_99_3: { __yield_0 = true; } break; case compiler_ast_operators_Operator_IndexAssign: - m_97_4: + m_99_4: { __yield_0 = true; } break; case compiler_ast_operators_Operator_LeftShiftEquals: - m_97_5: + m_99_5: { __yield_0 = true; } break; case compiler_ast_operators_Operator_RightShiftEquals: - m_97_6: + m_99_6: { __yield_0 = true; } break; @@ -26052,375 +26465,375 @@ bool compiler_ast_operators_OperatorOverload_eq(compiler_ast_operators_OperatorO } -#line 74 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 72 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Variable *compiler_ast_nodes_Variable_new(compiler_types_Type *type) { -#line 75 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 73 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Variable *var = std_mem_alloc__9(1); -#line 76 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 74 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" var->type=type; -#line 77 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 75 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" var->parsed_type=type; -#line 78 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 76 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return var; } -#line 93 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 90 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Structure *compiler_ast_nodes_Structure_new(void) { -#line 94 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 91 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Structure *struc = std_mem_alloc__10(1); -#line 95 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 92 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" struc->fields=std_vector_Vector__3_new(16); -#line 96 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 93 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return struc; } -#line 99 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 96 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Variable *compiler_ast_nodes_Structure_get_field(compiler_ast_nodes_Structure *this, char *name) { -#line 100 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 97 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(this->fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 100 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 97 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 100 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 97 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" { -#line 101 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 98 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" if (str_eq(field->sym->name, name)) { -#line 102 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 99 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return field; } } } -#line 105 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 102 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return NULL; } -#line 125 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 121 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_EnumVariant *compiler_ast_nodes_Enum_get_variant(compiler_ast_nodes_Enum *this, char *name) { -#line 126 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 122 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(this->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 126 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 122 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 126 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 122 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" { -#line 127 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 123 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" if (str_eq(variant->sym->name, name)) { -#line 127 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 123 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return variant; } } } -#line 129 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 125 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return NULL; } -#line 132 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 128 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Variable *compiler_ast_nodes_Enum_get_shared_field(compiler_ast_nodes_Enum *this, char *name) { -#line 133 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 129 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(this->shared_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 133 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 129 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 133 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 129 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" { -#line 134 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 130 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" if (str_eq(field->sym->name, name)) { -#line 134 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 130 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return field; } } } -#line 136 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 132 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return NULL; } -#line 139 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 135 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Enum *compiler_ast_nodes_Enum_new(std_span_Span span) { -#line 140 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 136 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Enum *enom = std_mem_alloc__11(1); -#line 141 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 137 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" enom->variants=std_vector_Vector__20_new(16); -#line 142 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 138 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" enom->shared_fields=std_vector_Vector__3_new(16); -#line 143 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 139 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" enom->span=span; -#line 144 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 140 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return enom; } -#line 158 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 154 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" u32 compiler_ast_nodes_EnumVariant_num_fields(compiler_ast_nodes_EnumVariant *this) { -#line 158 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 154 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return this->parent->shared_fields->size + this->specific_fields->size; } -#line 161 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 157 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Variable *compiler_ast_nodes_EnumVariant_get_field_by_idx(compiler_ast_nodes_EnumVariant *this, u32 idx) { -#line 162 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 158 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" if (idx < this->parent->shared_fields->size) { -#line 163 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 159 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return std_vector_Vector__3_at(this->parent->shared_fields, idx); } else { -#line 165 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 161 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return std_vector_Vector__3_at(this->specific_fields, (idx - this->parent->shared_fields->size)); } } -#line 170 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 166 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Variable *compiler_ast_nodes_EnumVariant_get_specific_field(compiler_ast_nodes_EnumVariant *this, char *name) { -#line 171 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 167 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(this->specific_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 171 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 167 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 171 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 167 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" { -#line 172 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 168 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" if (str_eq(field->sym->name, name)) { -#line 172 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 168 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return field; } } } -#line 174 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 170 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return NULL; } -#line 177 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 173 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_EnumVariant *compiler_ast_nodes_EnumVariant_new(std_span_Span span) { -#line 178 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 174 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_EnumVariant *variant = std_mem_alloc__12(1); -#line 179 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 175 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" variant->specific_fields=std_vector_Vector__3_new(16); -#line 180 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 176 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return variant; } -#line 224 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Function *compiler_ast_nodes_Function_new(void) { -#line 225 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Function *func = std_mem_alloc__13(1); -#line 226 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 232 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" func->params=std_vector_Vector__3_new(16); -#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 233 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return func; } -#line 232 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" bool compiler_ast_nodes_Function_is_template_instance(compiler_ast_nodes_Function *this) { -#line 233 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" if (((bool)this->type) && ((bool)this->type->template_instance)) { -#line 233 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return true; } -#line 234 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" if (((bool)this->parent_type) && ((bool)this->parent_type->template_instance)) { -#line 234 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return true; } -#line 235 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return false; } -#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 263 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Argument *compiler_ast_nodes_Argument_new(compiler_ast_nodes_AST *expr, compiler_tokens_Token *label_token) { -#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_Argument *arg = std_mem_alloc__14(1); -#line 259 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" arg->expr=expr; -#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" if (((bool)label_token)) { -#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" arg->label=label_token->text; } -#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" if (((bool)label_token)) { -#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" arg->label_span=label_token->span; } -#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 268 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return arg; } -#line 315 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 321 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_ImportPart *compiler_ast_nodes_ImportPart_new(compiler_ast_nodes_ImportPartType type, std_span_Span span) { -#line 316 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 322 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_ImportPart *part = std_mem_alloc__15(1); -#line 317 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 323 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" part->type=type; -#line 318 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 324 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" part->span=span; -#line 319 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 325 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return part; } -#line 431 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 437 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_MatchCond *compiler_ast_nodes_MatchCond_new(compiler_ast_nodes_AST *cond, std_vector_Vector__19 *args, compiler_ast_nodes_Function *cmp_fn) { -#line 432 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_MatchCond *mcond = std_mem_alloc__16(1); -#line 433 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 439 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" mcond->expr=cond; -#line 434 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 440 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" mcond->args=args; -#line 435 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 441 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" mcond->cmp_fn=cmp_fn; -#line 436 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 442 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return mcond; } -#line 512 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 518 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_AST *compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType type, std_span_Span span) { -#line 513 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 519 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_AST *ast = std_mem_alloc__17(1); -#line 514 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 520 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" ast->type=type; -#line 515 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 521 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" ast->span=span; -#line 516 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 522 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return ast; } -#line 519 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 525 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_AST *compiler_ast_nodes_AST_new_unop(compiler_ast_operators_Operator op, std_span_Span span, compiler_ast_nodes_AST *expr) { -#line 520 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_AST *ast = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_UnaryOp, span); -#line 521 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 527 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" ast->u.unary.op=op; -#line 522 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 528 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" ast->u.unary.expr=expr; -#line 523 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 529 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return ast; } -#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 532 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_AST *compiler_ast_nodes_AST_new_binop(compiler_ast_operators_Operator op, compiler_ast_nodes_AST *lhs, compiler_ast_nodes_AST *rhs, std_span_Span op_span) { -#line 527 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 533 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" std_span_Span span = std_span_Span_join(lhs->span, rhs->span); -#line 528 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 534 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_nodes_AST *ast = compiler_ast_nodes_AST_new(compiler_ast_nodes_ASTType_BinaryOp, span); -#line 529 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 535 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" ast->u.binary.op=op; -#line 530 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 536 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" ast->u.binary.lhs=lhs; -#line 531 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 537 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" ast->u.binary.rhs=rhs; -#line 532 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 538 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" ast->u.binary.op_span=op_span; -#line 533 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 539 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return ast; } -#line 537 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 543 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" std_span_Span compiler_ast_nodes_AST_display_span(compiler_ast_nodes_AST *this) { -#line 537 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 543 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return ({ std_span_Span __yield_0; -#line 537 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 543 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" switch ((this->type)) { case compiler_ast_nodes_ASTType_Match: - m_98_0: + m_100_0: { __yield_0 = this->u.match_stmt.match_span; } break; case compiler_ast_nodes_ASTType_If: - m_98_1: + m_100_1: { __yield_0 = this->u.if_stmt.if_span; } break; @@ -26434,50 +26847,50 @@ std_span_Span compiler_ast_nodes_AST_display_span(compiler_ast_nodes_AST *this) } -#line 549 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 555 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_scopes_Symbol *compiler_ast_nodes_AST_symbol(compiler_ast_nodes_AST *this) { -#line 549 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 555 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return this->resolved_symbol; } -#line 551 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 557 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" bool compiler_ast_nodes_AST_is_lvalue(compiler_ast_nodes_AST *this) { -#line 551 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 557 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return ({ bool __yield_0; -#line 551 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 557 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" switch ((this->type)) { case compiler_ast_nodes_ASTType_Identifier: - m_99_0: + m_101_0: { __yield_0 = !(this->u.ident.is_function); } break; case compiler_ast_nodes_ASTType_Member: - m_99_1: + m_101_1: { __yield_0 = true; } break; case compiler_ast_nodes_ASTType_UnaryOp: - m_99_2: + m_101_2: { __yield_0 = this->u.unary.op==compiler_ast_operators_Operator_Dereference; } break; case compiler_ast_nodes_ASTType_BinaryOp: - m_99_3: + m_101_3: { __yield_0 = this->u.binary.op==compiler_ast_operators_Operator_Index; } break; case compiler_ast_nodes_ASTType_NSLookup: - m_99_4: + m_101_4: { -#line 557 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 563 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" compiler_ast_scopes_Symbol *sym = this->resolved_symbol; -#line 558 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" +#line 564 "/Users/mustafa/ocen-lang/ocen/compiler/ast/nodes.oc" return ((bool)sym) && sym->type==compiler_ast_scopes_SymbolType_Variable; } break; default: @@ -26498,22 +26911,22 @@ compiler_attributes_AttributeType compiler_attributes_AttributeType_from_str(cha #line 28 "/Users/mustafa/ocen-lang/ocen/compiler/attributes.oc" { - char *__match_var_100 = s; - if (str_eq(__match_var_100, "extern")) { + char *__match_var_102 = s; + if (str_eq(__match_var_102, "extern")) { __yield_0 = compiler_attributes_AttributeType_Extern; - } else if (str_eq(__match_var_100, "exits")) { + } else if (str_eq(__match_var_102, "exits")) { __yield_0 = compiler_attributes_AttributeType_Exits; - } else if (str_eq(__match_var_100, "variadic_format")) { + } else if (str_eq(__match_var_102, "variadic_format")) { __yield_0 = compiler_attributes_AttributeType_VariadicFormat; - } else if (str_eq(__match_var_100, "export")) { + } else if (str_eq(__match_var_102, "export")) { __yield_0 = compiler_attributes_AttributeType_Export; - } else if (str_eq(__match_var_100, "formatting")) { + } else if (str_eq(__match_var_102, "formatting")) { __yield_0 = compiler_attributes_AttributeType_Formatting; - } else if (str_eq(__match_var_100, "operator")) { + } else if (str_eq(__match_var_102, "operator")) { __yield_0 = compiler_attributes_AttributeType_Operator; - } else if (str_eq(__match_var_100, "atomic")) { + } else if (str_eq(__match_var_102, "atomic")) { __yield_0 = compiler_attributes_AttributeType_Atomic; - } else if (str_eq(__match_var_100, "alive")) { + } else if (str_eq(__match_var_102, "alive")) { __yield_0 = compiler_attributes_AttributeType_Alive; } else { __yield_0 = compiler_attributes_AttributeType_Invalid; @@ -26550,7 +26963,7 @@ bool compiler_attributes_Attribute_validate(compiler_attributes_Attribute *this, #line 60 "/Users/mustafa/ocen-lang/ocen/compiler/attributes.oc" switch ((this->type)) { case compiler_attributes_AttributeType_Extern: - m_101_0: + m_103_0: { #line 62 "/Users/mustafa/ocen-lang/ocen/compiler/attributes.oc" @@ -26564,7 +26977,7 @@ bool compiler_attributes_Attribute_validate(compiler_attributes_Attribute *this, } } break; case compiler_attributes_AttributeType_Formatting: - m_101_1: + m_103_1: { #line 71 "/Users/mustafa/ocen-lang/ocen/compiler/attributes.oc" @@ -26621,7 +27034,7 @@ bool compiler_attributes_Attribute_validate(compiler_attributes_Attribute *this, case compiler_attributes_AttributeType_Export: case compiler_attributes_AttributeType_Atomic: case compiler_attributes_AttributeType_Alive: - m_101_2: + m_103_2: { #line 101 "/Users/mustafa/ocen-lang/ocen/compiler/attributes.oc" @@ -26635,7 +27048,7 @@ bool compiler_attributes_Attribute_validate(compiler_attributes_Attribute *this, } } break; case compiler_attributes_AttributeType_Invalid: - m_101_3: + m_103_3: { #line 110 "/Users/mustafa/ocen-lang/ocen/compiler/attributes.oc" @@ -26645,7 +27058,7 @@ bool compiler_attributes_Attribute_validate(compiler_attributes_Attribute *this, return false; } break; case compiler_attributes_AttributeType_Operator: - m_101_4: + m_103_4: { #line 117 "/Users/mustafa/ocen-lang/ocen/compiler/attributes.oc" @@ -26686,10 +27099,10 @@ void compiler_lsp_typecheck_and_log_errors(compiler_ast_program_Program *program } #line 45 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" - for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(program->errors); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { + for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(program->errors); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { #line 45 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" - compiler_errors_Error *err = std_vector_Iterator__14_cur(&__iter); + compiler_errors_Error *err = std_vector_Iterator__13_cur(&__iter); #line 45 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" { @@ -26718,10 +27131,10 @@ void compiler_lsp_handle_validate(compiler_ast_program_Program *program, char *p compiler_lsp_typecheck_and_log_errors(program, path); #line 54 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" - for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(program->errors); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { + for (std_vector_Iterator__13 __iter = std_vector_Vector__13_iter(program->errors); std_vector_Iterator__13_has_value(&__iter); std_vector_Iterator__13_next(&__iter)) { #line 54 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" - compiler_errors_Error *err = std_vector_Iterator__14_cur(&__iter); + compiler_errors_Error *err = std_vector_Iterator__13_cur(&__iter); #line 54 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" { @@ -26786,12 +27199,12 @@ void compiler_lsp_handle_location_command(compiler_ast_program_Program *program, #line 75 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" switch ((type)) { case compiler_lsp_CommandType_Hover: - m_102_0: + m_104_0: { __yield_0 = compiler_lsp_utils_gen_hover_string_with_docs(finder.found_sym); } break; case compiler_lsp_CommandType_GoToDefinition: - m_102_1: + m_104_1: { #line 78 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" @@ -26803,7 +27216,7 @@ void compiler_lsp_handle_location_command(compiler_ast_program_Program *program, #line 79 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" switch ((usage->type)) { case compiler_ast_scopes_SymbolType_Namespace: - m_103_0: + m_105_0: { __yield_1 = usage->u.ns->span; } break; @@ -26819,7 +27232,7 @@ void compiler_lsp_handle_location_command(compiler_ast_program_Program *program, __yield_0 = compiler_lsp_utils_gen_span_json_with_filename(jump_span, loc); } break; case compiler_lsp_CommandType_GoToType: - m_102_2: + m_104_2: { #line 86 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" @@ -26843,22 +27256,22 @@ void compiler_lsp_handle_location_command(compiler_ast_program_Program *program, __yield_0 = compiler_lsp_utils_gen_span_json_with_filename(typ->span, loc); } break; case compiler_lsp_CommandType_Completions: - m_102_3: + m_104_3: { __yield_0 = compiler_lsp_utils_gen_completions_json(&finder); } break; case compiler_lsp_CommandType_References: - m_102_4: + m_104_4: { __yield_0 = compiler_lsp_utils_gen_references_json(finder.found_sym, loc); } break; case compiler_lsp_CommandType_Renames: - m_102_5: + m_104_5: { __yield_0 = compiler_lsp_utils_gen_renames_json(finder.found_sym, loc); } break; case compiler_lsp_CommandType_SignatureHelp: - m_102_6: + m_104_6: { __yield_0 = compiler_lsp_utils_gen_signature_help(finder.call, finder.active_param); } break; @@ -27082,32 +27495,32 @@ void compiler_lsp_lsp_main(i32 argc, char **argv) { #line 177 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" { - char *__match_var_104 = arg; - if (str_eq(__match_var_104, "--help")) { + char *__match_var_106 = arg; + if (str_eq(__match_var_106, "--help")) { #line 178 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" compiler_lsp_lsp_usage(0, true); - } else if (str_eq(__match_var_104, "-h") || str_eq(__match_var_104, "-d") || str_eq(__match_var_104, "-t") || str_eq(__match_var_104, "-c") || str_eq(__match_var_104, "-r") || str_eq(__match_var_104, "-s") || str_eq(__match_var_104, "--refs") || str_eq(__match_var_104, "--renames")) { + } else if (str_eq(__match_var_106, "-h") || str_eq(__match_var_106, "-d") || str_eq(__match_var_106, "-t") || str_eq(__match_var_106, "-c") || str_eq(__match_var_106, "-r") || str_eq(__match_var_106, "-s") || str_eq(__match_var_106, "--refs") || str_eq(__match_var_106, "--renames")) { #line 180 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" cmd_type=({ compiler_lsp_CommandType __yield_0; #line 180 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" { - char *__match_var_105 = arg; - if (str_eq(__match_var_105, "-h")) { + char *__match_var_107 = arg; + if (str_eq(__match_var_107, "-h")) { __yield_0 = compiler_lsp_CommandType_Hover; - } else if (str_eq(__match_var_105, "-d")) { + } else if (str_eq(__match_var_107, "-d")) { __yield_0 = compiler_lsp_CommandType_GoToDefinition; - } else if (str_eq(__match_var_105, "-t")) { + } else if (str_eq(__match_var_107, "-t")) { __yield_0 = compiler_lsp_CommandType_GoToType; - } else if (str_eq(__match_var_105, "-c")) { + } else if (str_eq(__match_var_107, "-c")) { __yield_0 = compiler_lsp_CommandType_Completions; - } else if (str_eq(__match_var_105, "-s")) { + } else if (str_eq(__match_var_107, "-s")) { __yield_0 = compiler_lsp_CommandType_SignatureHelp; - } else if (str_eq(__match_var_105, "-r") || str_eq(__match_var_105, "--refs")) { + } else if (str_eq(__match_var_107, "-r") || str_eq(__match_var_107, "--refs")) { __yield_0 = compiler_lsp_CommandType_References; - } else if (str_eq(__match_var_105, "--renames")) { + } else if (str_eq(__match_var_107, "--renames")) { __yield_0 = compiler_lsp_CommandType_Renames; } else std_panic("Invalid command type"); } @@ -27119,19 +27532,19 @@ void compiler_lsp_lsp_main(i32 argc, char **argv) { #line 191 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" col=str_to_u32(compiler_lsp_shift_args(&argc, &argv)); - } else if (str_eq(__match_var_104, "--validate")) { + } else if (str_eq(__match_var_106, "--validate")) { #line 193 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" cmd_type=compiler_lsp_CommandType_Validate; - } else if (str_eq(__match_var_104, "--doc-symbols")) { + } else if (str_eq(__match_var_106, "--doc-symbols")) { #line 194 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" cmd_type=compiler_lsp_CommandType_DocumentSymbols; - } else if (str_eq(__match_var_104, "-v")) { + } else if (str_eq(__match_var_106, "-v")) { #line 195 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" compiler_lsp_utils_verbose=true; - } else if (str_eq(__match_var_104, "--show-path")) { + } else if (str_eq(__match_var_106, "--show-path")) { #line 196 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" show_path=compiler_lsp_shift_args(&argc, &argv); @@ -27206,7 +27619,7 @@ void compiler_lsp_lsp_main(i32 argc, char **argv) { switch ((cmd_type)) { case compiler_lsp_CommandType_References: case compiler_lsp_CommandType_Renames: - m_106_0: + m_108_0: { __yield_0 = true; } break; @@ -27224,14 +27637,14 @@ void compiler_lsp_lsp_main(i32 argc, char **argv) { #line 237 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" switch ((cmd_type)) { case compiler_lsp_CommandType_DocumentSymbols: - m_107_0: + m_109_0: { #line 238 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" compiler_lsp_handle_document_symbols(program, show_path); } break; case compiler_lsp_CommandType_Validate: - m_107_1: + m_109_1: { #line 239 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/mod.oc" @@ -27358,24 +27771,24 @@ char *compiler_lsp_utils_gen_type_string(compiler_types_Type *type, bool full) { case compiler_types_BaseType_U64: case compiler_types_BaseType_F32: case compiler_types_BaseType_F64: - m_108_0: + m_110_0: { __yield_0 = compiler_types_BaseType_str(type->base); } break; case compiler_types_BaseType_Pointer: - m_108_1: + m_110_1: { __yield_0 = ({ char *__yield_1; #line 61 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((type->u.ptr->base)) { case compiler_types_BaseType_Void: - m_109_0: + m_111_0: { __yield_1 = "untyped_ptr"; } break; case compiler_types_BaseType_Char: - m_109_1: + m_111_1: { __yield_1 = "str"; } break; @@ -27388,14 +27801,14 @@ char *compiler_lsp_utils_gen_type_string(compiler_types_Type *type, bool full) { __yield_1; }); } break; case compiler_types_BaseType_Array: - m_108_2: + m_110_2: { __yield_0 = std_format("&%s", compiler_lsp_utils_gen_type_string(type->u.arr.elem_type, full)); } break; case compiler_types_BaseType_Structure: case compiler_types_BaseType_Alias: case compiler_types_BaseType_Enum: - m_108_3: + m_110_3: { #line 68 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27430,7 +27843,7 @@ char *compiler_lsp_utils_gen_type_string(compiler_types_Type *type, bool full) { } break; case compiler_types_BaseType_Closure: case compiler_types_BaseType_FunctionPtr: - m_108_4: + m_110_4: { #line 80 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27482,7 +27895,7 @@ char *compiler_lsp_utils_gen_type_string(compiler_types_Type *type, bool full) { std_buffer_Buffer_write_str(&sb, "<"); #line 102 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - std_vector_Vector__10 *params = orig->sym->template->params; + std_vector_Vector__9 *params = orig->sym->template->params; #line 103 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (u32 i = 0; i < params->size; i+=1) { @@ -27495,7 +27908,7 @@ char *compiler_lsp_utils_gen_type_string(compiler_types_Type *type, bool full) { } #line 107 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - std_buffer_Buffer_write_str(&sb, std_vector_Vector__10_at(params, i)->name); + std_buffer_Buffer_write_str(&sb, std_vector_Vector__9_at(params, i)->name); } #line 109 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27503,6 +27916,13 @@ char *compiler_lsp_utils_gen_type_string(compiler_types_Type *type, bool full) { } } else { +#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + if (type->base==compiler_types_BaseType_Closure) { + +#line 113 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + std_buffer_Buffer_write_str(&sb, "@"); + } + #line 114 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer_write_str(&sb, "fn"); } @@ -27558,7 +27978,7 @@ char *compiler_lsp_utils_gen_type_string(compiler_types_Type *type, bool full) { __yield_0 = std_buffer_Buffer_str(sb); } break; case compiler_types_BaseType_Unresolved: - m_108_5: + m_110_5: { #line 138 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27570,7 +27990,7 @@ char *compiler_lsp_utils_gen_type_string(compiler_types_Type *type, bool full) { #line 139 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((unres->type)) { case compiler_ast_nodes_ASTType_Identifier: - m_110_0: + m_112_0: { __yield_1 = unres->u.ident.name; } break; @@ -27583,7 +28003,7 @@ char *compiler_lsp_utils_gen_type_string(compiler_types_Type *type, bool full) { __yield_1; }); } break; case compiler_types_BaseType_UnresolvedTemplate: - m_108_6: + m_110_6: { #line 145 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27603,7 +28023,7 @@ char *compiler_lsp_utils_gen_type_string(compiler_types_Type *type, bool full) { } break; case compiler_types_BaseType_Error: case compiler_types_BaseType_NUM_BASE_TYPES: - m_108_7: + m_110_7: { __yield_0 = "ERROR"; } break; @@ -27622,12 +28042,12 @@ char *compiler_lsp_utils_try_gen_expr_string(compiler_ast_nodes_AST *expr) { #line 154 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((expr->type)) { case compiler_ast_nodes_ASTType_BoolLiteral: - m_111_0: + m_113_0: __yield_0 = (expr->u.bool_literal ? "true" : "false"); break; case compiler_ast_nodes_ASTType_IntLiteral: case compiler_ast_nodes_ASTType_FloatLiteral: - m_111_1: + m_113_1: { #line 157 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27645,27 +28065,27 @@ char *compiler_lsp_utils_try_gen_expr_string(compiler_ast_nodes_AST *expr) { __yield_1; }); } break; case compiler_ast_nodes_ASTType_StringLiteral: - m_111_2: + m_113_2: { __yield_0 = std_format("\"%s\"", expr->u.string_literal); } break; case compiler_ast_nodes_ASTType_CharLiteral: - m_111_3: + m_113_3: { __yield_0 = std_format("'%s'", expr->u.char_literal); } break; case compiler_ast_nodes_ASTType_Null: - m_111_4: + m_113_4: { __yield_0 = "null"; } break; case compiler_ast_nodes_ASTType_Identifier: - m_111_5: + m_113_5: { __yield_0 = expr->u.ident.name; } break; case compiler_ast_nodes_ASTType_NSLookup: - m_111_6: + m_113_6: { #line 168 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27699,18 +28119,19 @@ char *compiler_lsp_utils_gen_hover_string(compiler_ast_scopes_Symbol *sym) { #line 175 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((sym->type)) { + case compiler_ast_scopes_SymbolType_ClosureType: case compiler_ast_scopes_SymbolType_TypeDef: - m_112_0: + m_114_0: { __yield_0 = compiler_lsp_utils_gen_type_string(sym->u.type_def, true); } break; case compiler_ast_scopes_SymbolType_Function: - m_112_1: + m_114_1: { __yield_0 = compiler_lsp_utils_gen_type_string(sym->u.func->type, true); } break; case compiler_ast_scopes_SymbolType_Variable: - m_112_2: + m_114_2: { #line 179 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27729,7 +28150,7 @@ char *compiler_lsp_utils_gen_hover_string(compiler_ast_scopes_Symbol *sym) { __yield_0 = std_buffer_Buffer_str(sb); } break; case compiler_ast_scopes_SymbolType_Constant: - m_112_3: + m_114_3: { #line 186 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27751,22 +28172,22 @@ char *compiler_lsp_utils_gen_hover_string(compiler_ast_scopes_Symbol *sym) { __yield_0 = std_buffer_Buffer_str(sb); } break; case compiler_ast_scopes_SymbolType_Structure: - m_112_4: + m_114_4: { __yield_0 = std_format("struct %s", sym->display); } break; case compiler_ast_scopes_SymbolType_Namespace: - m_112_5: + m_114_5: { __yield_0 = std_format("namespace %s", sym->display); } break; case compiler_ast_scopes_SymbolType_Enum: - m_112_6: + m_114_6: { __yield_0 = std_format("enum %s", sym->display); } break; case compiler_ast_scopes_SymbolType_EnumVariant: - m_112_7: + m_114_7: { #line 197 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27822,7 +28243,7 @@ char *compiler_lsp_utils_gen_hover_string(compiler_ast_scopes_Symbol *sym) { __yield_0 = std_buffer_Buffer_str(buf); } break; case compiler_ast_scopes_SymbolType_EnumField: - m_112_8: + m_114_8: { #line 217 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" @@ -27832,112 +28253,144 @@ char *compiler_lsp_utils_gen_hover_string(compiler_ast_scopes_Symbol *sym) { __yield_0 = std_format("enum %s.%u", field.variant->sym->display, field.idx); } break; case compiler_ast_scopes_SymbolType_Closure: - m_112_9: + m_114_9: { __yield_0 = std_format("closure %s", sym->display); } break; + case compiler_ast_scopes_SymbolType_ClosedVariable: + m_114_10: + { + +#line 222 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + compiler_ast_nodes_Variable *var = sym->u.closed_var.orig; + +#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + std_buffer_Buffer buf = std_buffer_Buffer_make(16); + +#line 224 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + std_buffer_Buffer_write_str(&buf, var->sym->display); + +#line 225 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + std_buffer_Buffer_write_str(&buf, ": "); + +#line 226 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + std_buffer_Buffer_write_str(&buf, compiler_lsp_utils_gen_type_string(var->type, true)); + +#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + __yield_0 = std_buffer_Buffer_str(buf); + } break; } __yield_0; }); } -#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_types_Type *compiler_lsp_utils_get_symbol_typedef(compiler_ast_scopes_Symbol *sym) { -#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return ({ compiler_types_Type *__yield_0; -#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_TypeDef: - m_113_0: + m_115_0: { __yield_0 = sym->u.type_def; } break; case compiler_ast_scopes_SymbolType_Function: - m_113_1: + m_115_1: { __yield_0 = sym->u.func->type; } break; case compiler_ast_scopes_SymbolType_Variable: - m_113_2: + m_115_2: { __yield_0 = sym->u.var->type; } break; case compiler_ast_scopes_SymbolType_Constant: - m_113_3: + m_115_3: { __yield_0 = sym->u.var->type; } break; case compiler_ast_scopes_SymbolType_Structure: - m_113_4: + m_115_4: { __yield_0 = sym->u.struc->type; } break; case compiler_ast_scopes_SymbolType_Namespace: - m_113_5: + m_115_5: { __yield_0 = NULL; } break; case compiler_ast_scopes_SymbolType_Enum: - m_113_6: + m_115_6: { __yield_0 = sym->u.enom->type; } break; case compiler_ast_scopes_SymbolType_EnumVariant: - m_113_7: + m_115_7: { __yield_0 = sym->u.enum_var->parent->type; } break; case compiler_ast_scopes_SymbolType_EnumField: - m_113_8: + m_115_8: { __yield_0 = sym->u.enum_field.variant->parent->type; } break; + case compiler_ast_scopes_SymbolType_ClosureType: + m_115_9: + { + __yield_0 = sym->u.type_def; + } break; case compiler_ast_scopes_SymbolType_Closure: - m_113_9: + m_115_10: { __yield_0 = sym->u.func->type; } break; + case compiler_ast_scopes_SymbolType_ClosedVariable: + m_115_11: + { + __yield_0 = sym->u.closed_var.orig->type; + } break; } __yield_0; }); } -#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_error_json(compiler_errors_Error *err) { -#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_Dictionary); -#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "severity", "Error"); -#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "span", compiler_lsp_utils_gen_span_json(err->span1)); -#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "message", err->msg1); -#line 242 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((err->type)) { case compiler_errors_ErrorType_WithHint: case compiler_errors_ErrorType_WithNote: - m_114_0: + m_116_0: { -#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 254 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *extra_info = std_value_Value_new(std_value_ValueType_Dictionary); -#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_span_Span extra_span = ({ std_span_Span __yield_0; -#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((err->type)) { case compiler_errors_ErrorType_WithHint: - m_115_0: + m_117_0: __yield_0 = (std_span_Span_is_valid(err->span2) ? err->span2 : err->span1); break; default: @@ -27948,984 +28401,984 @@ std_value_Value *compiler_lsp_utils_gen_error_json(compiler_errors_Error *err) { __yield_0; }); -#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 259 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(extra_info, "span", compiler_lsp_utils_gen_span_json(extra_span)); -#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(extra_info, "message", err->msg2); -#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "extra_info", extra_info); } break; case compiler_errors_ErrorType_Standard: - m_114_1: + m_116_1: { } break; } -#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 268 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_span_json(std_span_Span span) { -#line 259 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_Dictionary); -#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "start_line", std_value_Value_new_int(((i64)span.start.line))); -#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 271 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "start_col", std_value_Value_new_int(((i64)span.start.col))); -#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 272 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "end_line", std_value_Value_new_int(((i64)span.end.line))); -#line 263 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "end_col", std_value_Value_new_int(((i64)span.end.col))); -#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 274 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 277 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_span_json_with_filename(std_span_Span span, std_span_Location search_loc) { -#line 268 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 278 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = compiler_lsp_utils_gen_span_json(span); -#line 269 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 279 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (!(str_eq(span.start.filename, search_loc.filename))) { -#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 280 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "file", span.start.filename); } -#line 272 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 282 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 281 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 291 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_hover_string_with_docs(compiler_ast_scopes_Symbol *sym) { -#line 282 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 292 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer sb = std_buffer_Buffer_make(16); -#line 283 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 293 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer_write_str(&sb, compiler_lsp_utils_gen_hover_string(sym)); -#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 294 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)sym->comment)) { -#line 285 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 295 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer_write_str(&sb, "\n"); -#line 286 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 296 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer_write_str(&sb, sym->comment); } -#line 289 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 299 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_Dictionary); -#line 290 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 300 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "hover", std_buffer_Buffer_str(sb)); -#line 291 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 301 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 294 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 304 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" void compiler_lsp_utils_gen_type_methods_into(std_value_Value *obj, compiler_types_Type *type) { -#line 295 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 305 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (!(((bool)type)) || !(((bool)type->methods))) { -#line 295 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 305 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return; } -#line 296 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - for (std_map_Iterator__9 __iter = std_map_Map__9_iter(type->methods); std_map_Iterator__9_has_value(&__iter); std_map_Iterator__9_next(&__iter)) { +#line 306 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + for (std_map_Iterator__8 __iter = std_map_Map__8_iter(type->methods); std_map_Iterator__8_has_value(&__iter); std_map_Iterator__8_next(&__iter)) { -#line 296 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - std_map_Item__9 *it = std_map_Iterator__9_cur(&__iter); +#line 306 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + std_map_Item__8 *it = std_map_Iterator__8_cur(&__iter); -#line 296 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 306 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 297 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 307 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_Function *func = it->value; -#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 308 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *func_doc = std_value_Value_new(std_value_ValueType_Dictionary); -#line 299 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 309 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(func_doc, "name", it->key); -#line 300 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 310 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(func_doc, "detail", compiler_lsp_utils_gen_hover_string(func->sym)); -#line 301 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 311 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(func_doc, "kind", "method"); -#line 302 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 312 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(func_doc, "range", compiler_lsp_utils_gen_span_json(func->sym->span)); -#line 303 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 313 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(func_doc, "selection_range", compiler_lsp_utils_gen_span_json(func->sym->span)); -#line 304 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 314 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(func_doc, "children", std_value_Value_new(std_value_ValueType_List)); -#line 305 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 315 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(obj, func_doc); } } } -#line 333 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 343 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_struct_json(compiler_ast_nodes_Structure *struc) { -#line 334 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 344 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_Dictionary); -#line 335 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 345 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "name", struc->sym->name); -#line 336 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 346 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "detail", compiler_lsp_utils_gen_hover_string(struc->sym)); -#line 337 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 347 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "kind", "struct"); -#line 338 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 348 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "range", compiler_lsp_utils_gen_span_json(struc->sym->span)); -#line 339 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 349 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "selection_range", compiler_lsp_utils_gen_span_json(struc->sym->span)); -#line 341 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 351 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *children = std_value_Value_new(std_value_ValueType_List); -#line 342 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 352 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_gen_type_methods_into(children, struc->type); -#line 343 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 353 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "children", children); -#line 345 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 355 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 348 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 358 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_variable_json(compiler_ast_nodes_Variable *var) { -#line 349 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 359 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_Dictionary); -#line 350 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 360 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "name", var->sym->name); -#line 351 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 361 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "detail", compiler_lsp_utils_gen_hover_string(var->sym)); -#line 352 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 362 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "kind", "variable"); -#line 353 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 363 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "range", compiler_lsp_utils_gen_span_json(var->sym->span)); -#line 354 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 364 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "selection_range", compiler_lsp_utils_gen_span_json(var->sym->span)); -#line 355 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 365 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "children", std_value_Value_new(std_value_ValueType_List)); -#line 356 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 366 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 359 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 369 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_function_json(compiler_ast_nodes_Function *func) { -#line 360 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 370 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_Dictionary); -#line 361 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 371 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "name", func->sym->name); -#line 362 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 372 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "detail", compiler_lsp_utils_gen_hover_string(func->sym)); -#line 363 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 373 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "kind", "function"); -#line 364 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 374 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "range", compiler_lsp_utils_gen_span_json(func->sym->span)); -#line 365 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 375 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "selection_range", compiler_lsp_utils_gen_span_json(func->sym->span)); -#line 366 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 376 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "children", std_value_Value_new(std_value_ValueType_List)); -#line 367 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 377 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 370 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 380 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_namespace_json(compiler_ast_program_Namespace *ns) { -#line 371 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 381 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_Dictionary); -#line 372 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 382 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "name", ns->sym->name); -#line 373 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 383 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "detail", compiler_lsp_utils_gen_hover_string(ns->sym)); -#line 374 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "kind", "namespace"); -#line 375 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "range", compiler_lsp_utils_gen_span_json(ns->span)); -#line 376 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 386 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "selection_range", compiler_lsp_utils_gen_span_json(ns->span)); -#line 378 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 388 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *children = std_value_Value_new(std_value_ValueType_List); -#line 380 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(ns->structs); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { +#line 390 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(ns->structs); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { -#line 380 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - compiler_ast_nodes_Structure *struc = std_vector_Iterator__9_cur(&__iter); +#line 390 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + compiler_ast_nodes_Structure *struc = std_vector_Iterator__14_cur(&__iter); -#line 380 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 390 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 381 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 391 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(children, compiler_lsp_utils_gen_struct_json(struc)); } } -#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 394 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->variables); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 394 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_AST *var = std_vector_Iterator__16_cur(&__iter); -#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 394 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 395 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(children, compiler_lsp_utils_gen_variable_json(var->u.var_decl)); } } -#line 388 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 398 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->constants); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 388 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 398 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_AST *var = std_vector_Iterator__16_cur(&__iter); -#line 388 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 398 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 389 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 399 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(children, compiler_lsp_utils_gen_variable_json(var->u.var_decl)); } } -#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 402 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(ns->functions); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 402 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_Function *func = std_vector_Iterator__6_cur(&__iter); -#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 402 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 393 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 403 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (func->kind==compiler_ast_nodes_FunctionKind_Method) { -#line 393 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 403 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" continue; } -#line 394 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 404 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(children, compiler_lsp_utils_gen_function_json(func)); } } -#line 397 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 397 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_program_Namespace *it = std_map_ValueIterator__3_cur(&__iter); -#line 397 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 398 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 408 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (!(it->is_a_file) && !(it->is_dir_with_mod)) { -#line 399 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 409 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(children, compiler_lsp_utils_gen_namespace_json(it)); } } } -#line 403 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 413 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "children", children); -#line 404 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 414 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 417 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" void compiler_lsp_utils_insert_completion_item(std_value_Value *completions, compiler_ast_scopes_Symbol *sym, std_set_Set__2 *seen) { -#line 408 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 418 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (std_set_Set__2_contains(seen, sym->display)) { -#line 408 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 418 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return; } -#line 409 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 419 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__2_add(seen, sym->display); -#line 411 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 421 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *val = std_value_Value_new(std_value_ValueType_Dictionary); -#line 412 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 422 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "label", sym->name); -#line 413 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 423 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "detail", compiler_lsp_utils_gen_hover_string(sym)); -#line 416 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 426 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Function: - m_116_0: + m_118_0: { -#line 418 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 428 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "insertText", sym->name); -#line 419 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 429 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "kind", "function"); -#line 420 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 430 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "labelDetails", compiler_lsp_utils_gen_hover_string(sym)); -#line 421 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 431 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)sym->comment)) { -#line 422 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 432 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "documentation", sym->comment); } } break; case compiler_ast_scopes_SymbolType_Variable: - m_116_1: + m_118_1: { -#line 426 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 436 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "insertText", sym->name); -#line 427 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 437 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "kind", "field"); -#line 428 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "labelDetails", compiler_lsp_utils_gen_hover_string(sym)); -#line 429 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 439 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)sym->comment)) { -#line 430 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 440 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "documentation", sym->comment); } } break; default: { -#line 434 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 444 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "insertText", sym->name); -#line 436 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 446 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "kind", "field"); -#line 437 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 447 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "labelDetails", compiler_lsp_utils_gen_hover_string(sym)); -#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 448 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)sym->comment)) { -#line 439 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 449 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(val, "documentation", sym->comment); } } break; } -#line 443 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 453 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(completions, val); } -#line 446 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 456 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_vector_Vector__25 *compiler_lsp_utils_get_unique_reference_spans(compiler_ast_scopes_Symbol *sym, bool for_rename) { -#line 447 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 457 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__3 *set = std_set_Set__3_new(); -#line 448 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__18 __iter = std_vector_Vector__18_iter(sym->references); std_vector_Iterator__18_has_value(&__iter); std_vector_Iterator__18_next(&__iter)) { -#line 448 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_scopes_Reference ref = std_vector_Iterator__18_cur(&__iter); -#line 448 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 449 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 459 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (for_rename && (ref.type != compiler_ast_scopes_ReferenceType_Normal)) { -#line 449 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 459 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" continue; } -#line 450 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 460 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__3_add(set, ref.span); } } -#line 452 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 462 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__3_add(set, sym->span); -#line 453 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 463 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_vector_Vector__25 *vec = std_vector_Vector__25_new(16); -#line 454 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 464 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_set_Iterator__3 __iter = std_set_Set__3_iter(set); std_set_Iterator__3_has_value(&__iter); std_set_Iterator__3_next(&__iter)) { -#line 454 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 464 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_span_Span span = std_set_Iterator__3_cur(&__iter); -#line 454 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 464 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 455 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 465 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_vector_Vector__25_push(vec, span); } } -#line 457 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 467 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__3_free(set); -#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 468 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return vec; } -#line 461 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 471 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_references_json(compiler_ast_scopes_Symbol *sym, std_span_Location loc) { -#line 462 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 472 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_List); -#line 463 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 473 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_vector_Vector__25 *spans = compiler_lsp_utils_get_unique_reference_spans(sym, false); -#line 464 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 474 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__25 __iter = std_vector_Vector__25_iter(spans); std_vector_Iterator__25_has_value(&__iter); std_vector_Iterator__25_next(&__iter)) { -#line 464 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 474 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_span_Span ref = std_vector_Iterator__25_cur(&__iter); -#line 464 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 474 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 465 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 475 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(obj, compiler_lsp_utils_gen_span_json_with_filename(ref, loc)); } } -#line 467 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 477 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_vector_Vector__25_free(spans); -#line 468 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 478 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 471 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 481 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_signature_help(compiler_ast_nodes_AST *node, u32 active_param) { -#line 472 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 482 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_Dictionary); -#line 473 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 483 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_scopes_Symbol *callee_sym = node->u.call.callee->resolved_symbol; -#line 475 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 485 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" bool is_non_static_method = false; -#line 476 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 486 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_vector_Vector__3 *params = ({ std_vector_Vector__3 *__yield_0; -#line 476 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 486 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((callee_sym->type)) { case compiler_ast_scopes_SymbolType_Function: - m_117_0: + m_119_0: { -#line 478 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 488 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_Function *func = callee_sym->u.func; -#line 479 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 489 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "label", compiler_lsp_utils_gen_type_string(func->type, true)); -#line 480 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 490 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" is_non_static_method=(func->kind==compiler_ast_nodes_FunctionKind_Method && !(func->is_static)); -#line 481 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 491 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" __yield_0 = func->params; } break; case compiler_ast_scopes_SymbolType_Variable: - m_117_1: + m_119_1: { -#line 484 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 494 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_Variable *var = callee_sym->u.var; -#line 485 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 495 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (var->type->base != compiler_types_BaseType_FunctionPtr) { -#line 486 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 496 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (compiler_lsp_utils_verbose) { -#line 486 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 496 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" printf("gen_signature_help: variable is not a function: %p\n", var->type); } -#line 487 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 497 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 489 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 499 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "label", compiler_lsp_utils_gen_type_string(var->type, true)); -#line 490 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 500 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" __yield_0 = var->type->u.func.params; } break; case compiler_ast_scopes_SymbolType_Structure: - m_117_2: + m_119_2: { -#line 493 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 503 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_Structure *struc = callee_sym->u.struc; -#line 494 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 504 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer struc_func_label = std_buffer_Buffer_make(16); -#line 498 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 508 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer_write_str(&struc_func_label, "struct "); -#line 499 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 509 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer_write_str(&struc_func_label, compiler_lsp_utils_gen_type_string(struc->type, true)); -#line 500 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 510 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer_write_str(&struc_func_label, "("); -#line 502 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 512 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_vector_Vector__3 *params = struc->fields; -#line 503 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 513 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (u32 i = 0; i < params->size; i+=1) { -#line 504 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 514 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_Variable *param = std_vector_Vector__3_at(params, i); -#line 505 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 515 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (i != 0) { -#line 506 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 516 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer_write_str(&struc_func_label, ", "); } -#line 508 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 518 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer_write_str(&struc_func_label, compiler_lsp_utils_gen_func_param_string(i, param, false)); } -#line 510 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 520 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_buffer_Buffer_write_str(&struc_func_label, ")"); -#line 512 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 522 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(obj, "label", std_buffer_Buffer_str(struc_func_label)); -#line 513 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 523 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" __yield_0 = struc->fields; } break; default: { -#line 516 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (compiler_lsp_utils_verbose) { -#line 516 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" printf("gen_signature_help: unhandled symbol type: %s\n", compiler_ast_scopes_SymbolType_dbg(callee_sym->type)); } -#line 517 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 527 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } break; } __yield_0; }); -#line 521 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 531 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *params_obj = std_value_Value_new(std_value_ValueType_List); -#line 523 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 533 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (u32 i = 0; i < params->size; i+=1) { -#line 524 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 534 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_Variable *param = std_vector_Vector__3_at(params, i); -#line 525 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 535 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *param_obj = std_value_Value_new(std_value_ValueType_Dictionary); -#line 526 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 536 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(param_obj, "label", compiler_lsp_utils_gen_func_param_string(i, param, is_non_static_method)); -#line 527 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 537 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(params_obj, param_obj); } -#line 529 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 539 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "parameters", params_obj); -#line 531 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 541 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *sig_help = std_value_Value_new(std_value_ValueType_Dictionary); -#line 532 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 542 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(sig_help, "signatures", std_value_Value_new(std_value_ValueType_List)); -#line 533 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 543 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(std_value_Value_at_key(sig_help, "signatures"), obj); -#line 535 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 545 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_u32(sig_help, "activeSignature", 0); -#line 536 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 546 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_u32(sig_help, "activeParameter", active_param); -#line 537 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 547 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return sig_help; } -#line 540 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 550 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_renames_json(compiler_ast_scopes_Symbol *sym, std_span_Location loc) { -#line 541 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 551 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_List); -#line 542 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 552 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_vector_Vector__25 *spans = compiler_lsp_utils_get_unique_reference_spans(sym, true); -#line 543 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 553 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__25 __iter = std_vector_Vector__25_iter(spans); std_vector_Iterator__25_has_value(&__iter); std_vector_Iterator__25_next(&__iter)) { -#line 543 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 553 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_span_Span ref = std_vector_Iterator__25_cur(&__iter); -#line 543 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 553 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 544 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 554 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" u32 size = (ref.end.index - ref.start.index); -#line 549 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 559 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (str_eq(sym->name, "this") && size==1) { -#line 550 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 560 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" ref=(std_span_Span){.start=ref.start, .end=ref.start}; } -#line 553 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 563 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(obj, compiler_lsp_utils_gen_span_json_with_filename(ref, loc)); } } -#line 555 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 565 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return obj; } -#line 558 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 568 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" void compiler_lsp_utils_gen_completions_from_scope(compiler_ast_scopes_Scope *scope, std_value_Value *completions, compiler_types_Type *hint_type, std_set_Set__2 *seen) { -#line 559 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 569 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (!(((bool)scope))) { -#line 559 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 569 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return; } -#line 560 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 570 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)hint_type) && hint_type->base==compiler_types_BaseType_Enum) { -#line 562 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 572 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_Enum *enom = hint_type->u.enom; -#line 563 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(enom->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 563 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 563 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 564 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 574 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, variant->sym, seen); } } } -#line 567 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 577 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_map_ValueIterator__4 __iter = std_map_Map__4_iter_values(scope->items); std_map_ValueIterator__4_has_value(&__iter); std_map_ValueIterator__4_next(&__iter)) { -#line 567 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 577 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_scopes_Symbol *item = std_map_ValueIterator__4_cur(&__iter); -#line 567 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 577 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 568 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 578 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_types_Type *item_type = compiler_lsp_utils_get_symbol_typedef(item); -#line 569 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 579 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)hint_type) && !(compiler_types_Type_eq(item_type, hint_type, false))) { -#line 569 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 579 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" continue; } -#line 571 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 581 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, item, seen); } } -#line 573 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 583 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_gen_completions_from_scope(scope->parent, completions, hint_type, seen); } -#line 576 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 586 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" void compiler_lsp_utils_gen_completion_items_from_ns(std_value_Value *completions, compiler_ast_program_Namespace *ns, std_set_Set__2 *seen) { -#line 577 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 587 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 577 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 587 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_program_Namespace *it = std_map_ValueIterator__3_cur(&__iter); -#line 577 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 587 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 578 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 588 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__2_add(seen, it->sym->name); -#line 579 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 589 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, it->sym, seen); } } -#line 581 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(ns->structs); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { +#line 591 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(ns->structs); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { -#line 581 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - compiler_ast_nodes_Structure *it = std_vector_Iterator__9_cur(&__iter); +#line 591 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + compiler_ast_nodes_Structure *it = std_vector_Iterator__14_cur(&__iter); -#line 581 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 591 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 582 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 592 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__2_add(seen, it->sym->name); -#line 583 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 593 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, it->sym, seen); } } -#line 585 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 595 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->variables); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 585 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 595 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_AST *it = std_vector_Iterator__16_cur(&__iter); -#line 585 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 595 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 586 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 596 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)it->resolved_symbol)) { -#line 587 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 597 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__2_add(seen, it->resolved_symbol->name); -#line 588 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 598 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, it->resolved_symbol, seen); } } } -#line 591 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 601 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->constants); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 591 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 601 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_AST *it = std_vector_Iterator__16_cur(&__iter); -#line 591 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 601 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 592 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 602 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)it->resolved_symbol)) { -#line 593 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 603 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__2_add(seen, it->resolved_symbol->name); -#line 594 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 604 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, it->resolved_symbol, seen); } } } -#line 597 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 607 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(ns->functions); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 597 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 607 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_Function *it = std_vector_Iterator__6_cur(&__iter); -#line 597 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 607 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 598 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 608 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (it->kind != compiler_ast_nodes_FunctionKind_Method) { -#line 599 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 609 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__2_add(seen, it->sym->name); -#line 600 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 610 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, it->sym, seen); } } } -#line 606 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 616 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (!((ns->is_a_file && !(ns->is_dir_with_mod)))) { -#line 607 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 617 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" char *ns_path = ns->path; -#line 608 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 618 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_fs_DirectoryIterator __iter = std_fs_iterate_directory(ns_path, true); std_fs_DirectoryIterator_has_value(&__iter); std_fs_DirectoryIterator_next(&__iter)) { -#line 608 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 618 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_fs_DirectoryEntry entry = std_fs_DirectoryIterator_cur(&__iter); -#line 608 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 618 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 609 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 619 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (std_set_Set__2_contains(seen, entry.name)) { -#line 609 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 619 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" continue; } -#line 611 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 621 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" char *path = std_format("%s/%s", ns_path, entry.name); -#line 612 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 622 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" -#line 614 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 624 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (std_fs_file_exists(path) && str_ends_with(path, ".oc")) { -#line 615 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 625 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" char *name = strdup(entry.name); -#line 616 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 626 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" name[(strlen(name) - 3)]='\0'; -#line 617 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 627 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (str_eq(name, "mod") || std_set_Set__2_contains(seen, name)) { -#line 617 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 627 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" /* defers */ -#line 612 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 622 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" str_free(&path); continue; } -#line 619 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 629 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *item = std_value_Value_new(std_value_ValueType_Dictionary); -#line 620 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 630 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(item, "label", name); -#line 621 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 631 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(item, "kind", "field"); -#line 622 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 632 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(item, "insertText", name); -#line 623 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 633 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(item, "detail", "(file)"); -#line 624 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 634 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(completions, item); } -#line 627 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 637 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (std_fs_directory_exists(path)) { -#line 628 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 638 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *item = std_value_Value_new(std_value_ValueType_Dictionary); -#line 629 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 639 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(item, "label", entry.name); -#line 630 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 640 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(item, "kind", "field"); -#line 631 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 641 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(item, "insertText", entry.name); -#line 632 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 642 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert_str(item, "detail", "(directory)"); -#line 633 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 643 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_push(completions, item); } /* defers */ -#line 612 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 622 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" str_free(&path); } } @@ -28933,136 +29386,136 @@ void compiler_lsp_utils_gen_completion_items_from_ns(std_value_Value *completion } -#line 639 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 649 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" void compiler_lsp_utils_gen_completions_from_symbol(compiler_ast_scopes_Symbol *sym, compiler_ast_nodes_AST *node, std_value_Value *completions, std_set_Set__2 *seen) { -#line 640 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 650 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((sym->type)) { case compiler_ast_scopes_SymbolType_Structure: - m_118_0: + m_120_0: { -#line 642 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 652 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)node) && (node->type != compiler_ast_nodes_ASTType_NSLookup)) { -#line 643 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 653 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(sym->u.struc->fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 643 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 653 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 643 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 653 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 644 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 654 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, field->sym, seen); } } } -#line 647 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - for (std_map_ValueIterator__9 __iter = std_map_Map__9_iter_values(sym->u.struc->type->methods); std_map_ValueIterator__9_has_value(&__iter); std_map_ValueIterator__9_next(&__iter)) { +#line 657 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + for (std_map_ValueIterator__8 __iter = std_map_Map__8_iter_values(sym->u.struc->type->methods); std_map_ValueIterator__8_has_value(&__iter); std_map_ValueIterator__8_next(&__iter)) { -#line 647 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - compiler_ast_nodes_Function *mth = std_map_ValueIterator__9_cur(&__iter); +#line 657 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + compiler_ast_nodes_Function *mth = std_map_ValueIterator__8_cur(&__iter); -#line 647 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 657 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 648 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 658 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, mth->sym, seen); } } } break; case compiler_ast_scopes_SymbolType_TypeDef: - m_118_1: + m_120_1: { -#line 652 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - for (std_map_ValueIterator__9 __iter = std_map_Map__9_iter_values(sym->u.type_def->methods); std_map_ValueIterator__9_has_value(&__iter); std_map_ValueIterator__9_next(&__iter)) { +#line 662 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + for (std_map_ValueIterator__8 __iter = std_map_Map__8_iter_values(sym->u.type_def->methods); std_map_ValueIterator__8_has_value(&__iter); std_map_ValueIterator__8_next(&__iter)) { -#line 652 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - compiler_ast_nodes_Function *mth = std_map_ValueIterator__9_cur(&__iter); +#line 662 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + compiler_ast_nodes_Function *mth = std_map_ValueIterator__8_cur(&__iter); -#line 652 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 662 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 653 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 663 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, mth->sym, seen); } } } break; case compiler_ast_scopes_SymbolType_Enum: - m_118_2: + m_120_2: { -#line 657 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 667 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)node) && node->type==compiler_ast_nodes_ASTType_NSLookup) { -#line 658 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 668 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(sym->u.enom->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 658 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 668 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 658 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 668 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 659 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 669 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, variant->sym, seen); } } } -#line 662 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - for (std_map_ValueIterator__9 __iter = std_map_Map__9_iter_values(sym->u.enom->type->methods); std_map_ValueIterator__9_has_value(&__iter); std_map_ValueIterator__9_next(&__iter)) { +#line 672 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + for (std_map_ValueIterator__8 __iter = std_map_Map__8_iter_values(sym->u.enom->type->methods); std_map_ValueIterator__8_has_value(&__iter); std_map_ValueIterator__8_next(&__iter)) { -#line 662 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" - compiler_ast_nodes_Function *mth = std_map_ValueIterator__9_cur(&__iter); +#line 672 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" + compiler_ast_nodes_Function *mth = std_map_ValueIterator__8_cur(&__iter); -#line 662 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 672 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" { -#line 663 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 673 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_insert_completion_item(completions, mth->sym, seen); } } } break; case compiler_ast_scopes_SymbolType_Variable: - m_118_3: + m_120_3: { -#line 667 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 677 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_types_Type *typ = compiler_lsp_utils_get_symbol_typedef(sym); -#line 668 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 678 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if ((((bool)typ) && !(compiler_types_Type_can_have_methods(typ))) && typ->base==compiler_types_BaseType_Pointer) { -#line 669 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 679 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" typ=typ->u.ptr; } -#line 671 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 681 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)typ) && ((bool)typ->sym)) { -#line 672 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 682 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_gen_completions_from_symbol(typ->sym, node, completions, seen); } } break; case compiler_ast_scopes_SymbolType_Namespace: - m_118_4: + m_120_4: { -#line 675 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 685 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_gen_completion_items_from_ns(completions, sym->u.ns, seen); } break; default: { -#line 677 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 687 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (compiler_lsp_utils_verbose) { -#line 677 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 687 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" printf("gen_completions_json: unhandled symbol type: %s\n", compiler_ast_scopes_SymbolType_dbg(sym->type)); } } break; @@ -29070,42 +29523,42 @@ void compiler_lsp_utils_gen_completions_from_symbol(compiler_ast_scopes_Symbol * } -#line 682 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 692 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *compiler_lsp_utils_gen_completions_json(compiler_lsp_finder_Finder *finder) { -#line 683 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 693 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_nodes_AST *node = finder->found_node; -#line 684 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 694 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (!(((bool)node))) { -#line 684 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 694 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" return NULL; } -#line 686 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 696 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *completions = std_value_Value_new(std_value_ValueType_List); -#line 687 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 697 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_types_Type *hint_type = node->hint; -#line 689 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 699 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_ast_scopes_Symbol *sym = ({ compiler_ast_scopes_Symbol *__yield_0; -#line 689 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 699 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_Member: - m_119_0: + m_121_0: { __yield_0 = node->u.member.lhs->resolved_symbol; } break; case compiler_ast_nodes_ASTType_NSLookup: - m_119_1: + m_121_1: { __yield_0 = node->u.lookup.lhs->resolved_symbol; } break; case compiler_ast_nodes_ASTType_Import: - m_119_2: + m_121_2: { __yield_0 = finder->found_import_ns->sym; } break; @@ -29117,31 +29570,31 @@ std_value_Value *compiler_lsp_utils_gen_completions_json(compiler_lsp_finder_Fin __yield_0; }); -#line 696 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 706 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__2 *seen = std_set_Set__2_new(); -#line 697 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 707 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" -#line 698 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 708 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" if (((bool)sym)) { -#line 700 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 710 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_gen_completions_from_symbol(sym, node, completions, seen); } else { -#line 703 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 713 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" compiler_lsp_utils_gen_completions_from_scope(finder->found_scope, completions, hint_type, seen); } -#line 706 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 716 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value *obj = std_value_Value_new(std_value_ValueType_Dictionary); -#line 707 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 717 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_value_Value_insert(obj, "completions", completions); -#line 708 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 718 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" /* defers */ -#line 697 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" +#line 707 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/utils.oc" std_set_Set__2_free(seen); return obj; } @@ -29286,17 +29739,17 @@ bool compiler_lsp_finder_Finder_find_signature_help(compiler_lsp_finder_Finder * #line 100 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" switch ((func->type)) { case compiler_ast_scopes_SymbolType_Function: - m_120_0: + m_122_0: { __yield_0 = func->u.func->params; } break; case compiler_ast_scopes_SymbolType_Structure: - m_120_1: + m_122_1: { __yield_0 = func->u.struc->fields; } break; case compiler_ast_scopes_SymbolType_Variable: - m_120_2: + m_122_2: { #line 104 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" @@ -29470,6 +29923,13 @@ bool compiler_lsp_finder_Finder_find_in_call_args(compiler_lsp_finder_Finder *th bool compiler_lsp_finder_Finder_find_in_expression(compiler_lsp_finder_Finder *this, compiler_ast_nodes_AST *node) { #line 176 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + if (!(((bool)node))) { + +#line 176 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + return false; + } + +#line 177 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_IntLiteral: case compiler_ast_nodes_ASTType_FloatLiteral: @@ -29477,270 +29937,277 @@ bool compiler_lsp_finder_Finder_find_in_expression(compiler_lsp_finder_Finder *t case compiler_ast_nodes_ASTType_StringLiteral: case compiler_ast_nodes_ASTType_CharLiteral: case compiler_ast_nodes_ASTType_Null: - m_121_0: + m_123_0: { -#line 179 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 180 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_literal(this, node); } break; case compiler_ast_nodes_ASTType_CreateNew: - m_121_1: + m_123_1: { -#line 180 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 181 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_expression(this, node->u.child); } break; case compiler_ast_nodes_ASTType_FormatStringLiteral: - m_121_2: + m_123_2: { -#line 183 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 184 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_FormatString *fmt = &node->u.fmt_str; -#line 184 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 185 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (u32 i = 0; i < fmt->exprs->size; i+=1) { -#line 185 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 186 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_expression(this, std_vector_Vector__16_at(fmt->exprs, i))) { -#line 185 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 186 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } -#line 187 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 188 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_literal(this, node); } break; case compiler_ast_nodes_ASTType_Identifier: - m_121_3: + m_123_3: { -#line 190 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 191 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_identifier(this, node); } break; case compiler_ast_nodes_ASTType_Member: - m_121_4: + m_123_4: { -#line 192 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 193 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" char *rhs = node->u.member.rhs_name; -#line 194 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 195 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if ((!(((bool)rhs)) && this->cmd==compiler_lsp_CommandType_Completions) && std_span_Span_contains_loc(node->span, this->loc)) { -#line 195 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 196 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, node->u.member.lhs->resolved_symbol, node); } -#line 198 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 199 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_expression(this, node->u.member.lhs)) { -#line 198 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 199 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 199 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 200 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(node->u.member.rhs_span, this->loc)) { -#line 200 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, node->resolved_symbol, node); } } break; + case compiler_ast_nodes_ASTType_CreateClosure: + m_123_5: + { + +#line 204 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + return compiler_lsp_finder_Finder_find_in_function(this, node->u.closure); + } break; case compiler_ast_nodes_ASTType_NSLookup: - m_121_5: + m_123_6: { -#line 205 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_expression(this, node->u.lookup.lhs)) { -#line 205 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 208 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 210 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" char *rhs = node->u.member.rhs_name; -#line 209 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 211 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (!(((bool)rhs)) && std_span_Span_contains_loc(node->span, this->loc)) { -#line 210 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 212 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" bool res = compiler_lsp_finder_Finder_set_usage(this, node->u.member.lhs->resolved_symbol, node); -#line 211 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 213 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return res; } -#line 214 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 216 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(node->u.member.rhs_span, this->loc)) { -#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 217 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, node->resolved_symbol, node); } } break; case compiler_ast_nodes_ASTType_BinaryOp: - m_121_6: + m_123_7: { -#line 219 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_AST *lhs = node->u.binary.lhs; -#line 220 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 222 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_AST *rhs = node->u.binary.rhs; -#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_expression(this, lhs) || compiler_lsp_finder_Finder_find_in_expression(this, rhs); } break; case compiler_ast_nodes_ASTType_UnaryOp: - m_121_7: + m_123_8: { -#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 225 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_expression(this, node->u.unary.expr); } break; case compiler_ast_nodes_ASTType_Defer: case compiler_ast_nodes_ASTType_Yield: - m_121_8: + m_123_9: { -#line 224 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 226 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_expression(this, node->u.child); } break; case compiler_ast_nodes_ASTType_Call: - m_121_9: + m_123_10: { -#line 226 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_FuncCall *call = &node->u.call; -#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 229 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_expression(this, call->callee)) { -#line 227 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 229 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_call_args(this, node, call->args)) { -#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } break; case compiler_ast_nodes_ASTType_Cast: - m_121_10: + m_123_11: { -#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 233 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_expression(this, node->u.cast.lhs)) { -#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 233 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 232 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 234 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_type(this, node->u.cast.parsed_to); } break; case compiler_ast_nodes_ASTType_SizeOf: - m_121_11: + m_123_12: { -#line 234 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_type(this, node->u.size_of_type); } break; case compiler_ast_nodes_ASTType_If: - m_121_12: + m_123_13: { -#line 236 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_IfStatement *stmt = &node->u.if_stmt; -#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__23 __iter = std_vector_Vector__23_iter(stmt->branches); std_vector_Iterator__23_has_value(&__iter); std_vector_Iterator__23_next(&__iter)) { -#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_IfBranch branch = std_vector_Iterator__23_cur(&__iter); -#line 237 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_expression(this, branch.cond)) { -#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_statement(this, branch.body)) { -#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } -#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)stmt->els) && compiler_lsp_finder_Finder_find_in_statement(this, stmt->els)) { -#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } break; case compiler_ast_nodes_ASTType_Match: - m_121_13: + m_123_14: { -#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 246 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Match *stmt = &node->u.match_stmt; -#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_expression(this, stmt->expr)) { -#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 246 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__24 __iter = std_vector_Vector__24_iter(stmt->cases); std_vector_Iterator__24_has_value(&__iter); std_vector_Iterator__24_next(&__iter)) { -#line 246 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_MatchCase _case = std_vector_Iterator__24_cur(&__iter); -#line 246 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" - for (std_vector_Iterator__11 __iter = std_vector_Vector__11_iter(_case.conds); std_vector_Iterator__11_has_value(&__iter); std_vector_Iterator__11_next(&__iter)) { +#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + for (std_vector_Iterator__10 __iter = std_vector_Vector__10_iter(_case.conds); std_vector_Iterator__10_has_value(&__iter); std_vector_Iterator__10_next(&__iter)) { -#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" - compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__11_cur(&__iter); +#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + compiler_ast_nodes_MatchCond *cond = std_vector_Iterator__10_cur(&__iter); -#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_expression(this, cond->expr)) { -#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)cond->args)) { -#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__19 __iter = std_vector_Vector__19_iter(cond->args); std_vector_Iterator__19_has_value(&__iter); std_vector_Iterator__19_next(&__iter)) { -#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_MatchCondArg *arg = std_vector_Iterator__19_cur(&__iter); -#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 253 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_var(this, arg->var, node)) { -#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 253 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } @@ -29749,211 +30216,211 @@ bool compiler_lsp_finder_Finder_find_in_expression(compiler_lsp_finder_Finder *t } } -#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)_case.body) && compiler_lsp_finder_Finder_find_in_statement(this, _case.body)) { -#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } -#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 259 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)stmt->defolt) && compiler_lsp_finder_Finder_find_in_statement(this, stmt->defolt)) { -#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 259 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } break; case compiler_ast_nodes_ASTType_Break: case compiler_ast_nodes_ASTType_Continue: - m_121_14: + m_123_15: { } break; case compiler_ast_nodes_ASTType_Assert: - m_121_15: + m_123_16: { -#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_expression(this, node->u.assertion.expr); } break; case compiler_ast_nodes_ASTType_Specialization: - m_121_16: + m_123_17: { -#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Specialization *spec = &node->u.spec; -#line 263 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_expression(this, spec->base)) { -#line 263 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__0 __iter = std_vector_Vector__0_iter(spec->parsed_template_args); std_vector_Iterator__0_has_value(&__iter); std_vector_Iterator__0_next(&__iter)) { -#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_types_Type *ty = std_vector_Iterator__0_cur(&__iter); -#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_type(this, ty)) { -#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } } break; case compiler_ast_nodes_ASTType_Block: - m_121_17: + m_123_18: { -#line 268 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_block(this, node); } break; case compiler_ast_nodes_ASTType_OverloadedOperator: - m_121_18: + m_123_19: { -#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 272 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_span_Span op_span = node->u.operator_span; -#line 271 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(op_span, this->loc)) { -#line 272 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 274 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, node->resolved_symbol, node); } } break; case compiler_ast_nodes_ASTType_Error: - m_121_19: + m_123_20: { -#line 276 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 278 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(node->span, this->loc)) { -#line 277 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 279 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, node->resolved_symbol, node); } } break; default: { -#line 281 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 283 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_utils_verbose) { -#line 281 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 283 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" printf("Unhandled node type in Finder::find_in_expression: %s""\n", compiler_ast_nodes_ASTType_dbg(node->type)); } } break; } -#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 286 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return false; } -#line 287 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 289 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" bool compiler_lsp_finder_Finder_find_in_import_part(compiler_lsp_finder_Finder *this, compiler_ast_scopes_Symbol *base, compiler_ast_nodes_ImportPart *part, compiler_ast_nodes_AST *node) { -#line 287 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 289 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return ({ bool __yield_0; -#line 287 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 289 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" switch ((part->type)) { case compiler_ast_nodes_ImportPartType_Single: - m_122_0: + m_124_0: { -#line 289 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 291 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(part->span, this->loc)) { -#line 290 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 292 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, part->resolved_symbol, node); } -#line 292 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 294 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return false; } break; case compiler_ast_nodes_ImportPartType_Multiple: - m_122_1: + m_124_1: { -#line 295 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 297 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_ImportPartMultiple *multi = &part->u.multiple; -#line 296 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__22 __iter = std_vector_Vector__22_iter(multi->paths); std_vector_Iterator__22_has_value(&__iter); std_vector_Iterator__22_next(&__iter)) { -#line 296 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_vector_Vector__5 *subpath = std_vector_Iterator__22_cur(&__iter); -#line 296 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 297 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 299 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_scopes_Symbol *prev = base; -#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 300 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__5 __iter = std_vector_Vector__5_iter(subpath); std_vector_Iterator__5_has_value(&__iter); std_vector_Iterator__5_next(&__iter)) { -#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 300 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_ImportPart *subpart = std_vector_Iterator__5_cur(&__iter); -#line 298 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 300 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 299 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 301 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_import_part(this, prev, subpart, node)) { -#line 300 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 302 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)prev) && prev->type==compiler_ast_scopes_SymbolType_Namespace) { -#line 301 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 303 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" this->found_import_ns=prev->u.ns; } -#line 303 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 305 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 305 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 307 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" prev=subpart->resolved_symbol; } } } } -#line 308 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 310 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_span_Span multi_span = std_span_Span_join(multi->open_curly_span, multi->close_curly_span); -#line 309 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 311 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(multi_span, this->loc)) { -#line 310 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 312 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_lsp_finder_Finder_set_usage(this, NULL, node); -#line 311 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 313 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)base) && base->type==compiler_ast_scopes_SymbolType_Namespace) { -#line 312 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 314 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" this->found_import_ns=base->u.ns; } -#line 314 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 316 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 316 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 318 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return false; } break; case compiler_ast_nodes_ImportPartType_Wildcard: - m_122_2: + m_124_2: { __yield_0 = false; } break; @@ -29963,116 +30430,116 @@ bool compiler_lsp_finder_Finder_find_in_import_part(compiler_lsp_finder_Finder * } -#line 321 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 323 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" bool compiler_lsp_finder_Finder_find_in_statement(compiler_lsp_finder_Finder *this, compiler_ast_nodes_AST *node) { -#line 322 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 324 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" switch ((node->type)) { case compiler_ast_nodes_ASTType_While: case compiler_ast_nodes_ASTType_For: - m_123_0: + m_125_0: { -#line 324 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 326 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Loop *loop = &node->u.loop; -#line 325 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 327 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)loop->init) && compiler_lsp_finder_Finder_find_in_statement(this, loop->init)) { -#line 325 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 327 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 326 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 328 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)loop->cond) && compiler_lsp_finder_Finder_find_in_expression(this, loop->cond)) { -#line 326 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 328 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 327 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 329 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)loop->step) && compiler_lsp_finder_Finder_find_in_expression(this, loop->step)) { -#line 327 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 329 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 328 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 330 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)loop->body) && compiler_lsp_finder_Finder_find_in_statement(this, loop->body)) { -#line 328 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 330 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } break; case compiler_ast_nodes_ASTType_VarDeclaration: - m_123_1: + m_125_1: { -#line 331 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 333 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Variable *decl = node->u.var_decl; -#line 332 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 334 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)decl) && compiler_lsp_finder_Finder_find_in_var(this, decl, node)) { -#line 332 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 334 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 333 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 335 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)decl->default_value) && compiler_lsp_finder_Finder_find_in_expression(this, decl->default_value)) { -#line 333 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 335 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } break; case compiler_ast_nodes_ASTType_Block: - m_123_2: + m_125_2: { -#line 335 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 337 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_block(this, node); } break; case compiler_ast_nodes_ASTType_Return: - m_123_3: + m_125_3: { -#line 336 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 338 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return ((bool)node->u.ret.expr) && compiler_lsp_finder_Finder_find_in_expression(this, node->u.ret.expr); } break; case compiler_ast_nodes_ASTType_Import: - m_123_4: + m_125_4: { -#line 338 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 340 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Import path = node->u.import_path; -#line 339 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 341 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_scopes_Symbol *prev = path.root_sym; -#line 340 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 342 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__5 __iter = std_vector_Vector__5_iter(path.parts); std_vector_Iterator__5_has_value(&__iter); std_vector_Iterator__5_next(&__iter)) { -#line 340 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 342 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_ImportPart *part = std_vector_Iterator__5_cur(&__iter); -#line 340 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 342 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 341 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 343 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_import_part(this, prev, part, node)) { -#line 342 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 344 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)prev) && prev->type==compiler_ast_scopes_SymbolType_Namespace) { -#line 343 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 345 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" this->found_import_ns=prev->u.ns; } -#line 345 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 347 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 347 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 349 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" prev=part->resolved_symbol; } } @@ -30080,241 +30547,281 @@ bool compiler_lsp_finder_Finder_find_in_statement(compiler_lsp_finder_Finder *th default: { -#line 350 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 352 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_expression(this, node); } break; } -#line 352 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 354 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return false; } -#line 355 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 357 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" bool compiler_lsp_finder_Finder_find_in_block(compiler_lsp_finder_Finder *this, compiler_ast_nodes_AST *node) { -#line 356 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 358 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_vector_Vector__1_push(this->scopes, node->u.block.scope); -#line 357 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 359 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_vector_Vector__16 *stmts = node->u.block.statements; -#line 358 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 360 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (u32 i = 0; i < stmts->size; i+=1) { -#line 359 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 361 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_statement(this, std_vector_Vector__16_at(stmts, i))) { -#line 359 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 361 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } -#line 365 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 367 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (this->cmd==compiler_lsp_CommandType_Completions && std_span_Span_contains_loc(node->span, this->loc)) { -#line 366 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 368 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, NULL, node); } -#line 369 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 371 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_vector_Vector__1_pop(this->scopes); -#line 370 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 372 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return false; } -#line 373 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 375 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" bool compiler_lsp_finder_Finder_find_in_type(compiler_lsp_finder_Finder *this, compiler_types_Type *type) { -#line 374 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 376 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" switch ((type->base)) { case compiler_types_BaseType_Pointer: - m_124_0: + m_126_0: { -#line 375 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 377 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_type(this, type->u.ptr); } break; case compiler_types_BaseType_Array: - m_124_1: + m_126_1: { -#line 377 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 379 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)type->u.arr.size_expr) && compiler_lsp_finder_Finder_find_in_expression(this, type->u.arr.size_expr)) { -#line 377 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 379 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 378 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 380 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_type(this, type->u.arr.elem_type); } break; case compiler_types_BaseType_Unresolved: - m_124_2: + m_126_2: { -#line 380 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 382 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_expression(this, type->u.unresolved); } break; case compiler_types_BaseType_UnresolvedTemplate: - m_124_3: + m_126_3: { -#line 382 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_types_UnresolvedTemplate spec = type->u.unresolved_spec; -#line 383 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_type(this, spec.base)) { -#line 383 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 386 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__0 __iter = std_vector_Vector__0_iter(spec.args); std_vector_Iterator__0_has_value(&__iter); std_vector_Iterator__0_next(&__iter)) { -#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 386 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_types_Type *ty = std_vector_Iterator__0_cur(&__iter); -#line 384 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 386 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 387 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_type(this, ty)) { -#line 385 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 387 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } } break; + case compiler_types_BaseType_FunctionPtr: + case compiler_types_BaseType_Closure: + m_126_4: + { + +#line 391 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + compiler_types_FunctionType func = type->u.func; + +#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(func.params); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { + +#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + compiler_ast_nodes_Variable *param = std_vector_Iterator__3_cur(&__iter); + +#line 392 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + { + +#line 393 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + if (compiler_lsp_finder_Finder_find_in_var(this, param, NULL)) { + +#line 393 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + return true; + } + } + } + +#line 395 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + if (((bool)func.return_type) && compiler_lsp_finder_Finder_find_in_type(this, func.return_type)) { + +#line 395 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + return true; + } + +#line 396 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + if (std_span_Span_contains_loc(type->span, this->loc)) { + +#line 397 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + return compiler_lsp_finder_Finder_set_usage(this, type->sym, NULL); + } + } break; default: { -#line 390 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 402 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(type->span, this->loc)) { -#line 391 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 403 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, type->sym, NULL); } } break; } -#line 395 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return false; } -#line 398 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 410 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" bool compiler_lsp_finder_Finder_find_in_function(compiler_lsp_finder_Finder *this, compiler_ast_nodes_Function *func) { -#line 402 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 414 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_ast_nodes_Function_is_template_instance(func)) { -#line 402 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 414 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return false; } -#line 404 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 416 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(func->sym->span, this->loc)) { -#line 405 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 417 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, func->sym, NULL); } -#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 419 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_expression(this, func->name_ast)) { -#line 407 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 419 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 409 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 421 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_vector_Vector__1_push(this->scopes, func->scope); -#line 410 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 422 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(func->params); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 410 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 422 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Variable *param = std_vector_Iterator__3_cur(&__iter); -#line 410 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 422 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 411 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 423 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_var(this, param, NULL)) { -#line 411 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 423 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } -#line 414 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 426 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_types_Type *ret_type = func->parsed_return_type; -#line 415 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 427 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)ret_type) && compiler_lsp_finder_Finder_find_in_type(this, ret_type)) { -#line 415 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 427 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } -#line 417 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 429 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" bool res = (((bool)func->body) && compiler_lsp_finder_Finder_find_in_statement(this, func->body)); -#line 418 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 430 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_vector_Vector__1_pop(this->scopes); -#line 420 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 432 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return res; } -#line 423 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 435 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" bool compiler_lsp_finder_Finder_find_in_program(compiler_lsp_finder_Finder *this, compiler_ast_program_Namespace *ns) { -#line 424 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 436 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_vector_Vector__1_push(this->scopes, ns->scope); -#line 426 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" - for (std_vector_Iterator__9 __iter = std_vector_Vector__9_iter(ns->structs); std_vector_Iterator__9_has_value(&__iter); std_vector_Iterator__9_next(&__iter)) { +#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + for (std_vector_Iterator__14 __iter = std_vector_Vector__14_iter(ns->structs); std_vector_Iterator__14_has_value(&__iter); std_vector_Iterator__14_next(&__iter)) { -#line 426 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" - compiler_ast_nodes_Structure *struc = std_vector_Iterator__9_cur(&__iter); +#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" + compiler_ast_nodes_Structure *struc = std_vector_Iterator__14_cur(&__iter); -#line 426 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 430 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 442 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)struc->type) && ((bool)struc->type->template_instance)) { -#line 430 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 442 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" continue; } -#line 432 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 444 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(struc->sym->span, this->loc)) { -#line 432 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 444 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, struc->sym, NULL); } -#line 433 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 445 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(struc->fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 433 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 445 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 433 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 445 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 434 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 446 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_var(this, field, NULL)) { -#line 434 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 446 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } @@ -30322,72 +30829,72 @@ bool compiler_lsp_finder_Finder_find_in_program(compiler_lsp_finder_Finder *this } } -#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 450 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__15 __iter = std_vector_Vector__15_iter(ns->enums); std_vector_Iterator__15_has_value(&__iter); std_vector_Iterator__15_next(&__iter)) { -#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 450 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Enum *enom = std_vector_Iterator__15_cur(&__iter); -#line 438 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 450 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 439 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 451 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(enom->sym->span, this->loc)) { -#line 439 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 451 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, enom->sym, NULL); } -#line 440 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 452 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(enom->shared_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 440 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 452 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 440 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 452 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 441 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 453 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_var(this, field, NULL)) { -#line 441 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 453 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } -#line 443 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 455 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__20 __iter = std_vector_Vector__20_iter(enom->variants); std_vector_Iterator__20_has_value(&__iter); std_vector_Iterator__20_next(&__iter)) { -#line 443 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 455 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_EnumVariant *variant = std_vector_Iterator__20_cur(&__iter); -#line 443 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 455 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 444 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 456 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(variant->sym->span, this->loc)) { -#line 444 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 456 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, variant->sym, NULL); } -#line 445 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 457 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)variant->specific_fields)) { -#line 446 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__3 __iter = std_vector_Vector__3_iter(variant->specific_fields); std_vector_Iterator__3_has_value(&__iter); std_vector_Iterator__3_next(&__iter)) { -#line 446 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Variable *field = std_vector_Iterator__3_cur(&__iter); -#line 446 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 447 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 459 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_var(this, field, NULL)) { -#line 447 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 459 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } @@ -30398,151 +30905,151 @@ bool compiler_lsp_finder_Finder_find_in_program(compiler_lsp_finder_Finder *this } } -#line 453 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 465 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__6 __iter = std_vector_Vector__6_iter(ns->functions); std_vector_Iterator__6_has_value(&__iter); std_vector_Iterator__6_next(&__iter)) { -#line 453 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 465 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Function *func = std_vector_Iterator__6_cur(&__iter); -#line 453 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 465 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 454 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 466 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(func->sym->span, this->loc)) { -#line 454 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 466 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, func->sym, NULL); } -#line 455 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 467 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_function(this, func)) { -#line 455 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 467 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } -#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 470 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->imports); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 470 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_AST *import_ = std_vector_Iterator__16_cur(&__iter); -#line 458 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 470 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 459 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 471 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_statement(this, import_)) { -#line 459 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 471 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } -#line 462 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 474 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->variables); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 462 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 474 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_AST *vardecl = std_vector_Iterator__16_cur(&__iter); -#line 462 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 474 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 463 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 475 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Variable *var = vardecl->u.var_decl; -#line 464 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 476 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(var->sym->span, this->loc)) { -#line 464 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 476 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, var->sym, NULL); } -#line 466 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 478 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_AST *init = vardecl->u.var_decl->default_value; -#line 467 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 479 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)init) && compiler_lsp_finder_Finder_find_in_expression(this, init)) { -#line 467 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 479 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } -#line 470 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 482 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_vector_Iterator__16 __iter = std_vector_Vector__16_iter(ns->constants); std_vector_Iterator__16_has_value(&__iter); std_vector_Iterator__16_next(&__iter)) { -#line 470 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 482 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_AST *vardecl = std_vector_Iterator__16_cur(&__iter); -#line 470 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 482 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 471 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 483 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_Variable *var = vardecl->u.var_decl; -#line 472 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 484 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(var->sym->span, this->loc)) { -#line 472 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 484 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, var->sym, NULL); } -#line 474 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 486 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_nodes_AST *init = vardecl->u.var_decl->default_value; -#line 475 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 487 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (((bool)init) && compiler_lsp_finder_Finder_find_in_expression(this, init)) { -#line 475 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 487 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } -#line 478 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 490 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_vector_Vector__1_pop(this->scopes); -#line 480 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 492 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" for (std_map_ValueIterator__3 __iter = std_map_Map__3_iter_values(ns->namespaces); std_map_ValueIterator__3_has_value(&__iter); std_map_ValueIterator__3_next(&__iter)) { -#line 480 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 492 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" compiler_ast_program_Namespace *child = std_map_ValueIterator__3_cur(&__iter); -#line 480 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 492 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" { -#line 481 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 493 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (std_span_Span_contains_loc(child->sym->span, this->loc)) { -#line 481 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 493 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_set_usage(this, child->sym, NULL); } -#line 482 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 494 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" if (compiler_lsp_finder_Finder_find_in_program(this, child)) { -#line 482 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 494 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return true; } } } -#line 485 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 497 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return false; } -#line 488 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 500 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" bool compiler_lsp_finder_Finder_find(compiler_lsp_finder_Finder *this, compiler_ast_program_Program *program) { -#line 489 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 501 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" std_vector_Vector__1_push(this->scopes, program->global->scope); -#line 490 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" +#line 502 "/Users/mustafa/ocen-lang/ocen/compiler/lsp/finder.oc" return compiler_lsp_finder_Finder_find_in_program(this, program->global); } @@ -30589,7 +31096,7 @@ bool compiler_tokens_Token_is_word(compiler_tokens_Token this) { #line 41 "/Users/mustafa/ocen-lang/ocen/compiler/tokens.oc" switch ((this.type)) { case compiler_tokens_TokenType_Identifier: - m_125_0: + m_127_0: { __yield_0 = true; } break; @@ -30612,7 +31119,7 @@ bool compiler_tokens_Token_is_identifier(compiler_tokens_Token this, char *name) #line 46 "/Users/mustafa/ocen-lang/ocen/compiler/tokens.oc" switch ((this.type)) { case compiler_tokens_TokenType_Identifier: - m_126_0: + m_128_0: { __yield_0 = str_eq(name, this.text); } break; @@ -30634,70 +31141,70 @@ compiler_tokens_TokenType compiler_tokens_TokenType_from_text(char *text) { #line 140 "/Users/mustafa/ocen-lang/ocen/compiler/tokens.oc" { - char *__match_var_127 = text; - if (str_eq(__match_var_127, "and")) { + char *__match_var_129 = text; + if (str_eq(__match_var_129, "and")) { __yield_0 = compiler_tokens_TokenType_And; - } else if (str_eq(__match_var_127, "as")) { + } else if (str_eq(__match_var_129, "as")) { __yield_0 = compiler_tokens_TokenType_As; - } else if (str_eq(__match_var_127, "assert")) { + } else if (str_eq(__match_var_129, "assert")) { __yield_0 = compiler_tokens_TokenType_Assert; - } else if (str_eq(__match_var_127, "break")) { + } else if (str_eq(__match_var_129, "break")) { __yield_0 = compiler_tokens_TokenType_Break; - } else if (str_eq(__match_var_127, "const")) { + } else if (str_eq(__match_var_129, "const")) { __yield_0 = compiler_tokens_TokenType_Const; - } else if (str_eq(__match_var_127, "continue")) { + } else if (str_eq(__match_var_129, "continue")) { __yield_0 = compiler_tokens_TokenType_Continue; - } else if (str_eq(__match_var_127, "def")) { + } else if (str_eq(__match_var_129, "def")) { __yield_0 = compiler_tokens_TokenType_Def; - } else if (str_eq(__match_var_127, "defer")) { + } else if (str_eq(__match_var_129, "defer")) { __yield_0 = compiler_tokens_TokenType_Defer; - } else if (str_eq(__match_var_127, "else")) { + } else if (str_eq(__match_var_129, "else")) { __yield_0 = compiler_tokens_TokenType_Else; - } else if (str_eq(__match_var_127, "enum")) { + } else if (str_eq(__match_var_129, "enum")) { __yield_0 = compiler_tokens_TokenType_Enum; - } else if (str_eq(__match_var_127, "extern")) { + } else if (str_eq(__match_var_129, "extern")) { __yield_0 = compiler_tokens_TokenType_Extern; - } else if (str_eq(__match_var_127, "false")) { + } else if (str_eq(__match_var_129, "false")) { __yield_0 = compiler_tokens_TokenType_False; - } else if (str_eq(__match_var_127, "for")) { + } else if (str_eq(__match_var_129, "for")) { __yield_0 = compiler_tokens_TokenType_For; - } else if (str_eq(__match_var_127, "fn")) { + } else if (str_eq(__match_var_129, "fn")) { __yield_0 = compiler_tokens_TokenType_Fn; - } else if (str_eq(__match_var_127, "if")) { + } else if (str_eq(__match_var_129, "if")) { __yield_0 = compiler_tokens_TokenType_If; - } else if (str_eq(__match_var_127, "let")) { + } else if (str_eq(__match_var_129, "let")) { __yield_0 = compiler_tokens_TokenType_Let; - } else if (str_eq(__match_var_127, "match")) { + } else if (str_eq(__match_var_129, "match")) { __yield_0 = compiler_tokens_TokenType_Match; - } else if (str_eq(__match_var_127, "namespace")) { + } else if (str_eq(__match_var_129, "namespace")) { __yield_0 = compiler_tokens_TokenType_Namespace; - } else if (str_eq(__match_var_127, "not")) { + } else if (str_eq(__match_var_129, "not")) { __yield_0 = compiler_tokens_TokenType_Not; - } else if (str_eq(__match_var_127, "null")) { + } else if (str_eq(__match_var_129, "null")) { __yield_0 = compiler_tokens_TokenType_Null; - } else if (str_eq(__match_var_127, "or")) { + } else if (str_eq(__match_var_129, "or")) { __yield_0 = compiler_tokens_TokenType_Or; - } else if (str_eq(__match_var_127, "return")) { + } else if (str_eq(__match_var_129, "return")) { __yield_0 = compiler_tokens_TokenType_Return; - } else if (str_eq(__match_var_127, "sizeof")) { + } else if (str_eq(__match_var_129, "sizeof")) { __yield_0 = compiler_tokens_TokenType_SizeOf; - } else if (str_eq(__match_var_127, "struct")) { + } else if (str_eq(__match_var_129, "struct")) { __yield_0 = compiler_tokens_TokenType_Struct; - } else if (str_eq(__match_var_127, "true")) { + } else if (str_eq(__match_var_129, "true")) { __yield_0 = compiler_tokens_TokenType_True; - } else if (str_eq(__match_var_127, "then")) { + } else if (str_eq(__match_var_129, "then")) { __yield_0 = compiler_tokens_TokenType_Then; - } else if (str_eq(__match_var_127, "typedef")) { + } else if (str_eq(__match_var_129, "typedef")) { __yield_0 = compiler_tokens_TokenType_TypeDef; - } else if (str_eq(__match_var_127, "union")) { + } else if (str_eq(__match_var_129, "union")) { __yield_0 = compiler_tokens_TokenType_Union; - } else if (str_eq(__match_var_127, "import")) { + } else if (str_eq(__match_var_129, "import")) { __yield_0 = compiler_tokens_TokenType_Import; - } else if (str_eq(__match_var_127, "void")) { + } else if (str_eq(__match_var_129, "void")) { __yield_0 = compiler_tokens_TokenType_Void; - } else if (str_eq(__match_var_127, "yield")) { + } else if (str_eq(__match_var_129, "yield")) { __yield_0 = compiler_tokens_TokenType_Yield; - } else if (str_eq(__match_var_127, "while")) { + } else if (str_eq(__match_var_129, "while")) { __yield_0 = compiler_tokens_TokenType_While; } else { __yield_0 = compiler_tokens_TokenType_Identifier; @@ -30717,162 +31224,162 @@ char *compiler_tokens_TokenType_str(compiler_tokens_TokenType this) { #line 176 "/Users/mustafa/ocen-lang/ocen/compiler/tokens.oc" switch ((this)) { case compiler_tokens_TokenType_And: - m_128_0: + m_130_0: { __yield_0 = "and"; } break; case compiler_tokens_TokenType_As: - m_128_1: + m_130_1: { __yield_0 = "as"; } break; case compiler_tokens_TokenType_Assert: - m_128_2: + m_130_2: { __yield_0 = "assert"; } break; case compiler_tokens_TokenType_Break: - m_128_3: + m_130_3: { __yield_0 = "break"; } break; case compiler_tokens_TokenType_Const: - m_128_4: + m_130_4: { __yield_0 = "const"; } break; case compiler_tokens_TokenType_Continue: - m_128_5: + m_130_5: { __yield_0 = "continue"; } break; case compiler_tokens_TokenType_Def: - m_128_6: + m_130_6: { __yield_0 = "def"; } break; case compiler_tokens_TokenType_Defer: - m_128_7: + m_130_7: { __yield_0 = "defer"; } break; case compiler_tokens_TokenType_Else: - m_128_8: + m_130_8: { __yield_0 = "else"; } break; case compiler_tokens_TokenType_Enum: - m_128_9: + m_130_9: { __yield_0 = "enum"; } break; case compiler_tokens_TokenType_Extern: - m_128_10: + m_130_10: { __yield_0 = "extern"; } break; case compiler_tokens_TokenType_False: - m_128_11: + m_130_11: { __yield_0 = "false"; } break; case compiler_tokens_TokenType_For: - m_128_12: + m_130_12: { __yield_0 = "for"; } break; case compiler_tokens_TokenType_Fn: - m_128_13: + m_130_13: { __yield_0 = "fn"; } break; case compiler_tokens_TokenType_If: - m_128_14: + m_130_14: { __yield_0 = "if"; } break; case compiler_tokens_TokenType_Let: - m_128_15: + m_130_15: { __yield_0 = "let"; } break; case compiler_tokens_TokenType_Match: - m_128_16: + m_130_16: { __yield_0 = "match"; } break; case compiler_tokens_TokenType_Namespace: - m_128_17: + m_130_17: { __yield_0 = "namespace"; } break; case compiler_tokens_TokenType_Not: - m_128_18: + m_130_18: { __yield_0 = "not"; } break; case compiler_tokens_TokenType_Null: - m_128_19: + m_130_19: { __yield_0 = "null"; } break; case compiler_tokens_TokenType_Or: - m_128_20: + m_130_20: { __yield_0 = "or"; } break; case compiler_tokens_TokenType_Return: - m_128_21: + m_130_21: { __yield_0 = "return"; } break; case compiler_tokens_TokenType_SizeOf: - m_128_22: + m_130_22: { __yield_0 = "sizeof"; } break; case compiler_tokens_TokenType_Struct: - m_128_23: + m_130_23: { __yield_0 = "struct"; } break; case compiler_tokens_TokenType_True: - m_128_24: + m_130_24: { __yield_0 = "true"; } break; case compiler_tokens_TokenType_Then: - m_128_25: + m_130_25: { __yield_0 = "then"; } break; case compiler_tokens_TokenType_TypeDef: - m_128_26: + m_130_26: { __yield_0 = "typedef"; } break; case compiler_tokens_TokenType_Union: - m_128_27: + m_130_27: { __yield_0 = "union"; } break; case compiler_tokens_TokenType_Import: - m_128_28: + m_130_28: { __yield_0 = "import"; } break; case compiler_tokens_TokenType_Void: - m_128_29: + m_130_29: { __yield_0 = "void"; } break; case compiler_tokens_TokenType_Yield: - m_128_30: + m_130_30: { __yield_0 = "yield"; } break; case compiler_tokens_TokenType_While: - m_128_31: + m_130_31: { __yield_0 = "while"; } break; @@ -31106,67 +31613,67 @@ void parse_args(i32 *argc, char ***argv, compiler_ast_program_Program *program) #line 107 "compiler/main.oc" { - char *__match_var_129 = arg; - if (str_eq(__match_var_129, "--help")) { + char *__match_var_131 = arg; + if (str_eq(__match_var_131, "--help")) { #line 108 "compiler/main.oc" usage(0, true); - } else if (str_eq(__match_var_129, "-s")) { + } else if (str_eq(__match_var_131, "-s")) { #line 109 "compiler/main.oc" silent=true; - } else if (str_eq(__match_var_129, "-d")) { + } else if (str_eq(__match_var_131, "-d")) { #line 110 "compiler/main.oc" debug=true; - } else if (str_eq(__match_var_129, "-n")) { + } else if (str_eq(__match_var_131, "-n")) { #line 112 "compiler/main.oc" compile_c=false; - } else if (str_eq(__match_var_129, "--no-dce")) { + } else if (str_eq(__match_var_131, "--no-dce")) { #line 114 "compiler/main.oc" program->keep_all_code=true; - } else if (str_eq(__match_var_129, "-o")) { + } else if (str_eq(__match_var_131, "-o")) { #line 115 "compiler/main.oc" exec_path=std_shift_args(argc, argv, "here"); - } else if (str_eq(__match_var_129, "-c")) { + } else if (str_eq(__match_var_131, "-c")) { #line 116 "compiler/main.oc" c_path=std_shift_args(argc, argv, "here"); - } else if (str_eq(__match_var_129, "-l")) { + } else if (str_eq(__match_var_131, "-l")) { #line 117 "compiler/main.oc" std_vector_Vector__8_push(program->library_paths, std_shift_args(argc, argv, "here")); - } else if (str_eq(__match_var_129, "-e0")) { + } else if (str_eq(__match_var_131, "-e0")) { #line 118 "compiler/main.oc" error_level=0; - } else if (str_eq(__match_var_129, "-e1")) { + } else if (str_eq(__match_var_131, "-e1")) { #line 119 "compiler/main.oc" error_level=1; - } else if (str_eq(__match_var_129, "-e2")) { + } else if (str_eq(__match_var_131, "-e2")) { #line 120 "compiler/main.oc" error_level=2; - } else if (str_eq(__match_var_129, "--docs")) { + } else if (str_eq(__match_var_131, "--docs")) { #line 122 "compiler/main.oc" docs_path=std_shift_args(argc, argv, "here"); #line 123 "compiler/main.oc" program->check_doc_links=true; - } else if (str_eq(__match_var_129, "--no-stdlib")) { + } else if (str_eq(__match_var_131, "--no-stdlib")) { #line 125 "compiler/main.oc" include_stdlib=false; - } else if (str_eq(__match_var_129, "--cflags") || str_eq(__match_var_129, "-cf")) { + } else if (str_eq(__match_var_131, "--cflags") || str_eq(__match_var_131, "-cf")) { #line 126 "compiler/main.oc" std_vector_Vector__8_push(extra_c_flags, std_shift_args(argc, argv, "here")); - } else if (str_eq(__match_var_129, "-r") || str_eq(__match_var_129, "--run")) { + } else if (str_eq(__match_var_131, "-r") || str_eq(__match_var_131, "--run")) { #line 128 "compiler/main.oc" run_after_compile=true; @@ -31313,67 +31820,67 @@ char *compiler_types_BaseType_str(compiler_types_BaseType this) { #line 46 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" switch ((this)) { case compiler_types_BaseType_Char: - m_130_0: + m_132_0: { __yield_0 = "char"; } break; case compiler_types_BaseType_Bool: - m_130_1: + m_132_1: { __yield_0 = "bool"; } break; case compiler_types_BaseType_Void: - m_130_2: + m_132_2: { __yield_0 = "void"; } break; case compiler_types_BaseType_I8: - m_130_3: + m_132_3: { __yield_0 = "i8"; } break; case compiler_types_BaseType_I16: - m_130_4: + m_132_4: { __yield_0 = "i16"; } break; case compiler_types_BaseType_I32: - m_130_5: + m_132_5: { __yield_0 = "i32"; } break; case compiler_types_BaseType_I64: - m_130_6: + m_132_6: { __yield_0 = "i64"; } break; case compiler_types_BaseType_U8: - m_130_7: + m_132_7: { __yield_0 = "u8"; } break; case compiler_types_BaseType_U16: - m_130_8: + m_132_8: { __yield_0 = "u16"; } break; case compiler_types_BaseType_U32: - m_130_9: + m_132_9: { __yield_0 = "u32"; } break; case compiler_types_BaseType_U64: - m_130_10: + m_132_10: { __yield_0 = "u64"; } break; case compiler_types_BaseType_F32: - m_130_11: + m_132_11: { __yield_0 = "f32"; } break; case compiler_types_BaseType_F64: - m_130_12: + m_132_12: { __yield_0 = "f64"; } break; @@ -31425,7 +31932,7 @@ compiler_types_Type *compiler_types_Type_new_resolved(compiler_types_BaseType ba type->name=compiler_types_BaseType_str(base); #line 128 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" - type->methods=std_map_Map__9_new(8); + type->methods=std_map_Map__8_new(8); #line 129 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return type; @@ -31482,7 +31989,7 @@ bool compiler_types_Type_is_integer(compiler_types_Type *this) { case compiler_types_BaseType_U16: case compiler_types_BaseType_U32: case compiler_types_BaseType_U64: - m_131_0: + m_133_0: { __yield_0 = true; } break; @@ -31522,7 +32029,7 @@ bool compiler_types_Type_is_numeric(compiler_types_Type *this) { case compiler_types_BaseType_U64: case compiler_types_BaseType_F32: case compiler_types_BaseType_F64: - m_132_0: + m_134_0: { __yield_0 = true; } break; @@ -31568,7 +32075,7 @@ bool compiler_types_Type_can_have_methods(compiler_types_Type *this) { case compiler_types_BaseType_Structure: case compiler_types_BaseType_Alias: case compiler_types_BaseType_Enum: - m_133_0: + m_135_0: { __yield_0 = true; } break; @@ -31591,22 +32098,22 @@ bool compiler_types_Type_is_resolved(compiler_types_Type *this) { #line 171 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" switch ((this->base)) { case compiler_types_BaseType_Unresolved: - m_134_0: + m_136_0: { __yield_0 = false; } break; case compiler_types_BaseType_Alias: - m_134_1: + m_136_1: { __yield_0 = compiler_types_Type_is_resolved(this->u.ptr); } break; case compiler_types_BaseType_Pointer: - m_134_2: + m_136_2: { __yield_0 = compiler_types_Type_is_resolved(this->u.ptr); } break; case compiler_types_BaseType_FunctionPtr: - m_134_3: + m_136_3: { #line 176 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" @@ -31682,270 +32189,284 @@ bool compiler_types_Type_eq(compiler_types_Type *this, compiler_types_Type *othe case compiler_types_BaseType_Error: case compiler_types_BaseType_Unresolved: case compiler_types_BaseType_UnresolvedTemplate: - m_135_0: + m_137_0: { #line 196 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return false; } break; case compiler_types_BaseType_Closure: - case compiler_types_BaseType_FunctionPtr: - m_135_1: + m_137_1: { #line 198 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" + return str_eq(this->sym->full_name, other->sym->full_name); + } break; + case compiler_types_BaseType_FunctionPtr: + m_137_2: + { + +#line 200 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" compiler_types_FunctionType af = this->u.func; -#line 199 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" compiler_types_FunctionType bf = other->u.func; -#line 200 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 202 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (!(compiler_types_Type_eq(af.return_type, bf.return_type, true))) { -#line 200 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 202 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return false; } -#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 203 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (af.params->size != bf.params->size) { -#line 201 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 203 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return false; } -#line 202 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 204 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" for (u32 i = 0; i < af.params->size; i+=1) { -#line 203 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 205 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" compiler_ast_nodes_Variable *a = std_vector_Vector__3_at(af.params, i); -#line 204 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 206 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" compiler_ast_nodes_Variable *b = std_vector_Vector__3_at(bf.params, i); -#line 205 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (!(compiler_types_Type_eq(a->type, b->type, true))) { -#line 205 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 207 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return false; } } -#line 208 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 210 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return true; } break; case compiler_types_BaseType_Pointer: - m_135_2: + m_137_3: { -#line 211 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 213 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (!(strict)) { -#line 212 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 214 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (this->u.ptr->base==compiler_types_BaseType_Void || other->u.ptr->base==compiler_types_BaseType_Void) { -#line 213 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 215 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return true; } } -#line 216 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 218 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return compiler_types_Type_eq(this->u.ptr, other->u.ptr, true); } break; case compiler_types_BaseType_Structure: - m_135_3: + m_137_4: { -#line 218 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 220 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return this->u.struc==other->u.struc; } break; case compiler_types_BaseType_Enum: - m_135_4: + m_137_5: { -#line 219 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return this->u.enom==other->u.enom; } break; case compiler_types_BaseType_Array: - m_135_5: + m_137_6: { -#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (!(compiler_types_Type_eq(this->u.arr.elem_type, other->u.arr.elem_type, true))) { -#line 221 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return false; } -#line 222 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 224 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (this->u.arr.size_known && other->u.arr.size_known) { -#line 223 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 225 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return this->u.arr.size==other->u.arr.size; } -#line 226 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 228 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return true; } break; default: { -#line 229 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 231 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (((u32)this->base) < ((u32)compiler_types_BaseType_NUM_BASE_TYPES)) { -#line 230 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 232 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return true; } -#line 233 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" - if(!(false)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/types.oc:233:20: Assertion failed: `false`", std_format("Unhandled case in Type::eq(), base = %s", compiler_types_BaseType_dbg(this->base))); exit(1); } +#line 235 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" + if(!(false)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/compiler/types.oc:235:20: Assertion failed: `false`", std_format("Unhandled case in Type::eq(), base = %s", compiler_types_BaseType_dbg(this->base))); exit(1); } } break; } } -#line 238 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 240 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" bool compiler_types_Type_is_str(compiler_types_Type *this) { -#line 239 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 241 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return this->base==compiler_types_BaseType_Alias && str_eq(this->sym->full_name, "str"); } -#line 243 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" compiler_types_Type *compiler_types_Type_unaliased(compiler_types_Type *this) { -#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 246 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (this->base != compiler_types_BaseType_Alias) { -#line 244 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 246 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return this; } -#line 245 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 247 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return compiler_types_Type_unaliased(this->u.ptr); } -#line 248 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" compiler_types_Type *compiler_types_Type_decay_array(compiler_types_Type *this) { -#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (this->base != compiler_types_BaseType_Array) { -#line 249 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return this; } -#line 250 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" compiler_types_Type *res = compiler_types_Type_new_resolved(compiler_types_BaseType_Pointer, this->span); -#line 251 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 253 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" res->u.ptr=this->u.arr.elem_type; -#line 252 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 254 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return res; } -#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" char *compiler_types_Type_str(compiler_types_Type *this) { -#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return ({ char *__yield_0; -#line 255 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 257 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" switch ((this->base)) { case compiler_types_BaseType_Pointer: - m_136_0: + m_138_0: { __yield_0 = std_format("&%s", compiler_types_Type_str(this->u.ptr)); } break; + case compiler_types_BaseType_Closure: case compiler_types_BaseType_FunctionPtr: - m_136_1: + m_138_1: { -#line 258 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer buf = std_buffer_Buffer_make(16); -#line 259 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" + if (this->base==compiler_types_BaseType_Closure) { + +#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" + std_buffer_Buffer_write_str(&buf, "@"); + } + +#line 264 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, "fn("); -#line 260 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" for (u32 i = 0; i < this->u.func.params->size; i+=1) { -#line 261 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 266 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" compiler_ast_nodes_Variable *param = std_vector_Vector__3_at(this->u.func.params, i); -#line 262 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (((bool)param->type)) { -#line 263 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 268 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, compiler_types_Type_str(param->type)); } else { -#line 265 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 270 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, "null"); } -#line 267 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 272 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (i < (this->u.func.params->size - 1)) { -#line 268 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, ", "); } } -#line 271 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 276 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, "): "); -#line 272 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 277 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, compiler_types_Type_str(this->u.func.return_type)); -#line 273 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 278 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return std_buffer_Buffer_str(buf); } break; case compiler_types_BaseType_Array: - m_136_2: + m_138_2: { -#line 276 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 281 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer buf = std_buffer_Buffer_make(16); -#line 277 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 282 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, compiler_types_Type_str(this->u.arr.elem_type)); -#line 278 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 283 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, "["); -#line 279 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 284 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" if (this->u.arr.size_known) { -#line 280 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 285 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, std_format("%u", this->u.arr.size)); } else { -#line 283 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 288 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, std_format("?%p", this)); } -#line 285 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 290 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" std_buffer_Buffer_write_str(&buf, "]"); -#line 286 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" +#line 291 "/Users/mustafa/ocen-lang/ocen/compiler/types.oc" return std_buffer_Buffer_str(buf); } break; case compiler_types_BaseType_Structure: - m_136_3: + m_138_3: { __yield_0 = this->u.struc->sym->display; } break; case compiler_types_BaseType_Enum: - m_136_4: + m_138_4: { __yield_0 = this->u.enom->sym->display; } break; case compiler_types_BaseType_Alias: - m_136_5: + m_138_5: { __yield_0 = this->name; } break; @@ -31968,17 +32489,17 @@ char *compiler_errors_MessageType_to_color(compiler_errors_MessageType this) { #line 34 "/Users/mustafa/ocen-lang/ocen/compiler/errors.oc" switch ((this)) { case compiler_errors_MessageType_Error: - m_137_0: + m_139_0: { __yield_0 = "\x1b[31m"; } break; case compiler_errors_MessageType_Warning: - m_137_1: + m_139_1: { __yield_0 = "\x1b[33m"; } break; case compiler_errors_MessageType_Note: - m_137_2: + m_139_2: { __yield_0 = "\x1b[32m"; } break; @@ -31997,17 +32518,17 @@ char *compiler_errors_MessageType_str(compiler_errors_MessageType this) { #line 40 "/Users/mustafa/ocen-lang/ocen/compiler/errors.oc" switch ((this)) { case compiler_errors_MessageType_Error: - m_138_0: + m_140_0: { __yield_0 = "Error"; } break; case compiler_errors_MessageType_Warning: - m_138_1: + m_140_1: { __yield_0 = "Warning"; } break; case compiler_errors_MessageType_Note: - m_138_2: + m_140_2: { __yield_0 = "Note"; } break; @@ -32186,14 +32707,14 @@ void compiler_errors_Error_display(compiler_errors_Error *this) { #line 112 "/Users/mustafa/ocen-lang/ocen/compiler/errors.oc" switch ((this->type)) { case compiler_errors_ErrorType_Standard: - m_139_0: + m_141_0: { #line 114 "/Users/mustafa/ocen-lang/ocen/compiler/errors.oc" compiler_errors_display_message_span(compiler_errors_MessageType_Error, this->span1, this->msg1, true); } break; case compiler_errors_ErrorType_WithNote: - m_139_1: + m_141_1: { #line 117 "/Users/mustafa/ocen-lang/ocen/compiler/errors.oc" @@ -32203,7 +32724,7 @@ void compiler_errors_Error_display(compiler_errors_Error *this) { compiler_errors_display_message(compiler_errors_MessageType_Note, this->span1, this->msg2); } break; case compiler_errors_ErrorType_WithHint: - m_139_2: + m_141_2: { #line 121 "/Users/mustafa/ocen-lang/ocen/compiler/errors.oc" @@ -32297,7 +32818,7 @@ compiler_errors_Error *compiler_errors_Error_new_hint(std_span_Span span, char * #line 160 "/Users/mustafa/ocen-lang/ocen/compiler/errors.oc" -void compiler_errors_display_error_messages(std_vector_Vector__14 *errors, u32 detail_level) { +void compiler_errors_display_error_messages(std_vector_Vector__13 *errors, u32 detail_level) { #line 161 "/Users/mustafa/ocen-lang/ocen/compiler/errors.oc" char *num_errors_env = getenv("OCEN_NUM_ERRORS"); @@ -32312,7 +32833,7 @@ void compiler_errors_display_error_messages(std_vector_Vector__14 *errors, u32 d for (u32 i = 0; i < num_errors; i+=1) { #line 166 "/Users/mustafa/ocen-lang/ocen/compiler/errors.oc" - compiler_errors_Error *err = std_vector_Vector__14_at(errors, ((num_errors - i) - 1)); + compiler_errors_Error *err = std_vector_Vector__13_at(errors, ((num_errors - i) - 1)); #line 168 "/Users/mustafa/ocen-lang/ocen/compiler/errors.oc" switch (detail_level) { @@ -32903,10 +33424,10 @@ compiler_passes_generic_pass_GenericPass *std_mem_alloc__1(u32 count) { #line 44 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_passes_reorder_structs_ReorderStructs *std_mem_alloc__2(u32 count) { +compiler_passes_reorder_symbols_ReorderSymbols *std_mem_alloc__2(u32 count) { #line 46 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - return ((compiler_passes_reorder_structs_ReorderStructs *)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_passes_reorder_structs_ReorderStructs))))); + return ((compiler_passes_reorder_symbols_ReorderSymbols *)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_passes_reorder_symbols_ReorderSymbols))))); } @@ -33631,10 +34152,10 @@ std_vector_Vector__9 *std_mem_alloc__92(u32 count) { #line 44 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_ast_nodes_Structure **std_mem_alloc__93(u32 count) { +compiler_ast_scopes_Symbol **std_mem_alloc__93(u32 count) { #line 46 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - return ((compiler_ast_nodes_Structure **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_ast_nodes_Structure *))))); + return ((compiler_ast_scopes_Symbol **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_ast_scopes_Symbol *))))); } @@ -33647,10 +34168,10 @@ std_vector_Vector__10 *std_mem_alloc__94(u32 count) { #line 44 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_ast_scopes_Symbol **std_mem_alloc__95(u32 count) { +compiler_ast_nodes_MatchCond **std_mem_alloc__95(u32 count) { #line 46 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - return ((compiler_ast_scopes_Symbol **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_ast_scopes_Symbol *))))); + return ((compiler_ast_nodes_MatchCond **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_ast_nodes_MatchCond *))))); } @@ -33663,10 +34184,10 @@ std_vector_Vector__11 *std_mem_alloc__96(u32 count) { #line 44 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_ast_nodes_MatchCond **std_mem_alloc__97(u32 count) { +compiler_tokens_Token **std_mem_alloc__97(u32 count) { #line 46 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - return ((compiler_ast_nodes_MatchCond **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_ast_nodes_MatchCond *))))); + return ((compiler_tokens_Token **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_tokens_Token *))))); } @@ -33679,10 +34200,10 @@ std_vector_Vector__12 *std_mem_alloc__98(u32 count) { #line 44 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_tokens_Token **std_mem_alloc__99(u32 count) { +compiler_attributes_Attribute **std_mem_alloc__99(u32 count) { #line 46 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - return ((compiler_tokens_Token **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_tokens_Token *))))); + return ((compiler_attributes_Attribute **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_attributes_Attribute *))))); } @@ -33695,10 +34216,10 @@ std_vector_Vector__13 *std_mem_alloc__100(u32 count) { #line 44 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_attributes_Attribute **std_mem_alloc__101(u32 count) { +compiler_errors_Error **std_mem_alloc__101(u32 count) { #line 46 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - return ((compiler_attributes_Attribute **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_attributes_Attribute *))))); + return ((compiler_errors_Error **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_errors_Error *))))); } @@ -33711,10 +34232,10 @@ std_vector_Vector__14 *std_mem_alloc__102(u32 count) { #line 44 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_errors_Error **std_mem_alloc__103(u32 count) { +compiler_ast_nodes_Structure **std_mem_alloc__103(u32 count) { #line 46 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - return ((compiler_errors_Error **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_errors_Error *))))); + return ((compiler_ast_nodes_Structure **)std_mem_state_alloc_fn(std_mem_state_allocator, (count * ((u32)sizeof(compiler_ast_nodes_Structure *))))); } @@ -34304,40 +34825,7 @@ char **std_mem_realloc__9(char **ptr, u32 old_count, u32 new_count) { #line 57 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_ast_nodes_Structure **std_mem_realloc__10(compiler_ast_nodes_Structure **ptr, u32 old_count, u32 new_count) { - -#line 58 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - u32 old_size = (old_count * ((u32)sizeof(compiler_ast_nodes_Structure *))); - -#line 59 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - u32 new_size = (new_count * ((u32)sizeof(compiler_ast_nodes_Structure *))); - -#line 60 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - if (std_mem_state_realloc_fn != NULL) { - -#line 61 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - return std_mem_state_realloc_fn(std_mem_state_allocator, ptr, old_size, new_size); - } - -#line 63 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - if(!(new_size >= old_size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/mem.oc:63:12: Assertion failed: `new_size >= old_size`", "Cannot shrink memory in default allocator"); } - -#line 64 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - compiler_ast_nodes_Structure **new_ptr = std_mem_alloc__93(new_count); - -#line 65 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - memcpy(new_ptr, ptr, old_size); - -#line 66 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - std_mem_free(ptr); - -#line 67 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - return new_ptr; -} - - -#line 57 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_ast_scopes_Symbol **std_mem_realloc__11(compiler_ast_scopes_Symbol **ptr, u32 old_count, u32 new_count) { +compiler_ast_scopes_Symbol **std_mem_realloc__10(compiler_ast_scopes_Symbol **ptr, u32 old_count, u32 new_count) { #line 58 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" u32 old_size = (old_count * ((u32)sizeof(compiler_ast_scopes_Symbol *))); @@ -34356,7 +34844,7 @@ compiler_ast_scopes_Symbol **std_mem_realloc__11(compiler_ast_scopes_Symbol **pt if(!(new_size >= old_size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/mem.oc:63:12: Assertion failed: `new_size >= old_size`", "Cannot shrink memory in default allocator"); } #line 64 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - compiler_ast_scopes_Symbol **new_ptr = std_mem_alloc__95(new_count); + compiler_ast_scopes_Symbol **new_ptr = std_mem_alloc__93(new_count); #line 65 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" memcpy(new_ptr, ptr, old_size); @@ -34370,7 +34858,7 @@ compiler_ast_scopes_Symbol **std_mem_realloc__11(compiler_ast_scopes_Symbol **pt #line 57 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_ast_nodes_MatchCond **std_mem_realloc__12(compiler_ast_nodes_MatchCond **ptr, u32 old_count, u32 new_count) { +compiler_ast_nodes_MatchCond **std_mem_realloc__11(compiler_ast_nodes_MatchCond **ptr, u32 old_count, u32 new_count) { #line 58 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" u32 old_size = (old_count * ((u32)sizeof(compiler_ast_nodes_MatchCond *))); @@ -34389,7 +34877,7 @@ compiler_ast_nodes_MatchCond **std_mem_realloc__12(compiler_ast_nodes_MatchCond if(!(new_size >= old_size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/mem.oc:63:12: Assertion failed: `new_size >= old_size`", "Cannot shrink memory in default allocator"); } #line 64 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - compiler_ast_nodes_MatchCond **new_ptr = std_mem_alloc__97(new_count); + compiler_ast_nodes_MatchCond **new_ptr = std_mem_alloc__95(new_count); #line 65 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" memcpy(new_ptr, ptr, old_size); @@ -34403,7 +34891,7 @@ compiler_ast_nodes_MatchCond **std_mem_realloc__12(compiler_ast_nodes_MatchCond #line 57 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_tokens_Token **std_mem_realloc__13(compiler_tokens_Token **ptr, u32 old_count, u32 new_count) { +compiler_tokens_Token **std_mem_realloc__12(compiler_tokens_Token **ptr, u32 old_count, u32 new_count) { #line 58 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" u32 old_size = (old_count * ((u32)sizeof(compiler_tokens_Token *))); @@ -34422,7 +34910,7 @@ compiler_tokens_Token **std_mem_realloc__13(compiler_tokens_Token **ptr, u32 old if(!(new_size >= old_size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/mem.oc:63:12: Assertion failed: `new_size >= old_size`", "Cannot shrink memory in default allocator"); } #line 64 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - compiler_tokens_Token **new_ptr = std_mem_alloc__99(new_count); + compiler_tokens_Token **new_ptr = std_mem_alloc__97(new_count); #line 65 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" memcpy(new_ptr, ptr, old_size); @@ -34436,7 +34924,7 @@ compiler_tokens_Token **std_mem_realloc__13(compiler_tokens_Token **ptr, u32 old #line 57 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_attributes_Attribute **std_mem_realloc__14(compiler_attributes_Attribute **ptr, u32 old_count, u32 new_count) { +compiler_attributes_Attribute **std_mem_realloc__13(compiler_attributes_Attribute **ptr, u32 old_count, u32 new_count) { #line 58 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" u32 old_size = (old_count * ((u32)sizeof(compiler_attributes_Attribute *))); @@ -34455,7 +34943,7 @@ compiler_attributes_Attribute **std_mem_realloc__14(compiler_attributes_Attribut if(!(new_size >= old_size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/mem.oc:63:12: Assertion failed: `new_size >= old_size`", "Cannot shrink memory in default allocator"); } #line 64 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - compiler_attributes_Attribute **new_ptr = std_mem_alloc__101(new_count); + compiler_attributes_Attribute **new_ptr = std_mem_alloc__99(new_count); #line 65 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" memcpy(new_ptr, ptr, old_size); @@ -34469,7 +34957,7 @@ compiler_attributes_Attribute **std_mem_realloc__14(compiler_attributes_Attribut #line 57 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" -compiler_errors_Error **std_mem_realloc__15(compiler_errors_Error **ptr, u32 old_count, u32 new_count) { +compiler_errors_Error **std_mem_realloc__14(compiler_errors_Error **ptr, u32 old_count, u32 new_count) { #line 58 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" u32 old_size = (old_count * ((u32)sizeof(compiler_errors_Error *))); @@ -34488,7 +34976,40 @@ compiler_errors_Error **std_mem_realloc__15(compiler_errors_Error **ptr, u32 old if(!(new_size >= old_size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/mem.oc:63:12: Assertion failed: `new_size >= old_size`", "Cannot shrink memory in default allocator"); } #line 64 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" - compiler_errors_Error **new_ptr = std_mem_alloc__103(new_count); + compiler_errors_Error **new_ptr = std_mem_alloc__101(new_count); + +#line 65 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" + memcpy(new_ptr, ptr, old_size); + +#line 66 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" + std_mem_free(ptr); + +#line 67 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" + return new_ptr; +} + + +#line 57 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" +compiler_ast_nodes_Structure **std_mem_realloc__15(compiler_ast_nodes_Structure **ptr, u32 old_count, u32 new_count) { + +#line 58 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" + u32 old_size = (old_count * ((u32)sizeof(compiler_ast_nodes_Structure *))); + +#line 59 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" + u32 new_size = (new_count * ((u32)sizeof(compiler_ast_nodes_Structure *))); + +#line 60 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" + if (std_mem_state_realloc_fn != NULL) { + +#line 61 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" + return std_mem_state_realloc_fn(std_mem_state_allocator, ptr, old_size, new_size); + } + +#line 63 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" + if(!(new_size >= old_size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/mem.oc:63:12: Assertion failed: `new_size >= old_size`", "Cannot shrink memory in default allocator"); } + +#line 64 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" + compiler_ast_nodes_Structure **new_ptr = std_mem_alloc__103(new_count); #line 65 "/Users/mustafa/ocen-lang/ocen/std/mem.oc" memcpy(new_ptr, ptr, old_size); @@ -35686,20 +36207,20 @@ void std_logging_init_logging(std_logging_LogLevel level, char *time_format) { #line 22 "/Users/mustafa/ocen-lang/ocen/std/logging.oc" { - char *__match_var_140 = s; - if (str_eq(__match_var_140, "debug") || str_eq(__match_var_140, "DEBUG")) { + char *__match_var_142 = s; + if (str_eq(__match_var_142, "debug") || str_eq(__match_var_142, "DEBUG")) { #line 23 "/Users/mustafa/ocen-lang/ocen/std/logging.oc" std_logging_log_level=std_logging_LogLevel_Debug; - } else if (str_eq(__match_var_140, "info") || str_eq(__match_var_140, "INFO")) { + } else if (str_eq(__match_var_142, "info") || str_eq(__match_var_142, "INFO")) { #line 24 "/Users/mustafa/ocen-lang/ocen/std/logging.oc" std_logging_log_level=std_logging_LogLevel_Info; - } else if (str_eq(__match_var_140, "warn") || str_eq(__match_var_140, "WARN")) { + } else if (str_eq(__match_var_142, "warn") || str_eq(__match_var_142, "WARN")) { #line 25 "/Users/mustafa/ocen-lang/ocen/std/logging.oc" std_logging_log_level=std_logging_LogLevel_Warn; - } else if (str_eq(__match_var_140, "error") || str_eq(__match_var_140, "ERROR")) { + } else if (str_eq(__match_var_142, "error") || str_eq(__match_var_142, "ERROR")) { #line 26 "/Users/mustafa/ocen-lang/ocen/std/logging.oc" std_logging_log_level=std_logging_LogLevel_Error; @@ -35741,28 +36262,28 @@ void std_logging_vlog(std_logging_LogLevel level, char *fmt, va_list vargs) { #line 42 "/Users/mustafa/ocen-lang/ocen/std/logging.oc" switch ((level)) { case std_logging_LogLevel_Debug: - m_141_0: + m_143_0: { #line 43 "/Users/mustafa/ocen-lang/ocen/std/logging.oc" printf("[DEBUG] "); } break; case std_logging_LogLevel_Info: - m_141_1: + m_143_1: { #line 44 "/Users/mustafa/ocen-lang/ocen/std/logging.oc" printf("[INFO] "); } break; case std_logging_LogLevel_Warn: - m_141_2: + m_143_2: { #line 45 "/Users/mustafa/ocen-lang/ocen/std/logging.oc" printf("[WARN] "); } break; case std_logging_LogLevel_Error: - m_141_3: + m_143_3: { #line 46 "/Users/mustafa/ocen-lang/ocen/std/logging.oc" @@ -35887,7 +36408,7 @@ std_set_Set__1 *std_set_Set__1_new(void) { void std_set_Set__2_free(std_set_Set__2 *this) { #line 55 "/Users/mustafa/ocen-lang/ocen/std/set.oc" - std_map_Map__8_free(this->map); + std_map_Map__7_free(this->map); #line 56 "/Users/mustafa/ocen-lang/ocen/std/set.oc" std_mem_free(this); @@ -35898,7 +36419,7 @@ void std_set_Set__2_free(std_set_Set__2 *this) { void std_set_Set__2_add(std_set_Set__2 *this, char *key) { #line 19 "/Users/mustafa/ocen-lang/ocen/std/set.oc" - std_map_Map__8_insert(this->map, key, true); + std_map_Map__7_insert(this->map, key, true); #line 20 "/Users/mustafa/ocen-lang/ocen/std/set.oc" this->size=this->map->size; @@ -35909,7 +36430,7 @@ void std_set_Set__2_add(std_set_Set__2 *this, char *key) { bool std_set_Set__2_contains(std_set_Set__2 *this, char *key) { #line 49 "/Users/mustafa/ocen-lang/ocen/std/set.oc" - return std_map_Map__8_contains(this->map, key); + return std_map_Map__7_contains(this->map, key); } @@ -35920,7 +36441,7 @@ std_set_Set__2 *std_set_Set__2_new(void) { std_set_Set__2 *set = std_mem_alloc__29(1); #line 13 "/Users/mustafa/ocen-lang/ocen/std/set.oc" - set->map=std_map_Map__8_new(8); + set->map=std_map_Map__7_new(8); #line 14 "/Users/mustafa/ocen-lang/ocen/std/set.oc" return set; @@ -36276,14 +36797,14 @@ std_value_Value *std_value_Value_new(std_value_ValueType type) { #line 40 "/Users/mustafa/ocen-lang/ocen/std/value.oc" switch ((type)) { case std_value_ValueType_Dictionary: - m_142_0: + m_144_0: { #line 41 "/Users/mustafa/ocen-lang/ocen/std/value.oc" val->u.as_dict=std_compact_map_Map__0_new(16); } break; case std_value_ValueType_List: - m_142_1: + m_144_1: { #line 42 "/Users/mustafa/ocen-lang/ocen/std/value.oc" @@ -36643,8 +37164,8 @@ void std_fs_DirectoryIterator_next(std_fs_DirectoryIterator *this) { #line 264 "/Users/mustafa/ocen-lang/ocen/std/fs.oc" { - char *__match_var_143 = this->dp->d_name; - if (str_eq(__match_var_143, ".") || str_eq(__match_var_143, "..")) { + char *__match_var_145 = this->dp->d_name; + if (str_eq(__match_var_145, ".") || str_eq(__match_var_145, "..")) { #line 265 "/Users/mustafa/ocen-lang/ocen/std/fs.oc" this->dp=readdir(this->dir); @@ -38839,7 +39360,7 @@ std_map_Iterator__6 std_map_Map__6_iter(std_map_Map__6 *this) { #line 31 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_Item__7 *std_map_Item__7_new(char *key, compiler_ast_nodes_Variable *value, std_map_Item__7 *next) { +std_map_Item__7 *std_map_Item__7_new(char *key, bool value, std_map_Item__7 *next) { #line 32 "/Users/mustafa/ocen-lang/ocen/std/map.oc" std_map_Item__7 *node = std_mem_alloc__53(1); @@ -38898,7 +39419,7 @@ void std_map_Map__7_free(std_map_Map__7 *this) { #line 115 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -void std_map_Map__7_insert(std_map_Map__7 *this, char *key, compiler_ast_nodes_Variable *value) { +void std_map_Map__7_insert(std_map_Map__7 *this, char *key, bool value) { #line 116 "/Users/mustafa/ocen-lang/ocen/std/map.oc" std_map_Item__7 *node = std_map_Map__7_get_item(this, key); @@ -38939,82 +39460,11 @@ void std_map_Map__7_insert(std_map_Map__7 *this, char *key, compiler_ast_nodes_V } -#line 243 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_Item__7 *std_map_Iterator__7_cur(std_map_Iterator__7 *this) { - -#line 243 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return this->node; -} - - -#line 245 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -void std_map_Iterator__7_next(std_map_Iterator__7 *this) { - -#line 246 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - while (this->idx < ((i32)this->map->num_buckets)) { - -#line 247 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - while (((bool)this->node)) { - -#line 248 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - this->node=this->node->next; - -#line 249 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - if (((bool)this->node)) { - -#line 249 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return; - } - } - -#line 251 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - this->idx+=1; - -#line 252 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - this->node=({ std_map_Item__7 *__yield_0; - -#line 252 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - if (this->idx < ((i32)this->map->num_buckets)) { - -#line 253 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - __yield_0 = this->map->buckets[this->idx]; - } else { - -#line 255 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - __yield_0 = NULL; - } - - __yield_0; }); - -#line 257 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - if (((bool)this->node)) { - -#line 257 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return; - } - } -} - - -#line 241 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -bool std_map_Iterator__7_has_value(std_map_Iterator__7 *this) { - -#line 241 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return ((bool)this->node); -} - - -#line 235 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_Iterator__7 std_map_Iterator__7_make(std_map_Map__7 *map) { - -#line 236 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - std_map_Iterator__7 it = (std_map_Iterator__7){.idx=-1, .node=NULL, .map=map}; - -#line 237 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - std_map_Iterator__7_next(&it); +#line 109 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +bool std_map_Map__7_contains(std_map_Map__7 *this, char *key) { -#line 238 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return it; +#line 110 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return ((bool)std_map_Map__7_get_item(this, key)); } @@ -39150,16 +39600,8 @@ std_map_Item__7 *std_map_Map__7_get_item(std_map_Map__7 *this, char *key) { } -#line 210 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_Iterator__7 std_map_Map__7_iter(std_map_Map__7 *this) { - -#line 211 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return std_map_Iterator__7_make(this); -} - - #line 31 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_Item__8 *std_map_Item__8_new(char *key, bool value, std_map_Item__8 *next) { +std_map_Item__8 *std_map_Item__8_new(char *key, compiler_ast_nodes_Function *value, std_map_Item__8 *next) { #line 32 "/Users/mustafa/ocen-lang/ocen/std/map.oc" std_map_Item__8 *node = std_mem_alloc__56(1); @@ -39199,26 +39641,22 @@ void std_map_Item__8_free_list(std_map_Item__8 *this) { } -#line 191 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -void std_map_Map__8_free(std_map_Map__8 *this) { - -#line 192 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - for (u32 i = 0; i < this->num_buckets; i+=1) { +#line 94 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +compiler_ast_nodes_Function *std_map_Map__8_at(std_map_Map__8 *this, char *key) { -#line 193 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - std_map_Item__8_free_list(this->buckets[i]); - } +#line 95 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + std_map_Item__8 *node = std_map_Map__8_get_item(this, key); -#line 195 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - std_mem_free(this->buckets); +#line 96 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + if(!(((bool)node))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/map.oc:96:12: Assertion failed: `node?`", "Key not found"); } -#line 196 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - std_mem_free(this); +#line 97 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return node->value; } #line 115 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -void std_map_Map__8_insert(std_map_Map__8 *this, char *key, bool value) { +void std_map_Map__8_insert(std_map_Map__8 *this, char *key, compiler_ast_nodes_Function *value) { #line 116 "/Users/mustafa/ocen-lang/ocen/std/map.oc" std_map_Item__8 *node = std_map_Map__8_get_item(this, key); @@ -39259,11 +39697,100 @@ void std_map_Map__8_insert(std_map_Map__8 *this, char *key, bool value) { } -#line 109 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -bool std_map_Map__8_contains(std_map_Map__8 *this, char *key) { +#line 101 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +compiler_ast_nodes_Function *std_map_Map__8_get(std_map_Map__8 *this, char *key, compiler_ast_nodes_Function *defolt) { -#line 110 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return ((bool)std_map_Map__8_get_item(this, key)); +#line 102 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + std_map_Item__8 *node = std_map_Map__8_get_item(this, key); + +#line 103 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + if (!(((bool)node))) { + +#line 103 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return defolt; + } + +#line 104 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return node->value; +} + + +#line 243 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +std_map_Item__8 *std_map_Iterator__8_cur(std_map_Iterator__8 *this) { + +#line 243 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return this->node; +} + + +#line 245 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +void std_map_Iterator__8_next(std_map_Iterator__8 *this) { + +#line 246 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + while (this->idx < ((i32)this->map->num_buckets)) { + +#line 247 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + while (((bool)this->node)) { + +#line 248 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + this->node=this->node->next; + +#line 249 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + if (((bool)this->node)) { + +#line 249 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return; + } + } + +#line 251 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + this->idx+=1; + +#line 252 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + this->node=({ std_map_Item__8 *__yield_0; + +#line 252 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + if (this->idx < ((i32)this->map->num_buckets)) { + +#line 253 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + __yield_0 = this->map->buckets[this->idx]; + } else { + +#line 255 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + __yield_0 = NULL; + } + + __yield_0; }); + +#line 257 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + if (((bool)this->node)) { + +#line 257 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return; + } + } +} + + +#line 241 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +bool std_map_Iterator__8_has_value(std_map_Iterator__8 *this) { + +#line 241 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return ((bool)this->node); +} + + +#line 235 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +std_map_Iterator__8 std_map_Iterator__8_make(std_map_Map__8 *map) { + +#line 236 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + std_map_Iterator__8 it = (std_map_Iterator__8){.idx=-1, .node=NULL, .map=map}; + +#line 237 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + std_map_Iterator__8_next(&it); + +#line 238 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return it; } @@ -39354,6 +39881,38 @@ u32 std_map_Map__8_hash(std_map_Map__8 *this, char *key) { } +#line 218 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +std_map_ValueIterator__8 std_map_Map__8_iter_values(std_map_Map__8 *this) { + +#line 218 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return (std_map_ValueIterator__8){.map_iter=std_map_Map__8_iter(this)}; +} + + +#line 276 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +compiler_ast_nodes_Function *std_map_ValueIterator__8_cur(std_map_ValueIterator__8 *this) { + +#line 276 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return std_map_Iterator__8_cur(&this->map_iter)->value; +} + + +#line 277 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +void std_map_ValueIterator__8_next(std_map_ValueIterator__8 *this) { + +#line 278 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + std_map_Iterator__8_next(&this->map_iter); +} + + +#line 275 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +bool std_map_ValueIterator__8_has_value(std_map_ValueIterator__8 *this) { + +#line 275 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return std_map_Iterator__8_has_value(&this->map_iter); +} + + #line 62 "/Users/mustafa/ocen-lang/ocen/std/map.oc" std_map_Map__8 *std_map_Map__8_new(u32 capacity) { @@ -39399,8 +39958,16 @@ std_map_Item__8 *std_map_Map__8_get_item(std_map_Map__8 *this, char *key) { } +#line 210 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +std_map_Iterator__8 std_map_Map__8_iter(std_map_Map__8 *this) { + +#line 211 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + return std_map_Iterator__8_make(this); +} + + #line 31 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_Item__9 *std_map_Item__9_new(char *key, compiler_ast_nodes_Function *value, std_map_Item__9 *next) { +std_map_Item__9 *std_map_Item__9_new(char *key, compiler_ast_nodes_Argument *value, std_map_Item__9 *next) { #line 32 "/Users/mustafa/ocen-lang/ocen/std/map.oc" std_map_Item__9 *node = std_mem_alloc__59(1); @@ -39440,22 +40007,26 @@ void std_map_Item__9_free_list(std_map_Item__9 *this) { } -#line 94 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -compiler_ast_nodes_Function *std_map_Map__9_at(std_map_Map__9 *this, char *key) { +#line 191 "/Users/mustafa/ocen-lang/ocen/std/map.oc" +void std_map_Map__9_free(std_map_Map__9 *this) { -#line 95 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - std_map_Item__9 *node = std_map_Map__9_get_item(this, key); +#line 192 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + for (u32 i = 0; i < this->num_buckets; i+=1) { -#line 96 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - if(!(((bool)node))) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/map.oc:96:12: Assertion failed: `node?`", "Key not found"); } +#line 193 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + std_map_Item__9_free_list(this->buckets[i]); + } -#line 97 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return node->value; +#line 195 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + std_mem_free(this->buckets); + +#line 196 "/Users/mustafa/ocen-lang/ocen/std/map.oc" + std_mem_free(this); } #line 115 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -void std_map_Map__9_insert(std_map_Map__9 *this, char *key, compiler_ast_nodes_Function *value) { +void std_map_Map__9_insert(std_map_Map__9 *this, char *key, compiler_ast_nodes_Argument *value) { #line 116 "/Users/mustafa/ocen-lang/ocen/std/map.oc" std_map_Item__9 *node = std_map_Map__9_get_item(this, key); @@ -39496,103 +40067,6 @@ void std_map_Map__9_insert(std_map_Map__9 *this, char *key, compiler_ast_nodes_F } -#line 101 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -compiler_ast_nodes_Function *std_map_Map__9_get(std_map_Map__9 *this, char *key, compiler_ast_nodes_Function *defolt) { - -#line 102 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - std_map_Item__9 *node = std_map_Map__9_get_item(this, key); - -#line 103 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - if (!(((bool)node))) { - -#line 103 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return defolt; - } - -#line 104 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return node->value; -} - - -#line 243 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_Item__9 *std_map_Iterator__9_cur(std_map_Iterator__9 *this) { - -#line 243 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return this->node; -} - - -#line 245 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -void std_map_Iterator__9_next(std_map_Iterator__9 *this) { - -#line 246 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - while (this->idx < ((i32)this->map->num_buckets)) { - -#line 247 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - while (((bool)this->node)) { - -#line 248 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - this->node=this->node->next; - -#line 249 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - if (((bool)this->node)) { - -#line 249 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return; - } - } - -#line 251 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - this->idx+=1; - -#line 252 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - this->node=({ std_map_Item__9 *__yield_0; - -#line 252 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - if (this->idx < ((i32)this->map->num_buckets)) { - -#line 253 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - __yield_0 = this->map->buckets[this->idx]; - } else { - -#line 255 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - __yield_0 = NULL; - } - - __yield_0; }); - -#line 257 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - if (((bool)this->node)) { - -#line 257 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return; - } - } -} - - -#line 241 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -bool std_map_Iterator__9_has_value(std_map_Iterator__9 *this) { - -#line 241 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return ((bool)this->node); -} - - -#line 235 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_Iterator__9 std_map_Iterator__9_make(std_map_Map__9 *map) { - -#line 236 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - std_map_Iterator__9 it = (std_map_Iterator__9){.idx=-1, .node=NULL, .map=map}; - -#line 237 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - std_map_Iterator__9_next(&it); - -#line 238 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return it; -} - - #line 161 "/Users/mustafa/ocen-lang/ocen/std/map.oc" void std_map_Map__9_resize(std_map_Map__9 *this) { @@ -39680,38 +40154,6 @@ u32 std_map_Map__9_hash(std_map_Map__9 *this, char *key) { } -#line 218 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_ValueIterator__9 std_map_Map__9_iter_values(std_map_Map__9 *this) { - -#line 218 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return (std_map_ValueIterator__9){.map_iter=std_map_Map__9_iter(this)}; -} - - -#line 276 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -compiler_ast_nodes_Function *std_map_ValueIterator__9_cur(std_map_ValueIterator__9 *this) { - -#line 276 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return std_map_Iterator__9_cur(&this->map_iter)->value; -} - - -#line 277 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -void std_map_ValueIterator__9_next(std_map_ValueIterator__9 *this) { - -#line 278 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - std_map_Iterator__9_next(&this->map_iter); -} - - -#line 275 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -bool std_map_ValueIterator__9_has_value(std_map_ValueIterator__9 *this) { - -#line 275 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return std_map_Iterator__9_has_value(&this->map_iter); -} - - #line 62 "/Users/mustafa/ocen-lang/ocen/std/map.oc" std_map_Map__9 *std_map_Map__9_new(u32 capacity) { @@ -39757,16 +40199,8 @@ std_map_Item__9 *std_map_Map__9_get_item(std_map_Map__9 *this, char *key) { } -#line 210 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_Iterator__9 std_map_Map__9_iter(std_map_Map__9 *this) { - -#line 211 "/Users/mustafa/ocen-lang/ocen/std/map.oc" - return std_map_Iterator__9_make(this); -} - - #line 31 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -std_map_Item__10 *std_map_Item__10_new(char *key, compiler_ast_nodes_Argument *value, std_map_Item__10 *next) { +std_map_Item__10 *std_map_Item__10_new(char *key, compiler_ast_nodes_Variable *value, std_map_Item__10 *next) { #line 32 "/Users/mustafa/ocen-lang/ocen/std/map.oc" std_map_Item__10 *node = std_mem_alloc__62(1); @@ -39825,7 +40259,7 @@ void std_map_Map__10_free(std_map_Map__10 *this) { #line 115 "/Users/mustafa/ocen-lang/ocen/std/map.oc" -void std_map_Map__10_insert(std_map_Map__10 *this, char *key, compiler_ast_nodes_Argument *value) { +void std_map_Map__10_insert(std_map_Map__10 *this, char *key, compiler_ast_nodes_Variable *value) { #line 116 "/Users/mustafa/ocen-lang/ocen/std/map.oc" std_map_Item__10 *node = std_map_Map__10_get_item(this, key); @@ -41118,31 +41552,6 @@ void std_vector_Vector__2_push(std_vector_Vector__2 *this, compiler_ast_program_ } -#line 39 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Vector__3_push_front(std_vector_Vector__3 *this, compiler_ast_nodes_Variable *value) { - -#line 40 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - if (this->size==this->capacity) { - -#line 41 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - std_vector_Vector__3_resize(this, (this->capacity * 2)); - } - -#line 43 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - for (u32 i = this->size; i > 0; i-=1) { - -#line 44 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - this->data[i]=this->data[(i - 1)]; - } - -#line 46 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - this->data[0]=value; - -#line 47 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - this->size+=1; -} - - #line 85 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" compiler_ast_nodes_Variable *std_vector_Vector__3_back(std_vector_Vector__3 *this, u32 i) { @@ -41946,7 +42355,7 @@ std_vector_Iterator__9 std_vector_Vector__9_iter(std_vector_Vector__9 *this) { #line 151 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -compiler_ast_nodes_Structure *std_vector_Iterator__9_cur(std_vector_Iterator__9 *this) { +compiler_ast_scopes_Symbol *std_vector_Iterator__9_cur(std_vector_Iterator__9 *this) { #line 152 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if(!(this->index < this->vec->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:152:12: Assertion failed: `.index < .vec.size`", "Out of bounds in Iterator::current"); } @@ -41983,6 +42392,17 @@ std_vector_Iterator__9 std_vector_Iterator__9_make(std_vector_Vector__9 *vec) { } +#line 106 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +compiler_ast_scopes_Symbol *std_vector_Vector__9_at(std_vector_Vector__9 *this, u32 i) { + +#line 107 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + if(!(i < this->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:107:12: Assertion failed: `i < .size`", "Out of bounds in Vector::at"); } + +#line 108 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + return this->data[i]; +} + + #line 131 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" void std_vector_Vector__9_free(std_vector_Vector__9 *this) { @@ -42041,7 +42461,7 @@ std_vector_Vector__9 *std_vector_Vector__9_new(u32 capacity) { #line 29 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Vector__9_push(std_vector_Vector__9 *this, compiler_ast_nodes_Structure *value) { +void std_vector_Vector__9_push(std_vector_Vector__9 *this, compiler_ast_scopes_Symbol *value) { #line 30 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if (this->size==this->capacity) { @@ -42067,7 +42487,7 @@ std_vector_Iterator__10 std_vector_Vector__10_iter(std_vector_Vector__10 *this) #line 151 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -compiler_ast_scopes_Symbol *std_vector_Iterator__10_cur(std_vector_Iterator__10 *this) { +compiler_ast_nodes_MatchCond *std_vector_Iterator__10_cur(std_vector_Iterator__10 *this) { #line 152 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if(!(this->index < this->vec->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:152:12: Assertion failed: `.index < .vec.size`", "Out of bounds in Iterator::current"); } @@ -42105,7 +42525,7 @@ std_vector_Iterator__10 std_vector_Iterator__10_make(std_vector_Vector__10 *vec) #line 106 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -compiler_ast_scopes_Symbol *std_vector_Vector__10_at(std_vector_Vector__10 *this, u32 i) { +compiler_ast_nodes_MatchCond *std_vector_Vector__10_at(std_vector_Vector__10 *this, u32 i) { #line 107 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if(!(i < this->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:107:12: Assertion failed: `i < .size`", "Out of bounds in Vector::at"); } @@ -42115,25 +42535,6 @@ compiler_ast_scopes_Symbol *std_vector_Vector__10_at(std_vector_Vector__10 *this } -#line 131 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Vector__10_free(std_vector_Vector__10 *this) { - -#line 132 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - std_mem_free(this->data); - -#line 133 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - std_mem_free(this); -} - - -#line 127 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -bool std_vector_Vector__10_is_empty(std_vector_Vector__10 *this) { - -#line 127 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - return this->size==0; -} - - #line 21 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" void std_vector_Vector__10_resize(std_vector_Vector__10 *this, u32 new_capacity) { @@ -42173,7 +42574,7 @@ std_vector_Vector__10 *std_vector_Vector__10_new(u32 capacity) { #line 29 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Vector__10_push(std_vector_Vector__10 *this, compiler_ast_scopes_Symbol *value) { +void std_vector_Vector__10_push(std_vector_Vector__10 *this, compiler_ast_nodes_MatchCond *value) { #line 30 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if (this->size==this->capacity) { @@ -42190,59 +42591,32 @@ void std_vector_Vector__10_push(std_vector_Vector__10 *this, compiler_ast_scopes } -#line 129 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -std_vector_Iterator__11 std_vector_Vector__11_iter(std_vector_Vector__11 *this) { - -#line 129 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - return std_vector_Iterator__11_make(this); -} - - -#line 151 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -compiler_ast_nodes_MatchCond *std_vector_Iterator__11_cur(std_vector_Iterator__11 *this) { - -#line 152 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - if(!(this->index < this->vec->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:152:12: Assertion failed: `.index < .vec.size`", "Out of bounds in Iterator::current"); } - -#line 153 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - return this->vec->data[this->index]; -} - - -#line 146 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Iterator__11_next(std_vector_Iterator__11 *this) { +#line 106 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +compiler_tokens_Token *std_vector_Vector__11_at(std_vector_Vector__11 *this, u32 i) { -#line 147 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - if(!(this->index < this->vec->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:147:12: Assertion failed: `.index < .vec.size`", "Out of bounds in Iterator::next"); } +#line 107 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + if(!(i < this->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:107:12: Assertion failed: `i < .size`", "Out of bounds in Vector::at"); } -#line 148 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - this->index+=1; +#line 108 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + return this->data[i]; } -#line 144 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -bool std_vector_Iterator__11_has_value(std_vector_Iterator__11 *this) { - -#line 144 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - return this->index < this->vec->size; -} - +#line 131 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +void std_vector_Vector__11_free(std_vector_Vector__11 *this) { -#line 142 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -std_vector_Iterator__11 std_vector_Iterator__11_make(std_vector_Vector__11 *vec) { +#line 132 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + std_mem_free(this->data); -#line 142 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - return (std_vector_Iterator__11){.vec=vec, .index=0}; +#line 133 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + std_mem_free(this); } -#line 106 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -compiler_ast_nodes_MatchCond *std_vector_Vector__11_at(std_vector_Vector__11 *this, u32 i) { - -#line 107 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - if(!(i < this->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:107:12: Assertion failed: `i < .size`", "Out of bounds in Vector::at"); } +#line 119 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +compiler_tokens_Token *std_vector_Vector__11_unchecked_at(std_vector_Vector__11 *this, u32 i) { -#line 108 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +#line 119 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" return this->data[i]; } @@ -42286,7 +42660,7 @@ std_vector_Vector__11 *std_vector_Vector__11_new(u32 capacity) { #line 29 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Vector__11_push(std_vector_Vector__11 *this, compiler_ast_nodes_MatchCond *value) { +void std_vector_Vector__11_push(std_vector_Vector__11 *this, compiler_tokens_Token *value) { #line 30 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if (this->size==this->capacity) { @@ -42303,14 +42677,49 @@ void std_vector_Vector__11_push(std_vector_Vector__11 *this, compiler_ast_nodes_ } -#line 106 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -compiler_tokens_Token *std_vector_Vector__12_at(std_vector_Vector__12 *this, u32 i) { +#line 129 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +std_vector_Iterator__12 std_vector_Vector__12_iter(std_vector_Vector__12 *this) { -#line 107 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - if(!(i < this->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:107:12: Assertion failed: `i < .size`", "Out of bounds in Vector::at"); } +#line 129 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + return std_vector_Iterator__12_make(this); +} -#line 108 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - return this->data[i]; + +#line 151 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +compiler_attributes_Attribute *std_vector_Iterator__12_cur(std_vector_Iterator__12 *this) { + +#line 152 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + if(!(this->index < this->vec->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:152:12: Assertion failed: `.index < .vec.size`", "Out of bounds in Iterator::current"); } + +#line 153 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + return this->vec->data[this->index]; +} + + +#line 146 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +void std_vector_Iterator__12_next(std_vector_Iterator__12 *this) { + +#line 147 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + if(!(this->index < this->vec->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:147:12: Assertion failed: `.index < .vec.size`", "Out of bounds in Iterator::next"); } + +#line 148 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + this->index+=1; +} + + +#line 144 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +bool std_vector_Iterator__12_has_value(std_vector_Iterator__12 *this) { + +#line 144 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + return this->index < this->vec->size; +} + + +#line 142 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +std_vector_Iterator__12 std_vector_Iterator__12_make(std_vector_Vector__12 *vec) { + +#line 142 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + return (std_vector_Iterator__12){.vec=vec, .index=0}; } @@ -42325,14 +42734,6 @@ void std_vector_Vector__12_free(std_vector_Vector__12 *this) { } -#line 119 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -compiler_tokens_Token *std_vector_Vector__12_unchecked_at(std_vector_Vector__12 *this, u32 i) { - -#line 119 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - return this->data[i]; -} - - #line 21 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" void std_vector_Vector__12_resize(std_vector_Vector__12 *this, u32 new_capacity) { @@ -42372,7 +42773,7 @@ std_vector_Vector__12 *std_vector_Vector__12_new(u32 capacity) { #line 29 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Vector__12_push(std_vector_Vector__12 *this, compiler_tokens_Token *value) { +void std_vector_Vector__12_push(std_vector_Vector__12 *this, compiler_attributes_Attribute *value) { #line 30 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if (this->size==this->capacity) { @@ -42389,6 +42790,14 @@ void std_vector_Vector__12_push(std_vector_Vector__12 *this, compiler_tokens_Tok } +#line 123 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +void std_vector_Vector__12_clear(std_vector_Vector__12 *this) { + +#line 124 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + this->size=0; +} + + #line 129 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" std_vector_Iterator__13 std_vector_Vector__13_iter(std_vector_Vector__13 *this) { @@ -42398,7 +42807,7 @@ std_vector_Iterator__13 std_vector_Vector__13_iter(std_vector_Vector__13 *this) #line 151 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -compiler_attributes_Attribute *std_vector_Iterator__13_cur(std_vector_Iterator__13 *this) { +compiler_errors_Error *std_vector_Iterator__13_cur(std_vector_Iterator__13 *this) { #line 152 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if(!(this->index < this->vec->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:152:12: Assertion failed: `.index < .vec.size`", "Out of bounds in Iterator::current"); } @@ -42435,6 +42844,17 @@ std_vector_Iterator__13 std_vector_Iterator__13_make(std_vector_Vector__13 *vec) } +#line 106 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +compiler_errors_Error *std_vector_Vector__13_at(std_vector_Vector__13 *this, u32 i) { + +#line 107 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + if(!(i < this->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:107:12: Assertion failed: `i < .size`", "Out of bounds in Vector::at"); } + +#line 108 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + return this->data[i]; +} + + #line 131 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" void std_vector_Vector__13_free(std_vector_Vector__13 *this) { @@ -42446,6 +42866,14 @@ void std_vector_Vector__13_free(std_vector_Vector__13 *this) { } +#line 127 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" +bool std_vector_Vector__13_is_empty(std_vector_Vector__13 *this) { + +#line 127 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" + return this->size==0; +} + + #line 21 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" void std_vector_Vector__13_resize(std_vector_Vector__13 *this, u32 new_capacity) { @@ -42485,7 +42913,7 @@ std_vector_Vector__13 *std_vector_Vector__13_new(u32 capacity) { #line 29 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Vector__13_push(std_vector_Vector__13 *this, compiler_attributes_Attribute *value) { +void std_vector_Vector__13_push(std_vector_Vector__13 *this, compiler_errors_Error *value) { #line 30 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if (this->size==this->capacity) { @@ -42502,14 +42930,6 @@ void std_vector_Vector__13_push(std_vector_Vector__13 *this, compiler_attributes } -#line 123 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Vector__13_clear(std_vector_Vector__13 *this) { - -#line 124 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - this->size=0; -} - - #line 129 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" std_vector_Iterator__14 std_vector_Vector__14_iter(std_vector_Vector__14 *this) { @@ -42519,7 +42939,7 @@ std_vector_Iterator__14 std_vector_Vector__14_iter(std_vector_Vector__14 *this) #line 151 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -compiler_errors_Error *std_vector_Iterator__14_cur(std_vector_Iterator__14 *this) { +compiler_ast_nodes_Structure *std_vector_Iterator__14_cur(std_vector_Iterator__14 *this) { #line 152 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if(!(this->index < this->vec->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:152:12: Assertion failed: `.index < .vec.size`", "Out of bounds in Iterator::current"); } @@ -42556,28 +42976,6 @@ std_vector_Iterator__14 std_vector_Iterator__14_make(std_vector_Vector__14 *vec) } -#line 106 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -compiler_errors_Error *std_vector_Vector__14_at(std_vector_Vector__14 *this, u32 i) { - -#line 107 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - if(!(i < this->size)) { ae_assert_fail("/Users/mustafa/ocen-lang/ocen/std/vector.oc:107:12: Assertion failed: `i < .size`", "Out of bounds in Vector::at"); } - -#line 108 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - return this->data[i]; -} - - -#line 131 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Vector__14_free(std_vector_Vector__14 *this) { - -#line 132 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - std_mem_free(this->data); - -#line 133 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" - std_mem_free(this); -} - - #line 127 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" bool std_vector_Vector__14_is_empty(std_vector_Vector__14 *this) { @@ -42625,7 +43023,7 @@ std_vector_Vector__14 *std_vector_Vector__14_new(u32 capacity) { #line 29 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" -void std_vector_Vector__14_push(std_vector_Vector__14 *this, compiler_errors_Error *value) { +void std_vector_Vector__14_push(std_vector_Vector__14 *this, compiler_ast_nodes_Structure *value) { #line 30 "/Users/mustafa/ocen-lang/ocen/std/vector.oc" if (this->size==this->capacity) { @@ -44152,35 +44550,35 @@ void std_json_serialize_into(std_value_Value *val, std_buffer_Buffer *sb) { #line 161 "/Users/mustafa/ocen-lang/ocen/std/json.oc" switch ((val->type)) { case std_value_ValueType_Null: - m_144_0: + m_146_0: { #line 162 "/Users/mustafa/ocen-lang/ocen/std/json.oc" std_buffer_Buffer_write_str(sb, "null"); } break; case std_value_ValueType_Bool: - m_144_1: + m_146_1: { #line 163 "/Users/mustafa/ocen-lang/ocen/std/json.oc" std_buffer_Buffer_write_str(sb, (val->u.as_bool ? "true" : "false")); } break; case std_value_ValueType_Integer: - m_144_2: + m_146_2: { #line 164 "/Users/mustafa/ocen-lang/ocen/std/json.oc" std_buffer_Buffer_write_str_f(sb, std_format("%" PRId64 "", val->u.as_int)); } break; case std_value_ValueType_Float: - m_144_3: + m_146_3: { #line 165 "/Users/mustafa/ocen-lang/ocen/std/json.oc" std_buffer_Buffer_write_str_f(sb, std_format("%f", val->u.as_float)); } break; case std_value_ValueType_String: - m_144_4: + m_146_4: { #line 167 "/Users/mustafa/ocen-lang/ocen/std/json.oc" @@ -44252,7 +44650,7 @@ void std_json_serialize_into(std_value_Value *val, std_buffer_Buffer *sb) { std_buffer_Buffer_write_str(sb, "\""); } break; case std_value_ValueType_List: - m_144_5: + m_146_5: { #line 191 "/Users/mustafa/ocen-lang/ocen/std/json.oc" @@ -44282,7 +44680,7 @@ void std_json_serialize_into(std_value_Value *val, std_buffer_Buffer *sb) { std_buffer_Buffer_write_str(sb, "]"); } break; case std_value_ValueType_Dictionary: - m_144_6: + m_146_6: { #line 203 "/Users/mustafa/ocen-lang/ocen/std/json.oc" diff --git a/compiler/ast/nodes.oc b/compiler/ast/nodes.oc index c927405..e92aaaf 100644 --- a/compiler/ast/nodes.oc +++ b/compiler/ast/nodes.oc @@ -189,13 +189,10 @@ enum FunctionKind { // FIXME: Codegen is super hacky, need to clean up and fix: // FIXME: Check to see if any existing fields clash with implicit closure fields, and throw an error/rename // FIXME: Checking lifetimes: closures can't outlive their parent function -// FIXME: Allow capturing things other than variables // FIXME: Allow nested closures (in resolve_scoped_identifier) we only ever look up one level -// FIXME: Don't treat global variables/functions as captured variables, they should be looked up normally // FIXME: Almost ALL the details are hardcoded in codegen. Make type-checker aware of extra implicit fields/params etc. // FIXME: - Essentially, "unroll" the closures into structs+fields at type-checker level // FIXME: Allow passing a normal function pointer to a closure (just wrap it in Closure struct with empty context) -// FIXME: More comprehensive postive / negative tests for closures. struct Function { kind: FunctionKind diff --git a/compiler/passes/reorder_symbols.oc b/compiler/passes/reorder_symbols.oc new file mode 100644 index 0000000..5904d90 --- /dev/null +++ b/compiler/passes/reorder_symbols.oc @@ -0,0 +1,127 @@ +//* Topologically sort symbols +//* +//* This is needed because in C structs/enums/etc need to be declared before they are used +//* in others. The ordered structs are stored in `program.ordered_syms` + +import std::mem +import @passes::generic_pass::GenericPass +import std::vector::Vector +import std::set::{ Set } +import @ast::program::{ Program, Namespace } +import @ast::nodes::{ Structure, Variable } +import @ast::scopes::{ TemplateInstance, Symbol } + +struct ReorderSymbols { + o: &GenericPass + all_syms: &Vector<&Symbol> + done: &Set +} + +def ReorderSymbols::new(program: &Program): &ReorderSymbols { + let pass = mem::alloc() + *pass = ReorderSymbols( + o: GenericPass::new(program), + all_syms: Vector<&Symbol>::new(), + done: Set::new(), + ) + return pass +} + +def ReorderSymbols::free(&this) { + .all_syms.free() + .done.free() + mem::free(.o) + mem::free(this) +} + +def ReorderSymbols::collect_sym(&this, sym: &Symbol) { + if sym? and not sym.is_dead { + .all_syms += sym + } +} + +// Collects all structs we have in the namespace into the vector +def ReorderSymbols::collect_all_symbols_ns(&this, ns: &Namespace) { + for struc : ns.structs.iter() { + if struc.sym.is_templated() { + for instance : struc.sym.template.instances.iter() { + let sym = instance.resolved + assert sym.type == Structure + .collect_sym(sym) + } + + } else { + .collect_sym(struc.sym) + } + } + for enom in ns.enums.iter() { + .collect_sym(enom.sym) + } + for child : ns.namespaces.iter_values() { + .collect_all_symbols_ns(child) + } +} + +def ReorderSymbols::collect_all_symbols(&this) { + .collect_all_symbols_ns(.o.program.global) + for cty in .o.program.closure_types.iter() { + .collect_sym(cty.sym) + } + for closure in .o.program.closures.iter() { + .collect_sym(closure.sym) + } +} + +def ReorderSymbols::dfs(&this, sym: &Symbol) { + if not sym? or .done.contains(sym) return + .done.add(sym) + + match sym.type { + Structure => { + for field : sym.u.struc.fields.iter() { + if field.type? { + .dfs(field.type.sym) + } + } + } + Enum => { + for field in sym.u.enom.shared_fields.iter() { + if field.type? { + .dfs(field.type.sym) + } + } + for variant in sym.u.enom.variants.iter() { + for field in variant.specific_fields.iter() { + if field.type? { + .dfs(field.type.sym) + } + } + } + } + Closure => { + let func = sym.u.func + for param in func.params.iter() { + .dfs(param.type.sym) + } + .dfs(func.return_type.sym) + } + ClosureType => .dfs(sym.u.type_def.sym) + else => return // Don't care about other types + } + .o.program.ordered_symbols += sym +} + +// This function topologically sorts the structs based on depedencies, and stores +// the result inside `program.ordered_structs` +def ReorderSymbols::reorder_structs(&this) { + for sym : .all_syms.iter() { + .dfs(sym) + } +} + +def ReorderSymbols::run(program: &Program) { + let pass = ReorderSymbols::new(program) + pass.collect_all_symbols() + pass.reorder_structs() + pass.free() +} \ No newline at end of file diff --git a/tests/bad/closures/wrong_type_0.oc b/tests/bad/closures/wrong_type_0.oc new file mode 100644 index 0000000..3e68bdd --- /dev/null +++ b/tests/bad/closures/wrong_type_0.oc @@ -0,0 +1,11 @@ +/// fail: Expected `callback` with type @fn(i32): void, but got @fn(u32): void + +def test(callback: @fn(i32), x: i32) { + callback(x) +} + +def main() { + let x: u32 = 100 + let cb = |a: u32| => x += a + test(cb, 10) +} \ No newline at end of file diff --git a/tests/bad/closures/wrong_type_1.oc b/tests/bad/closures/wrong_type_1.oc new file mode 100644 index 0000000..6738215 --- /dev/null +++ b/tests/bad/closures/wrong_type_1.oc @@ -0,0 +1,11 @@ +/// fail: Variable type does not match assignment type, Expected type 'u32', got 'i32' + +def test(callback: @fn(i32), x: i32) { + callback(x) +} + +def main() { + let x: u32 = 100 + let cb = |a: i32| => x = a + test(cb, 10) +} \ No newline at end of file diff --git a/tests/lsp/hover/closure_body_captured.oc b/tests/lsp/hover/closure_body_captured.oc new file mode 100644 index 0000000..85fe896 --- /dev/null +++ b/tests/lsp/hover/closure_body_captured.oc @@ -0,0 +1,8 @@ +/// lsp: -h 6 26 +/// {"hover": "x: i32"} + +def main() { + let x: i32 = 100 + let cb = |a: i32| => x += a + cb(5) +} diff --git a/tests/lsp/hover/closure_call.oc b/tests/lsp/hover/closure_call.oc new file mode 100644 index 0000000..6c1ace7 --- /dev/null +++ b/tests/lsp/hover/closure_call.oc @@ -0,0 +1,8 @@ +/// lsp: -h 6 10 +/// {"hover": "cb: @fn(a: i32)"} + +def main() { + let x: i32 = 100 + let cb = |a: i32| => x += a + cb(5) +} diff --git a/tests/lsp/hover/closure_params.oc b/tests/lsp/hover/closure_params.oc new file mode 100644 index 0000000..09e2234 --- /dev/null +++ b/tests/lsp/hover/closure_params.oc @@ -0,0 +1,11 @@ +/// lsp: -h 6 15 +/// {"hover": "a: u32"} + +def main() { + let x = 100 + let cb = |a: u32| => x += a + + for let i = 0; i < 5; i++ { + cb(i) + } +} diff --git a/tests/lsp/hover/closure_type.oc b/tests/lsp/hover/closure_type.oc new file mode 100644 index 0000000..66b7ea0 --- /dev/null +++ b/tests/lsp/hover/closure_type.oc @@ -0,0 +1,5 @@ +/// lsp: -h 4 24 +/// {"hover": "i32"} + +def foo(x: @fn(str): i32) {} +def main() => 0