diff options
| author | Alexandros Naskos <alex_naskos@hotmail.com> | 2018-04-26 14:03:19 +0300 |
|---|---|---|
| committer | Alexandros Naskos <alex_naskos@hotmail.com> | 2018-04-26 14:03:19 +0300 |
| commit | bb56360bfaa317809bd3c742a655b357bd5b6226 (patch) | |
| tree | b402d0f319dfc6f45bd9304fc13389310eb680aa /src/codegen.cpp | |
| parent | dd88d7deda66a4e4e1527831e7b24a3cf358d1b7 (diff) | |
| download | zig-bb56360bfaa317809bd3c742a655b357bd5b6226.tar.gz zig-bb56360bfaa317809bd3c742a655b357bd5b6226.zip | |
Added TypeInfo cache
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 7d83a38bbf..71df7fcd65 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -88,6 +88,7 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out g->exported_symbol_names.init(8); g->external_prototypes.init(8); g->string_literals_table.init(16); + g->type_info_cache.init(32); g->is_test_build = false; g->want_h_file = (out_type == OutTypeObj || out_type == OutTypeLib); buf_resize(&g->global_asm, 0); @@ -6347,7 +6348,8 @@ static void define_builtin_compile_vars(CodeGen *g) { buf_appendf(contents, "};\n\n"); } { - // TODO: Add method info where methods are supported. + // @TODO Add method info where methods are supported. + // @TODO Add Namespace info. buf_appendf(contents, "pub const TypeInfo = union(TypeId) {\n" " Type: void,\n" @@ -6403,6 +6405,11 @@ static void define_builtin_compile_vars(CodeGen *g) { " Packed,\n" " };\n" "\n" + " pub const Method = struct {\n" + " name: []const u8,\n" + " fn_info: Fn,\n" + " };\n" + "\n" " pub const StructField = struct {\n" " name: []const u8,\n" " offset: usize,\n" @@ -6412,6 +6419,7 @@ static void define_builtin_compile_vars(CodeGen *g) { " pub const Struct = struct {\n" " layout: ContainerLayout,\n" " fields: []StructField,\n" + " methods: []Method,\n" " };\n" "\n" " pub const Nullable = struct {\n" |
