ruby-next-core 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -0
- data/lib/.rbnext/2.1/ruby-next/commands/nextify.rb +1 -1
- data/lib/.rbnext/2.1/ruby-next/language.rb +5 -2
- data/lib/.rbnext/2.3/ruby-next/commands/nextify.rb +1 -1
- data/lib/.rbnext/2.3/ruby-next/core/data.rb +4 -0
- data/lib/.rbnext/2.3/ruby-next/language/eval.rb +4 -4
- data/lib/.rbnext/2.6/ruby-next/core/data.rb +4 -0
- data/lib/.rbnext/2.7/ruby-next/core/data.rb +4 -0
- data/lib/ruby-next/commands/nextify.rb +1 -1
- data/lib/ruby-next/core/data.rb +4 -0
- data/lib/ruby-next/language/eval.rb +4 -4
- data/lib/ruby-next/language/parser.rb +8 -5
- data/lib/ruby-next/language.rb +5 -2
- data/lib/ruby-next/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ad6cea22baa599e5a6edeb4fdda1fb7c9bd0b0d5617fb01cf4450374c7d9443
|
4
|
+
data.tar.gz: fa39e7d51cdf70c32dc2067000023e42dbe3b23bd1d8bf520e06a3a028d63b8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7df787bfa90d036bbd45c7bd2dbc85f3513d922b3606dfde12ade0196f7ccb6789aba263d407fc012c7b4625d38b4aa6d7df05a5ac4e784b3b9cfc5db356b0f
|
7
|
+
data.tar.gz: a4c364d32b19003c219670096dd6420d415663445d68deb7e92c8d9763cc705884e7ab7e43fed81c6c084450f6a32e14bd8b50f24629256cb064c84a8bb87583
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -170,6 +170,10 @@ Ruby 3.2 has introduced a new core class—[Data](https://bugs.ruby-lang.org/iss
|
|
170
170
|
|
171
171
|
If you want to opt-out from loading Data backport, you must set the `RUBY_NEXT_DISABLE_DATA` env variable to `true`.
|
172
172
|
|
173
|
+
#### Known limitations
|
174
|
+
|
175
|
+
Currently, passing Hash as a last positional argument to `Data.new` is not supported in Ruby <3.0 (due to the difference in keyword arguments handling). We recommend always using keyword arguments when initializing Data objects.
|
176
|
+
|
173
177
|
## Transpiling
|
174
178
|
|
175
179
|
Ruby Next allows you to transpile\* edge Ruby syntax to older versions.
|
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
gem
|
4
|
-
|
3
|
+
# Checking gem specs doesn't work in ruby.wasm
|
4
|
+
unless RUBY_PLATFORM.match?(/wasm/)
|
5
|
+
gem "ruby-next-parser", ">= 2.8.0.3"
|
6
|
+
gem "unparser", ">= 0.4.7"
|
7
|
+
end
|
5
8
|
|
6
9
|
require "set" # rubocop:disable Lint/RedundantRequireStatement
|
7
10
|
|
@@ -11,7 +11,7 @@ module RubyNext
|
|
11
11
|
using: ((((__safe_lvar__ = bind) || true) && (!__safe_lvar__.nil? || nil)) && __safe_lvar__.receiver) == TOPLEVEL_BINDING.receiver || ((((__safe_lvar__ = ((((__safe_lvar__ = bind) || true) && (!__safe_lvar__.nil? || nil)) && __safe_lvar__.receiver)) || true) && (!__safe_lvar__.nil? || nil)) && __safe_lvar__.is_a?(Module))
|
12
12
|
)
|
13
13
|
RubyNext.debug_source(new_source, "(#{caller_locations(1, 1).first})")
|
14
|
-
super
|
14
|
+
super(new_source, bind, *args)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -25,7 +25,7 @@ module RubyNext
|
|
25
25
|
source = args.shift
|
26
26
|
new_source = ::RubyNext::Language::Runtime.transform(source, using: false)
|
27
27
|
RubyNext.debug_source(new_source, "(#{caller_locations(1, 1).first})")
|
28
|
-
super
|
28
|
+
super(new_source, *args)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -39,7 +39,7 @@ module RubyNext
|
|
39
39
|
new_source = ::RubyNext::Language::Runtime.transform(source, using: false)
|
40
40
|
|
41
41
|
RubyNext.debug_source(new_source, "(#{caller_locations(1, 1).first})")
|
42
|
-
super
|
42
|
+
super(new_source, *args)
|
43
43
|
end
|
44
44
|
|
45
45
|
def class_eval(*args, &block)
|
@@ -48,7 +48,7 @@ module RubyNext
|
|
48
48
|
source = args.shift
|
49
49
|
new_source = ::RubyNext::Language::Runtime.transform(source, using: false)
|
50
50
|
RubyNext.debug_source(new_source, "(#{caller_locations(1, 1).first})")
|
51
|
-
super
|
51
|
+
super(new_source, *args)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
data/lib/ruby-next/core/data.rb
CHANGED
@@ -11,7 +11,7 @@ module RubyNext
|
|
11
11
|
using: bind&.receiver == TOPLEVEL_BINDING.receiver || bind&.receiver&.is_a?(Module)
|
12
12
|
)
|
13
13
|
RubyNext.debug_source(new_source, "(#{caller_locations(1, 1).first})")
|
14
|
-
super
|
14
|
+
super(new_source, bind, *args)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -25,7 +25,7 @@ module RubyNext
|
|
25
25
|
source = args.shift
|
26
26
|
new_source = ::RubyNext::Language::Runtime.transform(source, using: false)
|
27
27
|
RubyNext.debug_source(new_source, "(#{caller_locations(1, 1).first})")
|
28
|
-
super
|
28
|
+
super(new_source, *args)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -39,7 +39,7 @@ module RubyNext
|
|
39
39
|
new_source = ::RubyNext::Language::Runtime.transform(source, using: false)
|
40
40
|
|
41
41
|
RubyNext.debug_source(new_source, "(#{caller_locations(1, 1).first})")
|
42
|
-
super
|
42
|
+
super(new_source, *args)
|
43
43
|
end
|
44
44
|
|
45
45
|
def class_eval(*args, &block)
|
@@ -48,7 +48,7 @@ module RubyNext
|
|
48
48
|
source = args.shift
|
49
49
|
new_source = ::RubyNext::Language::Runtime.transform(source, using: false)
|
50
50
|
RubyNext.debug_source(new_source, "(#{caller_locations(1, 1).first})")
|
51
|
-
super
|
51
|
+
super(new_source, *args)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -34,7 +34,7 @@ module RubyNext
|
|
34
34
|
end
|
35
35
|
|
36
36
|
class << self
|
37
|
-
attr_accessor :parser_class
|
37
|
+
attr_accessor :parser_class, :parser_syntax_errors
|
38
38
|
|
39
39
|
def parser
|
40
40
|
parser_class.new(Builder.new).tap do |prs|
|
@@ -50,8 +50,8 @@ module RubyNext
|
|
50
50
|
end
|
51
51
|
|
52
52
|
parser.parse(buffer)
|
53
|
-
rescue
|
54
|
-
raise ::SyntaxError, e.message
|
53
|
+
rescue *parser_syntax_errors => e
|
54
|
+
raise ::SyntaxError, e.message, e.backtrace
|
55
55
|
end
|
56
56
|
|
57
57
|
def parse_with_comments(source, file = "(string)")
|
@@ -60,16 +60,19 @@ module RubyNext
|
|
60
60
|
end
|
61
61
|
|
62
62
|
parser.parse_with_comments(buffer)
|
63
|
-
rescue
|
64
|
-
raise ::SyntaxError, e.message
|
63
|
+
rescue *parser_syntax_errors => e
|
64
|
+
raise ::SyntaxError, e.message, e.backtrace
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
self.parser_syntax_errors = [::Parser::SyntaxError]
|
69
|
+
|
68
70
|
# Set up default parser
|
69
71
|
unless parser_class
|
70
72
|
self.parser_class = if defined?(::Parser::RubyNext)
|
71
73
|
::Parser::RubyNext
|
72
74
|
elsif defined?(::Parser::Prism)
|
75
|
+
parser_syntax_errors << ::Prism::ParserCompiler::CompilationError
|
73
76
|
::Parser::Prism
|
74
77
|
else
|
75
78
|
::Parser::Ruby33
|
data/lib/ruby-next/language.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
gem
|
4
|
-
|
3
|
+
# Checking gem specs doesn't work in ruby.wasm
|
4
|
+
unless RUBY_PLATFORM.match?(/wasm/)
|
5
|
+
gem "ruby-next-parser", ">= 2.8.0.3"
|
6
|
+
gem "unparser", ">= 0.4.7"
|
7
|
+
end
|
5
8
|
|
6
9
|
require "set" # rubocop:disable Lint/RedundantRequireStatement
|
7
10
|
|
data/lib/ruby-next/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-next-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: require-hooks
|