Skip to content

Commit 5006ffe

Browse files
author
Alvaro Muñoz
committed
Use the LibYaml default AST hierarchy
1 parent 83ca36b commit 5006ffe

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

ql/lib/codeql/actions/Ast.qll

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,13 @@ private import codeql.actions.ast.internal.Actions
22
private import codeql.Locations
33

44
/**
5-
* Base class for the AST tree.
6-
* Based on YamlNode from the Yaml library but making mapping values children of the mapping keys:
7-
* eg: top:
8-
* key: value
9-
* According to the Yaml library, both `key` and `value` are direct children of `top`
10-
* This Tree implementation makes `key` child od `top` and `value` child of `key`
5+
* Base class for the AST tree. Based on YamlNode from the Yaml library.
116
*/
127
class AstNode instanceof YamlNode {
138
AstNode getParentNode() { result = super.getParentNode() }
149

15-
// AstNode getParentNode() {
16-
// if exists(YamlMapping m | m.maps(_, this))
17-
// then exists(YamlMapping m | m.maps(result, this))
18-
// else result = super.getParentNode()
19-
// }
2010
AstNode getAChildNode() { result = super.getAChildNode() }
2111

22-
// AstNode getAChildNode() {
23-
// if this instanceof YamlMapping
24-
// then this.(YamlMapping).maps(result, _)
25-
// else
26-
// if this instanceof YamlCollection
27-
// then result = super.getChildNode(_)
28-
// else
29-
// if this instanceof YamlScalar and exists(YamlMapping m | m.maps(this, _))
30-
// then exists(YamlMapping m | m.maps(this, result))
31-
// else none()
32-
// }
33-
// /**
34-
// * This should be getAChildNode(int i)
35-
// */
36-
// AstNode getChildNodeByOrder(int i) {
37-
// result =
38-
// rank[i](Expression child, Location l |
39-
// child = this.getAChildNode() and
40-
// child.getLocation() = l
41-
// |
42-
// child
43-
// order by
44-
// l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
45-
// )
46-
// }
4712
string toString() { result = super.toString() }
4813

4914
string getAPrimaryQlClass() { result = super.getAPrimaryQlClass() }

0 commit comments

Comments
 (0)