Skip to content

Commit 2552f41

Browse files
committed
[Name lookup] Add a staging flag for ASTScope-based name lookup.
1 parent 311fc55 commit 2552f41

File tree

7 files changed

+396
-171
lines changed

7 files changed

+396
-171
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ namespace swift {
141141
/// new enough?
142142
bool EnableTargetOSChecking = true;
143143

144+
/// Should we use \c ASTScope-based resolution for unqualified name lookup?
145+
bool EnableASTScopeLookup = false;
146+
144147
/// Whether to use the import as member inference system
145148
///
146149
/// When importing a global, try to infer whether we can import it as a

include/swift/Option/FrontendOptions.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ def disable_target_os_checking :
102102
Flag<["-"], "disable-target-os-checking">,
103103
HelpText<"Disable checking the target OS of serialized modules">;
104104

105+
def enable_astscope_lookup : Flag<["-"], "enable-astscope-lookup">,
106+
HelpText<"Enable ASTScope-based unqualified name lookup">;
107+
105108
def print_clang_stats : Flag<["-"], "print-clang-stats">,
106109
HelpText<"Print Clang importer statistics">;
107110

include/swift/Parse/Parser.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,9 @@ class Parser {
541541
}
542542

543543
ValueDecl *lookupInScope(DeclName Name) {
544+
if (Context.LangOpts.EnableASTScopeLookup)
545+
return nullptr;
546+
544547
return getScopeInfo().lookupValueName(Name);
545548
}
546549

lib/AST/ASTScope.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ DeclContext *ASTScope::getDeclContext() const {
15681568

15691569
case ASTScopeKind::Accessors:
15701570
// FIXME: Somewhat odd modeling because Subscripts don't have their
1571-
// own nodes. Maybe that should.
1571+
// own nodes. Maybe they should.
15721572
if (auto subscript = dyn_cast<SubscriptDecl>(abstractStorageDecl))
15731573
return subscript;
15741574

0 commit comments

Comments
 (0)