Skip to content

Commit bec213b

Browse files
committed
shared: Factor out declInScope(name, scope)
1 parent e23f3e4 commit bec213b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

shared/namebinding/codeql/namebinding/LocalNameBinding.qll

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,22 +354,25 @@ module LocalNameBinding<LocationSig Location, LocalNameBindingInputSig<Location>
354354
or
355355
exists(Scope mid |
356356
lookupInScope(name, lookup, mid) and
357-
not declInScope(_, name, mid) and
358-
not implicitDeclInScope(name, mid) and
357+
not declInScope(name, mid) and
359358
not isTopScope(mid) and
360359
scope = getEnclosingScope(mid)
361360
)
362361
}
363362

363+
private predicate declInScope(string name, AstNode scope) {
364+
declInScope(_, name, scope) or
365+
implicitDeclInScope(name, scope)
366+
}
367+
364368
/**
365369
* Holds if `name`, when resolved from `lookup`, may resolve to one of the uncertain members of `scope`.
366370
*/
367371
pragma[nomagic]
368372
private predicate lookupInUncertainScope(string name, Scope lookup, Scope scope) {
369373
lookupInScope(name, lookup, scope) and
370374
uncertainScope(scope) and
371-
not declInScope(_, name, scope) and
372-
not implicitDeclInScope(name, scope)
375+
not declInScope(name, scope)
373376
}
374377

375378
/**

0 commit comments

Comments
 (0)