Class: CodeTools::AST::SendPrivately

Inherits:
Send
  • Object
show all
Defined in:
lib/rubinius/code/ast/transforms.rb

Overview

Handles Rubinius.privately

Instance Attribute Summary

Attributes inherited from Send

#block, #name, #privately, #receiver, #variable, #vcall_style

Attributes inherited from Node

#line

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Send

#arguments_sexp, #check_local_reference, #defined, #initialize, #receiver_sexp, #sexp_name, #to_sexp, #value_defined

Methods inherited from Node

#ascii_graph, #attributes, #children, #defined, #initialize, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, #to_sexp, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk

Constructor Details

This class inherits a constructor from CodeTools::AST::Send

Class Method Details

.match?(line, receiver, name, arguments, privately) ⇒ Boolean

Returns:

  • (Boolean)


217
218
219
220
221
# File 'lib/rubinius/code/ast/transforms.rb', line 217

def self.match?(line, receiver, name, arguments, privately)
  if match_send? receiver, :Rubinius, name, :privately
    new line, receiver, name, privately
  end
end

Instance Method Details

#block=(iter) ⇒ Object



223
224
225
# File 'lib/rubinius/code/ast/transforms.rb', line 223

def block=(iter)
  @block = iter.body
end

#bytecode(g) ⇒ Object



238
239
240
241
242
243
# File 'lib/rubinius/code/ast/transforms.rb', line 238

def bytecode(g)
  map_sends

  pos(g)
  @block.bytecode(g)
end

#map_sendsObject



227
228
229
230
231
232
233
234
235
236
# File 'lib/rubinius/code/ast/transforms.rb', line 227

def map_sends
  walk do |result, node|
    case node
    when Send, SendWithArguments
      node.privately = true
    end

    result
  end
end