ruby2js 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96bf18688d1c3a685449b4e8404cb6a8c13f989031c61f950bfb69e5adf7855f
4
- data.tar.gz: 39abc46c793667b6b3bd502986ad0aec2dd8f912eca79d94d870095a5d0aeb64
3
+ metadata.gz: 0642705b39074ff92874d78f9fdb9924c5c8b0b88eb24a0c95577fe0ad17d159
4
+ data.tar.gz: 3d54c465d6fac6aa8e3d1a4f91ef30efde89b6da16ecfe2b5ff263e782cb4107
5
5
  SHA512:
6
- metadata.gz: 70a47951f48b3a389c497f393eb9a112e5b702f006efb3191fa7c99a36d7cd44dade1baef64925951a4c9158a2d7e3b2f5e27e24d03c4502c00af9056b0a1779
7
- data.tar.gz: 1f785124a3ad1dea8028f29c728953396eb7e2b34d51d8fdd634cffada1d63f574a21132a11337a3d08aff693668ef33132fe74f743a02f37c299027d8e017b9
6
+ metadata.gz: 2326276154512d96949008e6641c8648bc6951aede05a47e46d584657775bd0f0bc31630cdd07fddc78ab427a75dc6dbebea2c4df9f074ceb060fbd4bc768d16
7
+ data.tar.gz: 6b67057f75008f7219f052c2ddf24250bc966bdebabc92634cd2cec050b02b878c919802db7d1728a70657e5ca36d1b3b3f89d5981791b0cfdfceea78e1a5c6c
@@ -16,13 +16,15 @@ module Ruby2JS
16
16
  [:irange, :erange].include? call.children.first.children.first.type
17
17
  then
18
18
  begin
19
+ vars = @vars.dup
19
20
  next_token, @next_token = @next_token, :continue
20
21
 
21
22
  # convert combinations of range, step and block to a for loop
22
23
  var = args.children.first
23
24
  expression = call.children.first.children.first
24
25
  comp = (expression.type == :irange ? '<=' : '<')
25
- put "for (var "; parse var; put " = "; parse expression.children.first
26
+ put "for (#{es2015 ? 'let' : 'var'} ";
27
+ parse var; put " = "; parse expression.children.first
26
28
  put "; "; parse var;
27
29
  if call.children[2].type == :int and call.children[2].children[0] < 0
28
30
  put " #{comp.sub('<', '>')} "; parse expression.children.last
@@ -37,6 +39,7 @@ module Ruby2JS
37
39
  sput "}"
38
40
  ensure
39
41
  @next_token = next_token
42
+ @vars = vars
40
43
  end
41
44
 
42
45
  elsif
@@ -11,6 +11,7 @@ module Ruby2JS
11
11
 
12
12
  handle :for, :for_of do |var, expression, block|
13
13
  begin
14
+ vars = @vars.dup
14
15
  next_token, @next_token = @next_token, :continue
15
16
  put "for (#{es2015 ? 'let' : 'var'} "; parse var
16
17
  if [:irange, :erange].include? expression.type
@@ -23,6 +24,7 @@ module Ruby2JS
23
24
  puts ') {'; scope block; sput '}'
24
25
  ensure
25
26
  @next_token = next_token
27
+ @vars = vars
26
28
  end
27
29
  end
28
30
  end
@@ -2,7 +2,7 @@ module Ruby2JS
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2js
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby