From 535045ab3b27dd42030e837bcd83b74ff075b84b Mon Sep 17 00:00:00 2001 From: Jemma Issroff Date: Tue, 29 Aug 2023 12:27:00 -0400 Subject: [YARP] Compile basic types (#8311) * Add a compile_context arg to yp_compile_node The compile_context will allow us to pass around the parser, and the constants and lookup table (to be used in future commits). * Compile yp_program_node_t and yp_statements_node_t Add the compilation for program and statements node so that we can successfully compile an empty program with YARP. * Helper functions for parsing numbers, strings, and symbols * Compile basic numeric / boolean node types in YARP * Compile StringNode and SymbolNodes in YARP * Compile several basic node types in YARP * Added error return for missing node --- iseq.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'iseq.c') diff --git a/iseq.c b/iseq.c index 0b7ea138fa..cb54d267f4 100644 --- a/iseq.c +++ b/iseq.c @@ -45,8 +45,6 @@ #include "insns_info.inc" #include "yarp/yarp.h" -VALUE rb_iseq_compile_yarp_node(rb_iseq_t * iseq, const yp_node_t * yarp_pointer); - VALUE rb_cISeq; static VALUE iseqw_new(const rb_iseq_t *iseq); static const rb_iseq_t *iseqw_check(VALUE iseqw); @@ -944,6 +942,8 @@ rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE rea return iseq_translate(iseq); } +VALUE rb_iseq_compile_yarp_node(rb_iseq_t * iseq, const yp_node_t * yarp_pointer, yp_parser_t *parser); + rb_iseq_t * rb_iseq_new_with_callback( const struct rb_iseq_new_with_callback_callback_func * ifunc, @@ -1404,8 +1404,9 @@ iseqw_s_compile_yarp(int argc, VALUE *argv, VALUE self) prepare_iseq_build(iseq, name, file, path, first_lineno, &node_location, node_id, parent, 0, (enum rb_iseq_type)iseq_type, Qnil, &option); - rb_iseq_compile_yarp_node(iseq, node); + rb_iseq_compile_yarp_node(iseq, node, &parser); + finish_iseq_build(iseq); yp_node_destroy(&parser, node); yp_parser_free(&parser); -- cgit v1.2.3