mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Manual rebase with master
This commit is contained in:
@@ -53,8 +53,7 @@ Optional<bool> ASTScope::computeIsCascadingUse(
|
||||
|
||||
void ASTScope::dump() const { impl->dump(); }
|
||||
void ASTScope::print(llvm::raw_ostream &out) const { impl->print(out); }
|
||||
void ASTScope::dumpOneScopeMapLocation(
|
||||
std::pair<unsigned, unsigned> lineCol) const {
|
||||
void ASTScope::dumpOneScopeMapLocation(std::pair<unsigned, unsigned> lineCol) {
|
||||
impl->dumpOneScopeMapLocation(lineCol);
|
||||
}
|
||||
|
||||
@@ -81,20 +80,9 @@ AbstractClosureScope::getClosureIfClosureScope() const {
|
||||
return closureExpr;
|
||||
}
|
||||
|
||||
Decl *ASTScopeImpl::getEnclosingAbstractFunctionOrSubscriptDecl() const {
|
||||
return getParent().get()->getEnclosingAbstractFunctionOrSubscriptDecl();
|
||||
}
|
||||
Decl *
|
||||
AbstractFunctionDeclScope::getEnclosingAbstractFunctionOrSubscriptDecl() const {
|
||||
return decl;
|
||||
}
|
||||
Decl *SubscriptDeclScope::getEnclosingAbstractFunctionOrSubscriptDecl() const {
|
||||
return decl;
|
||||
}
|
||||
|
||||
// Conservative, because using precise info would be circular
|
||||
SourceRange AttachedPropertyWrapperScope::getCustomAttributesSourceRange(
|
||||
const VarDecl *const vd) {
|
||||
SourceRange
|
||||
AttachedPropertyWrapperScope::getSourceRangeFor(const VarDecl *const vd) {
|
||||
SourceRange sr;
|
||||
for (auto *attr : vd->getAttrs().getAttributes<CustomAttr>()) {
|
||||
if (sr.isInvalid())
|
||||
@@ -142,7 +130,7 @@ LabeledConditionalStmt *GuardStmtScope::getLabeledConditionalStmt() const {
|
||||
#pragma mark getASTContext
|
||||
|
||||
ASTContext &ASTScopeImpl::getASTContext() const {
|
||||
if (auto d = getDecl())
|
||||
if (auto d = getDeclIfAny())
|
||||
return d.get()->getASTContext();
|
||||
if (auto dc = getDeclContext())
|
||||
return dc.get()->getASTContext();
|
||||
@@ -199,7 +187,7 @@ NullablePtr<DeclContext> AbstractFunctionDeclScope::getDeclContext() const {
|
||||
return decl;
|
||||
}
|
||||
|
||||
NullablePtr<DeclContext> AbstractFunctionParamsScope::getDeclContext() const {
|
||||
NullablePtr<DeclContext> ParameterListScope::getDeclContext() const {
|
||||
return matchingContext;
|
||||
}
|
||||
|
||||
@@ -215,14 +203,13 @@ std::string GenericTypeOrExtensionScope::getClassName() const {
|
||||
DEFINE_GET_CLASS_NAME(ASTSourceFileScope)
|
||||
DEFINE_GET_CLASS_NAME(GenericParamScope)
|
||||
DEFINE_GET_CLASS_NAME(AbstractFunctionDeclScope)
|
||||
DEFINE_GET_CLASS_NAME(AbstractFunctionParamsScope)
|
||||
DEFINE_GET_CLASS_NAME(ParameterListScope)
|
||||
DEFINE_GET_CLASS_NAME(MethodBodyScope)
|
||||
DEFINE_GET_CLASS_NAME(PureFunctionBodyScope)
|
||||
DEFINE_GET_CLASS_NAME(DefaultArgumentInitializerScope)
|
||||
DEFINE_GET_CLASS_NAME(AttachedPropertyWrapperScope)
|
||||
DEFINE_GET_CLASS_NAME(PatternEntryDeclScope)
|
||||
DEFINE_GET_CLASS_NAME(PatternEntryInitializerScope)
|
||||
DEFINE_GET_CLASS_NAME(PatternEntryUseScope)
|
||||
DEFINE_GET_CLASS_NAME(ConditionalClauseScope)
|
||||
DEFINE_GET_CLASS_NAME(ConditionalClausePatternUseScope)
|
||||
DEFINE_GET_CLASS_NAME(CaptureListScope)
|
||||
@@ -233,10 +220,11 @@ DEFINE_GET_CLASS_NAME(TopLevelCodeScope)
|
||||
DEFINE_GET_CLASS_NAME(SpecializeAttributeScope)
|
||||
DEFINE_GET_CLASS_NAME(SubscriptDeclScope)
|
||||
DEFINE_GET_CLASS_NAME(VarDeclScope)
|
||||
DEFINE_GET_CLASS_NAME(EnumElementScope)
|
||||
DEFINE_GET_CLASS_NAME(IfStmtScope)
|
||||
DEFINE_GET_CLASS_NAME(WhileStmtScope)
|
||||
DEFINE_GET_CLASS_NAME(GuardStmtScope)
|
||||
DEFINE_GET_CLASS_NAME(GuardStmtUseScope)
|
||||
DEFINE_GET_CLASS_NAME(LookupParentDiversionScope)
|
||||
DEFINE_GET_CLASS_NAME(RepeatWhileScope)
|
||||
DEFINE_GET_CLASS_NAME(DoCatchStmtScope)
|
||||
DEFINE_GET_CLASS_NAME(SwitchStmtScope)
|
||||
@@ -265,6 +253,12 @@ ExtensionScope::getCorrespondingNominalTypeDecl() const {
|
||||
return decl->getExtendedNominal();
|
||||
}
|
||||
|
||||
void ASTScopeImpl::preOrderDo(function_ref<void(ASTScopeImpl *)> fn) {
|
||||
fn(this);
|
||||
for (auto *child : getChildren())
|
||||
child->preOrderDo(fn);
|
||||
}
|
||||
|
||||
void ASTScopeImpl::postOrderDo(function_ref<void(ASTScopeImpl *)> fn) {
|
||||
for (auto *child : getChildren())
|
||||
child->postOrderDo(fn);
|
||||
|
||||
Reference in New Issue
Block a user