File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -76,18 +76,22 @@ GenericSignatureImpl::GenericSignatureImpl(
7676
7777TypeArrayView<GenericTypeParamType>
7878GenericSignatureImpl::getInnermostGenericParams () const {
79- auto params = getGenericParams ();
79+ const auto params = getGenericParams ();
8080
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;
8792 }
8893
89- // All parameters are at the same depth.
90- return params;
94+ return params.slice (sliceCount);
9195}
9296
9397void GenericSignatureImpl::forEachParam (
You can’t perform that action at this time.
0 commit comments