Class: Y2R::AST::YCP::DefBlock

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

Instance Method Summary collapse

Methods inherited from Node

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

Instance Method Details

#always_returns?Boolean

Returns:

  • (Boolean)


1178
1179
1180
# File 'lib/y2r/ast/ycp.rb', line 1178

def always_returns?
  statements.any? { |s| s.always_returns? }
end

#compile(context) ⇒ Object



1168
1169
1170
1171
1172
1173
1174
1175
1176
# File 'lib/y2r/ast/ycp.rb', line 1168

def compile(context)
  context.inside self do |inner_context|
    Ruby::Statements.new(
      :statements => optimize_return(
        compile_statements_with_whitespace(statements, inner_context)
      )
    )
  end
end

#creates_local_scope?Boolean

Returns:

  • (Boolean)


1164
1165
1166
# File 'lib/y2r/ast/ycp.rb', line 1164

def creates_local_scope?
  true
end