sorbet-runtime 0.6.13281 → 0.6.13283
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/lib/types/private/methods/_methods.rb +18 -16
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d1fdd48689c79093572fa8d2ddc326182044d6eda688339914ead4c2df3408e
|
|
4
|
+
data.tar.gz: b5a5e63990218d9edf088d4e8fb1aeb21c6db4d46b2be89ee496f9fd3fd77abc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b7785710f28477878ed6d0363c75f20249cb38da19da858132815a54a359d8bd2e153a8262c6ca55f54f1ff9e4519d9ba09b4eedfd43cf06dfa6261baf69c5a4
|
|
7
|
+
data.tar.gz: 300a13e92ed07c63bd21156e8bd1e960a8d58053c16a5f711b438dbf316c50386312912813718028265b7f0315f915fca57ab5667525d7c3641ec23b4911965c
|
|
@@ -217,9 +217,23 @@ module T::Private::Methods
|
|
|
217
217
|
)
|
|
218
218
|
end
|
|
219
219
|
|
|
220
|
+
# We allow `sig` in the current module's context (normal case) and
|
|
221
|
+
if hook_mod != current_declaration.mod &&
|
|
222
|
+
# inside `class << self`, and
|
|
223
|
+
hook_mod.singleton_class != current_declaration.mod &&
|
|
224
|
+
# on `self` at the top level of a file
|
|
225
|
+
current_declaration.mod != TOP_SELF
|
|
226
|
+
raise "A method (#{method_name}) is being added on a different class/module (#{hook_mod}) than the " \
|
|
227
|
+
"last call to `sig` (#{current_declaration.mod}). Make sure each call " \
|
|
228
|
+
"to `sig` is immediately followed by a method definition on the same " \
|
|
229
|
+
"class/module."
|
|
230
|
+
end
|
|
231
|
+
# Overwrite the DeclarationBlock mod with `mod`, which is the Module that owns the method.
|
|
232
|
+
current_declaration.mod = mod
|
|
233
|
+
|
|
220
234
|
original_method = mod.instance_method(method_name)
|
|
221
235
|
sig_block = lambda do
|
|
222
|
-
T::Private::Methods.run_sig(
|
|
236
|
+
T::Private::Methods.run_sig(method_name, original_method, current_declaration)
|
|
223
237
|
end
|
|
224
238
|
|
|
225
239
|
# Always replace the original method with this wrapper,
|
|
@@ -298,7 +312,7 @@ module T::Private::Methods
|
|
|
298
312
|
|
|
299
313
|
# Executes the `sig` block, and converts the resulting Declaration
|
|
300
314
|
# to a Signature.
|
|
301
|
-
def self.run_sig(
|
|
315
|
+
def self.run_sig(method_name, original_method, declaration_block)
|
|
302
316
|
current_declaration =
|
|
303
317
|
begin
|
|
304
318
|
run_builder(declaration_block)
|
|
@@ -312,7 +326,7 @@ module T::Private::Methods
|
|
|
312
326
|
|
|
313
327
|
signature =
|
|
314
328
|
if current_declaration
|
|
315
|
-
build_sig(
|
|
329
|
+
build_sig(method_name, original_method, current_declaration)
|
|
316
330
|
else
|
|
317
331
|
Signature.new_untyped(method: original_method)
|
|
318
332
|
end
|
|
@@ -342,20 +356,8 @@ module T::Private::Methods
|
|
|
342
356
|
decl
|
|
343
357
|
end
|
|
344
358
|
|
|
345
|
-
def self.build_sig(
|
|
359
|
+
def self.build_sig(method_name, original_method, current_declaration)
|
|
346
360
|
begin
|
|
347
|
-
# We allow `sig` in the current module's context (normal case) and
|
|
348
|
-
if hook_mod != current_declaration.mod &&
|
|
349
|
-
# inside `class << self`, and
|
|
350
|
-
hook_mod.singleton_class != current_declaration.mod &&
|
|
351
|
-
# on `self` at the top level of a file
|
|
352
|
-
current_declaration.mod != TOP_SELF
|
|
353
|
-
raise "A method (#{method_name}) is being added on a different class/module (#{hook_mod}) than the " \
|
|
354
|
-
"last call to `sig` (#{current_declaration.mod}). Make sure each call " \
|
|
355
|
-
"to `sig` is immediately followed by a method definition on the same " \
|
|
356
|
-
"class/module."
|
|
357
|
-
end
|
|
358
|
-
|
|
359
361
|
signature = Signature.new(
|
|
360
362
|
method: original_method,
|
|
361
363
|
method_name: method_name,
|