Change how Param and Params are modeled

Previously any read of type Param or Params was a source. Now reading
Context.Params is a source. This should reduce the number of duplicate
paths.
This commit is contained in:
Owen Mansel-Chan
2020-06-24 16:01:40 +01:00
parent 9fd892ab94
commit cf47159a30
2 changed files with 1 additions and 18 deletions

View File

@@ -76,7 +76,7 @@ private module Gin {
or
// Field reads:
exists(DataFlow::Field fld |
fld.hasQualifiedName(packagePath, typeName, "Accepted") and
fld.hasQualifiedName(packagePath, typeName, ["Accepted", "Params"]) and
this = fld.getARead()
)
)
@@ -92,11 +92,6 @@ private module Gin {
packagePath = "github.com/gin-gonic/gin" and
typeName = "Params"
|
// Any read of a variable of this type:
exists(DataFlow::ReadNode read | read.getType().hasQualifiedName(packagePath, typeName) |
this = read
)
or
// Method calls:
exists(DataFlow::MethodCallNode call |
call.getTarget().hasQualifiedName(packagePath, typeName, ["ByName", "Get"])
@@ -116,11 +111,6 @@ private module Gin {
packagePath = "github.com/gin-gonic/gin" and
typeName = "Param"
|
// Any read of a variable of this type:
exists(DataFlow::ReadNode read | read.getType().hasQualifiedName(packagePath, typeName) |
this = read
)
or
// Field reads:
exists(DataFlow::Field fld | fld.hasQualifiedName(packagePath, typeName, ["Key", "Value"]) |
this = fld.getARead()

View File

@@ -26,22 +26,15 @@
| Gin.go:123:10:123:23 | call to FullPath |
| Gin.go:129:10:129:21 | selection of Accepted |
| Gin.go:133:10:133:19 | selection of Params |
| Gin.go:134:7:134:9 | val |
| Gin.go:134:7:134:12 | index expression |
| Gin.go:134:7:134:18 | selection of Value |
| Gin.go:139:10:139:19 | selection of Params |
| Gin.go:139:10:139:22 | index expression |
| Gin.go:140:7:140:9 | val |
| Gin.go:140:7:140:15 | selection of Value |
| Gin.go:143:10:143:19 | selection of Params |
| Gin.go:143:10:143:34 | call to ByName |
| Gin.go:147:3:147:34 | ... := ...[0] |
| Gin.go:147:13:147:22 | selection of Params |
| Gin.go:153:12:153:21 | selection of Params |
| Gin.go:153:12:153:24 | index expression |
| Gin.go:154:10:154:14 | param |
| Gin.go:154:10:154:18 | selection of Key |
| Gin.go:155:10:155:14 | param |
| Gin.go:155:10:155:20 | selection of Value |
| Gin.go:163:16:163:22 | &... |
| Gin.go:167:7:167:19 | definition of personPointer |