mirror of
https://github.com/github/codeql.git
synced 2026-01-29 06:12:58 +01:00
Merge pull request #585 from github/jbj/getAPrimaryQlClass-file
Fix getAPrimaryQlClass for File classes
This commit is contained in:
@@ -257,7 +257,7 @@ class ExtractedOrExternalFile extends Container, @file, Documentable, ExprParent
|
||||
/** Gets the number of child comment groups of this file. */
|
||||
int getNumCommentGroups() { result = count(this.getACommentGroup()) }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "File" }
|
||||
override string getAPrimaryQlClass() { result = "ExtractedOrExternalFile" }
|
||||
}
|
||||
|
||||
/** A file that has been extracted. */
|
||||
@@ -269,14 +269,20 @@ class File extends ExtractedOrExternalFile {
|
||||
or
|
||||
exists(this.getAChild())
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "File" }
|
||||
}
|
||||
|
||||
/** A Go file. */
|
||||
class GoFile extends File {
|
||||
GoFile() { this.getExtension() = "go" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "GoFile" }
|
||||
}
|
||||
|
||||
/** An HTML file. */
|
||||
class HtmlFile extends File {
|
||||
HtmlFile() { this.getExtension().regexpMatch("x?html?") }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "HtmlFile" }
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ go.mod:
|
||||
# 1| 0: [GoModModuleLine] go.mod module line
|
||||
# 3| 1: [GoModGoLine] go.mod go line
|
||||
input.go:
|
||||
# 0| [File] library-tests/semmle/go/PrintAst/input.go
|
||||
# 0| [GoFile] library-tests/semmle/go/PrintAst/input.go
|
||||
# 1| package: [Ident] main
|
||||
# 5| 1: [CommentGroup] comment group
|
||||
# 5| 0: [SlashSlashComment] comment
|
||||
@@ -597,7 +597,7 @@ input.go:
|
||||
# 145| Type = []int
|
||||
# 145| 1: [BlockStmt] block statement
|
||||
other.go:
|
||||
# 0| [File] library-tests/semmle/go/PrintAst/other.go
|
||||
# 0| [GoFile] library-tests/semmle/go/PrintAst/other.go
|
||||
# 1| package: [Ident] main
|
||||
# 3| 1: [FuncDecl] function declaration
|
||||
# 3| 0: [FunctionName, Ident] main
|
||||
|
||||
@@ -3,7 +3,7 @@ go.mod:
|
||||
# 1| 0: [GoModModuleLine] go.mod module line
|
||||
# 3| 1: [GoModGoLine] go.mod go line
|
||||
input.go:
|
||||
# 0| [File] library-tests/semmle/go/PrintAst/input.go
|
||||
# 0| [GoFile] library-tests/semmle/go/PrintAst/input.go
|
||||
# 1| package: [Ident] main
|
||||
# 3| 1: [ImportDecl] import declaration
|
||||
# 3| 0: [ImportSpec] import specifier
|
||||
@@ -577,7 +577,7 @@ input.go:
|
||||
# 145| Type = []int
|
||||
# 145| 1: [BlockStmt] block statement
|
||||
other.go:
|
||||
# 0| [File] library-tests/semmle/go/PrintAst/other.go
|
||||
# 0| [GoFile] library-tests/semmle/go/PrintAst/other.go
|
||||
# 1| package: [Ident] main
|
||||
# 3| 1: [FuncDecl] function declaration
|
||||
# 3| 0: [FunctionName, Ident] main
|
||||
|
||||
@@ -3,7 +3,7 @@ go.mod:
|
||||
# 1| 0: [GoModModuleLine] go.mod module line
|
||||
# 3| 1: [GoModGoLine] go.mod go line
|
||||
input.go:
|
||||
# 0| [File] library-tests/semmle/go/PrintAst/input.go
|
||||
# 0| [GoFile] library-tests/semmle/go/PrintAst/input.go
|
||||
# 1| package: [Ident] main
|
||||
# 5| 1: [CommentGroup] comment group
|
||||
# 5| 0: [SlashSlashComment] comment
|
||||
@@ -29,7 +29,7 @@ input.go:
|
||||
# 3| 0: [ImportSpec] import specifier
|
||||
# 3| 0: [StringLit] "fmt"
|
||||
other.go:
|
||||
# 0| [File] library-tests/semmle/go/PrintAst/other.go
|
||||
# 0| [GoFile] library-tests/semmle/go/PrintAst/other.go
|
||||
# 1| package: [Ident] main
|
||||
# 8| 1: [FuncDecl] function declaration
|
||||
# 8| 0: [FunctionName, Ident] hasNested
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
other.go:
|
||||
# 0| [File] library-tests/semmle/go/PrintAst/other.go
|
||||
# 0| [GoFile] library-tests/semmle/go/PrintAst/other.go
|
||||
# 1| package: [Ident] main
|
||||
# 3| 1: [FuncDecl] function declaration
|
||||
# 3| 0: [FunctionName, Ident] main
|
||||
|
||||
@@ -3,7 +3,7 @@ go.mod:
|
||||
# 1| 0: [GoModModuleLine] go.mod module line
|
||||
# 3| 1: [GoModGoLine] go.mod go line
|
||||
input.go:
|
||||
# 0| [File] library-tests/semmle/go/PrintAst/input.go
|
||||
# 0| [GoFile] library-tests/semmle/go/PrintAst/input.go
|
||||
# 1| package: [Ident] main
|
||||
# 5| 1: [CommentGroup] comment group
|
||||
# 5| 0: [SlashSlashComment] comment
|
||||
@@ -29,7 +29,7 @@ input.go:
|
||||
# 3| 0: [ImportSpec] import specifier
|
||||
# 3| 0: [StringLit] "fmt"
|
||||
other.go:
|
||||
# 0| [File] library-tests/semmle/go/PrintAst/other.go
|
||||
# 0| [GoFile] library-tests/semmle/go/PrintAst/other.go
|
||||
# 1| package: [Ident] main
|
||||
# 6| 1: [FuncDecl] function declaration
|
||||
# 6| 0: [FunctionName, Ident] g
|
||||
|
||||
Reference in New Issue
Block a user