|
2 | 2 | private import codeql.swift.generated.Synth |
3 | 3 | private import codeql.swift.generated.Raw |
4 | 4 | import codeql.swift.elements.expr.Expr |
| 5 | +import codeql.swift.elements.expr.OpaqueValueExpr |
5 | 6 |
|
6 | 7 | module Generated { |
| 8 | + /** |
| 9 | + * A placeholder substituting property initializations with `=` when the property has a property |
| 10 | + * wrapper with an initializer. |
| 11 | + */ |
7 | 12 | class PropertyWrapperValuePlaceholderExpr extends Synth::TPropertyWrapperValuePlaceholderExpr, |
8 | 13 | Expr { |
9 | 14 | override string getAPrimaryQlClass() { result = "PropertyWrapperValuePlaceholderExpr" } |
| 15 | + |
| 16 | + /** |
| 17 | + * Gets the wrapped value of this property wrapper value placeholder expression, if it exists. |
| 18 | + * |
| 19 | + * This includes nodes from the "hidden" AST. It can be overridden in subclasses to change the |
| 20 | + * behavior of both the `Immediate` and non-`Immediate` versions. |
| 21 | + */ |
| 22 | + Expr getImmediateWrappedValue() { |
| 23 | + result = |
| 24 | + Synth::convertExprFromRaw(Synth::convertPropertyWrapperValuePlaceholderExprToRaw(this) |
| 25 | + .(Raw::PropertyWrapperValuePlaceholderExpr) |
| 26 | + .getWrappedValue()) |
| 27 | + } |
| 28 | + |
| 29 | + /** |
| 30 | + * Gets the wrapped value of this property wrapper value placeholder expression, if it exists. |
| 31 | + */ |
| 32 | + final Expr getWrappedValue() { result = getImmediateWrappedValue().resolve() } |
| 33 | + |
| 34 | + /** |
| 35 | + * Holds if `getWrappedValue()` exists. |
| 36 | + */ |
| 37 | + final predicate hasWrappedValue() { exists(getWrappedValue()) } |
| 38 | + |
| 39 | + /** |
| 40 | + * Gets the placeholder of this property wrapper value placeholder expression. |
| 41 | + * |
| 42 | + * This includes nodes from the "hidden" AST. It can be overridden in subclasses to change the |
| 43 | + * behavior of both the `Immediate` and non-`Immediate` versions. |
| 44 | + */ |
| 45 | + OpaqueValueExpr getImmediatePlaceholder() { |
| 46 | + result = |
| 47 | + Synth::convertOpaqueValueExprFromRaw(Synth::convertPropertyWrapperValuePlaceholderExprToRaw(this) |
| 48 | + .(Raw::PropertyWrapperValuePlaceholderExpr) |
| 49 | + .getPlaceholder()) |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * Gets the placeholder of this property wrapper value placeholder expression. |
| 54 | + */ |
| 55 | + final OpaqueValueExpr getPlaceholder() { result = getImmediatePlaceholder().resolve() } |
10 | 56 | } |
11 | 57 | } |
0 commit comments