Skip to content

Commit 4931118

Browse files
committed
Change CustomControl and CustomController to use the new version of getExtendingModule
1 parent 1ca3c1c commit 4931118

File tree

1 file changed

+12
-14
lines changed
  • javascript/frameworks/ui5/lib/advanced_security/javascript/frameworks/ui5

1 file changed

+12
-14
lines changed

javascript/frameworks/ui5/lib/advanced_security/javascript/frameworks/ui5/UI5.qll

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,7 @@ class SapDefineModule extends AmdModuleDefinition::Range, MethodCallExpr, UserMo
193193
/**
194194
* Gets the module defined with sap.ui.define that imports and extends (subclasses) this module.
195195
*/
196-
SapDefineModule getExtendingModule() {
197-
// exists(SapExtendCall baseExtendCall, SapExtendCall subclassExtendCall |
198-
// baseExtendCall.getDefine() = this and
199-
// result = subclassExtendCall.getDefine() and
200-
// result
201-
// .getRequiredObject(baseExtendCall.getName().replaceAll(".", "/"))
202-
// .asSourceNode()
203-
// .flowsTo(subclassExtendCall.getReceiver())
204-
// )
205-
none() // TODO
206-
}
196+
SapDefineModule getExtendingModule() { result.getSuperModule(_) = this }
207197

208198
/**
209199
* Gets the module that this module imports via path `importPath`.
@@ -291,7 +281,9 @@ class CustomControl extends SapExtendCall {
291281
CustomControl() {
292282
this.getReceiver().getALocalSource() =
293283
TypeTrackers::hasDependency(["sap/ui/core/Control", "sap.ui.core.Control"]) or
294-
exists(SapDefineModule sapModule | this.getDefine() = sapModule.getExtendingModule())
284+
exists(CustomControl superControl |
285+
superControl.getDefine() = this.getDefine().getSuperModule(_)
286+
)
295287
}
296288

297289
CustomController getController() { this = result.getAControlReference().getDefinition() }
@@ -464,8 +456,14 @@ class CustomController extends SapExtendCall {
464456
string name;
465457

466458
CustomController() {
467-
this.getReceiver().getALocalSource() =
468-
TypeTrackers::hasDependency(["sap/ui/core/mvc/Controller", "sap.ui.core.mvc.Controller"]) and
459+
(
460+
this.getReceiver().getALocalSource() =
461+
TypeTrackers::hasDependency(["sap/ui/core/mvc/Controller", "sap.ui.core.mvc.Controller"])
462+
or
463+
exists(CustomController superController |
464+
superController.getDefine() = this.getDefine().getSuperModule(_)
465+
)
466+
) and
469467
name = this.getFile().getBaseName().regexpCapture("([a-zA-Z0-9]+).[cC]ontroller.js", 1)
470468
}
471469

0 commit comments

Comments
 (0)