From 963a8c0d368fd95131d147b68be6770e1dead5e1 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Tue, 25 Apr 2023 15:11:41 -0700 Subject: [PATCH] Add a compatibility layer for SwiftSyntax When renaming methods this new file can contain deprecated declarations to keep clients building. --- Sources/SwiftSyntax/CMakeLists.txt | 1 + .../SwiftSyntaxCompatibility.swift | 21 +++++++++++++++++++ utils/group.json | 1 + 3 files changed, 23 insertions(+) create mode 100644 Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift diff --git a/Sources/SwiftSyntax/CMakeLists.txt b/Sources/SwiftSyntax/CMakeLists.txt index 117fd67368e..66cb0a96043 100644 --- a/Sources/SwiftSyntax/CMakeLists.txt +++ b/Sources/SwiftSyntax/CMakeLists.txt @@ -18,6 +18,7 @@ add_swift_host_library(SwiftSyntax SourceLength.swift SourceLocation.swift SourcePresence.swift + SwiftSyntaxCompatibility.swift Syntax.swift SyntaxArena.swift SyntaxChildren.swift diff --git a/Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift b/Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift new file mode 100644 index 00000000000..4c7239cfbe3 --- /dev/null +++ b/Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +// This file provides compatiblity aliases to keep dependents of SwiftSyntax building. +// All users of the declarations in this file should transition away from them ASAP. + +public extension DeclGroupSyntax { + @available(*, deprecated, renamed: "memberBlock") + var members: MemberDeclBlockSyntax { + return self.memberBlock + } +} diff --git a/utils/group.json b/utils/group.json index ba6bb56be3b..ebefbc61788 100644 --- a/utils/group.json +++ b/utils/group.json @@ -62,5 +62,6 @@ "SyntaxVerifier.swift", "BumpPtrAllocator.swift", "PlatformMutex.swift", + "SwiftSyntaxCompatibility.swift", ] }