mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
use Parameter instead of SimpleParameter in the AngularJS model
This commit is contained in:
@@ -819,27 +819,27 @@ class LinkFunction extends Function {
|
||||
/**
|
||||
* Gets the scope parameter of this function.
|
||||
*/
|
||||
SimpleParameter getScopeParameter() { result = getParameter(0) }
|
||||
Parameter getScopeParameter() { result = getParameter(0) }
|
||||
|
||||
/**
|
||||
* Gets the element parameter of this function (contains a jqLite-wrapped DOM element).
|
||||
*/
|
||||
SimpleParameter getElementParameter() { result = getParameter(1) }
|
||||
Parameter getElementParameter() { result = getParameter(1) }
|
||||
|
||||
/**
|
||||
* Gets the attributes parameter of this function.
|
||||
*/
|
||||
SimpleParameter getAttributesParameter() { result = getParameter(2) }
|
||||
Parameter getAttributesParameter() { result = getParameter(2) }
|
||||
|
||||
/**
|
||||
* Gets the controller parameter of this function.
|
||||
*/
|
||||
SimpleParameter getControllerParameter() { result = getParameter(3) }
|
||||
Parameter getControllerParameter() { result = getParameter(3) }
|
||||
|
||||
/**
|
||||
* Gets the transclude-function parameter of this function.
|
||||
*/
|
||||
SimpleParameter getTranscludeFnParameter() { result = getParameter(4) }
|
||||
Parameter getTranscludeFnParameter() { result = getParameter(4) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -868,7 +868,7 @@ class AngularScope extends TAngularScope {
|
||||
*/
|
||||
Expr getAnAccess() {
|
||||
exists(CustomDirective d | this = d.getAScope() |
|
||||
exists(SimpleParameter p |
|
||||
exists(Parameter p |
|
||||
p = d.getController().getDependencyParameter("$scope") or
|
||||
p = d.getALinkFunction().getParameter(0)
|
||||
|
|
||||
@@ -884,7 +884,7 @@ class AngularScope extends TAngularScope {
|
||||
d.hasIsolateScope() and result = d.getMember("scope").asExpr()
|
||||
)
|
||||
or
|
||||
exists(DirectiveController c, DOM::ElementDefinition elem, SimpleParameter p |
|
||||
exists(DirectiveController c, DOM::ElementDefinition elem, Parameter p |
|
||||
c.boundTo(elem) and
|
||||
this.mayApplyTo(elem) and
|
||||
p = c.getFactoryFunction().getDependencyParameter("$scope") and
|
||||
|
||||
@@ -41,7 +41,7 @@ abstract class DependencyInjection extends DataFlow::ValueNode {
|
||||
*/
|
||||
abstract class InjectableFunction extends DataFlow::ValueNode {
|
||||
/** Gets the parameter corresponding to dependency `name`. */
|
||||
abstract SimpleParameter getDependencyParameter(string name);
|
||||
abstract Parameter getDependencyParameter(string name);
|
||||
|
||||
/**
|
||||
* Gets the `i`th dependency declaration, which is also named `name`.
|
||||
@@ -67,7 +67,7 @@ abstract class InjectableFunction extends DataFlow::ValueNode {
|
||||
/**
|
||||
* Gets a service corresponding to the dependency-injected `parameter`.
|
||||
*/
|
||||
ServiceReference getAResolvedDependency(SimpleParameter parameter) {
|
||||
ServiceReference getAResolvedDependency(Parameter parameter) {
|
||||
exists(string name, InjectableFunctionServiceRequest request |
|
||||
this = request.getAnInjectedFunction() and
|
||||
parameter = getDependencyParameter(name) and
|
||||
@@ -79,7 +79,7 @@ abstract class InjectableFunction extends DataFlow::ValueNode {
|
||||
* Gets a Custom service corresponding to the dependency-injected `parameter`.
|
||||
* (this is a convenience variant of `getAResolvedDependency`)
|
||||
*/
|
||||
DataFlow::Node getCustomServiceDependency(SimpleParameter parameter) {
|
||||
DataFlow::Node getCustomServiceDependency(Parameter parameter) {
|
||||
exists(CustomServiceDefinition custom |
|
||||
custom.getServiceReference() = getAResolvedDependency(parameter) and
|
||||
result = custom.getAService()
|
||||
@@ -99,11 +99,11 @@ private class FunctionWithImplicitDependencyAnnotation extends InjectableFunctio
|
||||
not exists(getAPropertyDependencyInjection(astNode))
|
||||
}
|
||||
|
||||
override SimpleParameter getDependencyParameter(string name) {
|
||||
override Parameter getDependencyParameter(string name) {
|
||||
result = astNode.getParameterByName(name)
|
||||
}
|
||||
|
||||
override SimpleParameter getDependencyDeclaration(int i, string name) {
|
||||
override Parameter getDependencyDeclaration(int i, string name) {
|
||||
result.getName() = name and
|
||||
result = astNode.getParameter(i)
|
||||
}
|
||||
@@ -139,7 +139,7 @@ private class FunctionWithInjectProperty extends InjectableFunction {
|
||||
)
|
||||
}
|
||||
|
||||
override SimpleParameter getDependencyParameter(string name) {
|
||||
override Parameter getDependencyParameter(string name) {
|
||||
exists(int i | exists(getDependencyDeclaration(i, name)) | result = astNode.getParameter(i))
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ private class FunctionWithExplicitDependencyAnnotation extends InjectableFunctio
|
||||
function.flowsToExpr(astNode.getElement(astNode.getSize() - 1))
|
||||
}
|
||||
|
||||
override SimpleParameter getDependencyParameter(string name) {
|
||||
override Parameter getDependencyParameter(string name) {
|
||||
exists(int i | astNode.getElement(i).mayHaveStringValue(name) |
|
||||
result = asFunction().getParameter(i)
|
||||
)
|
||||
|
||||
@@ -479,7 +479,7 @@ abstract class ServiceRequest extends Expr {
|
||||
/**
|
||||
* Gets the parameter of this request into which `service` is injected.
|
||||
*/
|
||||
abstract SimpleParameter getDependencyParameter(ServiceReference service);
|
||||
abstract Parameter getDependencyParameter(ServiceReference service);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -488,7 +488,7 @@ abstract class ServiceRequest extends Expr {
|
||||
private class LinkFunctionWithScopeInjection extends ServiceRequest {
|
||||
LinkFunctionWithScopeInjection() { this instanceof LinkFunction }
|
||||
|
||||
override SimpleParameter getDependencyParameter(ServiceReference service) {
|
||||
override Parameter getDependencyParameter(ServiceReference service) {
|
||||
service instanceof ScopeServiceReference and
|
||||
result = this.(LinkFunction).getScopeParameter()
|
||||
}
|
||||
@@ -521,7 +521,7 @@ class InjectableFunctionServiceRequest extends ServiceRequest {
|
||||
result.isInjectable()
|
||||
}
|
||||
|
||||
override SimpleParameter getDependencyParameter(ServiceReference service) {
|
||||
override Parameter getDependencyParameter(ServiceReference service) {
|
||||
service = injectedFunction.getAResolvedDependency(result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,3 +34,4 @@
|
||||
| dependency-kinds.js:98:33:98:63 | functio ... ency){} | animationDependency |
|
||||
| dependency-kinds.js:111:17:117:9 | functio ... } | $routeProvider |
|
||||
| dependency-kinds.js:114:33:115:21 | functio ... } | routeControllerDependency |
|
||||
| dependency-kinds.js:121:14:123:10 | ['modul ... }] | moduleRunService |
|
||||
|
||||
@@ -117,4 +117,8 @@
|
||||
})
|
||||
;
|
||||
|
||||
angular.module('myModule', [])
|
||||
.run(['moduleRunService', function({foo, bar}) {
|
||||
// ...
|
||||
}])
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user