Sha256: 58bf4f9dbd7270436311dab85ffd403cb4b50de9ed07cecb3cecf7ba865d9657

Contents?: true

Size: 552 Bytes

Versions: 28

Compression:

Stored size: 552 Bytes

Contents

module Ruby2JS
  class Converter

    # (cvasgn :@@a
    #   (int 1))

    handle :cvasgn do |var, expression=nil|
      multi_assign_declarations if @state == :statement

      prefix = underscored_private ? '_' : '#$'

      if @class_name
        parse @class_name
        put var.to_s.sub('@@', ".#{prefix}")
      elsif @prototype
        put var.to_s.sub('@@', "this.#{prefix}")
      else
        put var.to_s.sub('@@', "this.constructor.#{prefix}")
      end

      if expression
        put " = "; parse expression
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ruby2js-4.0.0 lib/ruby2js/converter/cvasgn.rb
ruby2js-3.6.1 lib/ruby2js/converter/cvasgn.rb
ruby2js-3.6.0 lib/ruby2js/converter/cvasgn.rb
ruby2js-3.5.3 lib/ruby2js/converter/cvasgn.rb
ruby2js-3.5.2 lib/ruby2js/converter/cvasgn.rb
ruby2js-3.5.1 lib/ruby2js/converter/cvasgn.rb
ruby2js-3.5.0 lib/ruby2js/converter/cvasgn.rb
ruby2js-3.4.0 lib/ruby2js/converter/cvasgn.rb