Class: Y2R::AST::YCP::YEBracket

Inherits:
Node
  • Object
show all
Defined in:
lib/y2r/ast/ycp.rb

Instance Method Summary collapse

Methods inherited from Node

#always_returns?, #compile_as_copy_if_needed, #compile_statements, #compile_statements_inside_block, #compile_statements_with_whitespace, #creates_local_scope?, #needs_copy?, #never_nil?, #optimize_last_statement, #optimize_next, #optimize_return, #remove_duplicate_imports, transfers_comments

Instance Method Details

#compile(context) ⇒ Object



2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
# File 'lib/y2r/ast/ycp.rb', line 2144

def compile(context)
  args, block = build_args_and_block(context)

  Ruby::MethodCall.new(
    :receiver => Ruby::Variable.new(:name => "Ops"),
    :name     => "get",
    :args     => args,
    :block    => block,
    :parens   => true
  )
end

#compile_as_shortcut(type, context) ⇒ Object



2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
# File 'lib/y2r/ast/ycp.rb', line 2156

def compile_as_shortcut(type, context)
  args, block = build_args_and_block(context)

  Ruby::MethodCall.new(
    :receiver => Ruby::Variable.new(:name => "Ops"),
    :name     => "get_#{type}",
    :args     => args,
    :block    => block,
    :parens   => true
  )
end