Skip to content

Commit 543fb81

Browse files
committed
xxx
1 parent 0bdc011 commit 543fb81

13 files changed

+225
-549
lines changed

include/swift/AST/NameLookup.h

Lines changed: 10 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ class AccessFilteringDeclConsumer final : public VisibleDeclConsumer {
442442
DynamicLookupInfo dynamicLookupInfo = {}) override;
443443
};
444444

445-
/// Filters out decls that are not usable based on their source location, eg.
446-
/// a decl inside its own initializer or a non-type decl before its definition.
445+
/// Filters out decls that are not usable based on their source location, e.g.
446+
/// a decl inside its own initializer or shadowed decls.
447447
class UsableFilteringDeclConsumer final : public VisibleDeclConsumer {
448448
const SourceManager &SM;
449449
const DeclContext *DC;
@@ -465,7 +465,7 @@ class UsableFilteringDeclConsumer final : public VisibleDeclConsumer {
465465
}
466466

467467
void foundDecl(ValueDecl *D, DeclVisibilityKind reason,
468-
DynamicLookupInfo dynamicLookupInfo) override;
468+
DynamicLookupInfo dynamicLookupInfo = {}) override;
469469
};
470470

471471
/// Remove any declarations in the given set that were overridden by
@@ -504,14 +504,10 @@ bool removeShadowedDecls(TinyPtrVector<OperatorDecl *> &decls,
504504
bool removeShadowedDecls(TinyPtrVector<PrecedenceGroupDecl *> &decls,
505505
const DeclContext *dc);
506506

507-
/// Finds decls visible in the given context and feeds them to the given
508-
/// VisibleDeclConsumer. If the current DeclContext is nested in a function,
509-
/// the SourceLoc is used to determine which declarations in that function
510-
/// are visible.
511-
void lookupVisibleDecls(VisibleDeclConsumer &Consumer,
512-
const DeclContext *DC,
513-
bool IncludeTopLevel,
514-
SourceLoc Loc = SourceLoc());
507+
/// Finds decls visible in the given context at the given location and feeds
508+
/// them to the given VisibleDeclConsumer.
509+
void lookupVisibleDecls(VisibleDeclConsumer &Consumer, SourceLoc Loc,
510+
const DeclContext *DC, bool IncludeTopLevel);
515511

516512
/// Finds decls visible as members of the given type and feeds them to the given
517513
/// VisibleDeclConsumer.
@@ -630,70 +626,6 @@ SelfBounds getSelfBoundsFromGenericSignature(const ExtensionDecl *extDecl);
630626

631627
namespace namelookup {
632628

633-
/// Searches through statements and patterns for local variable declarations.
634-
class FindLocalVal : public StmtVisitor<FindLocalVal> {
635-
friend class ASTVisitor<FindLocalVal>;
636-
637-
const SourceManager &SM;
638-
SourceLoc Loc;
639-
VisibleDeclConsumer &Consumer;
640-
641-
public:
642-
FindLocalVal(const SourceManager &SM, SourceLoc Loc,
643-
VisibleDeclConsumer &Consumer)
644-
: SM(SM), Loc(Loc), Consumer(Consumer) {}
645-
646-
void checkValueDecl(ValueDecl *D, DeclVisibilityKind Reason);
647-
648-
void checkPattern(const Pattern *Pat, DeclVisibilityKind Reason);
649-
650-
void checkParameterList(const ParameterList *params);
651-
652-
void checkGenericParams(GenericParamList *Params);
653-
654-
void checkSourceFile(const SourceFile &SF);
655-
656-
private:
657-
bool isReferencePointInRange(SourceRange R) {
658-
return SM.rangeContainsTokenLoc(R, Loc);
659-
}
660-
661-
void visitBreakStmt(BreakStmt *) {}
662-
void visitContinueStmt(ContinueStmt *) {}
663-
void visitFallthroughStmt(FallthroughStmt *) {}
664-
void visitFailStmt(FailStmt *) {}
665-
void visitReturnStmt(ReturnStmt *) {}
666-
void visitYieldStmt(YieldStmt *) {}
667-
void visitThenStmt(ThenStmt *) {}
668-
void visitThrowStmt(ThrowStmt *) {}
669-
void visitDiscardStmt(DiscardStmt *) {}
670-
void visitPoundAssertStmt(PoundAssertStmt *) {}
671-
void visitDeferStmt(DeferStmt *DS) {
672-
// Nothing in the defer is visible.
673-
}
674-
675-
void checkStmtCondition(const StmtCondition &Cond);
676-
677-
void visitIfStmt(IfStmt *S);
678-
void visitGuardStmt(GuardStmt *S);
679-
680-
void visitWhileStmt(WhileStmt *S);
681-
void visitRepeatWhileStmt(RepeatWhileStmt *S);
682-
void visitDoStmt(DoStmt *S);
683-
684-
void visitForEachStmt(ForEachStmt *S);
685-
686-
void visitBraceStmt(BraceStmt *S, bool isTopLevelCode = false);
687-
688-
void visitSwitchStmt(SwitchStmt *S);
689-
690-
void visitCaseStmt(CaseStmt *S);
691-
692-
void visitDoCatchStmt(DoCatchStmt *S);
693-
694-
};
695-
696-
697629
/// The bridge between the legacy UnqualifiedLookupFactory and the new ASTScope
698630
/// lookup system
699631
class AbstractASTScopeDeclConsumer {
@@ -737,9 +669,9 @@ class AbstractASTScopeDeclConsumer {
737669
}
738670

739671
#ifndef NDEBUG
740-
virtual void startingNextLookupStep() = 0;
741-
virtual void finishingLookup(std::string) const = 0;
742-
virtual bool isTargetLookup() const = 0;
672+
virtual void startingNextLookupStep() {}
673+
virtual void finishingLookup(std::string) const {}
674+
virtual bool isTargetLookup() const { return false; }
743675
#endif
744676
};
745677

0 commit comments

Comments
 (0)