ruby2js 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df66ef5836777a349c4f702cb4482631c3260f95f82d2f292ae914dfc9de5d86
4
- data.tar.gz: 6d4d513cdc4130c3e2a1af390441fd8e0642dd74b331498e4ab60799965c072b
3
+ metadata.gz: 2cdffdc5d823c8e1c36abf924de9f8a489508a5c472b5ac0dd11c42f14dfa7e1
4
+ data.tar.gz: bfa2a41e9865fef31f7502ab1027f5486103434050aec92d3fe4d6044d165d52
5
5
  SHA512:
6
- metadata.gz: b6b1f96c9e312700bd774f1d6344c21f67c48da1a9fea50f927ade02910541c56aa31fab988bd9a9e16a136e7112cbc830bfdda80bfa6486f5015e9a2edcf360
7
- data.tar.gz: 4b151db4cfe119e206ef46ac89b870754a531e67cf6b6026aec4d1639563220079db3d37d3b95e2070bb8d0c4f8bfdeead16bcb76f10d2a593d6fa4b7de224b3
6
+ metadata.gz: ce19f04471f515a27d5cd13fb8beea734fb88246efe03a7ac746e29b07a96696afc5751de9d5f73f0d81d761de7bd8d853197e7d0ce7ce68eab0796524f2b222
7
+ data.tar.gz: 70080cf83c65cfe8d8c6aaa6067ae191df714dfe838977e5be50902624f4e516a680ee0459fcdd8d7274834e29841df5ec592e6ee31dfe990dea305f457c1707
data/README.md CHANGED
@@ -622,6 +622,14 @@ conversions are made by the `functions` filter:
622
622
  * `.entries()` becomes `Object.entries()`
623
623
  * `.each_pair {}` becomes `for (let [key, value] of Object.entries()) {}'
624
624
 
625
+ async support:
626
+
627
+ * `async def` becomes `async function`
628
+ * `async lambda` becomes `async =>`
629
+ * `async proc` becomes `async =>`
630
+ * `async ->` becomes `async =>`
631
+ * `foo bar, async do...end` becomes `foo(bar, async () => {})`
632
+
625
633
  ES2018 support
626
634
  ---
627
635
 
@@ -9,6 +9,11 @@ module Ruby2JS
9
9
 
10
10
  handle :block do |call, args, block|
11
11
 
12
+ if es2017 and call.children.last == s(:send, nil, :async)
13
+ return parse call.updated(nil, [*call.children[0..-2],
14
+ s(:send, nil, :async, s(:block, s(:send, nil, :proc), args, block))])
15
+ end
16
+
12
17
  if \
13
18
  @state == :statement and args.children.length == 1 and
14
19
  call.children.first and call.children.first.type == :begin and
@@ -355,7 +355,7 @@ module Ruby2JS
355
355
  end
356
356
 
357
357
  split = buffer.source[0...pos].split("\n")
358
- vlq row, col, source_index, split.length-1, split.last.to_s.length
358
+ vlq row, col, source_index, [split.length - 1, 0].max, split.last.to_s.length
359
359
  end
360
360
  col += token.length
361
361
  end
@@ -1,7 +1,7 @@
1
1
  module Ruby2JS
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
- MINOR = 4
4
+ MINOR = 5
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
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.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-21 00:00:00.000000000 Z
11
+ date: 2020-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser