-
Notifications
You must be signed in to change notification settings - Fork 1.7k
QL: field only used in charPred #7598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
eadee88
to
cbd2a25
Compare
cbd2a25
to
708c18d
Compare
That code is fine. The field can just be deleted there, if we want. |
It's an instance of a harmless pattern that appears to also occur many other places: When a class wraps an IPA-injector, all the columns from the IPA case are added as fields, and it may well be that not all of those needs to be referenced in member predicates. |
We may want to exclude that pattern from this query. |
Results look better now. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me — but I've left two comments where I'm a bit uncertain.
javascript/ql/test/library-tests/TypeScript/LocalTypeResolution/tests.ql
Show resolved
Hide resolved
@@ -5,7 +5,7 @@ private import codeql_ql.ast.internal.Builtins | |||
|
|||
private newtype TValueNumber = | |||
TVariableValueNumber(VarDecl var) { variableAccessValueNumber(_, var) } or | |||
TFieldValueNumber(VarDecl var) { fieldAccessValueNumber(_, var) } or | |||
TFieldValueNumber(FieldDecl var) { fieldAccessValueNumber(_, var) } or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this an unrelated drive-by bugfix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think var instanceof FieldDecl
was implied by fieldAccessValueNumber
already. So this is just making the branch more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was trying to make it clear when something is a FieldDecl
and when something is a VarDecl
.
There is a lot of drive-by "Make FieldDecl
and it's uses better"-fixes in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to the javascript analyses look good to me! 👍
Flags some bad style I recently encountered during a code-review.
I also went ahead and fixed all the alerts found in JS. (Except for this one, and the alerts in shared files).
Most of the time the fix is to somehow inline the field into the charpred.
But the right way to inline the field can vary a lot, so I'm not writing an automated patch for this.
I think that for some of the issues (e.g. this one) the problem is that the field should have been used somewhere.