Sha256: b974663cef965acdefa86ffbb3e38fb9e097d66bf9b44f9f527bee70220f5221
Contents?: true
Size: 976 Bytes
Versions: 7
Compression:
Stored size: 976 Bytes
Contents
module Ruby2JS class Converter # (defs (self) :foo # (args) # (...) # NOTE: defp is only produced by filters handle :defs, :defp do |target, method, args, body| parse transform_defs(target, method, args, body) end def transform_defs(target, method, args, body) if not @ast.is_method? or @ast.type == :defp node = s(:prop, target, method.to_s => {enumerable: s(:true), configurable: s(:true), get: s(:block, s(:send, nil, :proc), args, s(:autoreturn, body))}) elsif method =~ /=$/ node = s(:prop, target, method.to_s.sub('=', '') => {enumerable: s(:true), configurable: s(:true), set: s(:block, s(:send, nil, :proc), args, body)}) else node = s(:send, target, "#{method}=", s(:block, s(:send, nil, :lambda), args, body)) end @comments[node] = @comments[@ast] if @comments[@ast] node end end end
Version data entries
7 entries across 7 versions & 1 rubygems