sorbet-runtime 0.5.11181 → 0.5.11188
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/call_validation.rb +16 -0
- data/lib/types/private/methods/call_validation_2_6.rb +518 -0
- data/lib/types/private/methods/call_validation_2_7.rb +518 -0
- data/lib/types/props/_props.rb +2 -2
- data/lib/types/props/decorator.rb +6 -5
- data/lib/types/props/private/setter_factory.rb +129 -69
- data/lib/types/types/typed_hash.rb +0 -6
- 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: 4d0992a81b5789f644f55cdf43e2b7ab450b7f7c8d98db581f77ef9f6a1a0e52
|
|
4
|
+
data.tar.gz: 4ff8d02c2163dbf19f9033a01e406d079095750d29d1e9fa1c5dc6576cc14675
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d22c0fc55e71413259c4d4c3fb2d3301305503784d26b3ef28369ecea2c31e26a70256a2754337cf0ff0e8cdbc17cea3646e43fdafc1092ce1a83d0b3619a067
|
|
7
|
+
data.tar.gz: 216e340d542b3140639492fa53277dd4a9ec6e2fc6cf09443ef368c5a167736d6b584648ed7bd6a6a83128684816e5131bfe4da6645687b16dec415fe2ebc6eb
|
|
@@ -67,14 +67,30 @@ module T::Private::Methods::CallValidation
|
|
|
67
67
|
simple_method = all_args_are_simple && method_sig.return_type.is_a?(T::Types::Simple)
|
|
68
68
|
simple_procedure = all_args_are_simple && method_sig.return_type.is_a?(T::Private::Types::Void)
|
|
69
69
|
|
|
70
|
+
# All the types for which valid? unconditionally returns `true`
|
|
71
|
+
return_is_ignorable =
|
|
72
|
+
(method_sig.return_type.equal?(T::Types::Untyped::Private::INSTANCE) ||
|
|
73
|
+
method_sig.return_type.equal?(T::Types::Anything::Private::INSTANCE) ||
|
|
74
|
+
method_sig.return_type.equal?(T::Types::AttachedClassType::Private::INSTANCE) ||
|
|
75
|
+
method_sig.return_type.equal?(T::Types::SelfType::Private::INSTANCE) ||
|
|
76
|
+
method_sig.return_type.is_a?(T::Types::TypeParameter) ||
|
|
77
|
+
method_sig.return_type.is_a?(T::Types::TypeVariable) ||
|
|
78
|
+
(method_sig.return_type.is_a?(T::Types::Simple) && method_sig.return_type.raw_type.equal?(BasicObject)))
|
|
79
|
+
|
|
80
|
+
returns_anything_method = all_args_are_simple && return_is_ignorable
|
|
81
|
+
|
|
70
82
|
T::Configuration.without_ruby_warnings do
|
|
71
83
|
T::Private::DeclState.current.without_on_method_added do
|
|
72
84
|
if simple_method
|
|
73
85
|
create_validator_method_fast(mod, original_method, method_sig, original_visibility)
|
|
86
|
+
elsif returns_anything_method
|
|
87
|
+
create_validator_method_skip_return_fast(mod, original_method, method_sig, original_visibility)
|
|
74
88
|
elsif simple_procedure
|
|
75
89
|
create_validator_procedure_fast(mod, original_method, method_sig, original_visibility)
|
|
76
90
|
elsif ok_for_fast_path && method_sig.return_type.is_a?(T::Private::Types::Void)
|
|
77
91
|
create_validator_procedure_medium(mod, original_method, method_sig, original_visibility)
|
|
92
|
+
elsif ok_for_fast_path && return_is_ignorable
|
|
93
|
+
create_validator_method_skip_return_medium(mod, original_method, method_sig, original_visibility)
|
|
78
94
|
elsif ok_for_fast_path
|
|
79
95
|
create_validator_method_medium(mod, original_method, method_sig, original_visibility)
|
|
80
96
|
elsif can_skip_block_type
|
|
@@ -343,6 +343,265 @@ module T::Private::Methods::CallValidation
|
|
|
343
343
|
end
|
|
344
344
|
end
|
|
345
345
|
|
|
346
|
+
def self.create_validator_method_skip_return_fast(mod, original_method, method_sig, original_visibility)
|
|
347
|
+
# trampoline to reduce stack frame size
|
|
348
|
+
arg_types = method_sig.arg_types
|
|
349
|
+
case arg_types.length
|
|
350
|
+
when 0
|
|
351
|
+
create_validator_method_skip_return_fast0(mod, original_method, method_sig, original_visibility)
|
|
352
|
+
when 1
|
|
353
|
+
create_validator_method_skip_return_fast1(mod, original_method, method_sig, original_visibility,
|
|
354
|
+
arg_types[0][1].raw_type)
|
|
355
|
+
when 2
|
|
356
|
+
create_validator_method_skip_return_fast2(mod, original_method, method_sig, original_visibility,
|
|
357
|
+
arg_types[0][1].raw_type,
|
|
358
|
+
arg_types[1][1].raw_type)
|
|
359
|
+
when 3
|
|
360
|
+
create_validator_method_skip_return_fast3(mod, original_method, method_sig, original_visibility,
|
|
361
|
+
arg_types[0][1].raw_type,
|
|
362
|
+
arg_types[1][1].raw_type,
|
|
363
|
+
arg_types[2][1].raw_type)
|
|
364
|
+
when 4
|
|
365
|
+
create_validator_method_skip_return_fast4(mod, original_method, method_sig, original_visibility,
|
|
366
|
+
arg_types[0][1].raw_type,
|
|
367
|
+
arg_types[1][1].raw_type,
|
|
368
|
+
arg_types[2][1].raw_type,
|
|
369
|
+
arg_types[3][1].raw_type)
|
|
370
|
+
else
|
|
371
|
+
raise 'should not happen'
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
def self.create_validator_method_skip_return_fast0(mod, original_method, method_sig, original_visibility)
|
|
376
|
+
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk|
|
|
377
|
+
# This method is a manually sped-up version of more general code in `validate_call`
|
|
378
|
+
# The following line breaks are intentional to show nice pry message
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
# PRY note:
|
|
390
|
+
# this code is sig validation code.
|
|
391
|
+
# Please issue `finish` to step out of it
|
|
392
|
+
|
|
393
|
+
original_method.bind(self).call(&blk)
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
def self.create_validator_method_skip_return_fast1(mod, original_method, method_sig, original_visibility, arg0_type)
|
|
398
|
+
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, &blk|
|
|
399
|
+
# This method is a manually sped-up version of more general code in `validate_call`
|
|
400
|
+
unless arg0.is_a?(arg0_type)
|
|
401
|
+
CallValidation.report_error(
|
|
402
|
+
method_sig,
|
|
403
|
+
method_sig.arg_types[0][1].error_message_for_obj(arg0),
|
|
404
|
+
'Parameter',
|
|
405
|
+
method_sig.arg_types[0][0],
|
|
406
|
+
arg0_type,
|
|
407
|
+
arg0,
|
|
408
|
+
caller_offset: -1
|
|
409
|
+
)
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# The following line breaks are intentional to show nice pry message
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
# PRY note:
|
|
424
|
+
# this code is sig validation code.
|
|
425
|
+
# Please issue `finish` to step out of it
|
|
426
|
+
|
|
427
|
+
original_method.bind(self).call(arg0, &blk)
|
|
428
|
+
end
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
def self.create_validator_method_skip_return_fast2(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type)
|
|
432
|
+
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, &blk|
|
|
433
|
+
# This method is a manually sped-up version of more general code in `validate_call`
|
|
434
|
+
unless arg0.is_a?(arg0_type)
|
|
435
|
+
CallValidation.report_error(
|
|
436
|
+
method_sig,
|
|
437
|
+
method_sig.arg_types[0][1].error_message_for_obj(arg0),
|
|
438
|
+
'Parameter',
|
|
439
|
+
method_sig.arg_types[0][0],
|
|
440
|
+
arg0_type,
|
|
441
|
+
arg0,
|
|
442
|
+
caller_offset: -1
|
|
443
|
+
)
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
unless arg1.is_a?(arg1_type)
|
|
447
|
+
CallValidation.report_error(
|
|
448
|
+
method_sig,
|
|
449
|
+
method_sig.arg_types[1][1].error_message_for_obj(arg1),
|
|
450
|
+
'Parameter',
|
|
451
|
+
method_sig.arg_types[1][0],
|
|
452
|
+
arg1_type,
|
|
453
|
+
arg1,
|
|
454
|
+
caller_offset: -1
|
|
455
|
+
)
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
# The following line breaks are intentional to show nice pry message
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
# PRY note:
|
|
470
|
+
# this code is sig validation code.
|
|
471
|
+
# Please issue `finish` to step out of it
|
|
472
|
+
|
|
473
|
+
original_method.bind(self).call(arg0, arg1, &blk)
|
|
474
|
+
end
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
def self.create_validator_method_skip_return_fast3(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type)
|
|
478
|
+
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, &blk|
|
|
479
|
+
# This method is a manually sped-up version of more general code in `validate_call`
|
|
480
|
+
unless arg0.is_a?(arg0_type)
|
|
481
|
+
CallValidation.report_error(
|
|
482
|
+
method_sig,
|
|
483
|
+
method_sig.arg_types[0][1].error_message_for_obj(arg0),
|
|
484
|
+
'Parameter',
|
|
485
|
+
method_sig.arg_types[0][0],
|
|
486
|
+
arg0_type,
|
|
487
|
+
arg0,
|
|
488
|
+
caller_offset: -1
|
|
489
|
+
)
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
unless arg1.is_a?(arg1_type)
|
|
493
|
+
CallValidation.report_error(
|
|
494
|
+
method_sig,
|
|
495
|
+
method_sig.arg_types[1][1].error_message_for_obj(arg1),
|
|
496
|
+
'Parameter',
|
|
497
|
+
method_sig.arg_types[1][0],
|
|
498
|
+
arg1_type,
|
|
499
|
+
arg1,
|
|
500
|
+
caller_offset: -1
|
|
501
|
+
)
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
unless arg2.is_a?(arg2_type)
|
|
505
|
+
CallValidation.report_error(
|
|
506
|
+
method_sig,
|
|
507
|
+
method_sig.arg_types[2][1].error_message_for_obj(arg2),
|
|
508
|
+
'Parameter',
|
|
509
|
+
method_sig.arg_types[2][0],
|
|
510
|
+
arg2_type,
|
|
511
|
+
arg2,
|
|
512
|
+
caller_offset: -1
|
|
513
|
+
)
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
# The following line breaks are intentional to show nice pry message
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
# PRY note:
|
|
528
|
+
# this code is sig validation code.
|
|
529
|
+
# Please issue `finish` to step out of it
|
|
530
|
+
|
|
531
|
+
original_method.bind(self).call(arg0, arg1, arg2, &blk)
|
|
532
|
+
end
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
def self.create_validator_method_skip_return_fast4(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type, arg3_type)
|
|
536
|
+
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, arg3, &blk|
|
|
537
|
+
# This method is a manually sped-up version of more general code in `validate_call`
|
|
538
|
+
unless arg0.is_a?(arg0_type)
|
|
539
|
+
CallValidation.report_error(
|
|
540
|
+
method_sig,
|
|
541
|
+
method_sig.arg_types[0][1].error_message_for_obj(arg0),
|
|
542
|
+
'Parameter',
|
|
543
|
+
method_sig.arg_types[0][0],
|
|
544
|
+
arg0_type,
|
|
545
|
+
arg0,
|
|
546
|
+
caller_offset: -1
|
|
547
|
+
)
|
|
548
|
+
end
|
|
549
|
+
|
|
550
|
+
unless arg1.is_a?(arg1_type)
|
|
551
|
+
CallValidation.report_error(
|
|
552
|
+
method_sig,
|
|
553
|
+
method_sig.arg_types[1][1].error_message_for_obj(arg1),
|
|
554
|
+
'Parameter',
|
|
555
|
+
method_sig.arg_types[1][0],
|
|
556
|
+
arg1_type,
|
|
557
|
+
arg1,
|
|
558
|
+
caller_offset: -1
|
|
559
|
+
)
|
|
560
|
+
end
|
|
561
|
+
|
|
562
|
+
unless arg2.is_a?(arg2_type)
|
|
563
|
+
CallValidation.report_error(
|
|
564
|
+
method_sig,
|
|
565
|
+
method_sig.arg_types[2][1].error_message_for_obj(arg2),
|
|
566
|
+
'Parameter',
|
|
567
|
+
method_sig.arg_types[2][0],
|
|
568
|
+
arg2_type,
|
|
569
|
+
arg2,
|
|
570
|
+
caller_offset: -1
|
|
571
|
+
)
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
unless arg3.is_a?(arg3_type)
|
|
575
|
+
CallValidation.report_error(
|
|
576
|
+
method_sig,
|
|
577
|
+
method_sig.arg_types[3][1].error_message_for_obj(arg3),
|
|
578
|
+
'Parameter',
|
|
579
|
+
method_sig.arg_types[3][0],
|
|
580
|
+
arg3_type,
|
|
581
|
+
arg3,
|
|
582
|
+
caller_offset: -1
|
|
583
|
+
)
|
|
584
|
+
end
|
|
585
|
+
|
|
586
|
+
# The following line breaks are intentional to show nice pry message
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
# PRY note:
|
|
598
|
+
# this code is sig validation code.
|
|
599
|
+
# Please issue `finish` to step out of it
|
|
600
|
+
|
|
601
|
+
original_method.bind(self).call(arg0, arg1, arg2, arg3, &blk)
|
|
602
|
+
end
|
|
603
|
+
end
|
|
604
|
+
|
|
346
605
|
def self.create_validator_procedure_fast(mod, original_method, method_sig, original_visibility)
|
|
347
606
|
# trampoline to reduce stack frame size
|
|
348
607
|
arg_types = method_sig.arg_types
|
|
@@ -944,6 +1203,265 @@ module T::Private::Methods::CallValidation
|
|
|
944
1203
|
end
|
|
945
1204
|
end
|
|
946
1205
|
|
|
1206
|
+
def self.create_validator_method_skip_return_medium(mod, original_method, method_sig, original_visibility)
|
|
1207
|
+
# trampoline to reduce stack frame size
|
|
1208
|
+
arg_types = method_sig.arg_types
|
|
1209
|
+
case arg_types.length
|
|
1210
|
+
when 0
|
|
1211
|
+
create_validator_method_skip_return_medium0(mod, original_method, method_sig, original_visibility)
|
|
1212
|
+
when 1
|
|
1213
|
+
create_validator_method_skip_return_medium1(mod, original_method, method_sig, original_visibility,
|
|
1214
|
+
arg_types[0][1])
|
|
1215
|
+
when 2
|
|
1216
|
+
create_validator_method_skip_return_medium2(mod, original_method, method_sig, original_visibility,
|
|
1217
|
+
arg_types[0][1],
|
|
1218
|
+
arg_types[1][1])
|
|
1219
|
+
when 3
|
|
1220
|
+
create_validator_method_skip_return_medium3(mod, original_method, method_sig, original_visibility,
|
|
1221
|
+
arg_types[0][1],
|
|
1222
|
+
arg_types[1][1],
|
|
1223
|
+
arg_types[2][1])
|
|
1224
|
+
when 4
|
|
1225
|
+
create_validator_method_skip_return_medium4(mod, original_method, method_sig, original_visibility,
|
|
1226
|
+
arg_types[0][1],
|
|
1227
|
+
arg_types[1][1],
|
|
1228
|
+
arg_types[2][1],
|
|
1229
|
+
arg_types[3][1])
|
|
1230
|
+
else
|
|
1231
|
+
raise 'should not happen'
|
|
1232
|
+
end
|
|
1233
|
+
end
|
|
1234
|
+
|
|
1235
|
+
def self.create_validator_method_skip_return_medium0(mod, original_method, method_sig, original_visibility)
|
|
1236
|
+
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk|
|
|
1237
|
+
# This method is a manually sped-up version of more general code in `validate_call`
|
|
1238
|
+
# The following line breaks are intentional to show nice pry message
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
# PRY note:
|
|
1250
|
+
# this code is sig validation code.
|
|
1251
|
+
# Please issue `finish` to step out of it
|
|
1252
|
+
|
|
1253
|
+
original_method.bind(self).call(&blk)
|
|
1254
|
+
end
|
|
1255
|
+
end
|
|
1256
|
+
|
|
1257
|
+
def self.create_validator_method_skip_return_medium1(mod, original_method, method_sig, original_visibility, arg0_type)
|
|
1258
|
+
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, &blk|
|
|
1259
|
+
# This method is a manually sped-up version of more general code in `validate_call`
|
|
1260
|
+
unless arg0_type.valid?(arg0)
|
|
1261
|
+
CallValidation.report_error(
|
|
1262
|
+
method_sig,
|
|
1263
|
+
method_sig.arg_types[0][1].error_message_for_obj(arg0),
|
|
1264
|
+
'Parameter',
|
|
1265
|
+
method_sig.arg_types[0][0],
|
|
1266
|
+
arg0_type,
|
|
1267
|
+
arg0,
|
|
1268
|
+
caller_offset: -1
|
|
1269
|
+
)
|
|
1270
|
+
end
|
|
1271
|
+
|
|
1272
|
+
# The following line breaks are intentional to show nice pry message
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
# PRY note:
|
|
1284
|
+
# this code is sig validation code.
|
|
1285
|
+
# Please issue `finish` to step out of it
|
|
1286
|
+
|
|
1287
|
+
original_method.bind(self).call(arg0, &blk)
|
|
1288
|
+
end
|
|
1289
|
+
end
|
|
1290
|
+
|
|
1291
|
+
def self.create_validator_method_skip_return_medium2(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type)
|
|
1292
|
+
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, &blk|
|
|
1293
|
+
# This method is a manually sped-up version of more general code in `validate_call`
|
|
1294
|
+
unless arg0_type.valid?(arg0)
|
|
1295
|
+
CallValidation.report_error(
|
|
1296
|
+
method_sig,
|
|
1297
|
+
method_sig.arg_types[0][1].error_message_for_obj(arg0),
|
|
1298
|
+
'Parameter',
|
|
1299
|
+
method_sig.arg_types[0][0],
|
|
1300
|
+
arg0_type,
|
|
1301
|
+
arg0,
|
|
1302
|
+
caller_offset: -1
|
|
1303
|
+
)
|
|
1304
|
+
end
|
|
1305
|
+
|
|
1306
|
+
unless arg1_type.valid?(arg1)
|
|
1307
|
+
CallValidation.report_error(
|
|
1308
|
+
method_sig,
|
|
1309
|
+
method_sig.arg_types[1][1].error_message_for_obj(arg1),
|
|
1310
|
+
'Parameter',
|
|
1311
|
+
method_sig.arg_types[1][0],
|
|
1312
|
+
arg1_type,
|
|
1313
|
+
arg1,
|
|
1314
|
+
caller_offset: -1
|
|
1315
|
+
)
|
|
1316
|
+
end
|
|
1317
|
+
|
|
1318
|
+
# The following line breaks are intentional to show nice pry message
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
# PRY note:
|
|
1330
|
+
# this code is sig validation code.
|
|
1331
|
+
# Please issue `finish` to step out of it
|
|
1332
|
+
|
|
1333
|
+
original_method.bind(self).call(arg0, arg1, &blk)
|
|
1334
|
+
end
|
|
1335
|
+
end
|
|
1336
|
+
|
|
1337
|
+
def self.create_validator_method_skip_return_medium3(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type)
|
|
1338
|
+
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, &blk|
|
|
1339
|
+
# This method is a manually sped-up version of more general code in `validate_call`
|
|
1340
|
+
unless arg0_type.valid?(arg0)
|
|
1341
|
+
CallValidation.report_error(
|
|
1342
|
+
method_sig,
|
|
1343
|
+
method_sig.arg_types[0][1].error_message_for_obj(arg0),
|
|
1344
|
+
'Parameter',
|
|
1345
|
+
method_sig.arg_types[0][0],
|
|
1346
|
+
arg0_type,
|
|
1347
|
+
arg0,
|
|
1348
|
+
caller_offset: -1
|
|
1349
|
+
)
|
|
1350
|
+
end
|
|
1351
|
+
|
|
1352
|
+
unless arg1_type.valid?(arg1)
|
|
1353
|
+
CallValidation.report_error(
|
|
1354
|
+
method_sig,
|
|
1355
|
+
method_sig.arg_types[1][1].error_message_for_obj(arg1),
|
|
1356
|
+
'Parameter',
|
|
1357
|
+
method_sig.arg_types[1][0],
|
|
1358
|
+
arg1_type,
|
|
1359
|
+
arg1,
|
|
1360
|
+
caller_offset: -1
|
|
1361
|
+
)
|
|
1362
|
+
end
|
|
1363
|
+
|
|
1364
|
+
unless arg2_type.valid?(arg2)
|
|
1365
|
+
CallValidation.report_error(
|
|
1366
|
+
method_sig,
|
|
1367
|
+
method_sig.arg_types[2][1].error_message_for_obj(arg2),
|
|
1368
|
+
'Parameter',
|
|
1369
|
+
method_sig.arg_types[2][0],
|
|
1370
|
+
arg2_type,
|
|
1371
|
+
arg2,
|
|
1372
|
+
caller_offset: -1
|
|
1373
|
+
)
|
|
1374
|
+
end
|
|
1375
|
+
|
|
1376
|
+
# The following line breaks are intentional to show nice pry message
|
|
1377
|
+
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
|
|
1381
|
+
|
|
1382
|
+
|
|
1383
|
+
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
# PRY note:
|
|
1388
|
+
# this code is sig validation code.
|
|
1389
|
+
# Please issue `finish` to step out of it
|
|
1390
|
+
|
|
1391
|
+
original_method.bind(self).call(arg0, arg1, arg2, &blk)
|
|
1392
|
+
end
|
|
1393
|
+
end
|
|
1394
|
+
|
|
1395
|
+
def self.create_validator_method_skip_return_medium4(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type, arg3_type)
|
|
1396
|
+
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, arg3, &blk|
|
|
1397
|
+
# This method is a manually sped-up version of more general code in `validate_call`
|
|
1398
|
+
unless arg0_type.valid?(arg0)
|
|
1399
|
+
CallValidation.report_error(
|
|
1400
|
+
method_sig,
|
|
1401
|
+
method_sig.arg_types[0][1].error_message_for_obj(arg0),
|
|
1402
|
+
'Parameter',
|
|
1403
|
+
method_sig.arg_types[0][0],
|
|
1404
|
+
arg0_type,
|
|
1405
|
+
arg0,
|
|
1406
|
+
caller_offset: -1
|
|
1407
|
+
)
|
|
1408
|
+
end
|
|
1409
|
+
|
|
1410
|
+
unless arg1_type.valid?(arg1)
|
|
1411
|
+
CallValidation.report_error(
|
|
1412
|
+
method_sig,
|
|
1413
|
+
method_sig.arg_types[1][1].error_message_for_obj(arg1),
|
|
1414
|
+
'Parameter',
|
|
1415
|
+
method_sig.arg_types[1][0],
|
|
1416
|
+
arg1_type,
|
|
1417
|
+
arg1,
|
|
1418
|
+
caller_offset: -1
|
|
1419
|
+
)
|
|
1420
|
+
end
|
|
1421
|
+
|
|
1422
|
+
unless arg2_type.valid?(arg2)
|
|
1423
|
+
CallValidation.report_error(
|
|
1424
|
+
method_sig,
|
|
1425
|
+
method_sig.arg_types[2][1].error_message_for_obj(arg2),
|
|
1426
|
+
'Parameter',
|
|
1427
|
+
method_sig.arg_types[2][0],
|
|
1428
|
+
arg2_type,
|
|
1429
|
+
arg2,
|
|
1430
|
+
caller_offset: -1
|
|
1431
|
+
)
|
|
1432
|
+
end
|
|
1433
|
+
|
|
1434
|
+
unless arg3_type.valid?(arg3)
|
|
1435
|
+
CallValidation.report_error(
|
|
1436
|
+
method_sig,
|
|
1437
|
+
method_sig.arg_types[3][1].error_message_for_obj(arg3),
|
|
1438
|
+
'Parameter',
|
|
1439
|
+
method_sig.arg_types[3][0],
|
|
1440
|
+
arg3_type,
|
|
1441
|
+
arg3,
|
|
1442
|
+
caller_offset: -1
|
|
1443
|
+
)
|
|
1444
|
+
end
|
|
1445
|
+
|
|
1446
|
+
# The following line breaks are intentional to show nice pry message
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
# PRY note:
|
|
1458
|
+
# this code is sig validation code.
|
|
1459
|
+
# Please issue `finish` to step out of it
|
|
1460
|
+
|
|
1461
|
+
original_method.bind(self).call(arg0, arg1, arg2, arg3, &blk)
|
|
1462
|
+
end
|
|
1463
|
+
end
|
|
1464
|
+
|
|
947
1465
|
def self.create_validator_procedure_medium(mod, original_method, method_sig, original_visibility)
|
|
948
1466
|
# trampoline to reduce stack frame size
|
|
949
1467
|
arg_types = method_sig.arg_types
|