sorbet-runtime 0.4.4494 → 0.4.4496
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4659ace7366df65951a7dc57622b64c6af229a70
|
4
|
+
data.tar.gz: 5a357b77dbe4d7c79499d0fbb12250e0f3cfa47c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a46f6ffc23d36431df3123d90d0223c6c3d078c90855e71597595f728d392d99b29d7b7fa0d706dc5646feaf338c92a500a5a263b7e1c5b7df1114151a97328b
|
7
|
+
data.tar.gz: cbfd072976127bc6b258903f921906d54df75b235a8fd2180a4a86e06c16bdcec8c26d943569ab137d72a0b6d8099874d03b57d97ac384b5ce5971faac0449e0
|
@@ -96,9 +96,11 @@ module T::Private::ClassUtils
|
|
96
96
|
|
97
97
|
overwritten = original_owner == mod
|
98
98
|
T::Configuration.without_ruby_warnings do
|
99
|
+
T::Private::DeclState.current.skip_on_method_added = true
|
99
100
|
mod.send(:define_method, name, &blk) # rubocop:disable PrisonGuard/UsePublicSend
|
100
|
-
|
101
|
+
T::Private::DeclState.current.skip_on_method_added = false
|
101
102
|
end
|
103
|
+
mod.send(original_visibility, name) # rubocop:disable PrisonGuard/UsePublicSend
|
102
104
|
new_method = mod.instance_method(name)
|
103
105
|
|
104
106
|
ReplacedMethod.new(mod, original_method, new_method, overwritten, original_visibility)
|
@@ -171,13 +171,24 @@ module T::Private::Methods
|
|
171
171
|
|
172
172
|
# Only public because it needs to get called below inside the replace_method blocks below.
|
173
173
|
def self._on_method_added(hook_mod, method_name, is_singleton_method: false)
|
174
|
+
if T::Private::DeclState.current.skip_on_method_added
|
175
|
+
return
|
176
|
+
end
|
177
|
+
|
174
178
|
current_declaration = T::Private::DeclState.current.active_declaration
|
175
179
|
mod = is_singleton_method ? hook_mod.singleton_class : hook_mod
|
176
|
-
original_method = mod.instance_method(method_name)
|
177
180
|
|
178
|
-
|
181
|
+
if T::Private::Final.final_module?(mod) && (current_declaration.nil? || !current_declaration.final)
|
182
|
+
raise "`#{mod.name}` was declared as final but its method `#{method_name}` was not declared as final"
|
183
|
+
end
|
184
|
+
_check_final_ancestors(mod, mod.ancestors, [method_name])
|
185
|
+
|
186
|
+
if current_declaration.nil?
|
187
|
+
return
|
188
|
+
end
|
179
189
|
T::Private::DeclState.current.reset!
|
180
190
|
|
191
|
+
original_method = mod.instance_method(method_name)
|
181
192
|
sig_block = lambda do
|
182
193
|
T::Private::Methods.run_sig(hook_mod, method_name, original_method, current_declaration)
|
183
194
|
end
|
@@ -187,7 +198,6 @@ module T::Private::Methods
|
|
187
198
|
# This wrapper is very slow, so it will subsequently re-wrap with a much faster wrapper
|
188
199
|
# (or unwrap back to the original method).
|
189
200
|
new_method = nil
|
190
|
-
# this prevents us from running the final checks twice for every method def.
|
191
201
|
T::Private::ClassUtils.replace_method(mod, method_name) do |*args, &blk|
|
192
202
|
if !T::Private::Methods.has_sig_block_for_method(new_method)
|
193
203
|
# This should only happen if the user used alias_method to grab a handle
|
@@ -420,8 +430,6 @@ module T::Private::Methods
|
|
420
430
|
|
421
431
|
private_class_method def self.install_singleton_method_added_hook(singleton_klass)
|
422
432
|
attached = nil
|
423
|
-
# this prevents the final checks from triggering about singleton_method_added not being a final method even if the
|
424
|
-
# module is final.
|
425
433
|
original_singleton_method = T::Private::ClassUtils.replace_method(singleton_klass, :singleton_method_added) do |name|
|
426
434
|
attached = self
|
427
435
|
T::Private::Methods._on_method_added(self, name, is_singleton_method: true)
|
@@ -170,6 +170,7 @@ module T::Private::Methods::CallValidation
|
|
170
170
|
has_simple_procedure_types = all_args_are_simple && method_sig.return_type.is_a?(T::Private::Types::Void)
|
171
171
|
|
172
172
|
T::Configuration.without_ruby_warnings do
|
173
|
+
T::Private::DeclState.current.skip_on_method_added = true
|
173
174
|
if has_fixed_arity && has_simple_method_types && method_sig.arg_types.length < 5 && is_allowed_to_have_fast_path
|
174
175
|
create_validator_method_fast(mod, original_method, method_sig)
|
175
176
|
elsif has_fixed_arity && has_simple_procedure_types && method_sig.arg_types.length < 5 && is_allowed_to_have_fast_path
|
@@ -177,6 +178,7 @@ module T::Private::Methods::CallValidation
|
|
177
178
|
else
|
178
179
|
create_validator_slow(mod, original_method, method_sig)
|
179
180
|
end
|
181
|
+
T::Private::DeclState.current.skip_on_method_added = false
|
180
182
|
end
|
181
183
|
mod.send(original_visibility, method_sig.method_name)
|
182
184
|
end
|