mirror of
https://github.com/github/codeql.git
synced 2026-07-08 21:15:32 +02:00
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -183,9 +183,9 @@ impl<C: Clone> BuildCtx<'_, C> {
|
||||
///
|
||||
/// Use when descending into a subtree — a body, expression, or statement
|
||||
/// list — that must not inherit any of the surrounding translation
|
||||
/// context (for example an enclosing binding modifier). Accepts single
|
||||
/// (`Id`), optional (`Option<Id>`), and repeated (`Vec<Id>`) captures,
|
||||
/// since all of them are `IntoIterator<Item = Id>`.
|
||||
/// context (for example an enclosing binding modifier). Accepts optional
|
||||
/// (`Option<Id>`) and repeated (`Vec<Id>`) captures (both `IntoIterator`);
|
||||
/// for a single `Id`, wrap it in `std::iter::once(id)`.
|
||||
pub fn translate_reset<I: Into<Id>>(
|
||||
&mut self,
|
||||
ids: impl IntoIterator<Item = I>,
|
||||
|
||||
@@ -44,7 +44,7 @@ module Public {
|
||||
class Comment extends TriviaToken {
|
||||
// At the moment, comments are the only type trivia token we extract
|
||||
/**
|
||||
* Gets the text inside this comment, not counting the delimeters.
|
||||
* Gets the text inside this comment, not counting the delimiters.
|
||||
*/
|
||||
string getCommentText() {
|
||||
result = this.getValue().regexpCapture("//(.*)", 1)
|
||||
|
||||
@@ -12,10 +12,10 @@ private module LocalNameBindingInput implements LocalNameBindingInputSig<Locatio
|
||||
private class LogicalAndRoot extends LogicalAndExpr {
|
||||
LogicalAndRoot() { not this = any(LogicalAndExpr e).getAnOperand() }
|
||||
|
||||
private Expr getDescendent(string path) {
|
||||
private Expr getDescendant(string path) {
|
||||
path = "" and result = this
|
||||
or
|
||||
exists(LogicalAndExpr mid, string midPath | mid = this.getDescendent(midPath) |
|
||||
exists(LogicalAndExpr mid, string midPath | mid = this.getDescendant(midPath) |
|
||||
result = mid.getLeft() and path = midPath + "A"
|
||||
or
|
||||
result = mid.getRight() and path = midPath + "B"
|
||||
@@ -25,7 +25,7 @@ private module LocalNameBindingInput implements LocalNameBindingInputSig<Locatio
|
||||
Expr getNthLeaf(int n) {
|
||||
result =
|
||||
rank[n](Expr e, string path |
|
||||
e = this.getDescendent(path) and not e instanceof LogicalAndExpr
|
||||
e = this.getDescendant(path) and not e instanceof LogicalAndExpr
|
||||
|
|
||||
e order by path
|
||||
)
|
||||
|
||||
@@ -244,7 +244,7 @@ func t27(opt: Int?) { // name=opt1
|
||||
func t28(a: Int?, b: Int?) {
|
||||
if let x = a, // $ access=a
|
||||
let y = b, // $ access=b
|
||||
x < y { // $ $ access=x access=y
|
||||
x < y { // $ access=x access=y
|
||||
print(x) // $ access=x
|
||||
print(y) // $ access=y
|
||||
}
|
||||
@@ -273,7 +273,7 @@ func t30(opt: Int?) { // name=opt1
|
||||
func t31(a: Int?, b: Int?) {
|
||||
guard let x = a, // $ access=a
|
||||
let y = b, // $ access=b
|
||||
x < y else { // $ $ access=x access=y
|
||||
x < y else { // $ access=x access=y
|
||||
return
|
||||
}
|
||||
print(x) // $ access=x
|
||||
@@ -303,7 +303,7 @@ func t34() {
|
||||
let x = 1 // name=x1
|
||||
if x > 0, // $ access=x1
|
||||
let x = x, // $ access=x1 // name=x2
|
||||
x > 0 else { // $ access=x2
|
||||
x > 0 { // $ access=x2
|
||||
print(x) // $ access=x2
|
||||
}
|
||||
}
|
||||
@@ -319,7 +319,7 @@ func t35(optional: Int?) { // name=optional1
|
||||
func t36(a: Int?, b: Int?) {
|
||||
while let x = a, // $ access=a
|
||||
let y = b, // $ access=b
|
||||
x < y { // $ $ access=x access=y
|
||||
x < y { // $ access=x access=y
|
||||
print(x) // $ access=x
|
||||
print(y) // $ access=y
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user