Class: Node::WHILE

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 a loop constructed with the ‘while’ keyword, e.g.:

while cond do
  body
end

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#[], #_dump, _load, #address, #bytecode_compile, compile_string, #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

#bodyObject

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



2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
# File 'ext/internal/node/nodeinfo.c', line 2076

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

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

#condObject

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



2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
# File 'ext/internal/node/nodeinfo.c', line 2129

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

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

#stateObject

Return the Node’s state member. The return type is an Integer.



2613
2614
2615
2616
2617
2618
# File 'ext/internal/node/nodeinfo.c', line 2613

static VALUE node_state(VALUE self)
{
  NODE * n;
  Data_Get_Struct(self, NODE, n);
  return LONG2NUM(n->nd_state);
}