diff --git a/src/ast_printer.zig b/src/ast_printer.zig index f354971..f2e6076 100644 --- a/src/ast_printer.zig +++ b/src/ast_printer.zig @@ -368,8 +368,8 @@ pub fn printContext(ctx: CompilationContext) void { prettyType(fn_sym.return_type), ); - var param_it = fn_sym.parameters.iterator(); - while (param_it.next()) |param_kv| { + for (fn_sym.decl.params.toSlice()) |param| { + var param_kv = fn_sym.parameters.get(param.name.lexeme).?; std.debug.warn( "\tparameter {} typ {}\n", param_kv.key, diff --git a/src/comp_ctx.zig b/src/comp_ctx.zig index 0646b22..8914cfd 100644 --- a/src/comp_ctx.zig +++ b/src/comp_ctx.zig @@ -33,6 +33,7 @@ pub const SymbolUnderlyingType = union(SymbolUnderlyingTypeEnum) { // - a return type // - TODO parameters pub const FunctionSymbol = struct { + decl: ast.FnDecl, return_type: SymbolUnderlyingType, /// Parameters for a function are also a table instead of an ArrayList @@ -153,6 +154,7 @@ pub const CompilationContext = struct { _ = try self.symbol_table.put(decl.func_name.lexeme, SymbolData{ .Function = FunctionSymbol{ + .decl = decl, .return_type = ret_type, .parameters = type_map, .symbols = symbols,