Class: PreUnifier

Inherits:
SexpProcessor
  • Object
show all
Defined in:
lib/unified_ruby.rb

Instance Method Summary collapse

Constructor Details

#initializePreUnifier

Returns a new instance of PreUnifier.



381
382
383
384
# File 'lib/unified_ruby.rb', line 381

def initialize
  super
  @unsupported.delete :newline
end

Instance Method Details

#rewrite_call(exp) ⇒ Object



386
387
388
389
390
# File 'lib/unified_ruby.rb', line 386

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



392
393
394
395
396
397
398
399
400
# File 'lib/unified_ruby.rb', line 392

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