@@ -174,42 +174,6 @@ DeclName TypeChecker::getObjectLiteralConstructorName(ASTContext &Context,
174
174
llvm_unreachable (" unknown literal constructor" );
175
175
}
176
176
177
- // / Return an idealized form of the parameter type of the given
178
- // / object-literal initializer. This removes references to the protocol
179
- // / name from the first argument label, which would be otherwise be
180
- // / redundant when writing out the object-literal syntax:
181
- // /
182
- // / #fileLiteral(fileReferenceLiteralResourceName: "hello.jpg")
183
- // /
184
- // / Doing this allows us to preserve a nicer (and source-compatible)
185
- // / literal syntax while still giving the initializer a semantically
186
- // / unambiguous name.
187
- Type TypeChecker::getObjectLiteralParameterType (ObjectLiteralExpr *expr,
188
- ConstructorDecl *ctor) {
189
- auto params = ctor->getMethodInterfaceType ()
190
- ->castTo <FunctionType>()->getParams ();
191
- SmallVector<AnyFunctionType::Param, 8 > newParams;
192
- newParams.append (params.begin (), params.end ());
193
-
194
- auto replace = [&](StringRef replacement) -> Type {
195
- auto &Context = ctor->getASTContext ();
196
- newParams[0 ] = AnyFunctionType::Param (newParams[0 ].getPlainType (),
197
- Context.getIdentifier (replacement),
198
- newParams[0 ].getParameterFlags ());
199
- return AnyFunctionType::composeInput (Context, newParams,
200
- /* canonicalVararg=*/ false );
201
- };
202
-
203
- switch (expr->getLiteralKind ()) {
204
- case ObjectLiteralExpr::colorLiteral:
205
- return replace (" red" );
206
- case ObjectLiteralExpr::fileLiteral:
207
- case ObjectLiteralExpr::imageLiteral:
208
- return replace (" resourceName" );
209
- }
210
- llvm_unreachable (" unknown literal constructor" );
211
- }
212
-
213
177
ModuleDecl *TypeChecker::getStdlibModule (const DeclContext *dc) {
214
178
if (auto *stdlib = dc->getASTContext ().getStdlibModule ()) {
215
179
return stdlib;
0 commit comments