Class: Node::OP_ASGN2

Inherits:
Node show all
Defined in:
ext/internal/node/nodeinfo.c,
ext/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.4/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.4/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.5/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.5/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.6/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.6/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.7/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.7/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.1/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.1/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.2/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.2/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.3/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.3/internal/node/nodeinfo.c

Overview

Represents attribute assignment of the form:

recv.attr op value

where recv is the receiver of the attr method, attr is the attribute to which to assign, op is an assignment operation (e.g. +=), and value is the value to assign to the attribute.

The ‘next’ member of this class is also of type OP_ASGN2, though it has different members than its parent. This child node is documented under OP_ASGN2_ARG.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#[], #_dump, _load, #address, #as_code, #as_expression, #as_paren_expression, #bytecode_compile, compile_string, define_code, define_expression, #eval, #flags, #inspect, #members, #nd_file, #nd_line, #nd_type, #obfusc, #pretty_print, #swap, #to_a, #tree, type

Class Method Details

.membersArray

Return an array of strings containing the names of the node class’s members.

Returns:

  • (Array)


2793
2794
2795
2796
# File 'ext/internal/node/nodeinfo.c', line 2793

VALUE node_s_members(VALUE klass)
{
  return rb_iv_get(klass, "__member__");
}

Instance Method Details

#nextObject

Return the Node’s next member. The return type is either a Node or an Object.



2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
# File 'ext/internal/node/nodeinfo.c', line 2437

static VALUE node_next(VALUE self)
{
  NODE * n;
  Data_Get_Struct(self, NODE, n);

  if(TYPE(n->nd_next) == T_NODE)
  {
    if(1 && nd_type(n) == NODE_OP_ASGN2)
    {
      return wrap_node_as(
        (NODE *)n->nd_next,
        rb_cNodeSubclass[NODE_OP_ASGN2_ARG]);
    }
    else
    {
      return wrap_node((NODE *)n->nd_next);
    }
  }
  else
  {
    return (VALUE)n->nd_next;
  }
}

#recvObject

Return the Node’s recv member. The return type is either a Node or an Object.



2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
# File 'ext/internal/node/nodeinfo.c', line 2511

static VALUE node_recv(VALUE self)
{
  NODE * n;
  Data_Get_Struct(self, NODE, n);

  if(TYPE(n->nd_recv) == T_NODE)
  {
    if(0 && nd_type(n) == NODE_OP_ASGN2)
    {
      return wrap_node_as(
        (NODE *)n->nd_recv,
        rb_cNodeSubclass[NODE_OP_ASGN2_ARG]);
    }
    else
    {
      return wrap_node((NODE *)n->nd_recv);
    }
  }
  else
  {
    return (VALUE)n->nd_recv;
  }
}

#valueObject

Return the Node’s value member. The return type is either a Node or an Object.



2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
# File 'ext/internal/node/nodeinfo.c', line 2714

static VALUE node_value(VALUE self)
{
  NODE * n;
  Data_Get_Struct(self, NODE, n);

  if(TYPE(n->nd_value) == T_NODE)
  {
    if(0 && nd_type(n) == NODE_OP_ASGN2)
    {
      return wrap_node_as(
        (NODE *)n->nd_value,
        rb_cNodeSubclass[NODE_OP_ASGN2_ARG]);
    }
    else
    {
      return wrap_node((NODE *)n->nd_value);
    }
  }
  else
  {
    return (VALUE)n->nd_value;
  }
}