ruby-next-core 0.15.0 → 0.15.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: 28083aad6fa1b32e00c885533e4c9c732a2401057f9ed6a939cd78ff3b1b58bb
4
- data.tar.gz: 55734dd6e38699ff7e03c2723633ecd063f8fd97fe8878ca553772dbdac08ab3
3
+ metadata.gz: fc36fd395eedfde5c29e65f1f3a75c683630d5111349b3070d3b4e6d200477ad
4
+ data.tar.gz: e53e28aec62f7e425a98ba1eeb9591778ca1dbab13a0390113fc7440aab9663d
5
5
  SHA512:
6
- metadata.gz: 7d42096d6a616470a402493894d5a7e65b7f08fd935dc8acfd0b91bf66016030edc93fd9c742aeed2fe8653dceb51c7b08c669e48ed1ff11373202cd738c9abc
7
- data.tar.gz: a5740b48cb70283a3848d9415205baf7d17f4ee859562937b7f597bea0de43edba09f59bead4418284b395e6132cec92222b93cb1c1dc0c985adc3eda7b36986
6
+ metadata.gz: 50069c2ef6b59005d7efc640e1d84a74e17e4e385aaadce3ac54c2e3e061c7f71b727943140899210af997196f0bdf5a1157b86b97ce7af3de307e68a1cffe12
7
+ data.tar.gz: edf464100a254380bee320c586f48afc35782027303840fd319f32260ac5cf771c6f349d7447b9ed2f8a55bab424395664099dbd58600a05ffcd79e49080509f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.15.1 (2022-04-05)
6
+
7
+ - Fix transpiling `rescue` within nested blocks. ([@palkan][])
8
+
5
9
  ## 0.15.0 (2022-03-21)
6
10
 
7
11
  - Support IRB ([@palkan][])
data/README.md CHANGED
@@ -544,9 +544,9 @@ These features are disabled by default, you must opt-in in one of the following
544
544
  # It's important to load language module first
545
545
  require "ruby-next/language"
546
546
 
547
- require "ruby-next/language/edge"
547
+ require "ruby-next/language/rewriters/edge"
548
548
  # or
549
- require "ruby-next/language/proposed"
549
+ require "ruby-next/language/rewriters/proposed"
550
550
 
551
551
  # and then activate the runtime mode
552
552
  require "ruby-next/language/runtime"
@@ -62,7 +62,7 @@ module RubyNext
62
62
  mod_name = singleton? ? singleton.name : mod.name
63
63
  camelized_method_name = method_name.to_s.split("_").map(&:capitalize).join
64
64
 
65
- "#{mod_name}#{camelized_method_name}".gsub(/\W/, "") # rubocop:disable Performance/StringReplacement
65
+ "#{mod_name}#{camelized_method_name}".gsub(/\W/, "")
66
66
  end
67
67
 
68
68
  def build_location(trace_locations)
@@ -152,6 +152,7 @@ module RubyNext
152
152
  transpile path, contents, version: version
153
153
  rescue SyntaxError, StandardError => e
154
154
  warn "Failed to transpile #{path}: #{e.class} — #{e.message}"
155
+ warn e.backtrace.take(10).join("\n") if ENV["RUBY_NEXT_DEBUG"] == "1"
155
156
  exit 1
156
157
  end
157
158
 
@@ -182,7 +182,6 @@ module RubyNext
182
182
  end
183
183
  end
184
184
 
185
- # rubocop:disable Style/MethodMissingSuper
186
185
  # rubocop:disable Style/MissingRespondToMissing
187
186
  class Noop < Base
188
187
  # Return node itself, no memoization
@@ -62,7 +62,7 @@ module RubyNext
62
62
  mod_name = singleton? ? singleton.name : mod.name
63
63
  camelized_method_name = method_name.to_s.split("_").map(&:capitalize).join
64
64
 
65
- "#{mod_name}#{camelized_method_name}".gsub(/\W/, "") # rubocop:disable Performance/StringReplacement
65
+ "#{mod_name}#{camelized_method_name}".gsub(/\W/, "")
66
66
  end
67
67
 
68
68
  def build_location(trace_locations)
@@ -182,7 +182,6 @@ module RubyNext
182
182
  end
183
183
  end
184
184
 
185
- # rubocop:disable Style/MethodMissingSuper
186
185
  # rubocop:disable Style/MissingRespondToMissing
187
186
  class Noop < Base
188
187
  # Return node itself, no memoization
data/lib/ruby-next/cli.rb CHANGED
@@ -80,18 +80,16 @@ module RubyNext
80
80
  end
81
81
 
82
82
  def optparser
83
- @optparser ||= begin
84
- OptionParser.new do |opts|
85
- opts.banner = "Usage: ruby-next COMMAND [options]"
86
-
87
- opts.on("-v", "--version", "Print version") do
88
- $stdout.puts RubyNext::VERSION
89
- exit 0
90
- end
91
-
92
- opts.on("-h", "--help", "Print help") do
93
- @print_help = true
94
- end
83
+ @optparser ||= OptionParser.new do |opts|
84
+ opts.banner = "Usage: ruby-next COMMAND [options]"
85
+
86
+ opts.on("-v", "--version", "Print version") do
87
+ $stdout.puts RubyNext::VERSION
88
+ exit 0
89
+ end
90
+
91
+ opts.on("-h", "--help", "Print help") do
92
+ @print_help = true
95
93
  end
96
94
  end
97
95
  end
@@ -152,6 +152,7 @@ module RubyNext
152
152
  transpile path, contents, version: version
153
153
  rescue SyntaxError, StandardError => e
154
154
  warn "Failed to transpile #{path}: #{e.class} — #{e.message}"
155
+ warn e.backtrace.take(10).join("\n") if ENV["RUBY_NEXT_DEBUG"] == "1"
155
156
  exit 1
156
157
  end
157
158
 
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # rubocop:disable Style/LambdaCall
4
3
  RubyNext::Core.patch Proc, name: "ProcCompose", method: :<<, version: "2.6" do
5
4
  <<-RUBY
6
5
  def <<(other)
@@ -54,7 +54,7 @@ RubyNext::Core.singleton_class.module_eval do
54
54
 
55
55
  # Copy constants (they could be accessed from methods)
56
56
  other.constants.each do |name|
57
- Kernel.eval "#{name} = #{other}::#{name}", bind
57
+ Kernel.eval "#{name} = #{other}::#{name}", bind # rubocop:disable Style/EvalWithLocation
58
58
  end
59
59
  end
60
60
  end
@@ -62,7 +62,7 @@ module RubyNext
62
62
  mod_name = singleton? ? singleton.name : mod.name
63
63
  camelized_method_name = method_name.to_s.split("_").map(&:capitalize).join
64
64
 
65
- "#{mod_name}#{camelized_method_name}".gsub(/\W/, "") # rubocop:disable Performance/StringReplacement
65
+ "#{mod_name}#{camelized_method_name}".gsub(/\W/, "")
66
66
  end
67
67
 
68
68
  def build_location(trace_locations)
@@ -15,23 +15,25 @@ module RubyNext
15
15
 
16
16
  def on_block(block_node)
17
17
  exception_node = block_node.children.find do |node|
18
- node.type == :rescue || node.type == :ensure
18
+ node && (node.type == :rescue || node.type == :ensure)
19
19
  end
20
20
 
21
- return unless exception_node
21
+ return super(block_node) unless exception_node
22
22
 
23
23
  context.track! self
24
24
 
25
25
  insert_before(exception_node.loc.expression, "begin;")
26
26
  insert_after(exception_node.loc.expression, ";end")
27
27
 
28
- new_childrens = block_node.children.map do |child|
28
+ new_children = block_node.children.map do |child|
29
29
  next s(:kwbegin, exception_node) if child == exception_node
30
30
 
31
31
  child
32
32
  end
33
33
 
34
- block_node.updated(:block, new_childrens)
34
+ process(
35
+ block_node.updated(:block, new_children)
36
+ )
35
37
  end
36
38
  end
37
39
  end
@@ -182,7 +182,6 @@ module RubyNext
182
182
  end
183
183
  end
184
184
 
185
- # rubocop:disable Style/MethodMissingSuper
186
185
  # rubocop:disable Style/MissingRespondToMissing
187
186
  class Noop < Base
188
187
  # Return node itself, no memoization
@@ -67,7 +67,7 @@ end
67
67
 
68
68
  # Patch Kernel to hijack require/require_relative/load/eval
69
69
  module Kernel
70
- module_function # rubocop:disable Style/ModuleFunction
70
+ module_function
71
71
 
72
72
  alias_method :require_without_ruby_next, :require
73
73
  def require(path)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyNext
4
- VERSION = "0.15.0"
4
+ VERSION = "0.15.1"
5
5
  end
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: 0.15.0
4
+ version: 0.15.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: 2022-03-21 00:00:00.000000000 Z
11
+ date: 2022-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-next-parser
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  requirements: []
173
- rubygems_version: 3.2.22
173
+ rubygems_version: 3.3.7
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: Ruby Next core functionality