mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
641870746f
commit
57b0489cdb
1 changed files with 34 additions and 24 deletions
58
node.c
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]");
|
||||
|
|
Loading…
Reference in a new issue