File tree 1 file changed +13
-9
lines changed
1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -76,18 +76,22 @@ GenericSignatureImpl::GenericSignatureImpl(
76
76
77
77
TypeArrayView<GenericTypeParamType>
78
78
GenericSignatureImpl::getInnermostGenericParams () const {
79
- auto params = getGenericParams ();
79
+ const auto params = getGenericParams ();
80
80
81
- // Find the point at which the depth changes.
82
- unsigned depth = params.back ()->getDepth ();
83
- for (unsigned n = params.size (); n > 0 ; --n) {
84
- if (params[n-1 ]->getDepth () != depth) {
85
- return params.slice (n);
86
- }
81
+ const unsigned maxDepth = params.back ()->getDepth ();
82
+ if (params.front ()->getDepth () == maxDepth)
83
+ return params;
84
+
85
+ // There is a depth change. Count the number of elements
86
+ // to slice off the front.
87
+ unsigned sliceCount = params.size () - 1 ;
88
+ while (true ) {
89
+ if (params[sliceCount - 1 ]->getDepth () != maxDepth)
90
+ break ;
91
+ --sliceCount;
87
92
}
88
93
89
- // All parameters are at the same depth.
90
- return params;
94
+ return params.slice (sliceCount);
91
95
}
92
96
93
97
void GenericSignatureImpl::forEachParam (
You can’t perform that action at this time.
0 commit comments