File tree Expand file tree Collapse file tree 13 files changed +63
-43
lines changed
lib/codeql/rust/elements/internal Expand file tree Collapse file tree 13 files changed +63
-43
lines changed Original file line number Diff line number Diff line change @@ -29,5 +29,19 @@ module Impl {
2929
3030 /** Holds if this record field is named `name` and belongs to the struct `s`. */
3131 predicate isStructField ( Struct s , string name ) { this = s .getStructField ( name ) }
32+
33+ override string toStringImpl ( ) {
34+ result = strictconcat ( int i | | this .toStringPart ( i ) order by i )
35+ }
36+
37+ private string toStringPart ( int index ) {
38+ index = 0 and result = this .getVisibility ( ) .toAbbreviatedString ( ) + " "
39+ or
40+ index = 1 and result = this .getName ( ) .getText ( )
41+ or
42+ index = 2 and result = ": "
43+ or
44+ index = 3 and result = this .getTypeRepr ( ) .toAbbreviatedString ( )
45+ }
3246 }
3347}
Original file line number Diff line number Diff line change 1- // generated by codegen, remove this comment if you wish to edit this file
21/**
32 * This module provides a hand-modifiable wrapper around the generated class `Visibility`.
43 *
@@ -12,6 +11,7 @@ private import codeql.rust.elements.internal.generated.Visibility
1211 * be referenced directly.
1312 */
1413module Impl {
14+ // the following QLdoc is generated: if you need to edit it, do it in the schema file
1515 /**
1616 * A visibility modifier.
1717 *
@@ -21,5 +21,13 @@ module Impl {
2121 * //^^^
2222 * ```
2323 */
24- class Visibility extends Generated:: Visibility { }
24+ class Visibility extends Generated:: Visibility {
25+ override string toStringImpl ( ) { result = this .toAbbreviatedString ( ) }
26+
27+ override string toAbbreviatedString ( ) {
28+ result = "pub(" + this .getPath ( ) .toAbbreviatedString ( ) + ")"
29+ or
30+ not this .hasPath ( ) and result = "pub"
31+ }
32+ }
2533}
Original file line number Diff line number Diff line change 99getName
1010| gen_macro_def.rs:4:5:9:5 | MacroDef | gen_macro_def.rs:7:15:7:24 | vec_of_two |
1111getVisibility
12- | gen_macro_def.rs:4:5:9:5 | MacroDef | gen_macro_def.rs:7:5:7:7 | Visibility |
12+ | gen_macro_def.rs:4:5:9:5 | MacroDef | gen_macro_def.rs:7:5:7:7 | pub |
Original file line number Diff line number Diff line change @@ -11,4 +11,4 @@ getName
1111| gen_module.rs:5:1:7:1 | mod bar | gen_module.rs:5:5:5:7 | bar |
1212| lib.rs:1:1:1:19 | mod gen_module | lib.rs:1:9:1:18 | gen_module |
1313getVisibility
14- | lib.rs:1:1:1:19 | mod gen_module | lib.rs:1:1:1:3 | Visibility |
14+ | lib.rs:1:1:1:19 | mod gen_module | lib.rs:1:1:1:3 | pub |
Original file line number Diff line number Diff line change 11instances
2- | gen_struct_field.rs:7:16:7:21 | StructField | isUnsafe: | no |
2+ | gen_struct_field.rs:7:16:7:21 | x: i32 | isUnsafe: | no |
33getAttr
44getDefault
55getName
6- | gen_struct_field.rs:7:16:7:21 | StructField | gen_struct_field.rs:7:16:7:16 | x |
6+ | gen_struct_field.rs:7:16:7:21 | x: i32 | gen_struct_field.rs:7:16:7:16 | x |
77getTypeRepr
8- | gen_struct_field.rs:7:16:7:21 | StructField | gen_struct_field.rs:7:19:7:21 | i32 |
8+ | gen_struct_field.rs:7:16:7:21 | x: i32 | gen_struct_field.rs:7:19:7:21 | i32 |
99getVisibility
Original file line number Diff line number Diff line change 11instances
22| gen_struct_field_list.rs:7:14:7:31 | StructFieldList |
33getField
4- | gen_struct_field_list.rs:7:14:7:31 | StructFieldList | 0 | gen_struct_field_list.rs:7:16:7:21 | StructField |
5- | gen_struct_field_list.rs:7:14:7:31 | StructFieldList | 1 | gen_struct_field_list.rs:7:24:7:29 | StructField |
4+ | gen_struct_field_list.rs:7:14:7:31 | StructFieldList | 0 | gen_struct_field_list.rs:7:16:7:21 | x: i32 |
5+ | gen_struct_field_list.rs:7:14:7:31 | StructFieldList | 1 | gen_struct_field_list.rs:7:24:7:29 | y: i32 |
Original file line number Diff line number Diff line change @@ -13,6 +13,6 @@ getName
1313| gen_trait.rs:10:1:10:57 | trait Foo | gen_trait.rs:10:11:10:13 | Foo |
1414getTypeBoundList
1515getVisibility
16- | gen_trait.rs:10:1:10:57 | trait Foo | gen_trait.rs:10:1:10:3 | Visibility |
16+ | gen_trait.rs:10:1:10:57 | trait Foo | gen_trait.rs:10:1:10:3 | pub |
1717getWhereClause
1818| gen_trait.rs:10:1:10:57 | trait Foo | gen_trait.rs:10:32:10:54 | WhereClause |
Original file line number Diff line number Diff line change 11instances
2- | gen_visibility.rs:7:7:7:9 | Visibility |
3- | lib.rs:1:1:1:3 | Visibility |
2+ | gen_visibility.rs:7:7:7:9 | pub |
3+ | lib.rs:1:1:1:3 | pub |
44getPath
You can’t perform that action at this time.
0 commit comments