}
delete :: #match {
- #precedence 1000 macro (x: ^$T, allocator := context.allocator) -> ^T {
+ #precedence 1000 macro (x: ^$T, allocator := context.allocator) {
raw_free(allocator, x);
}
}
return map;
}
+#match (package builtin).__make_overload macro (x: ^Map($K, $V), allocator := context.allocator) => (package core.map).make(K, V);
+
init :: (use map: ^Map($K, $V), default := __zero_value(V)) {
__initialize(map);
allocator = context.allocator;
default_value = default;
- memory.alloc_slice(^hashes, 8, allocator=allocator);
+ hashes = make([] u32, 8, allocator=allocator);
array.fill(hashes, -1);
array.init(^entries, allocator=allocator);
return set;
}
+#match (package builtin).__make_overload macro (x: ^Set, allocator: Allocator) => (package core.set).make(x.Elem_Type, allocator = allocator);
+
init :: (set: ^Set($T), default := __zero_value(T), allocator := context.allocator) {
set.allocator = allocator;
set.default_value = default;
array.free(^entries);
}
+#match (package builtin).delete (package core.set).free
+
insert :: (use set: ^Set, value: set.Elem_Type) {
if hashes.data == null do init(set);
lr := lookup(set, value);
if (type == NULL) return TYPE_MATCH_FAILED;
if (node == NULL) return TYPE_MATCH_FAILED;
- if (node->kind == Ast_Kind_Struct_Literal && node->type_node == NULL) {
+ if (node->kind == Ast_Kind_Struct_Literal && (node->type_node == NULL && node->type == NULL)) {
if (node->entity != NULL) return TYPE_MATCH_SUCCESS;
if (type->kind == Type_Kind_VarArgs) type = type->VarArgs.elem;
if (!type_is_sl_constructable(type)) return TYPE_MATCH_FAILED;