Minimize memory usage for AST nodes by using Slice<T> rather than Array<T> when the parameter doesn't need to grow

This commit is contained in:
gingerBill
2020-11-16 15:18:25 +00:00
parent adf6c85fd3
commit ca4b0527e8
12 changed files with 218 additions and 119 deletions

View File

@@ -165,7 +165,7 @@ struct Entity {
Scope *scope;
} ImportName;
struct {
Array<String> paths;
Slice<String> paths;
String name;
} LibraryName;
i32 Nil;
@@ -333,7 +333,7 @@ Entity *alloc_entity_import_name(Scope *scope, Token token, Type *type,
}
Entity *alloc_entity_library_name(Scope *scope, Token token, Type *type,
Array<String> paths, String name) {
Slice<String> paths, String name) {
Entity *entity = alloc_entity(Entity_LibraryName, scope, token, type);
entity->LibraryName.paths = paths;
entity->LibraryName.name = name;