aboutsummaryrefslogtreecommitdiff
path: root/src/index
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2021-01-04 11:01:28 +0100
committerDanielGavin <danielgavin5@hotmail.com>2021-01-04 11:01:28 +0100
commit0f00c4bfa3620d02e69beaf3e8b8afa3401a4ba3 (patch)
tree33c226d83191e2227d7833b43a11b11c265c31d5 /src/index
parent9776aac4ec027dc5dc7d078372b425ab22fd9f47 (diff)
start working on using in structs
Diffstat (limited to 'src/index')
-rw-r--r--src/index/collector.odin10
-rw-r--r--src/index/symbol.odin2
2 files changed, 4 insertions, 8 deletions
diff --git a/src/index/collector.odin b/src/index/collector.odin
index e671cf4..438366a 100644
--- a/src/index/collector.odin
+++ b/src/index/collector.odin
@@ -100,7 +100,7 @@ collect_struct_fields :: proc(collection: ^SymbolCollection, struct_type: ast.St
names := make([dynamic] string, 0, collection.allocator);
types := make([dynamic] ^ast.Expr, 0, collection.allocator);
- usings := make([dynamic] bool, 0, collection.allocator);
+ usings := make(map [string] bool, 0, collection.allocator);
for field in struct_type.fields.list {
@@ -113,11 +113,7 @@ collect_struct_fields :: proc(collection: ^SymbolCollection, struct_type: ast.St
append(&types, cloned);
if .Using in field.flags {
- append(&usings, true);
- }
-
- else {
- append(&usings, false);
+ usings[names[len(names)-1]] = true;
}
}
@@ -127,7 +123,7 @@ collect_struct_fields :: proc(collection: ^SymbolCollection, struct_type: ast.St
value := SymbolStructValue {
names = names[:],
types = types[:],
- usings = usings[:],
+ usings = usings,
};
return value;
diff --git a/src/index/symbol.odin b/src/index/symbol.odin
index 1f902db..35cb323 100644
--- a/src/index/symbol.odin
+++ b/src/index/symbol.odin
@@ -20,7 +20,7 @@ import "shared:common"
SymbolStructValue :: struct {
names: [] string,
types: [] ^ast.Expr,
- usings: [] bool, //not memory efficient
+ usings: map [string] bool,
};