Swift: use multiline comments for docs

This commit is contained in:
Alex Denisov
2023-11-23 16:33:15 +01:00
parent f77fd812a9
commit f6f6c98306

View File

@@ -8,7 +8,9 @@ private import codeql.swift.generated.MacroRole
* The role of a macro, for example #freestanding(declaration) or @attached(member).
*/
class MacroRole extends Generated::MacroRole {
// String representation of the role kind.
/**
* String representation of the role kind.
*/
string getKindName() {
this.isExpressionKind() and result = "expression"
or
@@ -29,44 +31,68 @@ class MacroRole extends Generated::MacroRole {
this.isExtensionKind() and result = "extension"
}
// Holds for `expression` roles.
/**
* Holds for `expression` roles.
*/
predicate isExpressionKind() { this.getKind() = 1 }
// Holds for `declaration` roles.
/**
* Holds for `declaration` roles.
*/
predicate isDeclarationKind() { this.getKind() = 2 }
// Holds for `accessor` roles.
/**
* Holds for `accessor` roles.
*/
predicate isAccessorKind() { this.getKind() = 4 }
// Holds for `memberAttribute` roles.
/**
* Holds for `memberAttribute` roles.
*/
predicate isMemberAttributeKind() { this.getKind() = 8 }
// Holds for `member` roles.
/**
* Holds for `member` roles.
*/
predicate isMemberKind() { this.getKind() = 16 }
// Holds for `peer` roles.
/**
* Holds for `peer` roles.
*/
predicate isPeerKind() { this.getKind() = 32 }
// Holds for `conformance` roles.
/**
* Holds for `conformance` roles.
*/
predicate isConformanceKind() { this.getKind() = 64 }
// Holds for `codeItem` roles.
/**
* Holds for `codeItem` roles.
*/
predicate isCodeItemKind() { this.getKind() = 128 }
// Holds for `extension` roles.
/**
* Holds for `extension` roles.
*/
predicate isExtensionKind() { this.getKind() = 256 }
// String representation of the syntax kind.
/**
* String representation of the macro syntax.
*/
string getMacroSyntaxName() {
this.isFreestandingMacroSyntax() and result = "#freestanding"
or
this.isAttachedMacroSyntax() and result = "@attached"
}
// Holds for #freestanding macros.
/**
* Holds for #freestanding macros.
*/
predicate isFreestandingMacroSyntax() { this.getMacroSyntax() = 0 }
// Holds for @attached macros.
/**
* Holds for @attached macros.
*/
predicate isAttachedMacroSyntax() { this.getMacroSyntax() = 1 }
override string toString() { result = this.getMacroSyntaxName() + "(" + this.getKindName() + ")" }