opal 1.4.1 → 1.5.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +5 -3
  3. data/.rubocop.yml +1 -0
  4. data/UNRELEASED.md +37 -2
  5. data/benchmark-ips/bm_js_symbols_vs_strings.rb +39 -14
  6. data/docs/releasing.md +10 -2
  7. data/lib/opal/ast/matcher.rb +77 -0
  8. data/lib/opal/cache.rb +1 -1
  9. data/lib/opal/cli_runners/applescript.rb +2 -0
  10. data/lib/opal/compiler.rb +18 -9
  11. data/lib/opal/nodes/call.rb +73 -28
  12. data/lib/opal/nodes/def.rb +31 -27
  13. data/lib/opal/nodes/definitions.rb +2 -0
  14. data/lib/opal/nodes/helpers.rb +4 -23
  15. data/lib/opal/nodes/if.rb +222 -0
  16. data/lib/opal/nodes/iter.rb +41 -37
  17. data/lib/opal/nodes/literal.rb +2 -2
  18. data/lib/opal/nodes/masgn.rb +15 -17
  19. data/lib/opal/nodes/node_with_args/shortcuts.rb +100 -0
  20. data/lib/opal/nodes/node_with_args.rb +1 -0
  21. data/lib/opal/nodes/top.rb +26 -10
  22. data/lib/opal/nodes.rb +0 -1
  23. data/lib/opal/parser/default_config.rb +3 -2
  24. data/lib/opal/repl.rb +1 -1
  25. data/lib/opal/rewriter.rb +13 -6
  26. data/lib/opal/rewriters/base.rb +12 -1
  27. data/lib/opal/rewriters/rubyspec/filters_rewriter.rb +1 -0
  28. data/lib/opal/version.rb +1 -1
  29. data/opal/corelib/array.rb +23 -28
  30. data/opal/corelib/binding.rb +14 -4
  31. data/opal/corelib/constants.rb +3 -3
  32. data/opal/corelib/hash.rb +2 -2
  33. data/opal/corelib/irb.rb +192 -0
  34. data/opal/corelib/math/polyfills.rb +127 -0
  35. data/opal/corelib/math.rb +14 -194
  36. data/opal/corelib/module.rb +23 -25
  37. data/opal/corelib/number.rb +63 -14
  38. data/opal/corelib/regexp.rb +2 -0
  39. data/opal/corelib/runtime.js +56 -20
  40. data/opal/corelib/string.rb +38 -59
  41. data/opal/corelib/time.rb +106 -68
  42. data/opal/opal/full.rb +0 -1
  43. data/opal/opal.rb +4 -1
  44. data/spec/filters/bugs/date.rb +0 -3
  45. data/spec/filters/bugs/datetime.rb +65 -0
  46. data/spec/filters/bugs/float.rb +0 -18
  47. data/spec/filters/bugs/hash.rb +0 -2
  48. data/spec/filters/bugs/language.rb +0 -3
  49. data/spec/filters/bugs/marshal.rb +0 -1
  50. data/spec/filters/bugs/string.rb +0 -30
  51. data/spec/filters/bugs/time.rb +18 -8
  52. data/spec/lib/cli_spec.rb +2 -2
  53. data/spec/lib/compiler_spec.rb +8 -8
  54. data/spec/lib/rewriters/base_spec.rb +1 -1
  55. data/spec/lib/rewriters/binary_operator_assignment_spec.rb +34 -59
  56. data/spec/lib/rewriters/block_to_iter_spec.rb +3 -6
  57. data/spec/lib/rewriters/dot_js_syntax_spec.rb +2 -5
  58. data/spec/lib/rewriters/for_rewriter_spec.rb +0 -1
  59. data/spec/lib/rewriters/forward_args_spec.rb +2 -3
  60. data/spec/lib/rewriters/js_reserved_words_spec.rb +2 -15
  61. data/spec/lib/rewriters/logical_operator_assignment_spec.rb +64 -89
  62. data/spec/lib/rewriters/numblocks_spec.rb +3 -5
  63. data/spec/lib/rewriters/opal_engine_check_spec.rb +2 -14
  64. data/spec/lib/rewriters/rubyspec/filters_rewriter_spec.rb +10 -2
  65. data/spec/opal/compiler/irb_spec.rb +4 -0
  66. data/spec/opal/core/language/super_spec.rb +26 -0
  67. data/spec/opal/core/regexp/assertions_spec.rb +19 -0
  68. data/spec/opal/core/string/to_proc_spec.rb +19 -0
  69. data/spec/ruby_specs +4 -0
  70. data/spec/support/rewriters_helper.rb +43 -23
  71. data/stdlib/date/date_time.rb +71 -0
  72. data/stdlib/date/formatters.rb +28 -0
  73. data/stdlib/date/infinity.rb +73 -0
  74. data/stdlib/date.rb +77 -214
  75. data/stdlib/opal/repl_js.rb +1 -1
  76. data/stdlib/{opal/replutils.rb → opal-replutils.rb} +3 -3
  77. data/stdlib/time.rb +39 -2
  78. data/stdlib/uri.rb +53 -0
  79. data/tasks/performance/asciidoctor_test.rb.erb +3 -1
  80. data/tasks/performance/optimization_status.rb +3 -2
  81. data/tasks/performance.rake +69 -35
  82. data/tasks/testing.rake +1 -0
  83. data/test/opal/test_uri.rb +35 -0
  84. data/yarn.lock +27 -5
  85. metadata +31 -18
  86. data/lib/opal/nodes/csend.rb +0 -24
  87. data/lib/opal/rewriters/explicit_writer_return.rb +0 -59
  88. data/spec/lib/rewriters/explicit_writer_return_spec.rb +0 -186
  89. data/stdlib/nodejs/irb.rb +0 -43
@@ -2,36 +2,70 @@
2
2
 
3
3
  require 'opal/util'
4
4
 
5
- # Runs a block N times and returns a mean number of seconds it took to run it.
6
- mean_time = proc do |tries: 31, &block|
7
- tries.times.map do
8
- t = Time.now
9
- block.()
10
- Time.now - t
11
- end.sort[tries/2]
12
- end
5
+ class Timing
6
+ def initialize(tries: 31, &block)
7
+ @tries = tries
8
+ @times = tries.times.map do
9
+ t = now
10
+ block.()
11
+ (now - t)
12
+ end.sort
13
+ end
14
+
15
+ def now
16
+ Process.clock_gettime Process::CLOCK_MONOTONIC, :float_microsecond
17
+ end
13
18
 
14
- failed = false
19
+ attr_reader :times, :tries
15
20
 
16
- # Mark a failure
17
- failure = proc do |reason|
18
- failed ||= []
19
- failed << reason
21
+ # Runs a block N times and returns a mean number of seconds it took to run it.
22
+ def mean_time
23
+ @times.sort[tries/2.0.floor + 1]
24
+ end
25
+
26
+ def error
27
+ m = mean_time
28
+ @times.minmax.map { |t| (m - t).abs }.max
29
+ end
30
+
31
+ def compare_to(previous, name)
32
+ current = self
33
+ percent = ->(a, b) { (a / b) * 100 }
34
+ change = percent[(current.mean_time - previous.mean_time), previous.mean_time]
35
+
36
+ puts ("%30s: %.3f (±%.2f%%) -> %.3f (±%.2f%%) (change: %+.2f%%)" % [
37
+ name,
38
+ previous.mean_time / 1_000_000.0, percent[previous.error, previous.mean_time],
39
+ current.mean_time / 1_000_000.0, percent[current.error, current.mean_time],
40
+ change
41
+ ]).gsub('.000','')
42
+
43
+ $failures << "#{name} increased by more than 5%" if change > 5.0
44
+ end
20
45
  end
21
46
 
22
- compare_values = proc do |name, current, previous|
23
- current = current.to_f
24
- previous = previous.to_f
47
+ class Size
48
+ def initialize(size)
49
+ @size = size
50
+ end
25
51
 
26
- change = ((current - previous).to_f / previous) * 100
52
+ attr_reader :size
27
53
 
28
- puts ("%30s: %.3f -> %.3f (change: %+.2f%%)" % [name, previous, current, change]).gsub('.000','')
54
+ def compare_to(previous, name)
55
+ change = 100 * (previous.size - size) / previous.size
56
+ puts ("%30s: %5.2f kB -> %5.2f kB (change: %+.2f%%)" % [
57
+ name,
58
+ previous.size / 1_000.0,
59
+ size / 1_000.0,
60
+ change,
61
+ ])
29
62
 
30
- if change > 5.0
31
- failure.("#{name} increased by more than 5%")
63
+ $failures << "#{name} increased by more than 5%" if change > 5.0
32
64
  end
33
65
  end
34
66
 
67
+ $failures = []
68
+
35
69
  ASCIIDOCTOR_REPO_BASE = ENV['ASCIIDOCTOR_REPO_BASE'] || 'https://github.com/asciidoctor'
36
70
 
37
71
  # Selected asciidoctor versions were working on Aug 19 2021, feel free to update.
@@ -71,17 +105,17 @@ performance_stat = ->(name) {
71
105
  sh("#{NODE_OPTSTATUS} > tmp/performance/optstatus_#{name}")
72
106
 
73
107
  puts "\n* Building AsciiDoctor with #{name}..."
74
- stat[:compiler_time] = mean_time.(tries: 7) { sh(ASCIIDOCTOR_BUILD_OPAL) }
108
+ stat[:compiler_time] = Timing.new(tries: 7) { sh(ASCIIDOCTOR_BUILD_OPAL) }
75
109
 
76
110
  puts "\n* Running AsciiDoctor with #{name}..."
77
- stat[:run_time] = mean_time.(tries: 63) { sh("#{ASCIIDOCTOR_RUN_OPAL} > tmp/performance/opal_result_#{name}.html") }
111
+ stat[:run_time] = Timing.new { sh("#{ASCIIDOCTOR_RUN_OPAL} > tmp/performance/opal_result_#{name}.html") }
78
112
  stat[:correct] = File.read("tmp/performance/opal_result_#{name}.html") == File.read("tmp/performance/ruby_result.html")
79
- stat[:size] = File.size("tmp/performance/asciidoctor_test.js")
113
+ stat[:size] = Size.new File.size("tmp/performance/asciidoctor_test.js")
80
114
 
81
115
  puts "\n* Minifying AsciiDoctor with #{name}..."
82
116
  source = File.read("tmp/performance/asciidoctor_test.js")
83
- stat[:min_size] = Opal::Util.uglify(source).bytesize rescue Float::INFINITY
84
- stat[:min_size_m] = Opal::Util.uglify(source, mangle: true).bytesize rescue Float::INFINITY
117
+ stat[:min_size] = Size.new Opal::Util.uglify(source).bytesize rescue Float::INFINITY
118
+ stat[:min_size_m] = Size.new Opal::Util.uglify(source, mangle: true).bytesize rescue Float::INFINITY
85
119
 
86
120
  stat
87
121
  }
@@ -121,24 +155,24 @@ namespace :performance do
121
155
  puts diff
122
156
 
123
157
  if diff_lines.grep(/^-\s+\[COMPILED\]/).count > 0
124
- failure.("Some methods are no longer compiled on V8")
158
+ $failures << "Some methods are no longer compiled on V8"
125
159
  end
126
160
 
127
161
  puts
128
162
  puts "Comparison of the Asciidoctor (a real-life Opal application) compile and run:"
129
163
 
130
- failure.("Wrong result on the current branch") unless current[:correct]
131
- failure.("Wrong result on the previous branch - ignore it") unless previous[:correct]
164
+ $failures << "Wrong result on the current branch" unless current[:correct]
165
+ $failures << "Wrong result on the previous branch - ignore it" unless previous[:correct]
132
166
 
133
- compare_values.("Compile time", current[:compiler_time], previous[:compiler_time])
134
- compare_values.("Run time", current[:run_time], previous[:run_time])
135
- compare_values.("Bundle size", current[:size], previous[:size])
136
- compare_values.("Minified bundle size", current[:min_size], previous[:min_size])
137
- compare_values.("Mangled & minified", current[:min_size_m], previous[:min_size_m])
167
+ current[:compiler_time].compare_to(previous[:compiler_time], "Compile time")
168
+ current[:run_time ].compare_to(previous[:run_time ], "Run time")
169
+ current[:size ].compare_to(previous[:size ], "Bundle size")
170
+ current[:min_size ].compare_to(previous[:min_size ], "Minified bundle size")
171
+ current[:min_size_m ].compare_to(previous[:min_size_m ], "Mangled & minified")
138
172
 
139
- if failed
173
+ if $failures.any?
140
174
  puts "--- Failures ---"
141
- failed.each do |f|
175
+ $failures.each do |f|
142
176
  puts " - #{f}"
143
177
  end
144
178
  puts
data/tasks/testing.rake CHANGED
@@ -337,6 +337,7 @@ platforms.each do |platform|
337
337
  opal/test_keyword.rb
338
338
  opal/test_base64.rb
339
339
  opal/test_openuri.rb
340
+ opal/test_uri.rb
340
341
  opal/unsupported_and_bugs.rb
341
342
  opal/test_matrix.rb
342
343
  opal/promisev2/test_always.rb
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: false
2
+
3
+ require 'uri'
4
+
5
+ module URI
6
+ class TestCommon < Test::Unit::TestCase
7
+ def test_decode_www_form
8
+ assert_equal([%w[a 1], %w[a 2]], URI.decode_www_form("a=1&a=2"))
9
+ assert_equal([%w[a 1;a=2]], URI.decode_www_form("a=1;a=2"))
10
+ assert_equal([%w[a 1], ['', ''], %w[a 2]], URI.decode_www_form("a=1&&a=2"))
11
+ assert_raise(ArgumentError){URI.decode_www_form("\u3042")}
12
+ # assert_equal([%w[a 1], ["\u3042", "\u6F22"]],
13
+ # URI.decode_www_form("a=1&%E3%81%82=%E6%BC%A2"))
14
+ # assert_equal([%w[a 1], ["\uFFFD%8", "\uFFFD"]],
15
+ # URI.decode_www_form("a=1&%E3%81%8=%E6%BC"))
16
+ assert_equal([%w[?a 1], %w[a 2]], URI.decode_www_form("?a=1&a=2"))
17
+ assert_equal([], URI.decode_www_form(""))
18
+ # assert_equal([%w[% 1]], URI.decode_www_form("%=1"))
19
+ # assert_equal([%w[a %]], URI.decode_www_form("a=%"))
20
+ # assert_equal([%w[a 1], %w[% 2]], URI.decode_www_form("a=1&%=2"))
21
+ # assert_equal([%w[a 1], %w[b %]], URI.decode_www_form("a=1&b=%"))
22
+ assert_equal([['a', ''], ['b', '']], URI.decode_www_form("a&b"))
23
+ bug4098 = '[ruby-core:33464]'
24
+ assert_equal([['a', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'], ['b', '']], URI.decode_www_form("a=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&b"), bug4098)
25
+
26
+ assert_raise(ArgumentError){ URI.decode_www_form("a=1&%82%A0=%8A%BF", "x-sjis") }
27
+ # assert_equal([["a", "1"], [s("\x82\xA0"), s("\x8a\xBF")]],
28
+ # URI.decode_www_form("a=1&%82%A0=%8A%BF", "sjis"))
29
+ # assert_equal([["a", "1"], [s("\x82\xA0"), s("\x8a\xBF")], %w[_charset_ sjis], [s("\x82\xA1"), s("\x8a\xC0")]],
30
+ # URI.decode_www_form("a=1&%82%A0=%8A%BF&_charset_=sjis&%82%A1=%8A%C0", use__charset_: true))
31
+ assert_equal([["", "isindex"], ["a", "1"]],
32
+ URI.decode_www_form("isindex&a=1", isindex: true))
33
+ end
34
+ end
35
+ end
data/yarn.lock CHANGED
@@ -445,6 +445,11 @@ combine-source-map@^0.8.0, combine-source-map@~0.8.0:
445
445
  lodash.memoize "~3.0.3"
446
446
  source-map "~0.5.3"
447
447
 
448
+ commander@^2.20.0:
449
+ version "2.20.3"
450
+ resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
451
+ integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
452
+
448
453
  concat-map@0.0.1:
449
454
  version "0.0.1"
450
455
  resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
@@ -1626,6 +1631,14 @@ source-map-support@0.5.19:
1626
1631
  buffer-from "^1.0.0"
1627
1632
  source-map "^0.6.0"
1628
1633
 
1634
+ source-map-support@~0.5.20:
1635
+ version "0.5.21"
1636
+ resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
1637
+ integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
1638
+ dependencies:
1639
+ buffer-from "^1.0.0"
1640
+ source-map "^0.6.0"
1641
+
1629
1642
  source-map@^0.6.0:
1630
1643
  version "0.6.1"
1631
1644
  resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
@@ -1636,6 +1649,11 @@ source-map@~0.5.3:
1636
1649
  resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
1637
1650
  integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
1638
1651
 
1652
+ source-map@~0.7.2:
1653
+ version "0.7.3"
1654
+ resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
1655
+ integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
1656
+
1639
1657
  sprintf-js@~1.0.2:
1640
1658
  version "1.0.3"
1641
1659
  resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
@@ -1766,6 +1784,15 @@ table@^6.0.9:
1766
1784
  string-width "^4.2.0"
1767
1785
  strip-ansi "^6.0.0"
1768
1786
 
1787
+ terser@^5.9.0:
1788
+ version "5.10.0"
1789
+ resolved "https://registry.yarnpkg.com/terser/-/terser-5.10.0.tgz#b86390809c0389105eb0a0b62397563096ddafcc"
1790
+ integrity sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA==
1791
+ dependencies:
1792
+ commander "^2.20.0"
1793
+ source-map "~0.7.2"
1794
+ source-map-support "~0.5.20"
1795
+
1769
1796
  text-table@^0.2.0:
1770
1797
  version "0.2.0"
1771
1798
  resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
@@ -1813,11 +1840,6 @@ typedarray@^0.0.6:
1813
1840
  resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
1814
1841
  integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
1815
1842
 
1816
- uglify-js@^3.7.2:
1817
- version "3.12.1"
1818
- resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.12.1.tgz#78307f539f7b9ca5557babb186ea78ad30cc0375"
1819
- integrity sha512-o8lHP20KjIiQe5b/67Rh68xEGRrc2SRsCuuoYclXXoC74AfSRGblU1HKzJWH3HxPZ+Ort85fWHpSX7KwBUC9CQ==
1820
-
1821
1843
  umd@^3.0.0:
1822
1844
  version "3.0.3"
1823
1845
  resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.3.tgz#aa9fe653c42b9097678489c01000acb69f0b26cf"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elia Schito
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-01-12 00:00:00.000000000 Z
13
+ date: 2022-04-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ast
@@ -435,6 +435,7 @@ files:
435
435
  - exe/opal-repl
436
436
  - lib/opal.rb
437
437
  - lib/opal/ast/builder.rb
438
+ - lib/opal/ast/matcher.rb
438
439
  - lib/opal/ast/node.rb
439
440
  - lib/opal/builder.rb
440
441
  - lib/opal/builder_processors.rb
@@ -530,7 +531,6 @@ files:
530
531
  - lib/opal/nodes/call_special.rb
531
532
  - lib/opal/nodes/class.rb
532
533
  - lib/opal/nodes/constants.rb
533
- - lib/opal/nodes/csend.rb
534
534
  - lib/opal/nodes/def.rb
535
535
  - lib/opal/nodes/defined.rb
536
536
  - lib/opal/nodes/definitions.rb
@@ -545,6 +545,7 @@ files:
545
545
  - lib/opal/nodes/masgn.rb
546
546
  - lib/opal/nodes/module.rb
547
547
  - lib/opal/nodes/node_with_args.rb
548
+ - lib/opal/nodes/node_with_args/shortcuts.rb
548
549
  - lib/opal/nodes/rescue.rb
549
550
  - lib/opal/nodes/scope.rb
550
551
  - lib/opal/nodes/singleton_class.rb
@@ -572,7 +573,6 @@ files:
572
573
  - lib/opal/rewriters/break_finder.rb
573
574
  - lib/opal/rewriters/dot_js_syntax.rb
574
575
  - lib/opal/rewriters/dump_args.rb
575
- - lib/opal/rewriters/explicit_writer_return.rb
576
576
  - lib/opal/rewriters/for_rewriter.rb
577
577
  - lib/opal/rewriters/forward_args.rb
578
578
  - lib/opal/rewriters/hashes/key_duplicates_rewriter.rb
@@ -621,6 +621,7 @@ files:
621
621
  - opal/corelib/hash.rb
622
622
  - opal/corelib/helpers.rb
623
623
  - opal/corelib/io.rb
624
+ - opal/corelib/irb.rb
624
625
  - opal/corelib/kernel.rb
625
626
  - opal/corelib/kernel/format.rb
626
627
  - opal/corelib/main.rb
@@ -628,6 +629,7 @@ files:
628
629
  - opal/corelib/marshal/read_buffer.rb
629
630
  - opal/corelib/marshal/write_buffer.rb
630
631
  - opal/corelib/math.rb
632
+ - opal/corelib/math/polyfills.rb
631
633
  - opal/corelib/method.rb
632
634
  - opal/corelib/module.rb
633
635
  - opal/corelib/nil.rb
@@ -674,6 +676,7 @@ files:
674
676
  - spec/filters/bugs/class.rb
675
677
  - spec/filters/bugs/complex.rb
676
678
  - spec/filters/bugs/date.rb
679
+ - spec/filters/bugs/datetime.rb
677
680
  - spec/filters/bugs/encoding.rb
678
681
  - spec/filters/bugs/enumerable.rb
679
682
  - spec/filters/bugs/enumerator.rb
@@ -776,7 +779,6 @@ files:
776
779
  - spec/lib/rewriters/binary_operator_assignment_spec.rb
777
780
  - spec/lib/rewriters/block_to_iter_spec.rb
778
781
  - spec/lib/rewriters/dot_js_syntax_spec.rb
779
- - spec/lib/rewriters/explicit_writer_return_spec.rb
780
782
  - spec/lib/rewriters/for_rewriter_spec.rb
781
783
  - spec/lib/rewriters/forward_args_spec.rb
782
784
  - spec/lib/rewriters/hashes/key_duplicates_rewriter_spec.rb
@@ -870,6 +872,7 @@ files:
870
872
  - spec/opal/core/number/to_i_spec.rb
871
873
  - spec/opal/core/number/to_s_spec.rb
872
874
  - spec/opal/core/object_id_spec.rb
875
+ - spec/opal/core/regexp/assertions_spec.rb
873
876
  - spec/opal/core/regexp/interpolation_spec.rb
874
877
  - spec/opal/core/regexp/match_spec.rb
875
878
  - spec/opal/core/runtime/bridged_classes_spec.rb
@@ -888,6 +891,7 @@ files:
888
891
  - spec/opal/core/string/gsub_spec.rb
889
892
  - spec/opal/core/string/scan_spec.rb
890
893
  - spec/opal/core/string/subclassing_spec.rb
894
+ - spec/opal/core/string/to_proc_spec.rb
891
895
  - spec/opal/core/string/to_sym_spec.rb
892
896
  - spec/opal/core/string/unpack_spec.rb
893
897
  - spec/opal/core/string_spec.rb
@@ -952,6 +956,9 @@ files:
952
956
  - stdlib/buffer/view.rb
953
957
  - stdlib/console.rb
954
958
  - stdlib/date.rb
959
+ - stdlib/date/date_time.rb
960
+ - stdlib/date/formatters.rb
961
+ - stdlib/date/infinity.rb
955
962
  - stdlib/delegate.rb
956
963
  - stdlib/dir.rb
957
964
  - stdlib/e2mmap.rb
@@ -985,7 +992,6 @@ files:
985
992
  - stdlib/nodejs/file.rb
986
993
  - stdlib/nodejs/fileutils.rb
987
994
  - stdlib/nodejs/io.rb
988
- - stdlib/nodejs/irb.rb
989
995
  - stdlib/nodejs/js-yaml-3-6-1.js
990
996
  - stdlib/nodejs/kernel.rb
991
997
  - stdlib/nodejs/node_modules/balanced-match/.npmignore
@@ -1058,11 +1064,11 @@ files:
1058
1064
  - stdlib/opal-builder.rb
1059
1065
  - stdlib/opal-parser.rb
1060
1066
  - stdlib/opal-platform.rb
1067
+ - stdlib/opal-replutils.rb
1061
1068
  - stdlib/opal-source-maps.rb
1062
1069
  - stdlib/opal/miniracer.rb
1063
1070
  - stdlib/opal/platform.rb
1064
1071
  - stdlib/opal/repl_js.rb
1065
- - stdlib/opal/replutils.rb
1066
1072
  - stdlib/open-uri.rb
1067
1073
  - stdlib/optparse.rb
1068
1074
  - stdlib/optparse/ac.rb
@@ -1094,6 +1100,7 @@ files:
1094
1100
  - stdlib/template.rb
1095
1101
  - stdlib/thread.rb
1096
1102
  - stdlib/time.rb
1103
+ - stdlib/uri.rb
1097
1104
  - stdlib/yaml.rb
1098
1105
  - tasks/benchmarking.rake
1099
1106
  - tasks/building.rake
@@ -1135,6 +1142,7 @@ files:
1135
1142
  - test/opal/test_keyword.rb
1136
1143
  - test/opal/test_matrix.rb
1137
1144
  - test/opal/test_openuri.rb
1145
+ - test/opal/test_uri.rb
1138
1146
  - test/opal/unsupported_and_bugs.rb
1139
1147
  - vendored-minitest/minitest.rb
1140
1148
  - vendored-minitest/minitest/assertions.rb
@@ -1152,10 +1160,10 @@ licenses:
1152
1160
  metadata:
1153
1161
  homepage_uri: https://opalrb.com/
1154
1162
  bug_tracker_uri: https://github.com/opal/opal/issues
1155
- changelog_uri: https://github.com/opal/opal/blob/v1.4.1/CHANGELOG.md
1156
- readme_uri: https://github.com/opal/opal/blob/v1.4.1/README.md
1157
- api_documentation_uri: http://opalrb.com/docs/api/v1.4.1/index.html
1158
- guides_uri: http://opalrb.com/docs/guides/v1.4.1/index.html
1163
+ changelog_uri: https://github.com/opal/opal/blob/v1.5.0.rc1/CHANGELOG.md
1164
+ readme_uri: https://github.com/opal/opal/blob/v1.5.0.rc1/README.md
1165
+ api_documentation_uri: http://opalrb.com/docs/api/v1.5.0.rc1/index.html
1166
+ guides_uri: http://opalrb.com/docs/guides/v1.5.0.rc1/index.html
1159
1167
  chat_uri: https://gitter.im/opal/opal
1160
1168
  source_code_uri: https://github.com/opal/opal
1161
1169
  post_install_message:
@@ -1169,11 +1177,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
1169
1177
  version: '2.3'
1170
1178
  required_rubygems_version: !ruby/object:Gem::Requirement
1171
1179
  requirements:
1172
- - - ">="
1180
+ - - ">"
1173
1181
  - !ruby/object:Gem::Version
1174
- version: '0'
1182
+ version: 1.3.1
1175
1183
  requirements: []
1176
- rubygems_version: 3.2.3
1184
+ rubygems_version: 3.3.7
1177
1185
  signing_key:
1178
1186
  specification_version: 4
1179
1187
  summary: Ruby runtime and core library for JavaScript
@@ -1372,6 +1380,7 @@ test_files:
1372
1380
  - exe/opal-repl
1373
1381
  - lib/opal.rb
1374
1382
  - lib/opal/ast/builder.rb
1383
+ - lib/opal/ast/matcher.rb
1375
1384
  - lib/opal/ast/node.rb
1376
1385
  - lib/opal/builder.rb
1377
1386
  - lib/opal/builder_processors.rb
@@ -1467,7 +1476,6 @@ test_files:
1467
1476
  - lib/opal/nodes/call_special.rb
1468
1477
  - lib/opal/nodes/class.rb
1469
1478
  - lib/opal/nodes/constants.rb
1470
- - lib/opal/nodes/csend.rb
1471
1479
  - lib/opal/nodes/def.rb
1472
1480
  - lib/opal/nodes/defined.rb
1473
1481
  - lib/opal/nodes/definitions.rb
@@ -1482,6 +1490,7 @@ test_files:
1482
1490
  - lib/opal/nodes/masgn.rb
1483
1491
  - lib/opal/nodes/module.rb
1484
1492
  - lib/opal/nodes/node_with_args.rb
1493
+ - lib/opal/nodes/node_with_args/shortcuts.rb
1485
1494
  - lib/opal/nodes/rescue.rb
1486
1495
  - lib/opal/nodes/scope.rb
1487
1496
  - lib/opal/nodes/singleton_class.rb
@@ -1509,7 +1518,6 @@ test_files:
1509
1518
  - lib/opal/rewriters/break_finder.rb
1510
1519
  - lib/opal/rewriters/dot_js_syntax.rb
1511
1520
  - lib/opal/rewriters/dump_args.rb
1512
- - lib/opal/rewriters/explicit_writer_return.rb
1513
1521
  - lib/opal/rewriters/for_rewriter.rb
1514
1522
  - lib/opal/rewriters/forward_args.rb
1515
1523
  - lib/opal/rewriters/hashes/key_duplicates_rewriter.rb
@@ -1558,6 +1566,7 @@ test_files:
1558
1566
  - opal/corelib/hash.rb
1559
1567
  - opal/corelib/helpers.rb
1560
1568
  - opal/corelib/io.rb
1569
+ - opal/corelib/irb.rb
1561
1570
  - opal/corelib/kernel.rb
1562
1571
  - opal/corelib/kernel/format.rb
1563
1572
  - opal/corelib/main.rb
@@ -1565,6 +1574,7 @@ test_files:
1565
1574
  - opal/corelib/marshal/read_buffer.rb
1566
1575
  - opal/corelib/marshal/write_buffer.rb
1567
1576
  - opal/corelib/math.rb
1577
+ - opal/corelib/math/polyfills.rb
1568
1578
  - opal/corelib/method.rb
1569
1579
  - opal/corelib/module.rb
1570
1580
  - opal/corelib/nil.rb
@@ -1613,6 +1623,9 @@ test_files:
1613
1623
  - stdlib/buffer/view.rb
1614
1624
  - stdlib/console.rb
1615
1625
  - stdlib/date.rb
1626
+ - stdlib/date/date_time.rb
1627
+ - stdlib/date/formatters.rb
1628
+ - stdlib/date/infinity.rb
1616
1629
  - stdlib/delegate.rb
1617
1630
  - stdlib/dir.rb
1618
1631
  - stdlib/e2mmap.rb
@@ -1646,7 +1659,6 @@ test_files:
1646
1659
  - stdlib/nodejs/file.rb
1647
1660
  - stdlib/nodejs/fileutils.rb
1648
1661
  - stdlib/nodejs/io.rb
1649
- - stdlib/nodejs/irb.rb
1650
1662
  - stdlib/nodejs/js-yaml-3-6-1.js
1651
1663
  - stdlib/nodejs/kernel.rb
1652
1664
  - stdlib/nodejs/node_modules/balanced-match/.npmignore
@@ -1719,11 +1731,11 @@ test_files:
1719
1731
  - stdlib/opal-builder.rb
1720
1732
  - stdlib/opal-parser.rb
1721
1733
  - stdlib/opal-platform.rb
1734
+ - stdlib/opal-replutils.rb
1722
1735
  - stdlib/opal-source-maps.rb
1723
1736
  - stdlib/opal/miniracer.rb
1724
1737
  - stdlib/opal/platform.rb
1725
1738
  - stdlib/opal/repl_js.rb
1726
- - stdlib/opal/replutils.rb
1727
1739
  - stdlib/open-uri.rb
1728
1740
  - stdlib/optparse.rb
1729
1741
  - stdlib/optparse/ac.rb
@@ -1755,6 +1767,7 @@ test_files:
1755
1767
  - stdlib/template.rb
1756
1768
  - stdlib/thread.rb
1757
1769
  - stdlib/time.rb
1770
+ - stdlib/uri.rb
1758
1771
  - stdlib/yaml.rb
1759
1772
  - tasks/benchmarking.rake
1760
1773
  - tasks/building.rake
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'opal/nodes/call'
4
-
5
- module Opal
6
- module Nodes
7
- # Safe navigator recv&.meth(arglist, &block)
8
- class CSendNode < CallNode
9
- handle :csend
10
-
11
- def default_compile
12
- helper :send
13
-
14
- conditional_send(recv(receiver_sexp)) do |receiver_temp|
15
- push '$send(', receiver_temp
16
- compile_method_name
17
- compile_arguments
18
- compile_block_pass
19
- push ')'
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'opal/rewriters/base'
4
-
5
- module Opal
6
- module Rewriters
7
- class ExplicitWriterReturn < Base
8
- def initialize
9
- @in_masgn = false
10
- end
11
-
12
- TMP_NAME = '$writer'
13
- GET_ARGS_NODE = s(:lvar, TMP_NAME)
14
- RETURN_ARGS_NODE = s(:jsattr,
15
- GET_ARGS_NODE,
16
- s(:send, s(:jsattr, GET_ARGS_NODE, s(:str, 'length')), :-, s(:int, 1)),
17
- )
18
-
19
- def on_send(node)
20
- return super if @in_masgn
21
-
22
- recv, method_name, *args = *node
23
-
24
- if method_name.to_s =~ /#{REGEXP_START}\w+=#{REGEXP_END}/ || method_name.to_s == '[]='
25
- set_args_node = s(:lvasgn, TMP_NAME, s(:array, *process_all(args)))
26
-
27
- s(:begin,
28
- set_args_node,
29
- node.updated(nil, [recv, method_name, s(:splat, GET_ARGS_NODE)]),
30
- RETURN_ARGS_NODE,
31
- )
32
- else
33
- super
34
- end
35
- end
36
-
37
- # Multiple assignment is handled by Opal::Nodes::MassAssignNode
38
- #
39
- # For example, "self.a, self.b = 1, 2" parses to:
40
- # s(:masgn,
41
- # s(:mlhs,
42
- # s(:send,
43
- # s(:self), :a=),
44
- # s(:send,
45
- # s(:self), :b=)),
46
- # s(:array,
47
- # s(:int, 1),
48
- # s(:int, 2)))
49
- #
50
- # And this AST rewriter skips this node.
51
- def on_masgn(node)
52
- @in_masgn = true
53
- result = super
54
- @in_masgn = false
55
- result
56
- end
57
- end
58
- end
59
- end