Skip to content

Commit 8674670

Browse files
committed
Compiler: bug fixes
* fix incorrect order in `defKind_names` * remove debug output in `TypeRef.diagName` * fix use after free in `ast.deinit`
1 parent d6dc8d0 commit 8674670

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

ast/function_decl.c2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const char*[] defKind_names = {
4949
"global",
5050
"type",
5151
"struct-member",
52-
"template",
5352
"param",
53+
"template",
5454
}
5555

5656
type FunctionDeclBits struct {

ast/type_ref.c2

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module ast;
1717

1818
import src_loc local;
1919
import string_buffer;
20-
import stdio;
20+
2121
import string;
2222

2323
public type TypeRefKind enum u8 {
@@ -538,7 +538,6 @@ public fn const char* TypeRef.diagName(const TypeRef* r) {
538538
local char[128] result;
539539
string_buffer.Buf buf.init(result, elemsof(result), false, false, 0);
540540
r.print(&buf, true);
541-
stdio.puts(result);
542541
return result;
543542
}
544543

ast/utils.c2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,9 @@ public fn void deinit(bool print_stats) {
188188
globals.ast_list = nil;
189189
globals.pointers.clear();
190190
globals.string_types.clear();
191-
stdlib.free(globals);
192191
globals.dump_buf.free();
192+
stdlib.free(globals);
193+
globals = nil;
193194
}
194195

195196
public fn u32 getWordSize() {

0 commit comments

Comments
 (0)