Skip to content

C# ReturnStmt (and other statements) doesn't return any getExpr() nor any getAChild() since v2.21.1 #20033

@nicolasdato

Description

@nicolasdato

Description of the issue

Since v2.21.1 (v2.22.1 included) some statements like ReturnStmt don't return any Expr with getExpr(), nor any Element with getAChild(). This works as expected in v2.21.0.
Also, the (expected) child Element doesn't have a getParent() neither.

You can try it with this example:

public static class A {
    static int get() {
        return 10;
    }
    static  void Main() {
    }
}

And these CodeQL queries:

from ReturnStmt r
select r, "number of children: " + r.getNumberOfChildren()

Got:

|      r      |         col1          |
+-------------+-----------------------+
| return ...; | number of children: 0 |

Expected 1 or more children

from ReturnStmt r
select r, "Expr: " + r.getExpr()

and

from ReturnStmt r
select r, "Expr: " + r.getAChild()

With both I got empty result. Expected the 10 of the return 10; statement.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions