зеркало из https://github.com/github/ruby.git
[YARP] Implement ClassVariableTargetNode
This commit is contained in:
Родитель
2f8daa5f51
Коммит
5c5391f444
|
@ -86,6 +86,10 @@ module YARP
|
|||
# Writes #
|
||||
############################################################################
|
||||
|
||||
def test_ClassVariableTargetNode
|
||||
test_yarp_eval("class YARP::CompilerTest; @@yct, @@yct1 = 1; end")
|
||||
end
|
||||
|
||||
def test_ClassVariableWriteNode
|
||||
test_yarp_eval("class YARP::CompilerTest; @@yct = 1; end")
|
||||
end
|
||||
|
|
|
@ -851,6 +851,12 @@ yp_compile_node(rb_iseq_t *iseq, const yp_node_t *node, LINK_ANCHOR *const ret,
|
|||
}
|
||||
return;
|
||||
}
|
||||
case YP_CLASS_VARIABLE_TARGET_NODE: {
|
||||
yp_class_variable_target_node_t *write_node = (yp_class_variable_target_node_t *) node;
|
||||
ID cvar_name = yp_constant_id_lookup(compile_context, write_node->name);
|
||||
ADD_INSN2(ret, &dummy_line_node, setclassvariable, ID2SYM(cvar_name), get_cvar_ic_value(iseq, cvar_name));
|
||||
return;
|
||||
}
|
||||
case YP_CLASS_VARIABLE_WRITE_NODE: {
|
||||
yp_class_variable_write_node_t *write_node = (yp_class_variable_write_node_t *) node;
|
||||
YP_COMPILE_NOT_POPPED(write_node->value);
|
||||
|
|
Загрузка…
Ссылка в новой задаче