Compare commits

...

5 Commits

Author SHA1 Message Date
Jeongsoo Lee
2931b95074 Merge branch 'main' into jeongsoolee09/refine-amdmodule 2025-05-06 10:55:14 -07:00
Jeongsoo Lee
44b1bc90fb Merge branch 'main' into jeongsoolee09/refine-amdmodule 2025-05-05 08:24:36 -07:00
Jeongsoo Lee
c327e6ff07 Remove type enforcement on the TValueNode 2025-05-05 11:19:11 -04:00
Jeongsoo Lee
f0dfa51fb9 Dynamically determine the callback argument's position
An additional parameter may be anywhere in the
parameter list and shift around the exact index of
the callback argument in the parameter list.

So, "dynamically" determine the index by type-checking
a parameter in the parameter list.

Note 1: There may be multiple matches since we're
using `_` (don't care) as the argument index.

Note 2: We could have used DataFlow::InvokeNode.getCallback
if the supertype were not CallExpr, but jumping to
data flow node is an overkill here.
2025-04-23 14:36:27 -04:00
Jeongsoo Lee
06e3a01314 Change definition of getFactoryNodeInternal
Some variants of AMD module such as
[sap.ui.define])(https://sdk.openui5.org/api/sap.ui#methods/sap.ui.define)
can accept a boolean as its last parameter.
Therefore, explicitly state the index of the
factory method parameter as `1`.
2025-04-23 14:16:12 -04:00

View File

@@ -91,7 +91,7 @@ class AmdModuleDefinition extends CallExpr instanceof AmdModuleDefinition::Range
Function getFactoryFunction() { TValueNode(result) = this.getFactoryNodeInternal() }
private EarlyStageNode getFactoryNodeInternal() {
result = TValueNode(this.getLastArgument())
result = TValueNode(this.getArgument(_))
or
DataFlow::localFlowStep(result, this.getFactoryNodeInternal())
}