Created
February 28, 2016 18:02
-
-
Save skids/b7db42fc7d029e5c0f9e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Signature.pm b/src/core/Signature.pm | |
index 129b4e9..0cbe262 100644 | |
--- a/src/core/Signature.pm | |
+++ b/src/core/Signature.pm | |
@@ -138,16 +138,26 @@ my class Signature { # declared in BOOTSTRAP | |
multi sub infix:<eqv>(Signature $a, Signature $b) { $a.perl eq $b.perl } | |
Perl6::Metamodel::Configuration.set_multi_sig_comparator( | |
- -> \a, \b { my $sa = a.signature.^find_private_method('gistperl')( | |
- a.signature, True, :where(-> $ { Nil })); | |
- with $sa { | |
- my $sb = b.signature.^find_private_method('gistperl')( | |
- b.signature, True, :where(-> $ { Nil })); | |
- $sa eqv $sb; | |
- } | |
- else { | |
- False; | |
- } | |
- }); | |
+ -> \a, \b { | |
+ my \sa := a.signature; | |
+ my \sb := b.signature; | |
+ | |
+ my $rv = -1; | |
+ if sa.count == sb.count | |
+ and +sa.params == +sb.params { # same thing? | |
+ while ++$rv < +sa.params { | |
+ my \sap := sa.params; | |
+ my \sbp := sb.params; | |
+ $rv = +sa.params | |
+ unless sap[$rv].invocant == sbp[$rv].invocant | |
+ and sap[$rv].multi-invocant == sbp[$rv].multi-invocant | |
+ and (my \pa := sap[$rv].perl(:where(-> $ { Nil }))) !=:= Nil | |
+ and (my \pb := sbp[$rv].perl(:where(-> $ { Nil }))) !=:= Nil | |
+ and pa eq pb; | |
+ } | |
+ } | |
+ $rv == +sa.params and sa.returns.perl eq sb.returns.perl; | |
+ } | |
+); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment