Skip to content

Commit d2f474d

Browse files
committed
Address review comments
1 parent caae5a8 commit d2f474d

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,9 @@ module Impl {
381381
class NestedFunctionAccess extends LocalAccess {
382382
private Function f;
383383

384+
NestedFunctionAccess() { f = super.getLocal().getDefiningNode() }
385+
384386
/** Gets the function being accessed. */
385-
Function getFunction() { result = super.getLocal().getDefiningNode() }
387+
Function getFunction() { result = f }
386388
}
387389
}

shared/namebinding/codeql/namebinding/LocalNameBinding.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ signature module LocalNameBindingInputSig<LocationSig Location> {
4646
* // x is not in scope here
4747
* }
4848
* ```
49+
*
50+
* If a local declaration inside the condition is a shadowing sibling declaration
51+
* (see below), then it should use the declaration itself as scope, otherwise it
52+
* should use the condition as scope.
4953
*/
5054
class Conditional extends AstNode {
5155
/** Gets the condition of this conditional. */
@@ -153,8 +157,6 @@ module LocalNameBinding<LocationSig Location, LocalNameBindingInputSig<Location>
153157
implicitDeclInScope(_, this)
154158
or
155159
isTopScope(this)
156-
or
157-
lookupStartsAt(_, this)
158160
}
159161
}
160162

0 commit comments

Comments
 (0)