fix: AstNode.getATriggerEvent()

getATriggerEvent did not work for nodes outside a Job.
If there is no enclosing job, get the trigger from the enclosing
workflow
This commit is contained in:
Alvaro Muñoz
2024-10-28 11:55:23 +01:00
parent 6136a98764
commit e34835f71a

View File

@@ -114,7 +114,11 @@ abstract class AstNodeImpl extends TAstNode {
/**
* Gets and Event triggering this node.
*/
EventImpl getATriggerEvent() { result = this.getEnclosingJob().getATriggerEvent() }
EventImpl getATriggerEvent() {
result = this.getEnclosingJob().getATriggerEvent()
or
not exists(this.getEnclosingJob()) and result = this.getEnclosingWorkflow().getATriggerEvent()
}
/**
* Gets the enclosing Step.