diff options
author | Matt Valentine-House <[email protected]> | 2023-09-18 21:58:10 +0100 |
---|---|---|
committer | Matt Valentine-House <[email protected]> | 2023-09-19 14:53:58 +0100 |
commit | 2f8daa5f5128ca63154ae6adb139c24ec0e14b40 (patch) | |
tree | d29e71f20c584eb982db84456bc778eff782cc1a /yarp | |
parent | 91b10c0b77c5408cbbbc2fc6d678ee92b2d4b28a (diff) |
[YARP] Implement InstanceVariableTargetNode, LocalVariableTargetNode
Diffstat (limited to 'yarp')
-rw-r--r-- | yarp/yarp_compiler.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/yarp/yarp_compiler.c b/yarp/yarp_compiler.c index 2a8ebe5403..eacdb72e21 100644 --- a/yarp/yarp_compiler.c +++ b/yarp/yarp_compiler.c @@ -1368,6 +1368,15 @@ yp_compile_node(rb_iseq_t *iseq, const yp_node_t *node, LINK_ANCHOR *const ret, } return; } + case YP_INSTANCE_VARIABLE_TARGET_NODE: { + yp_instance_variable_target_node_t *write_node = (yp_instance_variable_target_node_t *) node; + + ID ivar_name = yp_constant_id_lookup(compile_context, write_node->name); + ADD_INSN2(ret, &dummy_line_node, setinstancevariable, + ID2SYM(ivar_name), + get_ivar_ic_value(iseq, ivar_name)); + return; + } case YP_INSTANCE_VARIABLE_WRITE_NODE: { yp_instance_variable_write_node_t *write_node = (yp_instance_variable_write_node_t *) node; YP_COMPILE_NOT_POPPED(write_node->value); @@ -1565,6 +1574,15 @@ yp_compile_node(rb_iseq_t *iseq, const yp_node_t *node, LINK_ANCHOR *const ret, } return; } + case YP_LOCAL_VARIABLE_TARGET_NODE: { + yp_local_variable_target_node_t *local_write_node = (yp_local_variable_target_node_t *) node; + + yp_constant_id_t constant_id = local_write_node->name; + int index = yp_lookup_local_index(iseq, compile_context, constant_id); + + ADD_SETLOCAL(ret, &dummy_line_node, (int)index, local_write_node->depth); + return; + } case YP_LOCAL_VARIABLE_WRITE_NODE: { yp_local_variable_write_node_t *local_write_node = (yp_local_variable_write_node_t *) node; YP_COMPILE_NOT_POPPED(local_write_node->value); |