mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Rust: Move the restriction to variableDecl.
This commit is contained in:
@@ -77,7 +77,12 @@ module Impl {
|
||||
not exists(getOutermostEnclosingOrPat(p)) and
|
||||
definingNode = p.getName()
|
||||
) and
|
||||
name = p.getName().getText()
|
||||
name = p.getName().getText() and
|
||||
// exclude for now anything starting with an uppercase character, which may be a reference to
|
||||
// an enum constant (e.g. `None`). This excludes static and constant variables (UPPERCASE),
|
||||
// which we don't appear to recognize yet anyway. This also assumes programmers follow the
|
||||
// naming guidelines, which they generally do, but they're not enforced.
|
||||
not name.charAt(0).isUppercase()
|
||||
}
|
||||
|
||||
/** A variable. */
|
||||
@@ -85,13 +90,7 @@ module Impl {
|
||||
private AstNode definingNode;
|
||||
private string name;
|
||||
|
||||
Variable() {
|
||||
this = MkVariable(definingNode, name) and
|
||||
// exclude for now anything starting with an uppercase character, which may be an enum constant (e.g. `None`). This excludes
|
||||
// static and constant variables (UPPERCASE), which we don't appear to recognize yet anyway. This also assumes programmers
|
||||
// follow the naming guidelines, which they generally do, but they're not enforced.
|
||||
not name.charAt(0).isUppercase()
|
||||
}
|
||||
Variable() { this = MkVariable(definingNode, name) }
|
||||
|
||||
/** Gets the name of this variable. */
|
||||
string getName() { result = name }
|
||||
|
||||
Reference in New Issue
Block a user