orthoses 0.10.0 → 0.11.0

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: c0818d6847c70769b9111a99016d92dff5d4b369485ec5df1752ac847895c077
4
- data.tar.gz: d7b7866d290d31836a4fa860662b7abd44da2a4dd79ae0e8f0be4a3aa127cd86
3
+ metadata.gz: 1bbebf8271fbe9859e0e322e0e2d12fbf7a03dc30663309771edeba678674679
4
+ data.tar.gz: bfdfabbb3110a7c159a7763463077768d76b9cfd14ae77537a87d0abbd8fda74
5
5
  SHA512:
6
- metadata.gz: ae990a63a96d5d6e4c7a0053203695564451fb709fbcc139cce1d4c6dc8962a10c9bb7b78667be1eccf5dd8ccd69447da97cd011bb58beaa9cacf3dbb951e3ec
7
- data.tar.gz: 137f461a5286b3dc9d30c9c71d91fc61f6d948d743f9151b5e9b150dd47cecbe43d6d10073eb29de633bd51f12b3d43afed8ffccf29d52278a035ecbb2757c33
6
+ metadata.gz: e1093d5bbc23bf0577d915afd70fa34907316bcdd2062e34cdc7506f455636e47e02bb046048e4682c16feeba2bc045985fbae2636bd2e220fc90a66f30e957b
7
+ data.tar.gz: 84fe1da94bfe208b46ddc1b3607ba7962e1133150fe454ffc8d4e40ca0dd6bc99c4b7e24f41a18f0217913eedd6e5b08e45329d07455e1e5fb913d102c13b67e
data/Gemfile CHANGED
@@ -9,4 +9,3 @@ gem "rbs"
9
9
  gem "rake", "~> 13.0"
10
10
  gem "rgot", "~> 1.1"
11
11
  gem "steep"
12
- gem "activesupport"
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orthoses (0.10.0)
4
+ orthoses (0.11.0)
5
5
  rbs (~> 2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (7.0.3)
10
+ activesupport (7.0.3.1)
11
11
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
12
  i18n (>= 1.6, < 2)
13
13
  minitest (>= 5.1)
@@ -15,15 +15,15 @@ GEM
15
15
  ast (2.4.2)
16
16
  concurrent-ruby (1.1.10)
17
17
  ffi (1.15.5)
18
- i18n (1.10.0)
18
+ i18n (1.12.0)
19
19
  concurrent-ruby (~> 1.0)
20
- language_server-protocol (3.16.0.3)
20
+ language_server-protocol (3.17.0.0)
21
21
  listen (3.7.1)
22
22
  rb-fsevent (~> 0.10, >= 0.10.3)
23
23
  rb-inotify (~> 0.9, >= 0.9.10)
24
- minitest (5.16.1)
24
+ minitest (5.16.3)
25
25
  parallel (1.22.1)
26
- parser (3.1.2.0)
26
+ parser (3.1.2.1)
27
27
  ast (~> 2.4.1)
28
28
  rainbow (3.1.1)
29
29
  rake (13.0.6)
@@ -32,7 +32,7 @@ GEM
32
32
  ffi (~> 1.0)
33
33
  rbs (2.6.0)
34
34
  rgot (1.1.0)
35
- steep (1.0.1)
35
+ steep (1.1.1)
36
36
  activesupport (>= 5.1)
37
37
  language_server-protocol (>= 3.15, < 4.0)
38
38
  listen (~> 3.0)
@@ -43,15 +43,14 @@ GEM
43
43
  terminal-table (>= 2, < 4)
44
44
  terminal-table (3.0.2)
45
45
  unicode-display_width (>= 1.1.1, < 3)
46
- tzinfo (2.0.4)
46
+ tzinfo (2.0.5)
47
47
  concurrent-ruby (~> 1.0)
48
- unicode-display_width (2.1.0)
48
+ unicode-display_width (2.2.0)
49
49
 
50
50
  PLATFORMS
51
51
  ruby
52
52
 
53
53
  DEPENDENCIES
54
- activesupport
55
54
  orthoses!
56
55
  rake (~> 13.0)
57
56
  rbs
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orthoses
4
+ class CallTracer
5
+ module Capturable
6
+ def build_capture(tp)
7
+ Capture.new(
8
+ method: build_method(tp),
9
+ argument: build_argument(tp),
10
+ )
11
+ end
12
+
13
+ private
14
+
15
+ def build_method(tp)
16
+ METHOD_METHOD.bind(tp.self).call(tp.method_id)
17
+ end
18
+
19
+ def build_argument(tp)
20
+ tp.parameters.each_with_object({}) do |op_name, hash|
21
+ name = op_name[1]
22
+ case name
23
+ when :*, :**, :&, nil
24
+ # skip
25
+ else
26
+ hash[name] = tp.binding.local_variable_get(name).then do |var|
27
+ case var
28
+ when Module, Thread::Backtrace::Location
29
+ var
30
+ else
31
+ var.dup
32
+ end
33
+ rescue => err
34
+ warn("#dup fail (#{err.class}) #{err.message}")
35
+ var
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orthoses
4
+ class CallTracer
5
+ class Lazy
6
+ include Capturable
7
+
8
+ attr_reader :captures
9
+
10
+ def initialize
11
+ @captures = []
12
+ @lazy_trace_point = LazyTracePoint.new(:call) do |tp|
13
+ @captures << build_capture(tp)
14
+ end
15
+ end
16
+
17
+ def trace(name, &block)
18
+ @lazy_trace_point.enable(target: name, &block)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -16,46 +16,22 @@ module Orthoses
16
16
  class Capture < Struct.new(:method, :argument, keyword_init: true)
17
17
  end
18
18
 
19
+ autoload :Lazy, 'orthoses/call_tracer/lazy'
20
+ require_relative 'call_tracer/capturable'
21
+
22
+ include Capturable
23
+
19
24
  attr_accessor :captures
20
25
 
21
26
  def initialize
22
27
  @captures = []
28
+ @target_tp = TracePoint.new(:call) do |tp|
29
+ @captures << build_capture(tp)
30
+ end
23
31
  end
24
32
 
25
33
  def trace(target, &block)
26
- t = TracePoint.new(:call) do |tp|
27
- called_method = tp.self.method(tp.method_id)
28
- argument = tp.parameters.each_with_object({}) do |op_name, hash|
29
- name = op_name[1]
30
- case name
31
- when :*, :**, :&, nil
32
- # skip
33
- else
34
- hash[name] = tp.binding.local_variable_get(name).then do |var|
35
- case var
36
- when Module
37
- var # avoid missing name
38
- else
39
- var.dup
40
- end
41
- rescue => err
42
- case var
43
- when Thread::Backtrace::Location
44
- # known
45
- else
46
- warn("#dup fail (#{err.class}) #{err.message}")
47
- end
48
- var
49
- end
50
- end
51
- end
52
-
53
- @captures << Capture.new(
54
- method: called_method,
55
- argument: argument,
56
- )
57
- end
58
- t.enable(target: target, &block)
34
+ @target_tp.enable(target: target, &block)
59
35
  end
60
36
  end
61
37
  end
@@ -2,18 +2,20 @@ module Orthoses
2
2
  class Content
3
3
  # Check and drop duplication method, const etc...
4
4
  class DuplicationChecker
5
- def initialize(decl)
5
+ def initialize(decl, env: nil)
6
6
  @decl = decl
7
+ @env = env || Utils.rbs_environment(collection: true)
7
8
  end
8
9
 
9
10
  def update_decl
11
+ return unless @decl.respond_to?(:members)
10
12
  uniq_map = {}
11
13
  @decl.members.each do |member|
12
14
  key = member_key(member)
13
15
  drop_member = uniq_map[key]
14
16
  uniq_map[key] = member
15
17
  if drop_member
16
- Orthoses.logger.warn("#{@decl.name}::#{drop_member} was droped since duplication")
18
+ Orthoses.logger.info("#{@decl.name} \"#{member.location.source}\" was droped since duplication")
17
19
  end
18
20
  end
19
21
  drop_known_method_definition(uniq_map)
@@ -23,20 +25,24 @@ module Orthoses
23
25
  private
24
26
 
25
27
  def drop_known_method_definition(uniq_map)
26
- env = Utils.rbs_environment(collection: true)
27
- if m_entry = env.class_decls[@decl.name.absolute!]
28
+ decl_name = @decl.name.absolute!
29
+ if m_entry = @env.class_decls[decl_name]
28
30
  m_entry.decls.each do |d|
29
31
  d.decl.members.grep_v(RBS::AST::Members::LocationOnly).each do |member|
30
32
  uniq_map.delete(member_key(member))
31
33
  end
32
34
  end
33
35
  end
34
- end
35
36
 
36
- def member_to_s(member)
37
- out = StringIO.new
38
- RBS::Writer.new(out: out).write_member(member)
39
- out.string.chomp
37
+ constants_in_uniq_map = uniq_map.select do |key, value|
38
+ value.kind_of?(RBS::AST::Declarations::Constant)
39
+ end
40
+ constants_in_uniq_map.each do |key, value|
41
+ type_name = decl_name + value.name
42
+ if @env.constant_decls[type_name]
43
+ uniq_map.delete(key)
44
+ end
45
+ end
40
46
  end
41
47
 
42
48
  def member_key(member)
@@ -35,6 +35,14 @@ module Orthoses
35
35
  @body.concat(other)
36
36
  end
37
37
 
38
+ def empty?
39
+ @body.empty?
40
+ end
41
+
42
+ def delete(val)
43
+ @body.delete(val)
44
+ end
45
+
38
46
  def to_rbs
39
47
  auto_header
40
48
  uniqed_body_string
@@ -45,14 +53,36 @@ module Orthoses
45
53
  uniqed_body_decl
46
54
  end
47
55
 
48
- private
56
+ def uniq!
57
+ out = ArrayIO.new
58
+ writer = RBS::Writer.new(out: out)
59
+ to_decl.members.each do |member|
60
+ writer.write_member(member)
61
+ end
62
+ @body.replace(out.to_a)
63
+ end
49
64
 
50
65
  def original_rbs
51
- <<~RBS
52
- #{@header}
53
- #{@body.join("\n")}
54
- end
55
- RBS
66
+ a = [@header]
67
+ a << " #{@body.join("\n ")}" if @body.length > 0
68
+ a << "end"
69
+ a.join("\n")
70
+ end
71
+
72
+ private
73
+
74
+ class ArrayIO
75
+ def initialize
76
+ @outs = []
77
+ end
78
+
79
+ def puts(line)
80
+ @outs << line
81
+ end
82
+
83
+ def to_a
84
+ @outs
85
+ end
56
86
  end
57
87
 
58
88
  def uniqed_body_string
@@ -1,11 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'orthoses/outputable'
4
+
3
5
  module Orthoses
4
6
  class CreateFileByName
5
- def initialize(loader, base_dir:, header: nil)
7
+ prepend Outputable
8
+
9
+ def initialize(loader, base_dir:, header: nil, if: nil)
6
10
  @loader = loader
7
11
  @base_dir = base_dir
8
12
  @header = header
13
+ @if = binding.local_variable_get(:if)
9
14
  end
10
15
 
11
16
  using(Module.new {
@@ -28,12 +33,15 @@ module Orthoses
28
33
  store = @loader.call
29
34
 
30
35
  store.each do |name, content|
31
- rbs = begin
32
- content.to_rbs
36
+ begin
37
+ content.uniq!
33
38
  rescue NameError, LoadError => err
34
39
  Orthoses.logger.error(err.inspect)
35
40
  next
36
41
  end
42
+
43
+ next unless @if.nil? || @if.call(name, content)
44
+
37
45
  file_path = Pathname("#{@base_dir}/#{name.to_s.split('::').map(&:underscore).join('/')}.rbs")
38
46
  file_path.dirname.mkpath
39
47
  file_path.open('w+') do |out|
@@ -41,7 +49,7 @@ module Orthoses
41
49
  out.puts @header
42
50
  out.puts
43
51
  end
44
- out.puts rbs
52
+ out.puts content.original_rbs
45
53
  end
46
54
  Orthoses.logger.info("Generate file to #{file_path.to_s}")
47
55
  end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orthoses
4
+ # TracePoint wrapper that allows setting hooks
5
+ # even if the target is undefined
6
+ # LazyTracePoint.new(:call) do |tp|
7
+ # ...
8
+ # end.enable(target: 'Class#class_attribute') do
9
+ # require 'active_support/core_ext/class/attribute'
10
+ # ...
11
+ # end
12
+ class LazyTracePoint < TracePoint
13
+ # for TracePoint target
14
+ ::Module.prepend(Module.new{
15
+ def method_added(id)
16
+ super
17
+ end
18
+ })
19
+ ::BasicObject.prepend(Module.new{
20
+ def singleton_method_added(id)
21
+ super
22
+ end
23
+ })
24
+
25
+ METHOD_METHOD = ::Kernel.instance_method(:method)
26
+ INSTANCE_METHOD_METHOD = ::Module.instance_method(:instance_method)
27
+ UNBOUND_NAME_METHOD = ::Module.instance_method(:name)
28
+ METHOD_ADDED_METHOD = ::Module.instance_method(:method_added)
29
+ SINGLETON_METHOD_ADDED_METHOD = ::BasicObject.instance_method(:singleton_method_added)
30
+
31
+ def initialize(*events, &block)
32
+ @mod_name = nil
33
+ @instance_method_id = nil
34
+ @singleton_method_id = nil
35
+ super
36
+ end
37
+
38
+ def enable(target: nil, target_line: nil, target_thread: nil, &block)
39
+ return super unless target.kind_of?(String)
40
+
41
+ case
42
+ when target.include?('#')
43
+ @mod_name, instance_method_id = target.split('#', 2)
44
+ @instance_method_id = instance_method_id.to_sym
45
+ @singleton_method_id = nil
46
+
47
+ trace_instance_method(&block)
48
+ when target.include?('.')
49
+ @mod_name, singleton_method_id = target.split('.', 2)
50
+ @singleton_method_id = singleton_method_id.to_sym
51
+ @instance_method_id = nil
52
+
53
+ trace_singleton_method(&block)
54
+ else
55
+ raise ArgumentError, "argument shuold be 'Foo#foo' or 'Foo.foo' format"
56
+ end
57
+ end
58
+
59
+ private
60
+
61
+ def trace_instance_method(&block)
62
+ # try to load
63
+ target = Object.const_get(@mod_name).instance_method(@instance_method_id)
64
+ enable(target: target, &block)
65
+ rescue NameError
66
+ TracePoint.new(:call) do |tp|
67
+ id = tp.binding.local_variable_get(:id)
68
+ next unless id == @instance_method_id
69
+
70
+ mod_name = UNBOUND_NAME_METHOD.bind(tp.self).call
71
+
72
+ next unless mod_name
73
+ next unless mod_name == @mod_name
74
+
75
+ enable(target: INSTANCE_METHOD_METHOD.bind(tp.self).call(id))
76
+ tp.disable
77
+ end.enable(target: METHOD_ADDED_METHOD, &block)
78
+ ensure
79
+ disable
80
+ end
81
+
82
+ def trace_singleton_method(&block)
83
+ # try to load
84
+ target = Object.const_get(@mod_name).method(@singleton_method_id)
85
+ enable(target: target, &block)
86
+ rescue NameError
87
+ TracePoint.new(:call) do |tp|
88
+ id = tp.binding.local_variable_get(:id)
89
+ next unless id == @singleton_method_id
90
+
91
+ mod_name = UNBOUND_NAME_METHOD.bind(tp.self).call
92
+
93
+ next unless mod_name
94
+ next unless mod_name == @mod_name
95
+
96
+ enable(target: METHOD_METHOD.bind(tp.self).call(id))
97
+ tp.disable
98
+ end.enable(target: SINGLETON_METHOD_ADDED_METHOD, &block)
99
+ ensure
100
+ disable
101
+ end
102
+ end
103
+ end
@@ -2,9 +2,8 @@
2
2
 
3
3
  module Orthoses
4
4
  class ObjectSpaceAll
5
- def initialize(loader, if: nil)
5
+ def initialize(loader)
6
6
  @loader = loader
7
- @if = binding.local_variable_get(:if)
8
7
  end
9
8
 
10
9
  def call
@@ -14,7 +13,6 @@ module Orthoses
14
13
  after_modules.each do |mod|
15
14
  mod_name = Utils.module_name(mod)
16
15
  next if mod_name.nil?
17
- next unless @if.nil? || @if.call(mod)
18
16
 
19
17
  store[mod_name]
20
18
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orthoses
4
+ module Outputable
5
+ # AvoidRecursiveAncestorError is an internal middleware
6
+ # It's using on orthoses/outputable.rb
7
+ class AvoidRecursiveAncestorError
8
+ def initialize(loader)
9
+ @loader = loader
10
+ end
11
+
12
+ def call
13
+ @loader.call.tap do |store|
14
+ object_mixins = {}
15
+ collect_mixin_recursive(store, "Object", object_mixins)
16
+
17
+ object_mixins.each_key do |object_mixin|
18
+ store[object_mixin].header = "module #{object_mixin} : BasicObject"
19
+ end
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def collect_mixin_recursive(store, name, mixins)
26
+ store[name].to_decl.members.each do |member|
27
+ case member
28
+ when RBS::AST::Members::Mixin
29
+ member_name = member.name.relative!.to_s
30
+ mixins[member_name] = true
31
+ collect_mixin_recursive(store, member_name, mixins)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'orthoses/outputable/avoid_recursive_ancestor_error'
4
+
5
+ module Orthoses
6
+ # Module for output middleware.
7
+ # Call internal some middleware on output phase.
8
+ # class Sample
9
+ # prepend Outputable
10
+ #
11
+ # def initialize(loader)
12
+ # ...
13
+ # def call
14
+ # ...
15
+ module Outputable
16
+ def call
17
+ @loader = AvoidRecursiveAncestorError.new(@loader)
18
+ super
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orthoses
4
- VERSION = "0.10.0"
4
+ VERSION = "0.11.0"
5
5
  end
@@ -1,5 +1,7 @@
1
1
  module Orthoses
2
2
  class Writer
3
+ prepend Outputable
4
+
3
5
  def initialize(loader, io:)
4
6
  @loader = loader
5
7
  @io = io
data/lib/orthoses.rb CHANGED
@@ -4,7 +4,6 @@ require 'rbs'
4
4
  require 'pathname'
5
5
 
6
6
  require_relative 'orthoses/attribute'
7
- require_relative 'orthoses/avoid_recursive_ancestor_error'
8
7
  require_relative 'orthoses/builder'
9
8
  require_relative 'orthoses/call_tracer'
10
9
  require_relative 'orthoses/constant'
@@ -15,6 +14,7 @@ require_relative 'orthoses/filter'
15
14
  require_relative 'orthoses/mixin'
16
15
  require_relative 'orthoses/load_rbs'
17
16
  require_relative 'orthoses/object_space_all'
17
+ require_relative 'orthoses/outputable'
18
18
  require_relative 'orthoses/path_helper'
19
19
  require_relative 'orthoses/pp'
20
20
  require_relative 'orthoses/rbs_prototype_rb'
@@ -28,6 +28,12 @@ require_relative 'orthoses/walk'
28
28
  require_relative 'orthoses/writer'
29
29
 
30
30
  module Orthoses
31
+ # Use autoload just in case there are side effects.
32
+ autoload :LazyTracePoint, 'orthoses/lazy_trace_point'
33
+
34
+ METHOD_METHOD = ::Kernel.instance_method(:method)
35
+ INSTANCE_METHOD_METHOD = ::Module.instance_method(:instance_method)
36
+
31
37
  class ConstLoadError < StandardError
32
38
  attr_reader :root
33
39
  attr_reader :const
@@ -2,10 +2,7 @@
2
2
 
3
3
  module Orthoses::Attribute::Hook
4
4
  def attr: (*untyped names) -> untyped
5
-
6
5
  def attr_accessor: (*untyped names) -> untyped
7
-
8
6
  def attr_reader: (*untyped names) -> untyped
9
-
10
7
  def attr_writer: (*untyped names) -> untyped
11
8
  end
@@ -5,6 +5,5 @@ class Orthoses::Builder
5
5
  def use: (untyped middleware, *untyped args, **untyped key) ?{ () -> untyped } -> untyped
6
6
  def run: (untyped loader) -> untyped
7
7
  def to_loader: () -> untyped
8
-
9
8
  def call: () { () -> void } -> Orthoses::store
10
9
  end
@@ -0,0 +1,7 @@
1
+ # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
+
3
+ module Orthoses::CallTracer::Capturable
4
+ def build_capture: (untyped tp) -> untyped
5
+ private def build_method: (untyped tp) -> untyped
6
+ private def build_argument: (untyped tp) -> untyped
7
+ end
@@ -0,0 +1,6 @@
1
+ # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
+
3
+ class Orthoses::CallTracer::Lazy
4
+ def initialize: () -> void
5
+ def trace: (untyped name) ?{ () -> untyped } -> untyped
6
+ end
@@ -2,7 +2,6 @@
2
2
 
3
3
  class Orthoses::CallTracer
4
4
  def initialize: () -> void
5
-
6
5
  def trace: [T] (Method | UnboundMethod) ?{ () -> T } -> T
7
6
  attr_accessor captures: Array[Capture]
8
7
  end
@@ -0,0 +1,7 @@
1
+ # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
+
3
+ class Orthoses::Content::ArrayIO
4
+ def initialize: () -> void
5
+ def puts: (untyped line) -> untyped
6
+ def to_a: () -> untyped
7
+ end
@@ -1,9 +1,8 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::Content::DuplicationChecker
4
- def initialize: (untyped decl) -> void
5
- def update_decl: () -> untyped
4
+ def initialize: (untyped decl, ?env: untyped?) -> void
5
+ def update_decl: () -> (nil | untyped)
6
6
  private def drop_known_method_definition: (untyped uniq_map) -> untyped
7
- private def member_to_s: (untyped member) -> untyped
8
7
  private def member_key: (untyped member) -> untyped
9
8
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  class Orthoses::Content::Environment
4
4
  def self.load_from_paths: (untyped paths) -> untyped
5
-
6
5
  def initialize: (?constant_filter: constant_filter?, ?mixin_filter: mixin_filter?, ?attribute_filter: attribute_filter?) -> void
7
6
  def <<: (RBS::AST::Declarations::t decl) -> RBS::Environment
8
7
  def write_to: (store: Orthoses::store) -> void
@@ -4,10 +4,12 @@ class Orthoses::Content
4
4
  def initialize: (name: String) -> void
5
5
  def <<: (String) -> void
6
6
  def concat: (Array[String]) -> void
7
+ def empty?: () -> untyped
8
+ def delete: (untyped val) -> untyped
7
9
  def to_rbs: () -> String
8
10
  def to_decl: () -> untyped
9
- private def original_rbs: () -> ::String
10
-
11
+ def uniq!: () -> untyped
12
+ def original_rbs: () -> untyped
11
13
  private def uniqed_body_string: () -> String
12
14
  private def uniqed_body_decl: () -> RBS::AST::Declarations::t
13
15
  private def auto_header: () -> (nil | untyped)
@@ -0,0 +1,15 @@
1
+ # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
+
3
+ class Orthoses::LazyTracePoint < ::TracePoint
4
+ def method_added: (untyped id) -> untyped
5
+ def singleton_method_added: (untyped id) -> untyped
6
+ def initialize: (*untyped events) ?{ () -> untyped } -> void
7
+ def enable: (?target: untyped?, ?target_line: untyped?, ?target_thread: untyped?) ?{ () -> untyped } -> untyped
8
+ private def trace_instance_method: () ?{ () -> untyped } -> untyped
9
+ private def trace_singleton_method: () ?{ () -> untyped } -> untyped
10
+ INSTANCE_METHOD_METHOD: UnboundMethod
11
+ METHOD_ADDED_METHOD: UnboundMethod
12
+ METHOD_METHOD: UnboundMethod
13
+ SINGLETON_METHOD_ADDED_METHOD: UnboundMethod
14
+ UNBOUND_NAME_METHOD: UnboundMethod
15
+ end
@@ -2,8 +2,6 @@
2
2
 
3
3
  module Orthoses::Mixin::Hook
4
4
  def include: (*untyped modules) -> untyped
5
-
6
5
  def extend: (*untyped modules) -> untyped
7
-
8
6
  def prepend: (*untyped modules) -> untyped
9
7
  end
@@ -1,8 +1,8 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
- class Orthoses::AvoidRecursiveAncestorError
3
+ class Orthoses::Outputable::AvoidRecursiveAncestorError
4
4
  def initialize: (Orthoses::_Call loader) -> void
5
5
  def call: () -> Orthoses::store
6
- def set_object_mixins_recursive: (untyped store, untyped name, untyped object_mixins) -> untyped
6
+ private def collect_mixin_recursive: (untyped store, untyped name, untyped mixins) -> untyped
7
7
  @loader: Orthoses::_Call
8
8
  end
@@ -0,0 +1,5 @@
1
+ # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
+
3
+ module Orthoses::Outputable
4
+ def call: () -> untyped
5
+ end
@@ -2,28 +2,16 @@
2
2
 
3
3
  module Orthoses::Utils
4
4
  def self.unautoload!: () -> untyped
5
-
6
5
  def self.each_const_recursive: (Module root, ?cache: Hash[untyped, true], ?on_error: ^(Orthoses::ConstLoadError) -> void) ?{ (Module, Symbol, untyped) -> void } -> void
7
-
8
6
  def self.rbs_defined_const?: (String name, ?library: (String | Array[String])?, ?collection: boolish) -> bool
9
-
10
7
  def self.rbs_defined_class?: (String name, ?library: (String | Array[String])?, ?collection: boolish) -> bool
11
-
12
8
  def self.rbs_type_name: (String) -> RBS::TypeName
13
-
14
9
  def self.rbs_environment: (?library: String | Array[String] | nil, ?collection: boolish, ?cache: boolish) -> RBS::Environment
15
-
16
10
  def self.object_to_rbs: (untyped object, strict: bool) -> String
17
-
18
11
  def self.module_name: (Module mod) -> String?
19
-
20
12
  def self.module_to_type_name: (Module) -> RBS::TypeName?
21
-
22
13
  def self.known_type_params: (Module | String) -> Array[RBS::AST::TypeParam]?
23
-
24
14
  def self.new_store: () -> Orthoses::store
25
-
26
15
  UNBOUND_NAME_METHOD: UnboundMethod
27
-
28
16
  attr_accessor self.rbs_collection_pathname: Pathname
29
17
  end
data/sig/orthoses.rbs CHANGED
@@ -1,9 +1,9 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  module Orthoses
4
- VERSION: "0.10.0"
5
-
4
+ VERSION: "0.11.0"
6
5
  attr_accessor self.logger: ::Logger
7
-
8
6
  type store = Hash[String, Orthoses::Content]
7
+ INSTANCE_METHOD_METHOD: UnboundMethod
8
+ METHOD_METHOD: UnboundMethod
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orthoses
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-26 00:00:00.000000000 Z
11
+ date: 2022-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -42,9 +42,10 @@ files:
42
42
  - lib/orthoses.rb
43
43
  - lib/orthoses/attribute.rb
44
44
  - lib/orthoses/autoload.rb
45
- - lib/orthoses/avoid_recursive_ancestor_error.rb
46
45
  - lib/orthoses/builder.rb
47
46
  - lib/orthoses/call_tracer.rb
47
+ - lib/orthoses/call_tracer/capturable.rb
48
+ - lib/orthoses/call_tracer/lazy.rb
48
49
  - lib/orthoses/constant.rb
49
50
  - lib/orthoses/content.rb
50
51
  - lib/orthoses/content/duplication_checker.rb
@@ -53,9 +54,12 @@ files:
53
54
  - lib/orthoses/create_file_by_name.rb
54
55
  - lib/orthoses/delegate_class.rb
55
56
  - lib/orthoses/filter.rb
57
+ - lib/orthoses/lazy_trace_point.rb
56
58
  - lib/orthoses/load_rbs.rb
57
59
  - lib/orthoses/mixin.rb
58
60
  - lib/orthoses/object_space_all.rb
61
+ - lib/orthoses/outputable.rb
62
+ - lib/orthoses/outputable/avoid_recursive_ancestor_error.rb
59
63
  - lib/orthoses/path_helper.rb
60
64
  - lib/orthoses/pp.rb
61
65
  - lib/orthoses/rbs_prototype_rb.rb
@@ -74,14 +78,16 @@ files:
74
78
  - sig/orthoses/attribute/hook.rbs
75
79
  - sig/orthoses/autoload.rbs
76
80
  - sig/orthoses/autoload/hook.rbs
77
- - sig/orthoses/avoid_recursive_ancestor_error.rbs
78
81
  - sig/orthoses/builder.rbs
79
82
  - sig/orthoses/builder/call_logable.rbs
80
83
  - sig/orthoses/call_tracer.rbs
84
+ - sig/orthoses/call_tracer/capturable.rbs
81
85
  - sig/orthoses/call_tracer/capture.rbs
86
+ - sig/orthoses/call_tracer/lazy.rbs
82
87
  - sig/orthoses/const_load_error.rbs
83
88
  - sig/orthoses/constant.rbs
84
89
  - sig/orthoses/content.rbs
90
+ - sig/orthoses/content/array_io.rbs
85
91
  - sig/orthoses/content/duplication_checker.rbs
86
92
  - sig/orthoses/content/environment.rbs
87
93
  - sig/orthoses/content/header_builder.rbs
@@ -89,11 +95,14 @@ files:
89
95
  - sig/orthoses/delegate_class.rbs
90
96
  - sig/orthoses/delegate_class/hook.rbs
91
97
  - sig/orthoses/filter.rbs
98
+ - sig/orthoses/lazy_trace_point.rbs
92
99
  - sig/orthoses/load_rbs.rbs
93
100
  - sig/orthoses/mixin.rbs
94
101
  - sig/orthoses/mixin/hook.rbs
95
102
  - sig/orthoses/name_space_error.rbs
96
103
  - sig/orthoses/object_space_all.rbs
104
+ - sig/orthoses/outputable.rbs
105
+ - sig/orthoses/outputable/avoid_recursive_ancestor_error.rbs
97
106
  - sig/orthoses/path_helper.rbs
98
107
  - sig/orthoses/pp.rbs
99
108
  - sig/orthoses/rbs_prototype_rb.rbs
@@ -124,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
133
  - !ruby/object:Gem::Version
125
134
  version: '0'
126
135
  requirements: []
127
- rubygems_version: 3.3.16
136
+ rubygems_version: 3.4.0.dev
128
137
  signing_key:
129
138
  specification_version: 4
130
139
  summary: Framework for Generate RBS
@@ -1,29 +0,0 @@
1
- module Orthoses
2
- class AvoidRecursiveAncestorError
3
- def initialize(loader)
4
- @loader = loader
5
- end
6
-
7
- def call
8
- @loader.call.tap do |store|
9
- object_mixins = {}
10
- set_object_mixins_recursive(store, "Object", object_mixins)
11
-
12
- object_mixins.each_key do |object_mixin|
13
- store[object_mixin].header = "module #{object_mixin} : BasicObject"
14
- end
15
- end
16
- end
17
-
18
- def set_object_mixins_recursive(store, name, object_mixins)
19
- store[name].to_decl.members.each do |member|
20
- case member
21
- when RBS::AST::Members::Mixin
22
- member_name = member.name.relative!.to_s
23
- object_mixins[member_name] = true
24
- set_object_mixins_recursive(store, member_name, object_mixins)
25
- end
26
- end
27
- end
28
- end
29
- end