This repository was archived by the owner on Jan 5, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
test/library-tests/semmle/go/PrintAst Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,20 @@ class ExprNode extends BaseAstNode {
173
173
}
174
174
}
175
175
176
+ /**
177
+ * A node representing a `File`
178
+ */
179
+ class FileNode extends BaseAstNode {
180
+ override File ast ;
181
+
182
+ /**
183
+ * Gets the string representation of this File. Note explicitly using a relative path
184
+ * like this rather than absolute as per default for the File class is a workaround for
185
+ * a bug with codeql run test, which should replace absolute paths but currently does not.
186
+ */
187
+ override string toString ( ) { result = qlClass ( ast ) + ast .getRelativePath ( ) }
188
+ }
189
+
176
190
query predicate nodes ( PrintAstNode node , string key , string value ) {
177
191
node .shouldPrint ( ) and
178
192
value = node .getProperty ( key )
Original file line number Diff line number Diff line change 1
1
input.go:
2
- # 0| [File] /home/chris/codeql-home/codeql-go/ql/test/ library-tests/semmle/go/PrintAst/input.go
2
+ # 0| [File] library-tests/semmle/go/PrintAst/input.go
3
3
# 3| 0: [ImportDecl] import declaration
4
4
# 3| 0: [ImportSpec] import specifier
5
5
# 3| 0: [StringLit] "fmt"
You can’t perform that action at this time.
0 commit comments