node.c: show variable type for NODE_*ASGN

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2017-12-15 05:55:11 +00:00
Родитель 641870746f
Коммит 57b0489cdb
1 изменённых файлов: 34 добавлений и 24 удалений

58
node.c
Просмотреть файл

@ -377,37 +377,47 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("local variable assignment");
ANN("format: [nd_vid](lvar) = [nd_value]");
ANN("example: x = foo");
goto asgn;
case NODE_DASGN:
ANN("dynamic variable assignment (out of current scope)");
ANN("format: [nd_vid](dvar) = [nd_value]");
ANN("example: x = nil; 1.times { x = foo }");
goto asgn;
case NODE_DASGN_CURR:
ANN("dynamic variable assignment (in current scope)");
ANN("format: [nd_vid](current dvar) = [nd_value]");
ANN("example: 1.times { x = foo }");
goto asgn;
case NODE_IASGN:
ANN("instance variable assignment");
ANN("format: [nd_vid](ivar) = [nd_value]");
ANN("example: @x = foo");
goto asgn;
case NODE_CVASGN:
ANN("class variable assignment");
ANN("format: [nd_vid](cvar) = [nd_value]");
ANN("example: @@x = foo");
asgn:
F_ID(nd_vid, "variable");
LAST_NODE;
F_ID(nd_vid, "local variable");
if (node->nd_value == NODE_SPECIAL_REQUIRED_KEYWORD) {
F_MSG(nd_value, "rvalue", "NODE_SPECIAL_REQUIRED_KEYWORD (required keyword argument)");
}
else {
LAST_NODE;
F_NODE(nd_value, "rvalue");
}
return;
case NODE_DASGN:
ANN("dynamic variable assignment (out of current scope)");
ANN("format: [nd_vid](dvar) = [nd_value]");
ANN("example: x = nil; 1.times { x = foo }");
F_ID(nd_vid, "local variable");
LAST_NODE;
F_NODE(nd_value, "rvalue");
return;
case NODE_DASGN_CURR:
ANN("dynamic variable assignment (in current scope)");
ANN("format: [nd_vid](current dvar) = [nd_value]");
ANN("example: 1.times { x = foo }");
F_ID(nd_vid, "local variable");
LAST_NODE;
F_NODE(nd_value, "rvalue");
return;
case NODE_IASGN:
ANN("instance variable assignment");
ANN("format: [nd_vid](ivar) = [nd_value]");
ANN("example: @x = foo");
F_ID(nd_vid, "instance variable");
LAST_NODE;
F_NODE(nd_value, "rvalue");
return;
case NODE_CVASGN:
ANN("class variable assignment");
ANN("format: [nd_vid](cvar) = [nd_value]");
ANN("example: @@x = foo");
F_ID(nd_vid, "class variable");
LAST_NODE;
F_NODE(nd_value, "rvalue");
return;
case NODE_GASGN:
ANN("global variable assignment");
ANN("format: [nd_entry](gvar) = [nd_value]");