Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add Sexp methods for Ruby2Ruby

for the very few times the original Sexp `method_missing`
behavior is expected
  • Loading branch information...
commit 327ea4d3e72fd78e5343e25f28b5ce6ed0aeacd6 1 parent 35f9cdb
@presidentbeef authored
Showing with 20 additions and 3 deletions.
  1. +20 −3 lib/ruby_parser/bm_sexp.rb
View
23 lib/ruby_parser/bm_sexp.rb
@@ -35,12 +35,26 @@ def node_type= type
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 @@ def block_call
# 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
Please sign in to comment.
Something went wrong with that request. Please try again.