提交 327ea4d3 编写于 作者: J Justin Collins

Add Sexp methods for Ruby2Ruby

for the very few times the original Sexp `method_missing`
behavior is expected
上级 35f9cdb1
......@@ -35,12 +35,26 @@ class Sexp
self[0] = type
end
#Don't use this, please.
#:nodoc:
def resbody delete = false
#RubyParser relies on method_missing for this, but since we don't want to use
#method_missing, here's a real method.
#RubyParser and Ruby2Ruby rely on method_missing for this, but since we
#don't want to use method_missing, here's a real method.
find_node :resbody, delete
end
#Don't use this, please.
#:nodoc:
def lasgn delete = false
find_node :lasgn, delete
end
#Don't use this, please.
#:nodoc:
def iasgn delete = false
find_node :iasgn, delete
end
alias :node_type :sexp_type
alias :values :sexp_body # TODO: retire
......@@ -304,13 +318,16 @@ class Sexp
# s(:block, s(:lvar, :y), s(:call, nil, :z, s(:arglist))))
# ^-------------------- block --------------------------^
def block
expect :iter, :call_with_block, :scope
expect :iter, :call_with_block, :scope, :resbody
case self.node_type
when :iter, :call_with_block
self[3]
when :scope
self[1]
when :resbody
#This is for Ruby2Ruby ONLY
find_node :block
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册