opal 1.5.0 → 1.5.1
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 +4 -4
- data/.github/workflows/build.yml +1 -0
- data/CHANGELOG.md +41 -28
- data/UNRELEASED.md +1 -0
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/hash.rb +1 -1
- data/opal/corelib/time.rb +13 -10
- data/spec/filters/bugs/stringscanner.rb +0 -1
- data/spec/spec_helper.rb +4 -0
- data/stdlib/strscan.rb +27 -49
- data/tasks/testing.rake +8 -3
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e07c91ee89f49091b5245745dc0889d8266c6c437349f6c0a5f31c99ab34e61
|
4
|
+
data.tar.gz: bef7cf7822bd78100f39044d4243a588d8a752541bb9af584c324b7d9b31ed79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '05894c0ce50acfcda6bf2f333410639603c994ffdd56db7c892ae579601e7f739a13fb37b430e28048ae9ea84148956a5f3b37fc629506ccd11f913a1300cf7b'
|
7
|
+
data.tar.gz: deb8dfb2fecfb910d506a2707ad34a5306429debb693d4b54b61163195311807600b0b859db18e744669bdcfb4a07a610b31871050dbbb7df9f6dbf5ef712291
|
data/.github/workflows/build.yml
CHANGED
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
-
|
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
|
-
|
39
|
-
-
|
40
|
-
- Optimize
|
41
|
-
-
|
42
|
-
|
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
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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
data/lib/opal/version.rb
CHANGED
data/opal/corelib/constants.rb
CHANGED
@@ -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.
|
5
|
-
::RUBY_RELEASE_DATE = '2022-
|
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
|
-
|
153
|
-
|
154
|
-
|
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
|
-
|
158
|
-
|
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
|
-
|
162
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
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
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
-
|
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
|
129
|
-
|
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
|
-
|
134
|
-
|
135
|
-
|
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("[32m2 examples, 0 failures[0m\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(
|
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.
|
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-
|
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.
|
1164
|
-
readme_uri: https://github.com/opal/opal/blob/v1.5.
|
1165
|
-
api_documentation_uri: http://opalrb.com/docs/api/v1.5.
|
1166
|
-
guides_uri: http://opalrb.com/docs/guides/v1.5.
|
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.
|
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
|