Sha256: d02f09e204b3af28ac2c915ba9ab953d638d2fdec73d4585dd9663494b0288eb

Contents?: true

Size: 435 Bytes

Versions: 7

Compression:

Stored size: 435 Bytes

Contents

module Ruby2JS
  class Converter

    # (op-asgn
    #   (lvasgn :a) :+
    #   (int 1))

    handle :op_asgn do |var, op, value|
      if [:+, :-].include?(op) and value.type==:int and value.children==[1]
        if @state == :statement
          "#{ parse var }#{ op }#{ op }"
        else
          "#{ op }#{ op }#{ parse var }"
        end
      else
        "#{ parse var } #{ op }= #{ parse value }"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ruby2js-1.2.0 lib/ruby2js/converter/opasgn.rb
ruby2js-1.1.5 lib/ruby2js/converter/opasgn.rb
ruby2js-1.1.4 lib/ruby2js/converter/opasgn.rb
ruby2js-1.1.3 lib/ruby2js/converter/opasgn.rb
ruby2js-1.1.2 lib/ruby2js/converter/opasgn.rb
ruby2js-1.1.1 lib/ruby2js/converter/opasgn.rb
ruby2js-1.1.0 lib/ruby2js/converter/opasgn.rb