File Coverage

lib/SPVM/Builder/src/spvm_var_decl.c
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             // Copyright (c) 2023 Yuki Kimoto
2             // MIT License
3              
4             #include "spvm_var_decl.h"
5              
6             #include "spvm_allocator.h"
7             #include "spvm_compiler.h"
8              
9 2322339           SPVM_VAR_DECL* SPVM_VAR_DECL_new(SPVM_COMPILER* compiler) {
10 2322339           SPVM_VAR_DECL* var_decl = SPVM_ALLOCATOR_alloc_memory_block_tmp(compiler->current_each_compile_allocator, sizeof(SPVM_VAR_DECL));
11            
12 2322339           var_decl->index = -1;
13 2322339           var_decl->runtime_var_index = -1;
14            
15 2322339           return var_decl;
16             }
17              
18 520466           SPVM_VAR_DECL* SPVM_VAR_DECL_new_arg(SPVM_COMPILER* compiler) {
19 520466           SPVM_VAR_DECL* var_decl = SPVM_ALLOCATOR_alloc_memory_block_permanent(compiler->current_each_compile_allocator, sizeof(SPVM_VAR_DECL));
20            
21 520466           var_decl->index = -1;
22 520466           var_decl->runtime_var_index = -1;
23 520466           var_decl->is_arg = 1;
24            
25 520466           return var_decl;
26             }