Kotlin: Apply some review feedback

This commit is contained in:
Ian Lynagh
2022-04-28 17:25:37 +01:00
parent 726a005cc2
commit 1151f79eca
4 changed files with 4 additions and 10 deletions

View File

@@ -4,8 +4,6 @@ import semmle.code.java.ControlFlowGraph
predicate shouldBeDeadEnd(ControlFlowNode n) {
n instanceof BreakStmt and n.getFile().isKotlinSourceFile() // TODO
or
n instanceof ReturnStmt and n.getFile().isKotlinSourceFile() // TODO
or
n instanceof Interface // TODO
or
n instanceof Class // TODO

View File

@@ -46,8 +46,7 @@ predicate gapInChildren(Element e, int i) {
predicate lateFirstChild(Element e, int i) {
i > 0 and
exists(nthChildOf(e, i)) and
forex(int j | exists(nthChildOf(e, j)) | j >= i) and
i = min(int j | exists(nthChildOf(e, j))) and
// A wildcard type access can be `?` with no children,
// `? extends T` with only a child 0, or `? super T`
// with only a child 1.

View File

@@ -3,7 +3,7 @@
*/
import java
import semmle.code.java.frameworks.android.Compose
private import semmle.code.java.frameworks.android.Compose
/** A common super-class that represents all kinds of expressions. */
class Expr extends ExprParent, @expr {
@@ -2349,10 +2349,9 @@ class Argument extends Expr {
*/
predicate isNthVararg(int arrayindex) {
not this.isExplicitVarargsArray() and
exists(Callable tgt, Parameter varargsParam, int varargsParamPos |
exists(Callable tgt, int varargsParamPos |
call.getCallee() = tgt and
tgt.getParameter(varargsParamPos) = varargsParam and
varargsParam.isVarargs() and
tgt.getParameter(varargsParamPos).isVarargs() and
arrayindex = pos - varargsParamPos and
arrayindex >= 0 and
arrayindex <= (call.getNumArgument() - tgt.getNumberOfParameters())

View File

@@ -9,8 +9,6 @@ import java
* This always returns a constant expression and can be considered as such.
*/
class LiveLiteral extends MethodAccess {
CompileTimeConstantExpr value;
LiveLiteral() {
this.getMethod() instanceof LiveLiteralMethod and
not this.getEnclosingCallable() instanceof LiveLiteralMethod