Sha256: db6771bba1dc75c7d7121c71219b0e5009f7f032387199d5b5204e70e9d05b21

Contents?: true

Size: 301 Bytes

Versions: 8

Compression:

Stored size: 301 Bytes

Contents

module Ruby2JS
  class Converter

    # (defined? :@a)

    # (undefined? :@a)

    # NOTE: undefined is not produced directly by Parser

    handle :defined?, :undefined? do |var|
      op = (@ast.type == :defined? ? "!==" : "===")
      "typeof #{ parse var } #{ op } 'undefined'"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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