-
Notifications
You must be signed in to change notification settings - Fork 439
Add an introducer property to DeclGroupSyntax #2539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2014 - 2024 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
extension ActorDeclSyntax { | ||
public var introducer: TokenSyntax { | ||
get { | ||
return actorKeyword | ||
} | ||
set { | ||
actorKeyword = newValue | ||
} | ||
} | ||
} | ||
|
||
extension ClassDeclSyntax { | ||
public var introducer: TokenSyntax { | ||
get { | ||
return classKeyword | ||
} | ||
set { | ||
classKeyword = newValue | ||
} | ||
} | ||
} | ||
|
||
extension EnumDeclSyntax { | ||
public var introducer: TokenSyntax { | ||
get { | ||
return enumKeyword | ||
} | ||
set { | ||
enumKeyword = newValue | ||
} | ||
} | ||
} | ||
|
||
extension ExtensionDeclSyntax { | ||
public var introducer: TokenSyntax { | ||
get { | ||
return extensionKeyword | ||
} | ||
set { | ||
extensionKeyword = newValue | ||
} | ||
} | ||
} | ||
|
||
extension ProtocolDeclSyntax { | ||
public var introducer: TokenSyntax { | ||
get { | ||
return protocolKeyword | ||
} | ||
set { | ||
protocolKeyword = newValue | ||
} | ||
} | ||
} | ||
|
||
extension StructDeclSyntax { | ||
public var introducer: TokenSyntax { | ||
get { | ||
return structKeyword | ||
} | ||
set { | ||
structKeyword = newValue | ||
} | ||
} | ||
} | ||
|
||
//==========================================================================// | ||
// IMPORTANT: If you are tempted to add an extension here, please insert // | ||
// it in alphabetical order above // | ||
//==========================================================================// |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,22 @@ public protocol DeclGroupSyntax: SyntaxProtocol, DeclSyntaxProtocol { | |
set | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also open to renaming There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’m not a huge fan of my suggestion but what this conceptually is, is a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That matches the other "With" at least 😅 |
||
/// The token that introduces this declaration, eg. `class` for a class declaration. | ||
/// | ||
/// ### Tokens | ||
/// | ||
/// For syntax trees generated by the parser, this is guaranteed to be one of the following kinds: | ||
/// - `actor` | ||
/// - `class` | ||
/// - `enum` | ||
/// - `extension` | ||
/// - `protocol` | ||
/// - `struct` | ||
var introducer: TokenSyntax { | ||
get | ||
set | ||
} | ||
|
||
var inheritanceClause: InheritanceClauseSyntax? { | ||
get | ||
set | ||
|
Uh oh!
There was an error while loading. Please reload this page.