|
1 |
| -// the following QLdoc is generated: if you need to edit it, do it in the schema file |
| 1 | +/** |
| 2 | + * This module provides a hand-modifiable wrapper around the generated class `MacroRole`. |
| 3 | + */ |
| 4 | + |
| 5 | +private import codeql.swift.generated.MacroRole |
| 6 | + |
2 | 7 | /**
|
3 | 8 | * The role of a macro, for example #freestanding(declaration) or @attached(member).
|
4 | 9 | */
|
5 | 10 | class MacroRole extends Generated::MacroRole {
|
6 |
| - /** |
7 |
| - * String representation of the role kind. |
8 |
| - */ |
| 11 | + // String representation of the role kind. |
9 | 12 | string getKindName() {
|
10 |
| - this.getKind() = 1 and result = "expression" |
| 13 | + this.isExpressionKind() and result = "expression" |
11 | 14 | or
|
12 |
| - this.getKind() = 2 and result = "declaration" |
| 15 | + this.isDeclarationKind() and result = "declaration" |
13 | 16 | or
|
14 |
| - this.getKind() = 4 and result = "accessor" |
| 17 | + this.isAccessorKind() and result = "accessor" |
15 | 18 | or
|
16 |
| - this.getKind() = 8 and result = "memberAttribute" |
| 19 | + this.isMemberAttributeKind() and result = "memberAttribute" |
17 | 20 | or
|
18 |
| - this.getKind() = 16 and result = "member" |
| 21 | + this.isMemberKind() and result = "member" |
19 | 22 | or
|
20 |
| - this.getKind() = 32 and result = "peer" |
| 23 | + this.isPeerKind() and result = "peer" |
21 | 24 | or
|
22 |
| - this.getKind() = 64 and result = "conformance" |
| 25 | + this.isConformanceKind() and result = "conformance" |
23 | 26 | or
|
24 |
| - this.getKind() = 128 and result = "codeItem" |
| 27 | + this.isCodeItemKind() and result = "codeItem" |
25 | 28 | or
|
26 |
| - this.getKind() = 256 and result = "extension" |
| 29 | + this.isExtensionKind() and result = "extension" |
27 | 30 | }
|
28 | 31 |
|
29 |
| - /** |
30 |
| - * String representation of the syntax kind. |
31 |
| - */ |
| 32 | + // Holds for `expression` roles. |
| 33 | + predicate isExpressionKind() { this.getKind() = 1 } |
| 34 | + |
| 35 | + // Holds for `declaration` roles. |
| 36 | + predicate isDeclarationKind() { this.getKind() = 2 } |
| 37 | + |
| 38 | + // Holds for `accessor` roles. |
| 39 | + predicate isAccessorKind() { this.getKind() = 4 } |
| 40 | + |
| 41 | + // Holds for `memberAttribute` roles. |
| 42 | + predicate isMemberAttributeKind() { this.getKind() = 8 } |
| 43 | + |
| 44 | + // Holds for `member` roles. |
| 45 | + predicate isMemberKind() { this.getKind() = 16 } |
| 46 | + |
| 47 | + // Holds for `peer` roles. |
| 48 | + predicate isPeerKind() { this.getKind() = 32 } |
| 49 | + |
| 50 | + // Holds for `conformance` roles. |
| 51 | + predicate isConformanceKind() { this.getKind() = 64 } |
| 52 | + |
| 53 | + // Holds for `codeItem` roles. |
| 54 | + predicate isCodeItemKind() { this.getKind() = 128 } |
| 55 | + |
| 56 | + // Holds for `extension` roles. |
| 57 | + predicate isExtensionKind() { this.getKind() = 256 } |
| 58 | + |
| 59 | + // String representation of the syntax kind. |
32 | 60 | string getMacroSyntaxName() {
|
33 |
| - this.getMacroSyntax() = 0 and result = "#freestanding" |
| 61 | + this.isFreestandingMacroSyntax() and result = "#freestanding" |
34 | 62 | or
|
35 |
| - this.getMacroSyntax() = 1 and result = "@attached" |
| 63 | + this.isAttachedMacroSyntax() and result = "@attached" |
36 | 64 | }
|
37 | 65 |
|
| 66 | + // Holds for #freestanding macros. |
| 67 | + predicate isFreestandingMacroSyntax() { this.getMacroSyntax() = 0 } |
| 68 | + |
| 69 | + // Holds for @attached macros. |
| 70 | + predicate isAttachedMacroSyntax() { this.getMacroSyntax() = 1 } |
| 71 | + |
38 | 72 | override string toString() { result = this.getMacroSyntaxName() + "(" + this.getKindName() + ")" }
|
39 | 73 | }
|
0 commit comments