Merge pull request #18445 from hvitved/rust/format-args-index

Rust: Remove `Format.getArgument`
This commit is contained in:
Tom Hvitved
2025-01-10 15:06:43 +01:00
committed by GitHub
29 changed files with 267 additions and 73 deletions

View File

@@ -521,7 +521,7 @@ lib/codeql/rust/elements/internal/generated/FieldList.qll 43c13c6e3c9ba75a7a4cb8
lib/codeql/rust/elements/internal/generated/FnPtrTypeRepr.qll d490ab9f2e3654d9abde18a06e534abd99ca62f518ca08670b696a97e9d5c592 01500319820f66cb4bbda6fe7c26270f76ea934efff4bb3cbf88e9b1e07e8be2
lib/codeql/rust/elements/internal/generated/ForExpr.qll 6c1838d952be65acaa9744736e73d9bfdcf58d7b392394223bf6fbfdcc172906 44237a248a5aa326a2544e84bc77f536f118f57a98c51562b71ddc81edfcccb8
lib/codeql/rust/elements/internal/generated/ForTypeRepr.qll 3027879795a6be5bfb370b8c2231b579f9df8afde54345416c6ce2c64bd3dfec f871d73b36f079f473915db298951020e5a05bb5e8e4d570822063afb4807559
lib/codeql/rust/elements/internal/generated/Format.qll b1c2ce8dc4ee3cee9f637a007aa3d282e2001c754207604c8c4412ed94a20b4b 880e43fdaadae50e8b0e87ccaab93122d48cdbf73c612cbbd748ccacb91ea5a7
lib/codeql/rust/elements/internal/generated/Format.qll 934351f8a8ffd914cc3fd88aca8e81bf646236fe34d15e0df7aeeb0b942b203f da9f146e6f52bafd67dcfd3b916692cf8f66031e0b1d5d17fc8dda5eefb99ca0
lib/codeql/rust/elements/internal/generated/FormatArgsArg.qll c762a4af8609472e285dd1b1aec8251421aec49f8d0e5ce9df2cc5e2722326f8 c8c226b94b32447634b445c62bd9af7e11b93a706f8fa35d2de4fda3ce951926
lib/codeql/rust/elements/internal/generated/FormatArgsExpr.qll 8aed8715a27d3af3de56ded4610c6792a25216b1544eb7e57c8b0b37c14bd9c1 590a2b0063d2ecd00bbbd1ce29603c8fd69972e34e6daddf309c915ce4ec1375
lib/codeql/rust/elements/internal/generated/FormatArgument.qll cd05153276e63e689c95d5537fbc7d892615f62e110323759ef02e23a7587407 be2a4531b498f01625effa4c631d51ee8857698b00cfb829074120a0f2696d57
@@ -579,7 +579,7 @@ lib/codeql/rust/elements/internal/generated/ParamList.qll c808c9d84dd7800573832b
lib/codeql/rust/elements/internal/generated/ParenExpr.qll bc0731505bfe88516205ec360582a4222d2681d11342c93e15258590ddee82f2 d4bd6e0c80cf1d63746c88d4bcb3a01d4c75732e5da09e3ebd9437ced227fb60
lib/codeql/rust/elements/internal/generated/ParenPat.qll 4f168ef5d5bb87a903251cc31b2e44a759b099ec69c90af31783fbb15778c940 0e34f94a45a13396fd57d94c245dc64d1adde2ab0e22b56946f7e94c04e297fc
lib/codeql/rust/elements/internal/generated/ParenTypeRepr.qll 40ab5c592e7699c621787793743e33988de71ff42ca27599f5ab3ddb70e3f7d8 12c0a6eed2202ee3e892f61da3b3ce77ac3190854cdf3097e8d2be98aa3cb91d
lib/codeql/rust/elements/internal/generated/ParentChild.qll 668b9079bcb7a055b956cfff94930ba59a7d88d59a95284dd93bd146c4c73d22 60ffda092345f862082b0b61a052b7fad12b4b6431d23794ff2ba3cfd334bd93
lib/codeql/rust/elements/internal/generated/ParentChild.qll 738612c1ec404fe8c090e0d234bdac4ce207bd0d4cad699a2981e6b6cb8947a9 df002e5540bfe5de4e6849879f334b09c2ffb4893ff8364146c6c505f4b2d090
lib/codeql/rust/elements/internal/generated/ParenthesizedArgList.qll c5fa328ea60d3a3333d7c7bb3480969c1873166c7ac8ebb9d0afad7a8099d1a8 2dbbb6200d96f7db7dea4a55bdeab8d67b14d39a43e0bd54ada019f7e466f163
lib/codeql/rust/elements/internal/generated/Pat.qll 3605ac062be2f294ee73336e9669027b8b655f4ad55660e1eab35266275154ee 7f9400db2884d336dd1d21df2a8093759c2a110be9bf6482ce8e80ae0fd74ed4
lib/codeql/rust/elements/internal/generated/Path.qll bf6a86e7fcb7164624cc070dcce86d2bda50a2516b95115b87d0ebb5596e50a1 fd7a9ad4034cdebe8dfe495619c46f464630d38195313072e0bd904061b0fb00
@@ -801,7 +801,7 @@ test/extractor-tests/generated/ForExpr/ForExpr_getPat.ql 1e0205a9b3a58fd2ddba49e
test/extractor-tests/generated/ForTypeRepr/ForTypeRepr.ql 38fa18958dc8c1564abf0c38ebc7e76bc64904f9774a99e46504f903e9c19379 8384e007868981dcd8120f4ef52475ca99641a530a487cd9dc7eba98b9391060
test/extractor-tests/generated/ForTypeRepr/ForTypeRepr_getGenericParamList.ql 33535c02c7000e89e4d4e4560499b9512455fae407e72e05615b38f9e950c6bf 35a6aa7de0f627fb96ca7f4f2134b060a820327a3de4970fa2790c8fbea28a2c
test/extractor-tests/generated/ForTypeRepr/ForTypeRepr_getTypeRepr.ql f24d02c57af9f4fb4f5c3058e236a8d9b4c4f6f2aff84e65497f693309bdf93e 1c93d6214ee0a89e2bd5d0e02800e29e8a14ebd7efdb6a62380edb97dc902def
test/extractor-tests/generated/FormatArgsExpr/Format.ql 25268dd7ad2a58b071c3a38164944c1b7389dfdda01c99ef2694a475596341b4 0a3f674d5a4f005835b9a5ba11a6e8bf58477829258f30ae7d8f76f8986f7b7f
test/extractor-tests/generated/FormatArgsExpr/Format.ql 6fa117eebe7ec99b71ffd10cf2cb2a21e67ab157f7c08feedabcc9bcc5390dce 9e7681c3bff55ed78d43ba6567f85bb98da6b166358951b1e972de1114750009
test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.ql a521903c73f79e2616f7b8ef76790e11cbf432f8437825d52d117da232022b9e 4cb195d09ecb51e5bbd5c1c069ec1720f74fc074efc88b0f5c07cfc140167775
test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getExpr.ql 7e1a7f902fb661660760d2a2f3f4cb6818a0c9f5b5061ede6ae80223774e4e09 8a50f64cba6f56320631206c801160201e3c98e74367bb035d689baaa9b4e411
test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getName.ql 0e2f24388d516e14d195957163a2d5d97029c9e11a83ca71cf69e00ecc0bb2a8 dab2969f5ae6a15ec331c0152e7c116d1ee2c3d073b2d4da59ffbcb83404c65f
@@ -813,7 +813,9 @@ test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getTemplate.ql c912
test/extractor-tests/generated/FormatArgsExpr/FormatArgument.ql 7a7ee3a3322b4af8cb3b525cfed8cc9719d136ea80aa6b3fb30c7e16394dd93f 5aa8a77d7741b02f8ceb9e5991efa4c2c43c6f1624989218990e985108dae535
test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.ql 7bd4ec3dde2ef0463585794101e6cc426c368b0e4ab95fbb1f24f8f0a76cf471 e7b01e8b21df5b22c51643e2c909c6fc4ca96fda41b3290c907ba228abe8669b
test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql 2793ba1ff52182dab992d82d3767a000928f6b2fbfdb621349cafc183f0d2480 c3777d03214f7feb9020de3ce45af6556129e39e9b30d083de605b70ab9a0a12
test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.ql 26d592398a17795427b5b6b51ff4a013ee15c31443e732a000baca5f2e65acca 7940a864b84b89e84d7fb186599cb8b6bcbead7141c592b8ab0c59fcd380d5fb
test/extractor-tests/generated/FormatArgsExpr/Format_getArgumentRef.ql 634efdffaae4199aa9d95652cf081a8dc26e88224e24678845f8a67dc24ce090 d0302fee5c50403214771d5c6b896ba7c6e52be10c9bea59720ef2bb954e6f40
test/extractor-tests/generated/FormatArgsExpr/Format_getPrecisionArgument.ql 0d2140f84d0220b0c72c48c6bd272f4cfe1863d1797eddd16a6e238552a61e4d f4fe9b29697041e30764fa3dea44f125546bfb648f32c3474a1e922a4255c534
test/extractor-tests/generated/FormatArgsExpr/Format_getWidthArgument.ql 01ef27dd0bfab273e1ddc57ada0e079ece8a2bfd195ce413261006964b444093 acd0161f86010759417015c5b58044467a7f760f288ec4e8525458c54ae9a715
test/extractor-tests/generated/Function/Function.ql c1c2a9b68c35f839ccd2b5e62e87d1acd94dcc2a3dc4c307c269b84b2a0806e6 1c446f19d2f81dd139aa5a1578d1b165e13bddbaeab8cfee8f0430bced3a99ab
test/extractor-tests/generated/Function/Function_getAbi.ql e5c9c97de036ddd51cae5d99d41847c35c6b2eabbbd145f4467cb501edc606d8 0b81511528bd0ef9e63b19edfc3cb638d8af43eb87d018fad69d6ef8f8221454
test/extractor-tests/generated/Function/Function_getAttr.ql 44067ee11bdec8e91774ff10de0704a8c5c1b60816d587378e86bf3d82e1f660 b4bebf9441bda1f2d1e34e9261e07a7468cbabf53cf8047384f3c8b11869f04e

4
rust/ql/.gitattributes generated vendored
View File

@@ -815,7 +815,9 @@
/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/Format_getArgumentRef.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/Format_getPrecisionArgument.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/Format_getWidthArgument.ql linguist-generated
/test/extractor-tests/generated/Function/Function.ql linguist-generated
/test/extractor-tests/generated/Function/Function_getAbi.ql linguist-generated
/test/extractor-tests/generated/Function/Function_getAttr.ql linguist-generated

View File

@@ -52,6 +52,27 @@ query predicate multipleParents(Element child, string childClass, Element parent
parentClass = parent.getPrimaryQlClasses()
}
/** Holds if `parent` has multiple children at the same index. */
query predicate multipleChildren(Element parent, int index, Element child1, Element child2) {
child1 = getChildAndAccessor(parent, index, _) and
child2 = getChildAndAccessor(parent, index, _) and
child1 != child2
}
/**
* Holds if `child` has multiple positions amongst the `accessor` children
* of `parent`.
*
* Children are allowed to have multiple positions for _different_ accessors,
* for example in an array repeat expression `[1; 10]`, `1` has positions for
* both `getRepeatOperand()` and `getExpr()`.
*/
query predicate multiplePositions(Element parent, int pos1, int pos2, string accessor, Element child) {
child = getChildAndAccessor(parent, pos1, accessor) and
child = getChildAndAccessor(parent, pos2, accessor) and
pos1 != pos2
}
/**
* Gets counts of abstract syntax tree inconsistencies of each type.
*/
@@ -71,4 +92,10 @@ int getAstInconsistencyCounts(string type) {
or
type = "Multiple parents" and
result = count(Element e | multipleParents(e) | e)
or
type = "Multiple children" and
result = count(Element e | multipleChildren(_, _, e, _) | e)
or
type = "Multiple positions" and
result = count(Element e | multiplePositions(_, _, _, _, e) | e)
}

View File

@@ -195,8 +195,9 @@ final class FormatArgsExprCfgNode extends Nodes::FormatArgsExprCfgNode {
/** Gets a format argument of the `i`th format of this format arguments expression (0-based). */
FormatTemplateVariableAccessCfgNode getFormatTemplateVariableAccess(int i) {
exists(FormatTemplateVariableAccess v |
v.getArgument() = node.getFormat(i).getArgument() and
exists(FormatTemplateVariableAccess v, Format f |
f = node.getFormat(i) and
v.getArgument() = [f.getArgumentRef(), f.getWidthArgument(), f.getPrecisionArgument()] and
result.getFormatTemplateVariableAccess() = v and
any(ChildMapping mapping).hasCfgChild(node, v, this, result)
)

View File

@@ -42,41 +42,15 @@ module Impl {
override int getIndex() { result = index }
override FormatArgument getArgument() { result.getParent() = this }
/**
* Gets the name or position reference of this format, if any. For example `name` and `0` in:
* ```rust
* let name = "Alice";
* println!("{name} in wonderland");
* println!("{0} in wonderland", name);
* ```
*/
FormatArgument getArgumentRef() {
override FormatArgument getArgumentRef() {
result.getParent() = this and result = Synth::TFormatArgument(_, _, 0, _, _, _)
}
/**
* Gets the name or position reference of the width parameter in this format, if any. For example `width` and `1` in:
* ```rust
* let width = 6;
* println!("{:width$}", PI);
* println!("{:1$}", PI, width);
* ```
*/
FormatArgument getWidthArgument() {
override FormatArgument getWidthArgument() {
result.getParent() = this and result = Synth::TFormatArgument(_, _, 1, _, _, _)
}
/**
* Gets the name or position reference of the width parameter in this format, if any. For example `prec` and `1` in:
* ```rust
* let prec = 6;
* println!("{:.prec$}", PI);
* println!("{:.1$}", PI, prec);
* ```
*/
FormatArgument getPrecisionArgument() {
override FormatArgument getPrecisionArgument() {
result.getParent() = this and result = Synth::TFormatArgument(_, _, 2, _, _, _)
}
}

View File

@@ -41,13 +41,54 @@ module Generated {
int getIndex() { none() }
/**
* Gets the argument of this format, if it exists.
* Gets the argument reference of this format, if it exists.
*
* For example `name` and `0` in:
* ```rust
* let name = "Alice";
* println!("{name} in wonderland");
* println!("{0} in wonderland", name);
* ```
*/
FormatArgument getArgument() { none() }
FormatArgument getArgumentRef() { none() }
/**
* Holds if `getArgument()` exists.
* Holds if `getArgumentRef()` exists.
*/
final predicate hasArgument() { exists(this.getArgument()) }
final predicate hasArgumentRef() { exists(this.getArgumentRef()) }
/**
* Gets the width argument of this format, if it exists.
*
* For example `width` and `1` in:
* ```rust
* let width = 6;
* println!("{:width$}", PI);
* println!("{:1$}", PI, width);
* ```
*/
FormatArgument getWidthArgument() { none() }
/**
* Holds if `getWidthArgument()` exists.
*/
final predicate hasWidthArgument() { exists(this.getWidthArgument()) }
/**
* Gets the precision argument of this format, if it exists.
*
* For example `prec` and `1` in:
* ```rust
* let prec = 6;
* println!("{:.prec$}", PI);
* println!("{:.1$}", PI, prec);
* ```
*/
FormatArgument getPrecisionArgument() { none() }
/**
* Holds if `getPrecisionArgument()` exists.
*/
final predicate hasPrecisionArgument() { exists(this.getPrecisionArgument()) }
}
}

View File

@@ -69,17 +69,29 @@ private module Impl {
}
private Element getImmediateChildOfFormat(Format e, int index, string partialPredicateCall) {
exists(int b, int bLocatable, int n, int nArgument |
exists(
int b, int bLocatable, int n, int nArgumentRef, int nWidthArgument, int nPrecisionArgument
|
b = 0 and
bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and
n = bLocatable and
nArgument = n + 1 and
nArgumentRef = n + 1 and
nWidthArgument = nArgumentRef + 1 and
nPrecisionArgument = nWidthArgument + 1 and
(
none()
or
result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall)
or
index = n and result = e.getArgument() and partialPredicateCall = "Argument()"
index = n and result = e.getArgumentRef() and partialPredicateCall = "ArgumentRef()"
or
index = nArgumentRef and
result = e.getWidthArgument() and
partialPredicateCall = "WidthArgument()"
or
index = nWidthArgument and
result = e.getPrecisionArgument() and
partialPredicateCall = "PrecisionArgument()"
)
)
}

View File

@@ -32,7 +32,7 @@ FieldExpr/gen_field_expr.rs 9a70500d592e0a071b03d974a55558b3bc0df531ff11bce5898f
FnPtrTypeRepr/gen_fn_ptr_type_repr.rs 46af312570a9caec11e14ba05190e95e750c32565559f1622a132f7145320253 46af312570a9caec11e14ba05190e95e750c32565559f1622a132f7145320253
ForExpr/gen_for_expr.rs 67decf3073e1a9363d9df05a5a64a6059349e50b81356f480f7aeb352189136d 67decf3073e1a9363d9df05a5a64a6059349e50b81356f480f7aeb352189136d
ForTypeRepr/gen_for_type_repr.rs 5108a5d63ce440305b92dd87387c22a0a57abfd19d88e03e1984e1537779f4a4 5108a5d63ce440305b92dd87387c22a0a57abfd19d88e03e1984e1537779f4a4
FormatArgsExpr/gen_format.rs 38adb675e5d635a08fb5353982a03a484b34e92042a15ae3b57f0ff40479b59f 38adb675e5d635a08fb5353982a03a484b34e92042a15ae3b57f0ff40479b59f
FormatArgsExpr/gen_format.rs e9d8e7b98d0050ad6053c2459cb21faab00078e74245336a5962438336f76d33 e9d8e7b98d0050ad6053c2459cb21faab00078e74245336a5962438336f76d33
FormatArgsExpr/gen_format_args_arg.rs 53ffd6abe4cd899c57d1973b31df0edc1d5eaa5835b19172ec4cda15bb3db28f 53ffd6abe4cd899c57d1973b31df0edc1d5eaa5835b19172ec4cda15bb3db28f
FormatArgsExpr/gen_format_args_expr.rs 72c806ed163e9dcce2d0c5c8664d409b2aa635c1022c91959f9e8ae084f05bf2 72c806ed163e9dcce2d0c5c8664d409b2aa635c1022c91959f9e8ae084f05bf2
FormatArgsExpr/gen_format_argument.rs 350d370e6f1db03d756384a3dbdb294697d241ff7c28d159cf57748abe99cfe9 350d370e6f1db03d756384a3dbdb294697d241ff7c28d159cf57748abe99cfe9

View File

@@ -1,11 +1,17 @@
| gen_format.rs:5:21:5:22 | {} | getParent: | gen_format.rs:5:14:5:32 | FormatArgsExpr | getIndex: | 1 | hasArgument: | no |
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | getParent: | gen_format.rs:7:14:7:47 | FormatArgsExpr | getIndex: | 1 | hasArgument: | yes |
| gen_format_args_arg.rs:5:26:5:27 | {} | getParent: | gen_format_args_arg.rs:5:17:5:39 | FormatArgsExpr | getIndex: | 1 | hasArgument: | no |
| gen_format_args_expr.rs:6:19:6:20 | {} | getParent: | gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | getIndex: | 1 | hasArgument: | no |
| gen_format_args_expr.rs:6:26:6:29 | {:?} | getParent: | gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | getIndex: | 3 | hasArgument: | no |
| gen_format_args_expr.rs:7:19:7:21 | {b} | getParent: | gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | getIndex: | 1 | hasArgument: | yes |
| gen_format_args_expr.rs:7:27:7:31 | {a:?} | getParent: | gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | getIndex: | 3 | hasArgument: | yes |
| gen_format_args_expr.rs:9:19:9:21 | {x} | getParent: | gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | getIndex: | 1 | hasArgument: | yes |
| gen_format_args_expr.rs:9:24:9:26 | {y} | getParent: | gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | getIndex: | 3 | hasArgument: | yes |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | getParent: | gen_format_argument.rs:5:14:5:47 | FormatArgsExpr | getIndex: | 1 | hasArgument: | yes |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | getParent: | gen_format_argument.rs:7:14:7:56 | FormatArgsExpr | getIndex: | 1 | hasArgument: | yes |
| gen_format.rs:5:21:5:22 | {} | getParent: | gen_format.rs:5:14:5:32 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | no | hasWidthArgument: | no | hasPrecisionArgument: | no |
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | getParent: | gen_format.rs:7:14:7:47 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | yes | hasWidthArgument: | yes | hasPrecisionArgument: | yes |
| gen_format.rs:11:15:11:20 | {name} | getParent: | gen_format.rs:11:14:11:35 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | yes | hasWidthArgument: | no | hasPrecisionArgument: | no |
| gen_format.rs:12:15:12:17 | {0} | getParent: | gen_format.rs:12:14:12:38 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | yes | hasWidthArgument: | no | hasPrecisionArgument: | no |
| gen_format.rs:16:15:16:23 | {:width$} | getParent: | gen_format.rs:16:14:16:28 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | no | hasWidthArgument: | yes | hasPrecisionArgument: | no |
| gen_format.rs:17:15:17:19 | {:1$} | getParent: | gen_format.rs:17:14:17:31 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | no | hasWidthArgument: | yes | hasPrecisionArgument: | no |
| gen_format.rs:21:15:21:23 | {:.prec$} | getParent: | gen_format.rs:21:14:21:28 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | no | hasWidthArgument: | no | hasPrecisionArgument: | yes |
| gen_format.rs:22:15:22:20 | {:.1$} | getParent: | gen_format.rs:22:14:22:31 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | no | hasWidthArgument: | no | hasPrecisionArgument: | yes |
| gen_format_args_arg.rs:5:26:5:27 | {} | getParent: | gen_format_args_arg.rs:5:17:5:39 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | no | hasWidthArgument: | no | hasPrecisionArgument: | no |
| gen_format_args_expr.rs:6:19:6:20 | {} | getParent: | gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | no | hasWidthArgument: | no | hasPrecisionArgument: | no |
| gen_format_args_expr.rs:6:26:6:29 | {:?} | getParent: | gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | getIndex: | 3 | hasArgumentRef: | no | hasWidthArgument: | no | hasPrecisionArgument: | no |
| gen_format_args_expr.rs:7:19:7:21 | {b} | getParent: | gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | yes | hasWidthArgument: | no | hasPrecisionArgument: | no |
| gen_format_args_expr.rs:7:27:7:31 | {a:?} | getParent: | gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | getIndex: | 3 | hasArgumentRef: | yes | hasWidthArgument: | no | hasPrecisionArgument: | no |
| gen_format_args_expr.rs:9:19:9:21 | {x} | getParent: | gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | yes | hasWidthArgument: | no | hasPrecisionArgument: | no |
| gen_format_args_expr.rs:9:24:9:26 | {y} | getParent: | gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | getIndex: | 3 | hasArgumentRef: | yes | hasWidthArgument: | no | hasPrecisionArgument: | no |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | getParent: | gen_format_argument.rs:5:14:5:47 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | yes | hasWidthArgument: | yes | hasPrecisionArgument: | yes |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | getParent: | gen_format_argument.rs:7:14:7:56 | FormatArgsExpr | getIndex: | 1 | hasArgumentRef: | yes | hasWidthArgument: | yes | hasPrecisionArgument: | yes |

View File

@@ -2,11 +2,16 @@
import codeql.rust.elements
import TestUtils
from Format x, FormatArgsExpr getParent, int getIndex, string hasArgument
from
Format x, FormatArgsExpr getParent, int getIndex, string hasArgumentRef, string hasWidthArgument,
string hasPrecisionArgument
where
toBeTested(x) and
not x.isUnknown() and
getParent = x.getParent() and
getIndex = x.getIndex() and
if x.hasArgument() then hasArgument = "yes" else hasArgument = "no"
select x, "getParent:", getParent, "getIndex:", getIndex, "hasArgument:", hasArgument
(if x.hasArgumentRef() then hasArgumentRef = "yes" else hasArgumentRef = "no") and
(if x.hasWidthArgument() then hasWidthArgument = "yes" else hasWidthArgument = "no") and
if x.hasPrecisionArgument() then hasPrecisionArgument = "yes" else hasPrecisionArgument = "no"
select x, "getParent:", getParent, "getIndex:", getIndex, "hasArgumentRef:", hasArgumentRef,
"hasWidthArgument:", hasWidthArgument, "hasPrecisionArgument:", hasPrecisionArgument

View File

@@ -1,4 +1,11 @@
| gen_format.rs:5:26:5:32 | FormatArgsArg | hasExpr: | yes | hasName: | no |
| gen_format.rs:12:35:12:38 | FormatArgsArg | hasExpr: | yes | hasName: | no |
| gen_format.rs:16:27:16:28 | FormatArgsArg | hasExpr: | yes | hasName: | no |
| gen_format.rs:17:23:17:24 | FormatArgsArg | hasExpr: | yes | hasName: | no |
| gen_format.rs:17:27:17:31 | FormatArgsArg | hasExpr: | yes | hasName: | no |
| gen_format.rs:21:27:21:28 | FormatArgsArg | hasExpr: | yes | hasName: | no |
| gen_format.rs:22:24:22:25 | FormatArgsArg | hasExpr: | yes | hasName: | no |
| gen_format.rs:22:28:22:31 | FormatArgsArg | hasExpr: | yes | hasName: | no |
| gen_format_args_arg.rs:5:32:5:38 | FormatArgsArg | hasExpr: | yes | hasName: | no |
| gen_format_args_expr.rs:6:33:6:33 | FormatArgsArg | hasExpr: | yes | hasName: | no |
| gen_format_args_expr.rs:6:36:6:36 | FormatArgsArg | hasExpr: | yes | hasName: | no |

View File

@@ -1,4 +1,11 @@
| gen_format.rs:5:26:5:32 | FormatArgsArg | gen_format.rs:5:26:5:32 | "world" |
| gen_format.rs:12:35:12:38 | FormatArgsArg | gen_format.rs:12:35:12:38 | name |
| gen_format.rs:16:27:16:28 | FormatArgsArg | gen_format.rs:16:27:16:28 | PI |
| gen_format.rs:17:23:17:24 | FormatArgsArg | gen_format.rs:17:23:17:24 | PI |
| gen_format.rs:17:27:17:31 | FormatArgsArg | gen_format.rs:17:27:17:31 | width |
| gen_format.rs:21:27:21:28 | FormatArgsArg | gen_format.rs:21:27:21:28 | PI |
| gen_format.rs:22:24:22:25 | FormatArgsArg | gen_format.rs:22:24:22:25 | PI |
| gen_format.rs:22:28:22:31 | FormatArgsArg | gen_format.rs:22:28:22:31 | prec |
| gen_format_args_arg.rs:5:32:5:38 | FormatArgsArg | gen_format_args_arg.rs:5:32:5:38 | "world" |
| gen_format_args_expr.rs:6:33:6:33 | FormatArgsArg | gen_format_args_expr.rs:6:33:6:33 | 1 |
| gen_format_args_expr.rs:6:36:6:36 | FormatArgsArg | gen_format_args_expr.rs:6:36:6:36 | 2 |

View File

@@ -1,5 +1,11 @@
| gen_format.rs:5:14:5:32 | FormatArgsExpr | getNumberOfArgs: | 1 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 |
| gen_format.rs:7:14:7:47 | FormatArgsExpr | getNumberOfArgs: | 0 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 |
| gen_format.rs:11:14:11:35 | FormatArgsExpr | getNumberOfArgs: | 0 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 |
| gen_format.rs:12:14:12:38 | FormatArgsExpr | getNumberOfArgs: | 1 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 |
| gen_format.rs:16:14:16:28 | FormatArgsExpr | getNumberOfArgs: | 1 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 |
| gen_format.rs:17:14:17:31 | FormatArgsExpr | getNumberOfArgs: | 2 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 |
| gen_format.rs:21:14:21:28 | FormatArgsExpr | getNumberOfArgs: | 1 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 |
| gen_format.rs:22:14:22:31 | FormatArgsExpr | getNumberOfArgs: | 2 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 |
| gen_format_args_arg.rs:5:17:5:39 | FormatArgsExpr | getNumberOfArgs: | 1 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 |
| gen_format_args_expr.rs:5:17:5:27 | FormatArgsExpr | getNumberOfArgs: | 0 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 0 |
| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | getNumberOfArgs: | 2 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 2 |

View File

@@ -1,4 +1,11 @@
| gen_format.rs:5:14:5:32 | FormatArgsExpr | 0 | gen_format.rs:5:26:5:32 | FormatArgsArg |
| gen_format.rs:12:14:12:38 | FormatArgsExpr | 0 | gen_format.rs:12:35:12:38 | FormatArgsArg |
| gen_format.rs:16:14:16:28 | FormatArgsExpr | 0 | gen_format.rs:16:27:16:28 | FormatArgsArg |
| gen_format.rs:17:14:17:31 | FormatArgsExpr | 0 | gen_format.rs:17:23:17:24 | FormatArgsArg |
| gen_format.rs:17:14:17:31 | FormatArgsExpr | 1 | gen_format.rs:17:27:17:31 | FormatArgsArg |
| gen_format.rs:21:14:21:28 | FormatArgsExpr | 0 | gen_format.rs:21:27:21:28 | FormatArgsArg |
| gen_format.rs:22:14:22:31 | FormatArgsExpr | 0 | gen_format.rs:22:24:22:25 | FormatArgsArg |
| gen_format.rs:22:14:22:31 | FormatArgsExpr | 1 | gen_format.rs:22:28:22:31 | FormatArgsArg |
| gen_format_args_arg.rs:5:17:5:39 | FormatArgsExpr | 0 | gen_format_args_arg.rs:5:32:5:38 | FormatArgsArg |
| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 0 | gen_format_args_expr.rs:6:33:6:33 | FormatArgsArg |
| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 1 | gen_format_args_expr.rs:6:36:6:36 | FormatArgsArg |

View File

@@ -1,5 +1,11 @@
| gen_format.rs:5:14:5:32 | FormatArgsExpr | 0 | gen_format.rs:5:21:5:22 | {} |
| gen_format.rs:7:14:7:47 | FormatArgsExpr | 0 | gen_format.rs:7:21:7:46 | {value:#width$.precision$} |
| gen_format.rs:11:14:11:35 | FormatArgsExpr | 0 | gen_format.rs:11:15:11:20 | {name} |
| gen_format.rs:12:14:12:38 | FormatArgsExpr | 0 | gen_format.rs:12:15:12:17 | {0} |
| gen_format.rs:16:14:16:28 | FormatArgsExpr | 0 | gen_format.rs:16:15:16:23 | {:width$} |
| gen_format.rs:17:14:17:31 | FormatArgsExpr | 0 | gen_format.rs:17:15:17:19 | {:1$} |
| gen_format.rs:21:14:21:28 | FormatArgsExpr | 0 | gen_format.rs:21:15:21:23 | {:.prec$} |
| gen_format.rs:22:14:22:31 | FormatArgsExpr | 0 | gen_format.rs:22:15:22:20 | {:.1$} |
| gen_format_args_arg.rs:5:17:5:39 | FormatArgsExpr | 0 | gen_format_args_arg.rs:5:26:5:27 | {} |
| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 0 | gen_format_args_expr.rs:6:19:6:20 | {} |
| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 1 | gen_format_args_expr.rs:6:26:6:29 | {:?} |

View File

@@ -1,5 +1,11 @@
| gen_format.rs:5:14:5:32 | FormatArgsExpr | gen_format.rs:5:14:5:23 | "Hello {}\\n" |
| gen_format.rs:7:14:7:47 | FormatArgsExpr | gen_format.rs:7:14:7:47 | "Value {value:#width$.precisio... |
| gen_format.rs:11:14:11:35 | FormatArgsExpr | gen_format.rs:11:14:11:35 | "{name} in wonderland\\n" |
| gen_format.rs:12:14:12:38 | FormatArgsExpr | gen_format.rs:12:14:12:32 | "{0} in wonderland\\n" |
| gen_format.rs:16:14:16:28 | FormatArgsExpr | gen_format.rs:16:14:16:24 | "{:width$}\\n" |
| gen_format.rs:17:14:17:31 | FormatArgsExpr | gen_format.rs:17:14:17:20 | "{:1$}\\n" |
| gen_format.rs:21:14:21:28 | FormatArgsExpr | gen_format.rs:21:14:21:24 | "{:.prec$}\\n" |
| gen_format.rs:22:14:22:31 | FormatArgsExpr | gen_format.rs:22:14:22:21 | "{:.1$}\\n" |
| gen_format_args_arg.rs:5:17:5:39 | FormatArgsExpr | gen_format_args_arg.rs:5:18:5:29 | "Hello, {}!" |
| gen_format_args_expr.rs:5:17:5:27 | FormatArgsExpr | gen_format_args_expr.rs:5:18:5:26 | "no args" |
| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | gen_format_args_expr.rs:6:18:6:30 | "{} foo {:?}" |

View File

@@ -1,6 +1,12 @@
| gen_format.rs:7:22:7:26 | value | getParent: | gen_format.rs:7:21:7:46 | {value:#width$.precision$} | hasVariable: | yes |
| gen_format.rs:7:29:7:33 | width | getParent: | gen_format.rs:7:21:7:46 | {value:#width$.precision$} | hasVariable: | yes |
| gen_format.rs:7:36:7:44 | precision | getParent: | gen_format.rs:7:21:7:46 | {value:#width$.precision$} | hasVariable: | yes |
| gen_format.rs:11:16:11:19 | name | getParent: | gen_format.rs:11:15:11:20 | {name} | hasVariable: | yes |
| gen_format.rs:12:16:12:16 | 0 | getParent: | gen_format.rs:12:15:12:17 | {0} | hasVariable: | no |
| gen_format.rs:16:17:16:21 | width | getParent: | gen_format.rs:16:15:16:23 | {:width$} | hasVariable: | yes |
| gen_format.rs:17:17:17:17 | 1 | getParent: | gen_format.rs:17:15:17:19 | {:1$} | hasVariable: | no |
| gen_format.rs:21:18:21:21 | prec | getParent: | gen_format.rs:21:15:21:23 | {:.prec$} | hasVariable: | yes |
| gen_format.rs:22:18:22:18 | 1 | getParent: | gen_format.rs:22:15:22:20 | {:.1$} | hasVariable: | no |
| gen_format_args_expr.rs:7:20:7:20 | b | getParent: | gen_format_args_expr.rs:7:19:7:21 | {b} | hasVariable: | no |
| gen_format_args_expr.rs:7:28:7:28 | a | getParent: | gen_format_args_expr.rs:7:27:7:31 | {a:?} | hasVariable: | no |
| gen_format_args_expr.rs:9:20:9:20 | x | getParent: | gen_format_args_expr.rs:9:19:9:21 | {x} | hasVariable: | yes |

View File

@@ -1,6 +1,9 @@
| gen_format.rs:7:22:7:26 | value | gen_format.rs:7:22:7:26 | value |
| gen_format.rs:7:29:7:33 | width | gen_format.rs:7:29:7:33 | width |
| gen_format.rs:7:36:7:44 | precision | gen_format.rs:7:36:7:44 | precision |
| gen_format.rs:11:16:11:19 | name | gen_format.rs:11:16:11:19 | name |
| gen_format.rs:16:17:16:21 | width | gen_format.rs:16:17:16:21 | width |
| gen_format.rs:21:18:21:21 | prec | gen_format.rs:21:18:21:21 | prec |
| gen_format_args_expr.rs:9:20:9:20 | x | gen_format_args_expr.rs:9:20:9:20 | x |
| gen_format_args_expr.rs:9:25:9:25 | y | gen_format_args_expr.rs:9:25:9:25 | y |
| gen_format_argument.rs:5:22:5:26 | value | gen_format_argument.rs:5:22:5:26 | value |

View File

@@ -1,6 +1,9 @@
| gen_format.rs:7:22:7:26 | value |
| gen_format.rs:7:29:7:33 | width |
| gen_format.rs:7:36:7:44 | precision |
| gen_format.rs:11:16:11:19 | name |
| gen_format.rs:16:17:16:21 | width |
| gen_format.rs:21:18:21:21 | prec |
| gen_format_args_expr.rs:9:20:9:20 | x |
| gen_format_args_expr.rs:9:25:9:25 | y |
| gen_format_argument.rs:5:22:5:26 | value |

View File

@@ -1,13 +1,13 @@
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | gen_format.rs:7:22:7:26 | value |
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | gen_format.rs:7:29:7:33 | width |
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | gen_format.rs:7:36:7:44 | precision |
| gen_format_args_expr.rs:7:19:7:21 | {b} | gen_format_args_expr.rs:7:20:7:20 | b |
| gen_format_args_expr.rs:7:27:7:31 | {a:?} | gen_format_args_expr.rs:7:28:7:28 | a |
| gen_format_args_expr.rs:9:19:9:21 | {x} | gen_format_args_expr.rs:9:20:9:20 | x |
| gen_format_args_expr.rs:9:24:9:26 | {y} | gen_format_args_expr.rs:9:25:9:25 | y |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | gen_format_argument.rs:5:22:5:26 | value |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | gen_format_argument.rs:5:29:5:33 | width |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | gen_format_argument.rs:5:36:5:44 | precision |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | gen_format_argument.rs:7:22:7:22 | 0 |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | gen_format_argument.rs:7:25:7:25 | 1 |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | gen_format_argument.rs:7:28:7:28 | 2 |
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | 0 | gen_format.rs:7:22:7:26 | value |
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | 1 | gen_format.rs:7:29:7:33 | width |
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | 2 | gen_format.rs:7:36:7:44 | precision |
| gen_format_args_expr.rs:7:19:7:21 | {b} | 0 | gen_format_args_expr.rs:7:20:7:20 | b |
| gen_format_args_expr.rs:7:27:7:31 | {a:?} | 0 | gen_format_args_expr.rs:7:28:7:28 | a |
| gen_format_args_expr.rs:9:19:9:21 | {x} | 0 | gen_format_args_expr.rs:9:20:9:20 | x |
| gen_format_args_expr.rs:9:24:9:26 | {y} | 0 | gen_format_args_expr.rs:9:25:9:25 | y |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | 0 | gen_format_argument.rs:5:22:5:26 | value |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | 1 | gen_format_argument.rs:5:29:5:33 | width |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | 2 | gen_format_argument.rs:5:36:5:44 | precision |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | 0 | gen_format_argument.rs:7:22:7:22 | 0 |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | 1 | gen_format_argument.rs:7:25:7:25 | 1 |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | 2 | gen_format_argument.rs:7:28:7:28 | 2 |

View File

@@ -0,0 +1,9 @@
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | gen_format.rs:7:22:7:26 | value |
| gen_format.rs:11:15:11:20 | {name} | gen_format.rs:11:16:11:19 | name |
| gen_format.rs:12:15:12:17 | {0} | gen_format.rs:12:16:12:16 | 0 |
| gen_format_args_expr.rs:7:19:7:21 | {b} | gen_format_args_expr.rs:7:20:7:20 | b |
| gen_format_args_expr.rs:7:27:7:31 | {a:?} | gen_format_args_expr.rs:7:28:7:28 | a |
| gen_format_args_expr.rs:9:19:9:21 | {x} | gen_format_args_expr.rs:9:20:9:20 | x |
| gen_format_args_expr.rs:9:24:9:26 | {y} | gen_format_args_expr.rs:9:25:9:25 | y |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | gen_format_argument.rs:5:22:5:26 | value |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | gen_format_argument.rs:7:22:7:22 | 0 |

View File

@@ -4,4 +4,4 @@ import TestUtils
from Format x
where toBeTested(x) and not x.isUnknown()
select x, x.getArgument()
select x, x.getArgumentRef()

View File

@@ -0,0 +1,5 @@
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | gen_format.rs:7:36:7:44 | precision |
| gen_format.rs:21:15:21:23 | {:.prec$} | gen_format.rs:21:18:21:21 | prec |
| gen_format.rs:22:15:22:20 | {:.1$} | gen_format.rs:22:18:22:18 | 1 |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | gen_format_argument.rs:5:36:5:44 | precision |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | gen_format_argument.rs:7:28:7:28 | 2 |

View File

@@ -0,0 +1,7 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from Format x
where toBeTested(x) and not x.isUnknown()
select x, x.getPrecisionArgument()

View File

@@ -0,0 +1,5 @@
| gen_format.rs:7:21:7:46 | {value:#width$.precision$} | gen_format.rs:7:29:7:33 | width |
| gen_format.rs:16:15:16:23 | {:width$} | gen_format.rs:16:17:16:21 | width |
| gen_format.rs:17:15:17:19 | {:1$} | gen_format.rs:17:17:17:17 | 1 |
| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | gen_format_argument.rs:5:29:5:33 | width |
| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | gen_format_argument.rs:7:25:7:25 | 1 |

View File

@@ -0,0 +1,7 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from Format x
where toBeTested(x) and not x.isUnknown()
select x, x.getWidthArgument()

View File

@@ -5,4 +5,19 @@ fn test_format() -> () {
println!("Hello {}", "world");
// or the `{value:#width$.precision$}` in:
println!("Value {value:#width$.precision$}");
// # argument_ref
// For example `name` and `0` in:
let name = "Alice";
println!("{name} in wonderland");
println!("{0} in wonderland", name);
// # width_argument
// For example `width` and `1` in:
let width = 6;
println!("{:width$}", PI);
println!("{:1$}", PI, width);
// # precision_argument
// For example `prec` and `1` in:
let prec = 6;
println!("{:.prec$}", PI);
println!("{:.1$}", PI, prec);
}

View File

@@ -1,5 +1,7 @@
| Multiple children | 0 |
| Multiple locations | 0 |
| Multiple parents | 0 |
| Multiple positions | 0 |
| Multiple primary QL classes | 0 |
| Multiple toStrings | 0 |
| No location | 0 |

View File

@@ -1878,7 +1878,30 @@ class Format(Locatable):
"""
parent: FormatArgsExpr
index: int
argument: optional["FormatArgument"] | child
argument_ref: optional["FormatArgument"] | child | desc("""
For example `name` and `0` in:
```rust
let name = "Alice";
println!("{name} in wonderland");
println!("{0} in wonderland", name);
```
""")
width_argument: optional["FormatArgument"] | child | desc("""
For example `width` and `1` in:
```rust
let width = 6;
println!("{:width$}", PI);
println!("{:1$}", PI, width);
```
""")
precision_argument: optional["FormatArgument"] | child | desc("""
For example `prec` and `1` in:
```rust
let prec = 6;
println!("{:.prec$}", PI);
println!("{:.1$}", PI, prec);
```
""")
@synth.on_arguments(parent=FormatArgsExpr, index=int, kind=int, name=string, positional=boolean, offset=int)