ruby2js 3.0.6 → 3.0.7

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: 0642705b39074ff92874d78f9fdb9924c5c8b0b88eb24a0c95577fe0ad17d159
4
- data.tar.gz: 3d54c465d6fac6aa8e3d1a4f91ef30efde89b6da16ecfe2b5ff263e782cb4107
3
+ metadata.gz: b1f6b8ccdda1317ddb72ca731897a87304b28925ed71647ce4904b05fc18daeb
4
+ data.tar.gz: 4a71dd298b6c4f202036b4232b0d230617c75cea380e1f225e3869040daade3d
5
5
  SHA512:
6
- metadata.gz: 2326276154512d96949008e6641c8648bc6951aede05a47e46d584657775bd0f0bc31630cdd07fddc78ab427a75dc6dbebea2c4df9f074ceb060fbd4bc768d16
7
- data.tar.gz: 6b67057f75008f7219f052c2ddf24250bc966bdebabc92634cd2cec050b02b878c919802db7d1728a70657e5ca36d1b3b3f89d5981791b0cfdfceea78e1a5c6c
6
+ metadata.gz: 10dd9756d3f8349b0fdb944d7a3dc2202c3cd57f23782aba500a68c02f8a5cc70a2a2c9f4dc9e5725a4bba06a45fb326ab6cdb5604aefb5ec6a397a34b10bc99
7
+ data.tar.gz: 1fbb8a1e87b2215f4303718b39de422584af3e10134ae85260db649a8ddbb094edcfe7585667fc4a9cadcbf6e74939861f492bfccdce1c44c39746275f7369b4
@@ -39,7 +39,7 @@ module Ruby2JS
39
39
  sput "}"
40
40
  ensure
41
41
  @next_token = next_token
42
- @vars = vars
42
+ @vars = vars if es2015
43
43
  end
44
44
 
45
45
  elsif
@@ -95,7 +95,7 @@ module Ruby2JS
95
95
  put '('; parse args; put ') => '
96
96
 
97
97
  expr = body
98
- expr = expr.children.first if expr.type == :autoreturn
98
+ expr = expr.children.first while expr.type == :autoreturn
99
99
  while expr.type == :begin and expr.children.length == 1
100
100
  expr = expr.children.first
101
101
  end
@@ -143,7 +143,7 @@ module Ruby2JS
143
143
  mark = output_location
144
144
  scope body, vars
145
145
  if @block_this and @block_depth == 1
146
- insert mark, "var self = this#{@sep}"
146
+ insert mark, "#{es2015 ? 'let' : 'var'} self = this#{@sep}"
147
147
  @block_this = false
148
148
  end
149
149
 
@@ -24,7 +24,7 @@ module Ruby2JS
24
24
  puts ') {'; scope block; sput '}'
25
25
  ensure
26
26
  @next_token = next_token
27
- @vars = vars
27
+ @vars = vars if es2015
28
28
  end
29
29
  end
30
30
  end
@@ -11,7 +11,10 @@ module Ruby2JS
11
11
  prototype, @prototype = @prototype, true
12
12
  mark = output_location
13
13
  parse(expr)
14
- insert mark, "var self = this#{@sep}" if @block_this
14
+
15
+ if @block_this
16
+ insert mark, "#{es2015 ? 'let' : 'var'} self = this#{@sep}"
17
+ end
15
18
  ensure
16
19
  @prototype = prototype
17
20
  @block_this, @block_depth = nil, nil
@@ -2,7 +2,7 @@ module Ruby2JS
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 6
5
+ TINY = 7
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2js
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-06 00:00:00.000000000 Z
11
+ date: 2018-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  requirements: []
132
132
  rubyforge_project:
133
- rubygems_version: 2.7.6
133
+ rubygems_version: 2.7.4
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: Minimal yet extensible Ruby to JavaScript conversion.