@@ -1319,6 +1319,7 @@ namespace {
1319
1319
LazyResolver *const TypeResolver;
1320
1320
SourceLoc Loc;
1321
1321
const SourceManager &SM;
1322
+ // / Used to find the file-local names.
1322
1323
DebuggerClient *const DebugClient;
1323
1324
const Options options;
1324
1325
const bool isOriginallyTypeLookup;
@@ -1412,8 +1413,10 @@ namespace {
1412
1413
baseNLOptions |= NL_IgnoreAccessControl;
1413
1414
return baseNLOptions;
1414
1415
}
1415
-
1416
- bool shouldReturnBasedOnResults (bool noMoreOuterResults = false ) {
1416
+
1417
+ // / Return true if done with lookup.
1418
+ bool isFinishedWithLookupNowThatIsAboutToLookForOuterResults (
1419
+ bool noMoreOuterResults = false ) {
1417
1420
if (Results.empty ())
1418
1421
return false ;
1419
1422
@@ -1467,7 +1470,7 @@ namespace {
1467
1470
}
1468
1471
1469
1472
// If we found anything, we're done.
1470
- if (shouldReturnBasedOnResults ())
1473
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1471
1474
return std::make_pair (ScopeLookupResult::finished, selfDC);
1472
1475
1473
1476
// When we are in the body of a method, get the 'self' declaration.
@@ -1583,8 +1586,8 @@ namespace {
1583
1586
} else {
1584
1587
if (DebugClient)
1585
1588
filterForDiscriminator (Results, DebugClient);
1586
-
1587
- if (shouldReturnBasedOnResults ())
1589
+
1590
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1588
1591
return std::make_pair (ScopeLookupResult::finished, selfDC);
1589
1592
}
1590
1593
}
@@ -1628,7 +1631,7 @@ namespace {
1628
1631
if (auto *selfParam = PBI->getImplicitSelfDecl ()) {
1629
1632
Consumer.foundDecl (selfParam,
1630
1633
DeclVisibilityKind::FunctionParameter);
1631
- if (shouldReturnBasedOnResults ())
1634
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1632
1635
return true ;
1633
1636
1634
1637
DC = DC->getParent ();
@@ -1667,13 +1670,13 @@ namespace {
1667
1670
1668
1671
namelookup::FindLocalVal localVal (SM, Loc, Consumer);
1669
1672
localVal.visit (AFD->getBody ());
1670
- if (shouldReturnBasedOnResults ())
1673
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1671
1674
return true ;
1672
1675
1673
1676
if (auto *P = AFD->getImplicitSelfDecl ())
1674
1677
localVal.checkValueDecl (P, DeclVisibilityKind::FunctionParameter);
1675
1678
localVal.checkParameterList (AFD->getParameters ());
1676
- if (shouldReturnBasedOnResults ())
1679
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1677
1680
return true ;
1678
1681
}
1679
1682
if (!isCascadingUse.hasValue () || isCascadingUse.getValue ())
@@ -1708,11 +1711,11 @@ namespace {
1708
1711
namelookup::FindLocalVal localVal (SM, Loc, Consumer);
1709
1712
if (auto body = CE->getBody ())
1710
1713
localVal.visit (body);
1711
- if (shouldReturnBasedOnResults ())
1714
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1712
1715
return true ;
1713
1716
if (auto params = CE->getParameters ())
1714
1717
localVal.checkParameterList (params);
1715
- if (shouldReturnBasedOnResults ())
1718
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1716
1719
return true ;
1717
1720
}
1718
1721
}
@@ -1752,8 +1755,8 @@ namespace {
1752
1755
if (GenericParams) {
1753
1756
namelookup::FindLocalVal localVal (SM, Loc, Consumer);
1754
1757
localVal.checkGenericParams (GenericParams);
1755
-
1756
- if (shouldReturnBasedOnResults ())
1758
+
1759
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1757
1760
return true ;
1758
1761
}
1759
1762
@@ -1769,8 +1772,8 @@ namespace {
1769
1772
while (dcGenericParams) {
1770
1773
namelookup::FindLocalVal localVal (SM, Loc, Consumer);
1771
1774
localVal.checkGenericParams (dcGenericParams);
1772
-
1773
- if (shouldReturnBasedOnResults ())
1775
+
1776
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1774
1777
return true ;
1775
1778
1776
1779
dcGenericParams = dcGenericParams->getOuterParameters ();
@@ -1818,8 +1821,8 @@ namespace {
1818
1821
} else {
1819
1822
if (DebugClient)
1820
1823
filterForDiscriminator (Results, DebugClient);
1821
-
1822
- if (shouldReturnBasedOnResults ())
1824
+
1825
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1823
1826
return true ;
1824
1827
}
1825
1828
}
@@ -1842,7 +1845,7 @@ namespace {
1842
1845
// local types.
1843
1846
namelookup::FindLocalVal localVal (SM, Loc, Consumer);
1844
1847
localVal.checkSourceFile (*SF);
1845
- if (shouldReturnBasedOnResults ())
1848
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults ())
1846
1849
return true ;
1847
1850
}
1848
1851
}
@@ -1882,14 +1885,16 @@ namespace {
1882
1885
isOriginallyTypeLookup, Results);
1883
1886
1884
1887
// If we've found something, we're done.
1885
- if (shouldReturnBasedOnResults (/* noMoreOuterResults=*/ true ))
1888
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults (
1889
+ /* noMoreOuterResults=*/ true ))
1886
1890
return ;
1887
1891
1888
1892
// If we still haven't found anything, but we do have some
1889
1893
// declarations that are "unavailable in the current Swift", drop
1890
1894
// those in.
1891
1895
Results = std::move (UnavailableInnerResults);
1892
- if (shouldReturnBasedOnResults (/* noMoreOuterResults=*/ true ))
1896
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults (
1897
+ /* noMoreOuterResults=*/ true ))
1893
1898
return ;
1894
1899
1895
1900
if (!Name.isSimpleName ())
@@ -1898,7 +1903,8 @@ namespace {
1898
1903
// Look for a module with the given name.
1899
1904
if (Name.isSimpleName (M.getName ())) {
1900
1905
Results.push_back (LookupResultEntry (&M));
1901
- if (shouldReturnBasedOnResults (/* noMoreOuterResults=*/ true ))
1906
+ if (isFinishedWithLookupNowThatIsAboutToLookForOuterResults (
1907
+ /* noMoreOuterResults=*/ true ))
1902
1908
return ;
1903
1909
}
1904
1910
@@ -1915,7 +1921,8 @@ namespace {
1915
1921
});
1916
1922
}
1917
1923
// Make sure we've recorded the inner-result-boundary.
1918
- (void )shouldReturnBasedOnResults (/* noMoreOuterResults=*/ true );
1924
+ (void )isFinishedWithLookupNowThatIsAboutToLookForOuterResults (
1925
+ /* noMoreOuterResults=*/ true );
1919
1926
}
1920
1927
};
1921
1928
} // end anon namespace
0 commit comments