Class: Y2R::AST::YCP::UnspecBlock
- Inherits:
-
Node
- Object
- OpenStruct
- Node
- Y2R::AST::YCP::UnspecBlock
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
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
|
# File 'lib/y2r/ast/ycp.rb', line 1921
def compile(context)
context.inside self do |inner_context|
Ruby::MethodCall.new(
:receiver => nil,
:name => "lambda",
:args => [],
:block => Ruby::Block.new(
:args => [],
:statements => Ruby::Statements.new(
:statements => optimize_next(
statements.map { |s| s.compile(inner_context) }
)
)
),
:parens => true
)
end
end
|
#compile_as_block(context) ⇒ Object
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
|
# File 'lib/y2r/ast/ycp.rb', line 1940
def compile_as_block(context)
context.inside self do |inner_context|
Ruby::Block.new(
:args => args.map { |a| a.compile(inner_context) },
:statements => Ruby::Statements.new(
:statements => optimize_next(
statements.map { |s| s.compile(inner_context) }
)
)
)
end
end
|
#creates_local_scope? ⇒ Boolean
1917
1918
1919
|
# File 'lib/y2r/ast/ycp.rb', line 1917
def creates_local_scope?
true
end
|