Sha256: ba2bae004b085a491569bf5aafb3210f6d19d2e52a5e7eadc255168ca2ee8fa1
Contents?: true
Size: 956 Bytes
Versions: 12
Compression:
Stored size: 956 Bytes
Contents
module Ruby2JS class Converter # (block # (send nil :x) # (args # (arg :a)) # (lvar :a)) handle :block do |call, args, block| if @state == :statement and args.children.length == 1 and call.children.first and call.children.first.type == :begin and [:irange, :erange].include? call.children.first.children.first.type then var = args.children.first expression = call.children.first.children.first comp = (expression.type == :irange ? '<=' : '<') "for (var #{parse var} = #{ parse expression.children.first }; " + "#{ parse var } #{ comp } #{ parse expression.children.last }; " + "#{ parse var } += #{ parse call.children[2] }) " + "{#@nl#{ scope block }#@nl}" else block ||= s(:begin) function = s(:def, nil, args, block) parse s(:send, *call.children, function) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems