opal-optimizer 0.1.5 → 0.1.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: 125dd4183eebeaf54651e1888dc9e662693e8f20c0b60f65a5f8dd132475033b
4
- data.tar.gz: c8b571477260698fef8d6acbbf1914b2772dcb4c413916eeeff071d38fd3afd2
3
+ metadata.gz: 6498304a0ea20dac60d150ea41df0876ade32476a48a489daca24396686de528
4
+ data.tar.gz: e453ead6b82eedb0fd1c03fc38cd2de64a5d1ceda31a55a541e83f50b9ed76d8
5
5
  SHA512:
6
- metadata.gz: 64ca3cc44bce614557ae951e1b1b2d8bc57821d358ea6263a0cf9f587278af9c7150326706eb26f6194265814587c5b58899adf3a0a75f6af9d730611b3f70aa
7
- data.tar.gz: ad54442d22a1a162e0d18371890c0dd7d1f15f80ecb1bc83741368b2c315eea3e657b5cae1960621923895c5ea9ae3046634cc7f62baf4a729c7616f26599a59
6
+ metadata.gz: bcbf6fb6a5f209e3cea950be73637504ce830c16a9ef8e7402156b64d82e8905c6406a12e0acbc52feb2a1770a4f869ca1c52b78c6f08b590c6c64df94d7c9c7
7
+ data.tar.gz: 941e429601ce081347bad1179f152f0dd5aa0f3b20374cf683e021ca1c00e5e078cd63e44476af127fcc8d21eb0f34b35c605df5ae9a129c2e28c3917c970a59
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.1.6
2
+
3
+ * Further Opal 1.4 compatibility
4
+
1
5
  ## v0.1.5
2
6
 
3
7
  * Opal 1.4 compatibility
@@ -12,7 +12,7 @@ class CollapseStubs < Step
12
12
  nodes = corelib_calls["add_stubs"] || []
13
13
  nodes.each do |node|
14
14
  if opal_version >= 1.4
15
- stubs += node.arguments.value.first.value[1..-2].split(',')
15
+ stubs += node.arguments.value.first.value[1..-2].split(',').map(&"$".method(:+))
16
16
  else
17
17
  stubs += node.arguments.value.first.value.map do |i|
18
18
  i.value.value.gsub(/['"]/, '')
@@ -29,12 +29,13 @@ class CollapseStubs < Step
29
29
 
30
30
  stubs -= ["$respond_to_missing?"] if opal_version >= 1.1
31
31
 
32
- new_stub_code = <<~end
32
+
33
+ new_stub_code = <<~JAVASCRIPT
33
34
  var stubs = '#{stubs.to_a.join(',')}'.split(','), stubs_obj = {};
34
35
  for (var i = 0; i < stubs.length; i++)
35
36
  stubs_obj[stubs[i]] = {value: Opal.stub_for(stubs[i]), enumerable: false, configurable: true, writable: true};
36
37
  Object.defineProperties(Opal.BasicObject.$$prototype, stubs_obj);
37
- end
38
+ JAVASCRIPT
38
39
 
39
40
  new_stub_code = parse_js(new_stub_code)
40
41
 
@@ -15,7 +15,7 @@ class TreeShaking < Step
15
15
  corelib_calls["udef"] +
16
16
  aliases.keys
17
17
 
18
- method_calls = Set.new
18
+ method_calls = Set.new(['$method_missing'])
19
19
 
20
20
  method_calls += ( function_calls + exports.function_calls ).map do |i|
21
21
  out = if i.value_path?(DotAccessorNode) && i.value.accessor.start_with?("$")
@@ -25,7 +25,11 @@ class TreeShaking < Step
25
25
  i.value.accessor.value[1] == '$'
26
26
  i.value.accessor.value[1..-2]
27
27
  elsif i.value_path?(ResolveNode, ->(i) { %w[$send $send2 $refined_send].include? i })
28
- old = i.arguments.value[1]
28
+ if i.value.value == '$send'
29
+ old = i.arguments.value[1]
30
+ else
31
+ old = i.arguments.value[2]
32
+ end
29
33
  "$" + old.value[1..-2] if StringNode === old
30
34
  end
31
35
 
@@ -80,7 +84,7 @@ class TreeShaking < Step
80
84
  if opal_version >= 1.4
81
85
  stubs = stubcall.arguments.value.first.value
82
86
  new_stubs = stubs[1..-2].split(",").reject do |i|
83
- removed.include? i
87
+ removed.include? i[1..-1]
84
88
  end.join(',')
85
89
  new_stubs = "'#{new_stubs}'"
86
90
  stubs.replace(new_stubs)
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  class Optimizer
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-optimizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - hmdne