Skip to content

Commit f914ca3

Browse files
committed
Initialize the global constant pool
1 parent 5e0334c commit f914ca3

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

include/rbs/util/rbs_constant_pool.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ typedef struct {
8282
} rbs_constant_pool_t;
8383

8484
// A global constant pool for storing permenant keywords, such as the names of location children in `parser.c`.
85+
RBS_EXPORTED_FUNCTION
8586
extern rbs_constant_pool_t *RBS_GLOBAL_CONSTANT_POOL;
8687

8788
/**
@@ -91,6 +92,7 @@ extern rbs_constant_pool_t *RBS_GLOBAL_CONSTANT_POOL;
9192
* @param capacity The initial capacity of the pool.
9293
* @return Whether the initialization succeeded.
9394
*/
95+
RBS_EXPORTED_FUNCTION
9496
bool rbs_constant_pool_init(rbs_constant_pool_t *pool, uint32_t capacity);
9597

9698
/**

lib/rbs/ffi/parser.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,12 @@ def declarations
180180
attach_function :rbs_parser_free, [:pointer], :void
181181
attach_function :rbs_parse_type, [:pointer, :pointer, :bool, :bool, :bool], :bool
182182
attach_function :rbs_parse_signature, [:pointer, :pointer], :bool
183+
attach_function :rbs_constant_pool_init, [:pointer, :uint32], :bool
184+
attach_variable :RBS_GLOBAL_CONSTANT_POOL, :pointer
183185
end
184186

187+
Native.rbs_constant_pool_init(Native.RBS_GLOBAL_CONSTANT_POOL, 7)
188+
185189
class Parser
186190

187191
def self.new_parser(str, start_pos, end_pos)

0 commit comments

Comments
 (0)