@@ -222,7 +222,7 @@ bool ASTScopeImpl::lookInGenericParametersOf(
222
222
SmallVector<ValueDecl *, 32 > bindings;
223
223
for (auto *param : paramList.get ()->getParams ())
224
224
bindings.push_back (param);
225
- if (consumer.consume (bindings, DeclVisibilityKind::GenericParameter ))
225
+ if (consumer.consume (bindings))
226
226
return true ;
227
227
return false ;
228
228
}
@@ -289,28 +289,26 @@ PatternEntryInitializerScope::getLookupParent() const {
289
289
290
290
bool GenericParamScope::lookupLocalsOrMembers (DeclConsumer consumer) const {
291
291
auto *param = paramList->getParams ()[index];
292
- return consumer.consume ({param}, DeclVisibilityKind::GenericParameter );
292
+ return consumer.consume ({param});
293
293
}
294
294
295
295
bool PatternEntryDeclScope::lookupLocalsOrMembers (DeclConsumer consumer) const {
296
296
if (vis != DeclVisibilityKind::LocalVariable)
297
297
return false ; // look in self type will find this later
298
- return lookupLocalBindingsInPattern (getPattern (), vis, consumer);
298
+ return lookupLocalBindingsInPattern (getPattern (), consumer);
299
299
}
300
300
301
301
bool ForEachPatternScope::lookupLocalsOrMembers (DeclConsumer consumer) const {
302
- return lookupLocalBindingsInPattern (
303
- stmt->getPattern (), DeclVisibilityKind::LocalVariable, consumer);
302
+ return lookupLocalBindingsInPattern (stmt->getPattern (), consumer);
304
303
}
305
304
306
305
bool CaseLabelItemScope::lookupLocalsOrMembers (DeclConsumer consumer) const {
307
- return lookupLocalBindingsInPattern (
308
- item.getPattern (), DeclVisibilityKind::LocalVariable, consumer);
306
+ return lookupLocalBindingsInPattern (item.getPattern (), consumer);
309
307
}
310
308
311
309
bool CaseStmtBodyScope::lookupLocalsOrMembers (DeclConsumer consumer) const {
312
310
for (auto *var : stmt->getCaseBodyVariablesOrEmptyArray ())
313
- if (consumer.consume ({var}, DeclVisibilityKind::LocalVariable ))
311
+ if (consumer.consume ({var}))
314
312
return true ;
315
313
316
314
return false ;
@@ -320,13 +318,12 @@ bool FunctionBodyScope::lookupLocalsOrMembers(
320
318
DeclConsumer consumer) const {
321
319
if (auto *paramList = decl->getParameters ()) {
322
320
for (auto *paramDecl : *paramList)
323
- if (consumer.consume ({paramDecl}, DeclVisibilityKind::FunctionParameter ))
321
+ if (consumer.consume ({paramDecl}))
324
322
return true ;
325
323
}
326
324
327
325
if (decl->getDeclContext ()->isTypeContext ()) {
328
- return consumer.consume ({decl->getImplicitSelfDecl ()},
329
- DeclVisibilityKind::FunctionParameter);
326
+ return consumer.consume ({decl->getImplicitSelfDecl ()});
330
327
}
331
328
332
329
// Consider \c var t: T { (did/will/)get/set { ... t }}
@@ -335,7 +332,7 @@ bool FunctionBodyScope::lookupLocalsOrMembers(
335
332
// then t needs to be found as a local binding:
336
333
if (auto *accessor = dyn_cast<AccessorDecl>(decl)) {
337
334
if (auto *storage = accessor->getStorage ())
338
- if (consumer.consume ({storage}, DeclVisibilityKind::LocalVariable ))
335
+ if (consumer.consume ({storage}))
339
336
return true ;
340
337
}
341
338
@@ -346,7 +343,7 @@ bool SpecializeAttributeScope::lookupLocalsOrMembers(
346
343
DeclConsumer consumer) const {
347
344
if (auto *params = whatWasSpecialized->getGenericParams ())
348
345
for (auto *param : params->getParams ())
349
- if (consumer.consume ({param}, DeclVisibilityKind::GenericParameter ))
346
+ if (consumer.consume ({param}))
350
347
return true ;
351
348
return false ;
352
349
}
@@ -356,7 +353,7 @@ bool DifferentiableAttributeScope::lookupLocalsOrMembers(
356
353
auto visitAbstractFunctionDecl = [&](AbstractFunctionDecl *afd) {
357
354
if (auto *params = afd->getGenericParams ())
358
355
for (auto *param : params->getParams ())
359
- if (consumer.consume ({param}, DeclVisibilityKind::GenericParameter ))
356
+ if (consumer.consume ({param}))
360
357
return true ;
361
358
return false ;
362
359
};
@@ -371,7 +368,7 @@ bool DifferentiableAttributeScope::lookupLocalsOrMembers(
371
368
}
372
369
373
370
bool BraceStmtScope::lookupLocalsOrMembers (DeclConsumer consumer) const {
374
- if (consumer.consume (localFuncsAndTypes, DeclVisibilityKind::LocalVariable ))
371
+ if (consumer.consume (localFuncsAndTypes))
375
372
return true ;
376
373
377
374
if (consumer.consumePossiblyNotInScope (localVars))
@@ -390,18 +387,15 @@ bool PatternEntryInitializerScope::lookupLocalsOrMembers(
390
387
decl->getInitContext (0 ));
391
388
if (initContext) {
392
389
if (auto *selfParam = initContext->getImplicitSelfDecl ()) {
393
- return consumer.consume ({selfParam},
394
- DeclVisibilityKind::FunctionParameter);
390
+ return consumer.consume ({selfParam});
395
391
}
396
392
}
397
393
return false ;
398
394
}
399
395
400
396
bool CaptureListScope::lookupLocalsOrMembers (DeclConsumer consumer) const {
401
397
for (auto &e : expr->getCaptureList ()) {
402
- if (consumer.consume (
403
- {e.Var },
404
- DeclVisibilityKind::LocalVariable)) // or FunctionParameter??
398
+ if (consumer.consume ({e.Var }))
405
399
return true ;
406
400
}
407
401
return false ;
@@ -410,26 +404,24 @@ bool CaptureListScope::lookupLocalsOrMembers(DeclConsumer consumer) const {
410
404
bool ClosureParametersScope::lookupLocalsOrMembers (
411
405
DeclConsumer consumer) const {
412
406
for (auto param : *closureExpr->getParameters ())
413
- if (consumer.consume ({param}, DeclVisibilityKind::FunctionParameter ))
407
+ if (consumer.consume ({param}))
414
408
return true ;
415
409
return false ;
416
410
}
417
411
418
412
bool ConditionalClausePatternUseScope::lookupLocalsOrMembers (
419
413
DeclConsumer consumer) const {
420
- return lookupLocalBindingsInPattern (
421
- pattern, DeclVisibilityKind::LocalVariable, consumer);
414
+ return lookupLocalBindingsInPattern (pattern, consumer);
422
415
}
423
416
424
417
bool ASTScopeImpl::lookupLocalBindingsInPattern (const Pattern *p,
425
- DeclVisibilityKind vis,
426
418
DeclConsumer consumer) {
427
419
if (!p)
428
420
return false ;
429
421
bool isDone = false ;
430
422
p->forEachVariable ([&](VarDecl *var) {
431
423
if (!isDone)
432
- isDone = consumer.consume ({var}, vis );
424
+ isDone = consumer.consume ({var});
433
425
});
434
426
return isDone;
435
427
}
0 commit comments