Class: PreUnifier
- Inherits:
-
SexpProcessor
- Object
- SexpProcessor
- PreUnifier
- Defined in:
- lib/doppelganger/unified_ruby.rb
Instance Method Summary collapse
-
#initialize ⇒ PreUnifier
constructor
A new instance of PreUnifier.
- #rewrite_call(exp) ⇒ Object
- #rewrite_fcall(exp) ⇒ Object
Constructor Details
#initialize ⇒ PreUnifier
Returns a new instance of PreUnifier.
318 319 320 321 |
# File 'lib/doppelganger/unified_ruby.rb', line 318 def initialize super @unsupported.delete :newline end |
Instance Method Details
#rewrite_call(exp) ⇒ Object
323 324 325 326 327 |
# File 'lib/doppelganger/unified_ruby.rb', line 323 def rewrite_call exp exp << s(:arglist) if exp.size < 4 exp.last[0] = :arglist if exp.last.first == :array exp end |
#rewrite_fcall(exp) ⇒ Object
329 330 331 332 333 334 335 336 337 |
# File 'lib/doppelganger/unified_ruby.rb', line 329 def rewrite_fcall exp exp << s(:arglist) if exp.size < 3 if exp[-1][0] == :array then has_splat = exp[-1].find { |s| Array === s && s.first == :splat } exp[-1] = s(:arglist, exp[-1]) if has_splat exp[-1][0] = :arglist end exp end |