diff --git a/Sources/FrontEnd/TypeChecking/TypeChecker.swift b/Sources/FrontEnd/TypeChecking/TypeChecker.swift index 96169055b..587e66260 100644 --- a/Sources/FrontEnd/TypeChecking/TypeChecker.swift +++ b/Sources/FrontEnd/TypeChecking/TypeChecker.swift @@ -3169,7 +3169,7 @@ struct TypeChecker { /// without qualification. /// /// - Requires: The imports of the module containing `scopeOfUse` have been configured. - private mutating func lookup( + mutating func lookup( unqualified stem: String, in scopeOfUse: AnyScopeID ) -> Set { var matches = Set() @@ -3289,7 +3289,7 @@ struct TypeChecker { /// Returns the declarations that introduce a name with given `stem` as member of `nominalScope` /// and are exposed to `scopeOfUse`. - private mutating func lookup( + mutating func lookup( _ stem: String, memberOf nominalScope: AnyType, exposedTo scopeOfUse: AnyScopeID ) -> Set { switch nominalScope.base { diff --git a/Sources/FrontEnd/TypedProgram.swift b/Sources/FrontEnd/TypedProgram.swift index 4fc3b6fab..8d9ad8ef7 100644 --- a/Sources/FrontEnd/TypedProgram.swift +++ b/Sources/FrontEnd/TypedProgram.swift @@ -192,6 +192,26 @@ public struct TypedProgram { } } + /// Returns the declarations that introduce an entity with given `stem` exposed to `scopeOfUse` + /// without qualification. + /// + /// - Requires: The imports of the module containing `scopeOfUse` have been configured. + public func lookup( + unqualified stem: String, in scopeOfUse: AnyScopeID + ) -> Set { + var checker = TypeChecker(asContextFor: self) + return checker.lookup(unqualified: stem, in: scopeOfUse) + } + + /// Returns the declarations that introduce a name with given `stem` as member of `nominalScope` + /// and are exposed to `scopeOfUse`. + public func lookup( + _ stem: String, memberOf nominalScope: AnyType, exposedTo scopeOfUse: AnyScopeID + ) -> Set { + var checker = TypeChecker(asContextFor: self) + return checker.lookup(stem, memberOf: nominalScope, exposedTo: scopeOfUse) + } + /// Returns `true` iff deinitializing an instance of `t` in `scopeOfUse` is a no-op. /// /// A type is "trivially deinitializable" if deinitializing its instances doesn't have runtime