Skip to content

Commit b61e094

Browse files
committed
recognize @kinds with a dash
1 parent 362ee71 commit b61e094

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ql/ql/src/codeql_ql/ast/Ast.qll

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ class QueryDoc extends QLDoc {
186186
override string getAPrimaryQlClass() { result = "QueryDoc" }
187187

188188
/** Gets the @kind for the query */
189-
string getQueryKind() { result = this.getContents().regexpCapture("(?s).*@kind (\\w+)\\s.*", 1) }
189+
string getQueryKind() {
190+
result = this.getContents().regexpCapture("(?s).*@kind ([\\w-]+)\\s.*", 1)
191+
}
190192

191193
/** Gets the id part (without language) of the @id */
192194
string getQueryId() {
@@ -242,6 +244,12 @@ class Select extends TSelect, AstNode {
242244
*/
243245
Expr getExpr(int i) { toQL(result) = sel.getChild(_).(QL::AsExprs).getChild(i) }
244246

247+
Expr getMessage() {
248+
if this.getQueryDoc().getQueryKind() = "path-problem"
249+
then result = this.getExpr(3)
250+
else result = this.getExpr(1)
251+
}
252+
245253
// TODO: This gets the `i`th order-by, but some expressions might not have an order-by.
246254
Expr getOrderBy(int i) { toQL(result) = sel.getChild(_).(QL::OrderBys).getChild(i).getChild(0) }
247255

0 commit comments

Comments
 (0)