mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Add test for extracting a Java AST with an error expression
Also note that ErrorExpr can occur outside upgrade/downgrade scripts
This commit is contained in:
30
java/ql/test/library-tests/errorexpr/PrintAst.expected
Normal file
30
java/ql/test/library-tests/errorexpr/PrintAst.expected
Normal file
@@ -0,0 +1,30 @@
|
||||
Test.java:
|
||||
# 0| [CompilationUnit] Test
|
||||
# 1| 1: [Class] Test
|
||||
# 3| 2: [Method] yield
|
||||
# 3| 3: [TypeAccess] int
|
||||
#-----| 4: (Parameters)
|
||||
# 3| 0: [Parameter] x
|
||||
# 3| 0: [TypeAccess] int
|
||||
# 3| 5: [BlockStmt] { ... }
|
||||
# 3| 0: [ReturnStmt] return ...
|
||||
# 3| 0: [VarAccess] x
|
||||
# 5| 3: [Method] secondCall
|
||||
# 5| 3: [TypeAccess] void
|
||||
# 5| 5: [BlockStmt] { ... }
|
||||
# 7| 4: [Method] yieldWrapper
|
||||
# 7| 3: [TypeAccess] int
|
||||
#-----| 4: (Parameters)
|
||||
# 7| 0: [Parameter] x
|
||||
# 7| 0: [TypeAccess] int
|
||||
# 7| 5: [BlockStmt] { ... }
|
||||
# 8| 0: [LocalVariableDeclStmt] var ...;
|
||||
# 8| 0: [TypeAccess] int
|
||||
# 8| 1: [LocalVariableDeclExpr] ret
|
||||
# 8| 0: [ErrorExpr] <error expr>
|
||||
# 8| 0: [MethodAccess] yield(...)
|
||||
# 8| 0: [VarAccess] x
|
||||
# 9| 1: [ExprStmt] <Expr>;
|
||||
# 9| 0: [MethodAccess] secondCall(...)
|
||||
# 10| 2: [ReturnStmt] return ...
|
||||
# 10| 0: [VarAccess] ret
|
||||
1
java/ql/test/library-tests/errorexpr/PrintAst.qlref
Normal file
1
java/ql/test/library-tests/errorexpr/PrintAst.qlref
Normal file
@@ -0,0 +1 @@
|
||||
semmle/code/java/PrintAst.ql
|
||||
13
java/ql/test/library-tests/errorexpr/Test.java
Normal file
13
java/ql/test/library-tests/errorexpr/Test.java
Normal file
@@ -0,0 +1,13 @@
|
||||
public class Test {
|
||||
|
||||
public int yield(int x) { return x; }
|
||||
|
||||
public void secondCall() { }
|
||||
|
||||
public int yieldWrapper(int x) {
|
||||
int ret = yield(x);
|
||||
secondCall();
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
1
java/ql/test/library-tests/errorexpr/options
Normal file
1
java/ql/test/library-tests/errorexpr/options
Normal file
@@ -0,0 +1 @@
|
||||
//semmle-extractor-options: --no-strict-javac-errors --javac-args -source 17 -target 17
|
||||
Reference in New Issue
Block a user