Class: Y2R::AST::YCP::YCPCode
- Inherits:
-
Node
- Object
- OpenStruct
- Node
- Y2R::AST::YCP::YCPCode
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, #needs_copy?, #never_nil?, #optimize_last_statement, #optimize_next, #optimize_return, #remove_duplicate_imports, transfers_comments
Instance Method Details
#compile(context) ⇒ Object
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
|
# File 'lib/y2r/ast/ycp.rb', line 2047
def compile(context)
Ruby::MethodCall.new(
:receiver => nil,
:name => "lambda",
:args => [],
:block => Ruby::Block.new(
:args => [],
:statements => child.compile(context)
),
:parens => true
)
end
|
#compile_as_block(context) ⇒ Object
2060
2061
2062
2063
2064
2065
2066
2067
|
# File 'lib/y2r/ast/ycp.rb', line 2060
def compile_as_block(context)
context.inside self do |inner_context|
Ruby::Block.new(
:args => args.map { |a| a.compile(inner_context) },
:statements => child.compile(inner_context)
)
end
end
|
#creates_local_scope? ⇒ Boolean
2043
2044
2045
|
# File 'lib/y2r/ast/ycp.rb', line 2043
def creates_local_scope?
true
end
|