Skip to content

Commit

Permalink
Merge pull request #18294 from github/redsun82/extract-self-param-ref
Browse files Browse the repository at this point in the history
Rust: extract `isRef` for `SelfParam`
  • Loading branch information
redsun82 authored Dec 16, 2024
2 parents 9a80c40 + 4975e7b commit d624670
Show file tree
Hide file tree
Showing 19 changed files with 111 additions and 32 deletions.
8 changes: 8 additions & 0 deletions rust/ast-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fn property_name(type_name: &str, field_name: &str) -> String {
(_, "then_branch") => "then",
(_, "else_branch") => "else_",
("ArrayType", "ty") => "element_type_repr",
("SelfParam", "is_amp") => "is_ref",
(_, "ty") => "type_repr",
_ => field_name,
};
Expand Down Expand Up @@ -363,6 +364,13 @@ fn get_fields(node: &AstNodeSrc) -> Vec<FieldInfo> {
is_many: false,
});
}
"SelfParam" => {
result.push(FieldInfo {
name: "is_amp".to_string(),
tp: "predicate".to_string(),
is_many: false,
});
}
_ => {}
}

Expand Down
2 changes: 1 addition & 1 deletion rust/extractor/src/generated/.generated.list

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions rust/extractor/src/generated/top.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions rust/extractor/src/translate/generated.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions rust/ql/.generated.list

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions rust/ql/lib/codeql/rust/elements/SelfParam.qll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/SelfParamImpl.qll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/generated/SelfParam.qll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions rust/ql/lib/rust.dbscheme
Original file line number Diff line number Diff line change
Expand Up @@ -2226,6 +2226,11 @@ self_params(
unique int id: @self_param
);

#keyset[id]
self_param_is_ref(
int id: @self_param ref
);

#keyset[id]
self_param_is_mut(
int id: @self_param ref
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
| gen_self_param.rs:5:13:5:21 | SelfParam | getNumberOfAttrs: | 0 | hasTypeRepr: | no | isMut: | yes | hasLifetime: | no | hasName: | yes |
| gen_self_param.rs:6:10:6:14 | SelfParam | getNumberOfAttrs: | 0 | hasTypeRepr: | no | isRef: | yes | isMut: | no | hasLifetime: | no | hasName: | yes |
| gen_self_param.rs:7:10:7:18 | SelfParam | getNumberOfAttrs: | 0 | hasTypeRepr: | no | isRef: | yes | isMut: | yes | hasLifetime: | no | hasName: | yes |
| gen_self_param.rs:8:12:8:15 | SelfParam | getNumberOfAttrs: | 0 | hasTypeRepr: | no | isRef: | no | isMut: | no | hasLifetime: | no | hasName: | yes |
| gen_self_param.rs:9:11:9:18 | SelfParam | getNumberOfAttrs: | 0 | hasTypeRepr: | no | isRef: | no | isMut: | yes | hasLifetime: | no | hasName: | yes |
| gen_self_param.rs:10:15:10:22 | SelfParam | getNumberOfAttrs: | 0 | hasTypeRepr: | no | isRef: | yes | isMut: | no | hasLifetime: | yes | hasName: | yes |
9 changes: 5 additions & 4 deletions rust/ql/test/extractor-tests/generated/SelfParam/SelfParam.ql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
| gen_self_param.rs:10:15:10:22 | SelfParam | gen_self_param.rs:10:16:10:17 | ''a |
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
| gen_self_param.rs:5:13:5:21 | SelfParam | gen_self_param.rs:5:18:5:21 | self |
| gen_self_param.rs:6:10:6:14 | SelfParam | gen_self_param.rs:6:11:6:14 | self |
| gen_self_param.rs:7:10:7:18 | SelfParam | gen_self_param.rs:7:15:7:18 | self |
| gen_self_param.rs:8:12:8:15 | SelfParam | gen_self_param.rs:8:12:8:15 | self |
| gen_self_param.rs:9:11:9:18 | SelfParam | gen_self_param.rs:9:15:9:18 | self |
| gen_self_param.rs:10:15:10:22 | SelfParam | gen_self_param.rs:10:19:10:22 | self |
Loading

0 comments on commit d624670

Please sign in to comment.