-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
9947: Don't overwrite local multi-instance variables r=korthout a=korthout ## Description <!-- Please explain the changes you made here. --> This PR makes it possible to refer to the same [variable](https://docs.camunda.io/docs/components/concepts/variables/) in the multi-instance [`inputElement`](https://docs.camunda.io/docs/components/modeler/bpmn/multi-instance/#defining-the-collection-to-iterate-over) and the [`outputElement` expression](https://docs.camunda.io/docs/components/modeler/bpmn/multi-instance/#defining-the-collection-to-iterate-over). Technically, this PR makes sure that the 'NIL initialization' (explained below) of the `outputElement` variable doesn't overwrite: - the `inputElement` variable - the `loopCounter` variable When the `outputElement` expression (of a multi-instance element) refers directly to a variable (or the property of a variable), we NIL initialize the referenced variable. This is to make sure the `outputElement` exists on the local scope of the inner instance of a multi-instance body. However, when the `outputElement` expression refers to the same variable as the `inputElement`, then we would overwrite the locally scoped `inputElement` variable with this NIL value. Effectively erasing the `inputElement` variable's value. I wondered whether we could also overwrite other locally scoped variables. However, there aren't many local variables that can exist on the inner instance of a multi-instance body (see below). User-defined variables (e.g. input mappings) cannot reach this scope during the activation of the inner instance. So apart from the `inputElement` variables, only the `loopCounter` variable can be `NIL` initialized by the `outputElement` expression. - `inputElement` variable - `outputElement` expression that refers to variable (or property of a variable) - `loopCounter` variable ## Related issues <!-- Which issues are closed by this PR or are related --> closes #4687 Co-authored-by: Nico Korthout <nico.korthout@camunda.com>
- Loading branch information
Showing
3 changed files
with
117 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters