mirror of
https://github.com/github/codeql.git
synced 2026-04-21 23:14:03 +02:00
AST: add printAST test case
This commit is contained in:
1697
ql/test/library-tests/ast/Ast.expected
Normal file
1697
ql/test/library-tests/ast/Ast.expected
Normal file
File diff suppressed because it is too large
Load Diff
24
ql/test/library-tests/ast/Ast.ql
Normal file
24
ql/test/library-tests/ast/Ast.ql
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @kind graph
|
||||
*/
|
||||
|
||||
import codeql_ruby.printAst
|
||||
|
||||
class OrderedAstNode extends PrintAstNode {
|
||||
override string getProperty(string key) {
|
||||
result = super.getProperty(key)
|
||||
or
|
||||
key = "semmle.order" and
|
||||
result =
|
||||
any(int i |
|
||||
this =
|
||||
rank[i](AstNode p |
|
||||
|
|
||||
p
|
||||
order by
|
||||
p.getLocation().getFile().getBaseName(), p.getLocation().getFile().getAbsolutePath(),
|
||||
p.getLocation().getStartLine()
|
||||
)
|
||||
).toString()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user