parent
3b535d2c3a
commit
28ad4e6d83
@ -2861,8 +2861,12 @@ static void clone_subtree_list_ptr(ZigList<AstNode *> **dest_ptr, ZigList<AstNod
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void clone_subtree_field(AstNode **dest, AstNode *src, uint32_t *next_node_index) {
|
static void clone_subtree_field(AstNode **dest, AstNode *src, uint32_t *next_node_index) {
|
||||||
*dest = ast_clone_subtree(src, next_node_index);
|
if (src) {
|
||||||
(*dest)->parent_field = dest;
|
*dest = ast_clone_subtree(src, next_node_index);
|
||||||
|
(*dest)->parent_field = dest;
|
||||||
|
} else {
|
||||||
|
*dest = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clone_subtree_tld(TopLevelDecl *dest, TopLevelDecl *src, uint32_t *next_node_index) {
|
static void clone_subtree_tld(TopLevelDecl *dest, TopLevelDecl *src, uint32_t *next_node_index) {
|
||||||
|
@ -542,6 +542,18 @@ fn generic_function_equality() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#attribute("test")
|
||||||
|
fn generic_malloc_free() {
|
||||||
|
const a = %%mem_alloc(u8)(10);
|
||||||
|
mem_free(u8)(a);
|
||||||
|
}
|
||||||
|
const some_mem : [100]u8 = undefined;
|
||||||
|
fn mem_alloc(T: type)(n: isize) -> %[]T {
|
||||||
|
return (&T)(&some_mem[0])[0...n];
|
||||||
|
}
|
||||||
|
fn mem_free(T: type)(mem: []T) { }
|
||||||
|
|
||||||
|
|
||||||
fn assert(b: bool) {
|
fn assert(b: bool) {
|
||||||
if (!b) unreachable{}
|
if (!b) unreachable{}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user