File Coverage

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


line stmt bran cond sub pod time code
1             // Copyright (c) 2023 Yuki Kimoto
2             // MIT License
3              
4             #include "spvm_attribute.h"
5              
6             #include "spvm_allocator.h"
7             #include "spvm_compiler.h"
8              
9              
10 15           const char* const* SPVM_ATTRIBUTE_C_ID_NAMES(void) {
11              
12             static const char* const id_names[] = {
13             "unknown",
14             "mulnum_t",
15             "pointer",
16             "native",
17             "precompile",
18             "public",
19             "protected",
20             "private",
21             "rw",
22             "ro",
23             "wo",
24             "static",
25             "interface_t",
26             "required",
27             };
28            
29 15           return id_names;
30             }
31              
32 15           const char* SPVM_ATTRIBUTE_get_name(SPVM_COMPILER* compiler, int32_t id) {
33 15           return (SPVM_ATTRIBUTE_C_ID_NAMES())[id];
34             }
35              
36 353589           SPVM_ATTRIBUTE* SPVM_ATTRIBUTE_new(SPVM_COMPILER* compiler) {
37 353589           return SPVM_ALLOCATOR_alloc_memory_block_tmp(compiler->current_each_compile_allocator, sizeof(SPVM_ATTRIBUTE));
38             }