File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 18
18
#include " swift/AST/DeclNameLoc.h"
19
19
#include " swift/AST/Effects.h"
20
20
#include " swift/AST/Module.h"
21
+ #include " swift/AST/Expr.h"
21
22
#include " swift/Basic/LLVM.h"
22
23
#include " swift/IDE/SourceEntityWalker.h"
23
24
#include " swift/Parse/Token.h"
@@ -740,7 +741,7 @@ bool isDeclOverridable(ValueDecl *D);
740
741
// / one in `SomeType`. Contrast that to `type(of: foo).classMethod()` where
741
742
// / `classMethod` could be any `classMethod` up or down the hierarchy from the
742
743
// / type of the \p Base expression.
743
- bool isDynamicRef (Expr *Base, ValueDecl *D);
744
+ bool isDynamicRef (Expr *Base, ValueDecl *D, llvm::function_ref<Type(Expr *)> getType = [](Expr *E) { return E-> getType (); } );
744
745
745
746
// / Adds the resolved nominal types of \p Base to \p Types.
746
747
void getReceiverType (Expr *Base,
Original file line number Diff line number Diff line change @@ -921,7 +921,7 @@ bool swift::ide::isDeclOverridable(ValueDecl *D) {
921
921
return true ;
922
922
}
923
923
924
- bool swift::ide::isDynamicRef (Expr *Base, ValueDecl *D) {
924
+ bool swift::ide::isDynamicRef (Expr *Base, ValueDecl *D, llvm::function_ref<Type(Expr *)> getType ) {
925
925
if (!isDeclOverridable (D))
926
926
return false ;
927
927
@@ -940,7 +940,7 @@ bool swift::ide::isDynamicRef(Expr *Base, ValueDecl *D) {
940
940
941
941
// `type(of: foo).staticOrClassMethod()`. A static method may be "dynamic"
942
942
// here, but not if the instance type is a struct/enum.
943
- if (auto IT = Base-> getType ()->getAs <MetatypeType>()) {
943
+ if (auto IT = getType (Base )->getAs <MetatypeType>()) {
944
944
auto InstanceType = IT->getInstanceType ();
945
945
if (InstanceType->getStructOrBoundGenericStruct () ||
946
946
InstanceType->getEnumOrBoundGenericEnum ())
You can’t perform that action at this time.
0 commit comments