From fb8649c9b17ccaa36a3f69ac2f14e5d20404a1a4 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Thu, 13 Apr 2023 19:31:41 +0900 Subject: [PATCH] Pass ident_hash_new via config --- external/parse.h | 2 ++ parse.y | 11 ++++++----- ruby_parser.c | 10 ++++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/external/parse.h b/external/parse.h index d3a5f4385f60ac..286c5bafc03e07 100644 --- a/external/parse.h +++ b/external/parse.h @@ -45,6 +45,8 @@ typedef struct rb_parser_config_struct { VALUE (*hash_new)(void); VALUE (*hash_aset)(VALUE hash, VALUE key, VALUE val); VALUE (*hash_lookup)(VALUE hash, VALUE key); + VALUE (*ident_hash_new)(void); + } rb_parser_config_t; diff --git a/parse.y b/parse.y index d0a598a0f09705..578c5824129bce 100644 --- a/parse.y +++ b/parse.y @@ -44,7 +44,6 @@ struct lex_context; #include "internal/complex.h" #include "internal/encoding.h" #include "internal/error.h" -#include "internal/hash.h" #include "internal/imemo.h" #include "internal/io.h" #include "internal/rational.h" @@ -64,6 +63,7 @@ struct lex_context; #ifdef RIPPER #include "internal/numeric.h" +#include "internal/hash.h" #endif enum shareability { @@ -126,10 +126,11 @@ RBIMPL_WARNING_POP() #undef rb_str_new_cstr #define rb_str_new_cstr p->config.str_new_cstr -#define rb_hash_clear p->config.hash_clear -#define rb_hash_new p->config.hash_new -#define rb_hash_aset p->config.hash_aset -#define rb_hash_lookup p->config.hash_lookup +#define rb_hash_clear p->config.hash_clear +#define rb_hash_new p->config.hash_new +#define rb_hash_aset p->config.hash_aset +#define rb_hash_lookup p->config.hash_lookup +#define rb_ident_hash_new p->config.ident_hash_new #endif #define NO_LEX_CTXT (struct lex_context){0} diff --git a/ruby_parser.c b/ruby_parser.c index ff47ec0cbe5602..9ab4d086528733 100644 --- a/ruby_parser.c +++ b/ruby_parser.c @@ -1,6 +1,7 @@ /* This is a wrapper for parse.y */ #include "internal/array.h" +#include "internal/hash.h" #include "internal/parse.h" #include "internal/ruby_parser.h" @@ -77,10 +78,11 @@ rb_parser_config_initialize(rb_parser_config_t *config) config->str_new = rb_str_new; config->str_new_cstr = rb_str_new_cstr; - config->hash_clear = rb_hash_clear; - config->hash_new = rb_hash_new; - config->hash_aset = rb_hash_aset; - config->hash_lookup = rb_hash_lookup; + config->hash_clear = rb_hash_clear; + config->hash_new = rb_hash_new; + config->hash_aset = rb_hash_aset; + config->hash_lookup = rb_hash_lookup; + config->ident_hash_new = rb_ident_hash_new; }