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 +4 -4
- data/lib/ruby2js/converter/block.rb +4 -1
- data/lib/ruby2js/converter/for.rb +2 -0
- data/lib/ruby2js/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0642705b39074ff92874d78f9fdb9924c5c8b0b88eb24a0c95577fe0ad17d159
|
4
|
+
data.tar.gz: 3d54c465d6fac6aa8e3d1a4f91ef30efde89b6da16ecfe2b5ff263e782cb4107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 (
|
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
|
data/lib/ruby2js/version.rb
CHANGED