Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ class PrintAstNode extends AstNode {
/**
* Gets the child node that is accessed using the predicate `edgeName`.
*/
PrintAstNode getChild(string edgeName) { result = this.getAChild(edgeName) }
PrintAstNode getChild(string edgeName) {
result = this.getAChild()
and
edgeName = "semmle.label"
}
}

private predicate shouldPrintNode(AstNode n) {
Expand Down
36 changes: 18 additions & 18 deletions ql/lib/ide-contextual-queries/printAst.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
* @tags ide-contextual-queries/print-ast
*/

private import codeql.IDEContextual
private import codeql.bicep.AST
private import codeql.bicep.ideContextual.printAstAst

/**
* The source file to generate an AST from.
*/
external string selectedSourceFile();

/**
* A configuration that only prints nodes in the selected source file.
*/
class Cfg extends PrintAstConfiguration {
override predicate shouldPrintNode(AstNode n) {
super.shouldPrintNode(n) and
n.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile())
}
}
private import codeql.IDEContextual
private import codeql.bicep.AST
private import codeql.bicep.ideContextual.PrintAstNode
/**
* The source file to generate an AST from.
*/
external string selectedSourceFile();
/**
* A configuration that only prints nodes in the selected source file.
*/
class Cfg extends PrintAstConfiguration {
override predicate shouldPrintNode(AstNode n) {
super.shouldPrintNode(n) and
n.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile())
}
}