/*----------------------------------------------------------------------------*/
/* This file is generated by the templates/template.rb script and should not  */
/* be modified manually.                                                      */
/* To change the template see                                                 */
/* templates/ext/rbs_extension/ast_translation.h.erb                          */
/*----------------------------------------------------------------------------*/

#ifndef RBS_EXTENSION_AST_TRANSLATION_H
#define RBS_EXTENSION_AST_TRANSLATION_H

#include "compat.h"

SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
#include "ruby.h"
#include "ruby/encoding.h"
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END

#include "rbs/ast.h"
#include "rbs/location.h"

/// A bag of values needed when copying RBS C structs into Ruby objects.
typedef struct rbs_translation_context {
    rbs_constant_pool_t *constant_pool;
    VALUE buffer;
    rb_encoding *encoding;

    /// A reusable Hash used for calling `rb_class_new_instance_kw()` without allocating a new Hash each time.
    /// It's vital that the various Nodes' `#initialize` methods take the kwarg values, but don't retain this reusable Hash.
    VALUE reusable_kwargs_hash;
} rbs_translation_context_t;

rbs_translation_context_t rbs_translation_context_create(rbs_constant_pool_t *, VALUE buffer_string, rb_encoding *ruby_encoding);

VALUE rbs_node_list_to_ruby_array(rbs_translation_context_t, rbs_node_list_t *list);
VALUE rbs_hash_to_ruby_hash(rbs_translation_context_t, rbs_hash_t *hash);
VALUE rbs_struct_to_ruby_value(rbs_translation_context_t, rbs_node_t *instance);

extern VALUE EMPTY_ARRAY;
extern VALUE EMPTY_HASH;

#endif
