Refactor GrapeHeadersBlockCall and GrapeCookiesBlockCall to simplify method call checks

This commit is contained in:
Chad Bentz
2025-09-22 12:52:30 -04:00
parent b837c56bec
commit ecd0ce65fe

View File

@@ -237,11 +237,8 @@ module Grape {
*/
private class GrapeHeadersBlockCall extends MethodCall {
GrapeHeadersBlockCall() {
exists(GrapeApiClass api |
this.getParent+() = api.getADeclaration() and
this.getMethodName() = "headers" and
exists(this.getBlock())
)
this = grapeApiInstance().getAMethodCall("headers").asExpr().getExpr() and
exists(this.getBlock())
}
}
@@ -251,11 +248,8 @@ module Grape {
*/
private class GrapeCookiesBlockCall extends MethodCall {
GrapeCookiesBlockCall() {
exists(GrapeApiClass api |
this.getParent+() = api.getADeclaration() and
this.getMethodName() = "cookies" and
exists(this.getBlock())
)
this = grapeApiInstance().getAMethodCall("cookies").asExpr().getExpr() and
exists(this.getBlock())
}
}