@@ -37,56 +37,3 @@ StringRef swift::getDefaultArgumentSpelling(DefaultArgumentKind kind) {
37
37
38
38
llvm_unreachable (" Unhandled DefaultArgumentKind in switch." );
39
39
}
40
-
41
- DefaultArgumentKind swift::inferDefaultArgumentKind (Expr *expr) {
42
- if (auto call = dyn_cast<CallExpr>(expr)) {
43
- if (auto ctorRefCall = dyn_cast<ConstructorRefCallExpr>(call->getFn ())) {
44
- if (auto ctorRef = dyn_cast<DeclRefExpr>(ctorRefCall->getFn ())) {
45
- if (auto ctor = dyn_cast<ConstructorDecl>(ctorRef->getDecl ())) {
46
- auto ctorArg = call->getArg ()->getSemanticsProvidingExpr ();
47
-
48
- // #file, #line, #column, #function, #dsohandle.
49
- if (auto magic = dyn_cast<MagicIdentifierLiteralExpr>(ctorArg)) {
50
- switch (magic->getKind ()) {
51
- case MagicIdentifierLiteralExpr::File:
52
- return DefaultArgumentKind::File;
53
- case MagicIdentifierLiteralExpr::Line:
54
- return DefaultArgumentKind::Line;
55
- case MagicIdentifierLiteralExpr::Column:
56
- return DefaultArgumentKind::Column;
57
- case MagicIdentifierLiteralExpr::Function:
58
- return DefaultArgumentKind::Function;
59
- case MagicIdentifierLiteralExpr::DSOHandle:
60
- return DefaultArgumentKind::DSOHandle;
61
- }
62
- }
63
-
64
- // nil.
65
- if (ctor->getFullName ().getArgumentNames ().size () == 1 &&
66
- ctor->getFullName ().getArgumentNames ()[0 ]
67
- == ctor->getASTContext ().Id_nilLiteral )
68
- return DefaultArgumentKind::NilLiteral;
69
- }
70
- }
71
- }
72
- }
73
-
74
- // Empty array literals, [].
75
- if (auto arrayExpr = dyn_cast<ArrayExpr>(expr)) {
76
- if (arrayExpr->getElements ().empty ())
77
- return DefaultArgumentKind::EmptyArray;
78
-
79
- return DefaultArgumentKind::None;
80
- }
81
-
82
- // Empty dictionary literals, [:].
83
- if (auto dictionaryExpr = dyn_cast<DictionaryExpr>(expr)) {
84
- if (dictionaryExpr->getElements ().empty ())
85
- return DefaultArgumentKind::EmptyDictionary;
86
-
87
- return DefaultArgumentKind::None;
88
- }
89
-
90
- return DefaultArgumentKind::None;
91
- }
92
-
0 commit comments