diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-08-19 01:42:30 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-08-19 01:42:30 +0200 |
| commit | 0f18a09ea4d411e93d3310811bd5c67ab00ae7a2 (patch) | |
| tree | 1a6790826a320d91c0f940f4ca192028ee01257e /src | |
| parent | c92ac6011f40ff7163dd548d68f5be36f99f85cf (diff) | |
Replace clone with a string map
Diffstat (limited to 'src')
| -rw-r--r-- | src/index/collector.odin | 8 | ||||
| -rw-r--r-- | src/index/symbol.odin | 1 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/index/collector.odin b/src/index/collector.odin index b2cc37b..652ef6a 100644 --- a/src/index/collector.odin +++ b/src/index/collector.odin @@ -118,7 +118,7 @@ collect_struct_fields :: proc(collection: ^SymbolCollection, struct_type: ast.St names = names[:], types = types[:], usings = usings, - struct_name = strings.clone(ident, collection.allocator), + struct_name = get_index_unique_string(collection, ident.name), }; return value; @@ -143,7 +143,7 @@ collect_enum_fields :: proc(collection: ^SymbolCollection, fields: []^ast.Expr, value := SymbolEnumValue { names = names[:], - enum_name = strings.clone(ident, collection.allocator), + enum_name = get_index_unique_string(collection, ident.name), }; return value; @@ -174,7 +174,7 @@ collect_union_fields :: proc(collection: ^SymbolCollection, union_type: ast.Unio value := SymbolUnionValue { names = names[:], types = types[:], - union_name = strings.clone(ident, collection.allocator), + union_name = get_index_unique_string(collection, ident.name), }; return value; @@ -187,7 +187,7 @@ collect_bitset_field :: proc(collection: ^SymbolCollection, bitset_type: ast.Bit return SymbolBitSetValue { expr = cloned, - bitset_name = strings.clone(ident, collection.allocator), + bitset_name = get_index_unique_string(collection, ident.name), }; } diff --git a/src/index/symbol.odin b/src/index/symbol.odin index c8fbd56..a429a17 100644 --- a/src/index/symbol.odin +++ b/src/index/symbol.odin @@ -151,7 +151,6 @@ free_symbol :: proc(symbol: Symbol, allocator: mem.Allocator) { common.free_ast(v.arg_types, allocator); case SymbolStructValue: delete(v.names, allocator); - delete(v.struct_name, allocator); common.free_ast(v.types, allocator); case SymbolGenericValue: common.free_ast(v.expr, allocator); |