This repository was archived by the owner on Jan 5, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
test/library-tests/semmle/go/PrintAst Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -173,6 +173,20 @@ class ExprNode extends BaseAstNode {
173173 }
174174}
175175
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+
176190query predicate nodes ( PrintAstNode node , string key , string value ) {
177191 node .shouldPrint ( ) and
178192 value = node .getProperty ( key )
Original file line number Diff line number Diff line change 11input.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
33# 3| 0: [ImportDecl] import declaration
44# 3| 0: [ImportSpec] import specifier
55# 3| 0: [StringLit] "fmt"
You can’t perform that action at this time.
0 commit comments