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 2353327           SPVM_VAR_DECL* SPVM_VAR_DECL_new(SPVM_COMPILER* compiler) {
10 2353327           SPVM_VAR_DECL* var_decl = SPVM_ALLOCATOR_alloc_memory_block_tmp(compiler->current_each_compile_allocator, sizeof(SPVM_VAR_DECL));
11            
12 2353327           var_decl->index = -1;
13 2353327           var_decl->runtime_var_index = -1;
14            
15 2353327           return var_decl;
16             }
17              
18 528120           SPVM_VAR_DECL* SPVM_VAR_DECL_new_arg(SPVM_COMPILER* compiler) {
19 528120           SPVM_VAR_DECL* var_decl = SPVM_ALLOCATOR_alloc_memory_block_permanent(compiler->current_each_compile_allocator, sizeof(SPVM_VAR_DECL));
20            
21 528120           var_decl->index = -1;
22 528120           var_decl->runtime_var_index = -1;
23 528120           var_decl->is_arg = 1;
24            
25 528120           return var_decl;
26             }