Sha256: 4f3302e6617f1bd664538aff776aa607ed923a06abb0751bda362dd316e352f0

Contents?: true

Size: 404 Bytes

Versions: 4

Compression:

Stored size: 404 Bytes

Contents

module Ruby2JS
  class Converter

    # (cvar :@@a)

    handle :cvar do |var|
      prefix = es2020 ? '#' : '_'

      @class_name ||= nil
      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby2js-3.2.0 lib/ruby2js/converter/cvar.rb
ruby2js-3.1.2 lib/ruby2js/converter/cvar.rb
ruby2js-3.1.1 lib/ruby2js/converter/cvar.rb
ruby2js-3.1.0 lib/ruby2js/converter/cvar.rb