opal 1.5.0 → 1.5.1

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: c7a74100fe9d5254983a2b7efde2482df462edae5aa85bdd691ce89c13de5081
4
- data.tar.gz: 7c1841adacfc5dbf7156646bafd37592f1d9f54c31e07f98d7e2f77e4dc108e0
3
+ metadata.gz: 7e07c91ee89f49091b5245745dc0889d8266c6c437349f6c0a5f31c99ab34e61
4
+ data.tar.gz: bef7cf7822bd78100f39044d4243a588d8a752541bb9af584c324b7d9b31ed79
5
5
  SHA512:
6
- metadata.gz: 9324444976198f22d216fec12cda5047389b6c4c0afacdf3d19d458e85f329f9339e7fe626de2659af51dd8acd3d8edabaea878789fb58ce05f67d67d254f9da
7
- data.tar.gz: fe8b6678035e4160ee85328b60a59dfc68307e3a26b7a5e8e1273f3948017a0a7ad38c5858fedf1cce2fdfc7e93c9ea6d7cc210fbd0e7e916da599d2eec7b496
6
+ metadata.gz: '05894c0ce50acfcda6bf2f333410639603c994ffdd56db7c892ae579601e7f739a13fb37b430e28048ae9ea84148956a5f3b37fc629506ccd11f913a1300cf7b'
7
+ data.tar.gz: deb8dfb2fecfb910d506a2707ad34a5306429debb693d4b54b61163195311807600b0b859db18e744669bdcfb4a07a610b31871050dbbb7df9f6dbf5ef712291
@@ -51,6 +51,7 @@ jobs:
51
51
  command: bin/rake lint
52
52
  ruby: '3.0'
53
53
  - name: timezone
54
+ command: bin/rake mspec_nodejs TZ="Pacific/Fiji"
54
55
  ruby: '3.0'
55
56
  - name: performance
56
57
  ruby: '3.0'
data/CHANGELOG.md CHANGED
@@ -15,52 +15,65 @@ Changes are grouped as follows:
15
15
 
16
16
 
17
17
 
18
+ ## [1.5.1](https://github.com/opal/opal/compare/v1.5.0...v1.5.1) - 2022-07-20
19
+
20
+
21
+ ### Fixed
22
+
23
+ - Make `Time.new` not depend on `Date.prototype.getTimezoneOffset()` ([#2426](https://github.com/opal/opal/pull/2426))
24
+ - Fix exception during `Hash#each_value` if keys get deleted during loop ([#2427](https://github.com/opal/opal/pull/2427))
25
+ - Fix scan_until and check_until implementation of StringScanner ([#2420](https://github.com/opal/opal/pull/2420))
26
+
27
+
28
+
29
+
18
30
  ## [1.5.0](https://github.com/opal/opal/compare/v1.4.1...v1.5.0) - 2022-04-13
19
31
 
20
32
 
21
33
  ### Added
22
34
 
23
- - Introduce timezone support for Time ([#2394](https://github.com/opal/opal/pull/2394))
24
- - DateTime and Date refactor ([#2398](https://github.com/opal/opal/pull/2398))
25
- - Implement `Number#prev_float`/`#next_float` ([#2404](https://github.com/opal/opal/pull/2404))
26
- - Support `binding.irb` anywhere in the code, for both browsers and node ([#2392](https://github.com/opal/opal/pull/2392))
27
- - Added `URI.decode_www_form` ([#2387](https://github.com/opal/opal/pull/2387))
35
+ * Introduce timezone support for Time by @hmdne in https://github.com/opal/opal/pull/2394
36
+ * DateTime and Date refactor by @hmdne in https://github.com/opal/opal/pull/2398
37
+ * Implement `Number#prev_float`/`#next_float` by @takaram in https://github.com/opal/opal/pull/2404
38
+ * Support `binding.irb` anywhere in the code, for both browsers and node by @hmdne in https://github.com/opal/opal/pull/2392 and https://github.com/opal/opal/pull/2408
39
+ * Added `URI.decode_www_form` by @HoneyryderChuck in https://github.com/opal/opal/pull/2387
28
40
 
29
41
  ### Changed
30
42
 
31
- - Move Math IE11-supporting polyfills to a separate file ([#2395](https://github.com/opal/opal/pull/2395))
32
- - String methods always return Strings even when overloaded ([#2413](https://github.com/opal/opal/pull/2413))
33
- - `alias` calls will not add the "old name" method to the list of stubs for method missing ([#2414](https://github.com/opal/opal/pull/2414))
34
- - Optimize writer/setter methods, up to 4% performance gain ([#2402](https://github.com/opal/opal/pull/2402))
43
+ * Move `Math` IE11-supporting polyfills to a separate file by @hmdne in https://github.com/opal/opal/pull/2395
44
+ * `String` methods always return Strings even when overloaded by @hmdne in https://github.com/opal/opal/pull/2413
45
+ * Misc changes extracted from DCE work by @elia in https://github.com/opal/opal/pull/2414
46
+ - `alias` calls will not add the "old name" method to the list of stubs for method missing
47
+ * Optimize writer/setter methods (up to 4% performance gain!) by @hmdne in https://github.com/opal/opal/pull/2402
48
+ - Also fixed few edge cases of conditional calls combined with setters, e.g. `foo&.bar = 123`
35
49
 
36
50
  ### Performance
37
51
 
38
- - Improve performance of argument coertion, fast-track `Integer`, `String`, and calling the designed coertion method ([#2383](https://github.com/opal/opal/pull/2383))
39
- - Optimize `Array#[]=` by moving the implementation to JavaScript and inlining type checks ([#2383](https://github.com/opal/opal/pull/2383))
40
- - Optimize internal runtime passing of block-options ([#2383](https://github.com/opal/opal/pull/2383))
41
- - Compile `case` statements as `switch` whenever possible ([#2411](https://github.com/opal/opal/pull/2411))
42
- - Improve performance with optimized common method/iter implementation shortcuts ([#2401](https://github.com/opal/opal/pull/2401))
52
+ * Runtime optimization by @hmdne in https://github.com/opal/opal/pull/2383
53
+ - Improve performance of argument coertion, fast-track `Integer`, `String`, and calling the designed coertion method
54
+ - Optimize `Array#[]=` by moving the implementation to JavaScript and inlining type checks
55
+ - Optimize internal runtime passing of block-options
56
+ * Compile `case` statements as `switch` whenever possible by @hmdne in https://github.com/opal/opal/pull/2411
57
+ * Improve performance with optimized common method/iter implementation shortcuts by @hmdne in https://github.com/opal/opal/pull/2401
43
58
 
44
59
  ### Fixed
45
60
 
46
- - Fix `Regexp.new`, previously `\A` and `\z` didn't match beginning and end of input ([#2079](https://github.com/opal/opal/pull/2079))
47
- - Fix exception during `Hash#each` and `Hash#each_key` if keys get deleted during the loop ([#2403](https://github.com/opal/opal/pull/2403))
48
- - Fix defining multiple methods with the same block ([#2397](https://github.com/opal/opal/pull/2397))
49
- - A few edge cases of conditional calls combined with setters, e.g. `foo&.bar = 123` ([#2402](https://github.com/opal/opal/pull/2402))
50
- - Correct String#to_proc and method_missing compatibility ([#2418](https://github.com/opal/opal/pull/2418))
51
- - Exit REPL respecting the exit status number ([#2396](https://github.com/opal/opal/pull/2396))
61
+ * Fix `Regexp.new`, replace `\A` to `^` and `\z` to `$` by @ysakasin in https://github.com/opal/opal/pull/2079
62
+ * Fix exception during `Hash#each` and `Hash#each_key` if keys get deleted during the loop by @janbiedermann in https://github.com/opal/opal/pull/2403
63
+ * Fix defining multiple methods with the same block by @elia in https://github.com/opal/opal/pull/2397
64
+ * Correct `String#to_proc` and `method_missing` compatibility by @hmdne in https://github.com/opal/opal/pull/2418
65
+ * Exit REPL respecting the exit status number by @janbiedermann in https://github.com/opal/opal/pull/2396
52
66
 
53
67
  ### Internal
54
68
 
55
- - Rewriters refactor, fix interaction between cache and inverted runner ([#2400](https://github.com/opal/opal/pull/2400))
69
+ * Rewriters refactor, fix interaction between cache and inverted runner by @hmdne in https://github.com/opal/opal/pull/2400
70
+ * releasing.md: add a step to prepare for next release by @hmdne in https://github.com/opal/opal/pull/2407
56
71
 
57
- <!--
58
- ### Internal
59
- ### Changed
60
- ### Added
61
- ### Removed
62
- ### Deprecated
63
- -->
72
+ ## New Contributors
73
+
74
+ * @HoneyryderChuck made their first contribution in https://github.com/opal/opal/pull/2387
75
+
76
+ **Full Changelog**: https://github.com/opal/opal/compare/v1.4.1...v1.5.0
64
77
 
65
78
 
66
79
 
data/UNRELEASED.md CHANGED
@@ -5,4 +5,5 @@
5
5
  ### Removed
6
6
  ### Deprecated
7
7
  ### Performance
8
+ ### Fixed
8
9
  -->
data/lib/opal/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  module Opal
4
4
  # WHEN RELEASING:
5
5
  # Remember to update RUBY_ENGINE_VERSION in opal/corelib/constants.rb too!
6
- VERSION = '1.5.0'
6
+ VERSION = '1.5.1'
7
7
  end
@@ -1,8 +1,8 @@
1
1
  ::RUBY_PLATFORM = 'opal'
2
2
  ::RUBY_ENGINE = 'opal'
3
3
  ::RUBY_VERSION = '3.1.0'
4
- ::RUBY_ENGINE_VERSION = '1.5.0'
5
- ::RUBY_RELEASE_DATE = '2022-04-13'
4
+ ::RUBY_ENGINE_VERSION = '1.5.1'
5
+ ::RUBY_RELEASE_DATE = '2022-07-20'
6
6
  ::RUBY_PATCHLEVEL = 0
7
7
  ::RUBY_REVISION = '0'
8
8
  ::RUBY_COPYRIGHT = 'opal - Copyright (C) 2013-2022 Adam Beynon and the Opal contributors'
data/opal/corelib/hash.rb CHANGED
@@ -458,7 +458,7 @@ class ::Hash
458
458
  return enum_for(:each_value) { size } unless block
459
459
 
460
460
  %x{
461
- for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) {
461
+ for (var i = 0, keys = self.$$keys.slice(), length = keys.length, key; i < length; i++) {
462
462
  key = keys[i];
463
463
 
464
464
  block(key.$$is_string ? self.$$smap[key] : key.value);
data/opal/corelib/time.rb CHANGED
@@ -135,7 +135,7 @@ class ::Time < `Date`
135
135
 
136
136
  def self.new(year = undefined, month = nil, day = nil, hour = nil, min = nil, sec = nil, utc_offset = nil)
137
137
  %x{
138
- var args, result, timezone;
138
+ var args, result, timezone, utc_date;
139
139
 
140
140
  if (year === undefined) {
141
141
  return new Date();
@@ -149,19 +149,22 @@ class ::Time < `Date`
149
149
  min = args[4];
150
150
  sec = args[5];
151
151
 
152
- result = new Date(year, month, day, hour, min, 0, sec * 1000);
153
- if (year < 100) {
154
- result.setFullYear(year);
152
+ if (utc_offset === nil) {
153
+ result = new Date(year, month, day, hour, min, 0, sec * 1000);
154
+ if (year < 100) {
155
+ result.setFullYear(year);
156
+ }
157
+ return result;
155
158
  }
156
159
 
157
- if (utc_offset !== nil) {
158
- timezone = #{_parse_offset(utc_offset)};
160
+ timezone = #{_parse_offset(utc_offset)};
161
+ utc_date = new Date(Date.UTC(year, month, day, hour, min, 0, sec * 1000));
162
+ if (year < 100) {
163
+ utc_date.setUTCFullYear(year);
159
164
  }
160
165
 
161
- if (timezone != null) {
162
- result = new Date(result.getTime() - timezone * 3600000 - result.getTimezoneOffset() * 60000);
163
- result.timezone = timezone;
164
- }
166
+ result = new Date(utc_date.getTime() - timezone * 3600000);
167
+ result.timezone = timezone;
165
168
 
166
169
  return result;
167
170
  }
@@ -46,7 +46,6 @@ opal_filter "StringScanner" do
46
46
  fails "StringScanner#pointer= positions from the end if the argument is negative"
47
47
  fails "StringScanner#pointer= raises a RangeError if position too far backward"
48
48
  fails "StringScanner#pointer= raises a RangeError when the passed argument is out of range"
49
- fails "StringScanner#pos returns the position of the scan pointer"
50
49
  fails "StringScanner#pos= raises a RangeError if position too far backward"
51
50
  fails "StringScanner#pos= raises a RangeError when the passed argument is out of range"
52
51
  fails "StringScanner#restsize is equivalent to rest.size"
data/spec/spec_helper.rb CHANGED
@@ -14,6 +14,10 @@ TOLERANCE = 0.00004
14
14
 
15
15
  ENV['MSPEC_RUNNER'] = true
16
16
 
17
+ # Trigger autoloading, needed by `Module.constants`
18
+ # in `spec/ruby/core/module/constants_spec.rb`.
19
+ Dir
20
+
17
21
  module Kernel
18
22
  def opal_parse(str, file='(string)')
19
23
  Opal::Parser.new.parse str, file
data/stdlib/strscan.rb CHANGED
@@ -24,24 +24,13 @@ class StringScanner
24
24
  if (result == null) {
25
25
  return #{@matched} = nil;
26
26
  }
27
- else if (typeof(result) === 'object') {
28
- #{@prev_pos} = #{@pos};
29
- #{@pos} += result[0].length;
30
- #{@working} = #{@working}.substring(result[0].length);
31
- #{@matched} = result[0];
32
- #{@match} = result;
33
-
34
- return result[0];
35
- }
36
- else if (typeof(result) === 'string') {
37
- #{@pos} += result.length;
38
- #{@working} = #{@working}.substring(result.length);
27
+ #{@prev_pos} = #{@pos};
28
+ #{@pos} += result[0].length;
29
+ #{@working} = #{@working}.substring(result[0].length);
30
+ #{@matched} = result[0];
31
+ #{@match} = result;
39
32
 
40
- return result;
41
- }
42
- else {
43
- return nil;
44
- }
33
+ return result[0];
45
34
  }
46
35
  end
47
36
 
@@ -49,32 +38,24 @@ class StringScanner
49
38
  pattern = anchor(pattern)
50
39
 
51
40
  %x{
52
- var pos = #{@pos},
53
- working = #{@working},
54
- result;
55
-
56
- while (true) {
57
- result = pattern.exec(working);
58
- pos += 1;
59
- working = working.substr(1);
60
-
61
- if (result == null) {
62
- if (working.length === 0) {
63
- #{@match} = [];
64
- return #{@matched} = nil;
65
- }
66
-
67
- continue;
68
- }
41
+ var working = #{@working}
42
+
43
+ for(var i = 0; working.length != i; ++i) {
44
+ var result = pattern.exec(working.substr(i));
45
+ if (result !== null) {
46
+ var matched_size = i + result[0].length
47
+ var matched = working.substr(0, matched_size)
69
48
 
70
- #{@matched} = #{@string}.substr(#{@pos}, pos - #{@pos} - 1 + result[0].length);
71
- #{@match} = result;
72
- #{@prev_pos} = pos - 1;
73
- #{@pos} = pos;
74
- #{@working} = working.substr(result[0].length);
49
+ #{@matched} = result[0]
50
+ #{@match} = result
51
+ #{@prev_pos} = #{@pos} + i; // Position of first character of matched
52
+ #{@pos} += matched_size // Position one after last character of matched
53
+ #{@working} = working.substr(matched_size)
75
54
 
76
- return #{@matched};
55
+ return matched
56
+ }
77
57
  }
58
+ return #{@matched} = nil;
78
59
  }
79
60
  end
80
61
 
@@ -125,18 +106,15 @@ class StringScanner
125
106
 
126
107
  def check_until(pattern)
127
108
  %x{
128
- var prev_pos = #{@prev_pos},
129
- pos = #{@pos};
109
+ var old_prev_pos = #{@prev_pos};
110
+ var old_pos = #{@pos};
111
+ var old_working = #{@working};
130
112
 
131
113
  var result = #{scan_until(pattern)};
132
114
 
133
- if (result !== nil) {
134
- #{@matched} = result.substr(-1);
135
- #{@working} = #{@string}.substr(pos);
136
- }
137
-
138
- #{@prev_pos} = prev_pos;
139
- #{@pos} = pos;
115
+ #{@prev_pos} = old_prev_pos;
116
+ #{@pos} = old_pos;
117
+ #{@working} = old_working;
140
118
 
141
119
  return result;
142
120
  }
data/tasks/testing.rake CHANGED
@@ -111,8 +111,8 @@ module Testing
111
111
  require 'opal/platform' # in node ENV is replaced
112
112
  #{env_data}
113
113
 
114
- require 'spec_helper'
115
114
  require 'opal/full'
115
+ require 'spec_helper'
116
116
  require 'securerandom'
117
117
  #{enter_benchmarking_mode}
118
118
 
@@ -431,9 +431,14 @@ task :smoke_test do
431
431
  expect(actual_output.lines[3]).to eq("2 examples, 0 failures\n")
432
432
  expect(actual_output.lines[4]).to eq("\n")
433
433
  expect(actual_output.lines[5]).to match(%r{Top 2 slowest examples \(\d+\.\d+ seconds, \d+\.\d+% of total time\):\n})
434
- expect(actual_output.lines[6]).to eq(" Opal::Deprecations defaults to warn\n")
435
434
  expect(actual_output.lines[7]).to match(%r{ \[1m\d+\.\d+\[0m \[1mseconds\[0m \n})
436
- expect(actual_output.lines[8]).to eq(" Opal::Deprecations can be set to raise\n")
435
+ expect([
436
+ actual_output.lines[6],
437
+ actual_output.lines[8],
438
+ ]).to contain_exactly(
439
+ " Opal::Deprecations defaults to warn\n",
440
+ " Opal::Deprecations can be set to raise\n",
441
+ )
437
442
  rescue RSpec::Expectations::ExpectationNotMetError
438
443
  warn $!.message
439
444
  warn "\n\n== Full output:\n#{actual_output}"
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.5.0
4
+ version: 1.5.1
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-04-13 00:00:00.000000000 Z
13
+ date: 2022-07-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ast
@@ -1160,10 +1160,10 @@ licenses:
1160
1160
  metadata:
1161
1161
  homepage_uri: https://opalrb.com/
1162
1162
  bug_tracker_uri: https://github.com/opal/opal/issues
1163
- changelog_uri: https://github.com/opal/opal/blob/v1.5.0/CHANGELOG.md
1164
- readme_uri: https://github.com/opal/opal/blob/v1.5.0/README.md
1165
- api_documentation_uri: http://opalrb.com/docs/api/v1.5.0/index.html
1166
- guides_uri: http://opalrb.com/docs/guides/v1.5.0/index.html
1163
+ changelog_uri: https://github.com/opal/opal/blob/v1.5.1/CHANGELOG.md
1164
+ readme_uri: https://github.com/opal/opal/blob/v1.5.1/README.md
1165
+ api_documentation_uri: http://opalrb.com/docs/api/v1.5.1/index.html
1166
+ guides_uri: http://opalrb.com/docs/guides/v1.5.1/index.html
1167
1167
  chat_uri: https://gitter.im/opal/opal
1168
1168
  source_code_uri: https://github.com/opal/opal
1169
1169
  post_install_message:
@@ -1181,7 +1181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1181
1181
  - !ruby/object:Gem::Version
1182
1182
  version: '0'
1183
1183
  requirements: []
1184
- rubygems_version: 3.3.7
1184
+ rubygems_version: 3.3.13
1185
1185
  signing_key:
1186
1186
  specification_version: 4
1187
1187
  summary: Ruby runtime and core library for JavaScript