@@ -211,12 +211,15 @@ class ClassAggregateLiteral extends AggregateLiteral {
211
211
* field `field`, if present. The expression is the `position`'th entry in the
212
212
* aggregate literal.
213
213
*
214
- * For example, if `aggr` represents the initialization literal `{.x = 1234 , .x = 5678 }` in
214
+ * For example, if `aggr` represents the initialization literal `{.x = 123 , .y = 456 . x = 789 }` in
215
215
* ```cpp
216
- * struct Foo { int x; };
217
- * struct Foo foo = {.x = 1234 , .x = 5678 };
216
+ * struct Foo { int x; int y; };
217
+ * struct Foo foo = {.x = 123 , .y = 456 . x = 789 };
218
218
* ```
219
- * then `aggr.getFieldExpr(x, 0)` gives `1234`, and `aggr.getFieldExpr(x, 1)` gives `5678`.
219
+ * then:
220
+ * - `aggr.getFieldExpr(x, 0)` gives `123`.
221
+ * - `aggr.getFieldExpr(y, 1)` gives `456`.
222
+ * - `aggr.getFieldExpr(x, 2)` gives `789`.
220
223
*/
221
224
Expr getFieldExpr ( Field field , int position ) {
222
225
field = classType .getAField ( ) and
@@ -313,11 +316,14 @@ class ArrayOrVectorAggregateLiteral extends AggregateLiteral {
313
316
* element `elementIndex`, if present. The expression is the `position`'th entry
314
317
* in the aggregate literal.
315
318
*
316
- * For example, if `a` represents the initialization literal `{[0] = 1234 , [0] = 5678 }` in
319
+ * For example, if `a` represents the initialization literal `{[0] = 123 , [1] = 456, [ 0] = 789 }` in
317
320
* ```cpp
318
- * int x[1 ] = {[0] = 1234 , [0] = 5678 };
321
+ * int x[2 ] = {[0] = 123 , [1] = 456, [ 0] = 789 };
319
322
* ```
320
- * then `a.getElementExpr(0, 0)` gives `1234`, and `a.getElementExpr(0, 1)` gives `5678`.
323
+ * then:
324
+ * - `a.getElementExpr(0, 0)` gives `123`.
325
+ * - `a.getElementExpr(1, 1)` gives `456`.
326
+ * - `a.getElementExpr(0, 2)` gives `789`.
321
327
*/
322
328
Expr getElementExpr ( int elementIndex , int position ) {
323
329
aggregate_array_init ( underlyingElement ( this ) , unresolveElement ( result ) , elementIndex , position )
0 commit comments