Skip to content

Commit fb6a489

Browse files
committed
Revert "Method reference operator"
This reverts commit 67c5747. [Feature #16275]
1 parent b41a19f commit fb6a489

File tree

18 files changed

+5
-141
lines changed

18 files changed

+5
-141
lines changed

NEWS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ sufficient information, see the ChangeLog file or Redmine
186186
# Previously parsed as: (a, b = raise) rescue [1, 2]
187187
# Now parsed as: a, b = (raise rescue [1, 2])
188188

189-
* Method reference operator, <code>.:</code> is introduced as an
190-
experimental feature. [Feature #12125] [Feature #13581]
191-
192189
* +yield+ in singleton class syntax is warned and will be deprecated later [Feature #15575].
193190

194191
* Argument forwarding by <code>(...)</code> is introduced. [Feature #16253]

ast.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,6 @@ node_children(rb_ast_t *ast, NODE *node)
432432
NEW_CHILD(ast, node->nd_args));
433433
case NODE_VCALL:
434434
return rb_ary_new_from_args(1, ID2SYM(node->nd_mid));
435-
case NODE_METHREF:
436-
return rb_ary_new_from_args(2, NEW_CHILD(ast, node->nd_recv),
437-
ID2SYM(node->nd_mid));
438435
case NODE_SUPER:
439436
return rb_ary_new_from_node_args(ast, 1, node->nd_args);
440437
case NODE_ZSUPER:

compile.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4742,11 +4742,9 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
47424742
case NODE_OPCALL:
47434743
case NODE_VCALL:
47444744
case NODE_FCALL:
4745-
case NODE_METHREF:
47464745
case NODE_ATTRASGN:{
47474746
const int explicit_receiver =
47484747
(type == NODE_CALL || type == NODE_OPCALL ||
4749-
type == NODE_METHREF ||
47504748
(type == NODE_ATTRASGN && !private_recv_p(node)));
47514749

47524750
if (!lfinish[1] && (node->nd_args || explicit_receiver)) {
@@ -8484,13 +8482,6 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
84848482
}
84858483
break;
84868484
}
8487-
case NODE_METHREF:
8488-
CHECK(COMPILE(ret, "receiver", node->nd_recv));
8489-
ADD_ELEM(ret, &new_insn_body(iseq, line, BIN(methodref), 1, ID2SYM(node->nd_mid))->link);
8490-
if (popped) {
8491-
ADD_INSN(ret, line, pop);
8492-
}
8493-
break;
84948485
default:
84958486
UNKNOWN_NODE("iseq_compile_each", node, COMPILE_NG);
84968487
ng:

defs/id.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ token_ops = %[\
130130
ANDOP &&
131131
OROP ||
132132
ANDDOT &.
133-
METHREF .:
134133
]
135134

136135
class KeywordError < RuntimeError

ext/objspace/objspace.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ count_nodes(int argc, VALUE *argv, VALUE os)
474474
COUNT_NODE(NODE_DSYM);
475475
COUNT_NODE(NODE_ATTRASGN);
476476
COUNT_NODE(NODE_LAMBDA);
477-
COUNT_NODE(NODE_METHREF);
478477
COUNT_NODE(NODE_ARYPTN);
479478
COUNT_NODE(NODE_HSHPTN);
480479
#undef COUNT_NODE

ext/ripper/eventids2.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ ripper_token2eventid(enum yytokentype tok)
261261
[tSTAR] = O(op),
262262
[tDSTAR] = O(op),
263263
[tANDDOT] = O(op),
264-
[tMETHREF] = O(op),
265264
[tSTRING_BEG] = O(tstring_beg),
266265
[tSTRING_CONTENT] = O(tstring_content),
267266
[tSTRING_DBEG] = O(embexpr_beg),

insns.def

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -719,17 +719,6 @@ checktype
719719
ret = (TYPE(val) == (int)type) ? Qtrue : Qfalse;
720720
}
721721

722-
/* get frozen method reference. */
723-
DEFINE_INSN
724-
methodref
725-
(ID id)
726-
(VALUE val)
727-
(VALUE ret)
728-
{
729-
ret = rb_obj_method(val, ID2SYM(id));
730-
RB_OBJ_FREEZE_RAW(ret);
731-
}
732-
733722
/**********************************************************/
734723
/* deal with control flow 1: class/module */
735724
/**********************************************************/

lib/optparse.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ def complete(typ, opt, icase = false, *pat)
17811781
visit(:complete, typ, opt, icase, *pat) {|o, *sw| return sw}
17821782
}
17831783
exc = ambiguous ? AmbiguousOption : InvalidOption
1784-
raise exc.new(opt, additional: self.:additional_message.curry[typ])
1784+
raise exc.new(opt, additional: self.method(:additional_message).curry[typ])
17851785
end
17861786
private :complete
17871787

node.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -954,15 +954,6 @@ dump_node(VALUE buf, VALUE indent, int comment, const NODE * node)
954954
F_NODE(nd_args, "arguments");
955955
return;
956956

957-
case NODE_METHREF:
958-
ANN("method reference");
959-
ANN("format: [nd_recv].:[nd_mid]");
960-
ANN("example: foo.:method");
961-
F_NODE(nd_recv, "receiver");
962-
LAST_NODE;
963-
F_ID(nd_mid, "method name");
964-
return;
965-
966957
case NODE_LAMBDA:
967958
ANN("lambda expression");
968959
ANN("format: -> [nd_body]");

node.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ enum node_type {
122122
NODE_DSYM,
123123
NODE_ATTRASGN,
124124
NODE_LAMBDA,
125-
NODE_METHREF,
126125
NODE_ARYPTN,
127126
NODE_HSHPTN,
128127
NODE_LAST
@@ -378,7 +377,6 @@ typedef struct RNode {
378377
#define NEW_PREEXE(b,loc) NEW_SCOPE(b,loc)
379378
#define NEW_POSTEXE(b,loc) NEW_NODE(NODE_POSTEXE,0,b,0,loc)
380379
#define NEW_ATTRASGN(r,m,a,loc) NEW_NODE(NODE_ATTRASGN,r,m,a,loc)
381-
#define NEW_METHREF(r,m,loc) NEW_NODE(NODE_METHREF,r,m,0,loc)
382380

383381
#define NODE_SPECIAL_REQUIRED_KEYWORD ((NODE *)-1)
384382
#define NODE_REQUIRED_KEYWORD_P(node) ((node)->nd_value == NODE_SPECIAL_REQUIRED_KEYWORD)

0 commit comments

Comments
 (0)